Skip to content

Commit 66aa127

Browse files
committed
Implement 'stop' method for the html5 video player backend
1 parent fd58002 commit 66aa127

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

platform/video.html5/backend.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ Player.prototype.getFileExtension = function(filePath) {
180180
Player.prototype.setSource = function(url) {
181181
this.ui.ready = false
182182
this._extension = this.getFileExtension(url)
183+
this._storedSrc = ""
183184
if (url && this._xhr && (this._extension === ".m3u8" || this._extension === ".m3u")) {
184185
this._xhr.open('GET', url);
185186
this._xhr.send()
@@ -188,10 +189,15 @@ Player.prototype.setSource = function(url) {
188189
var source = url
189190
if (this.ui.startPosition)
190191
source += "#t=" + this.ui.startPosition
192+
191193
this.element.dom.src = source
192194
}
193195

194196
Player.prototype.play = function() {
197+
if (this._storedSrc) {
198+
this.element.dom.src = this._storedSrc
199+
this._storedSrc = ""
200+
}
195201
this.element.dom.play()
196202
}
197203

@@ -200,8 +206,11 @@ Player.prototype.pause = function() {
200206
}
201207

202208
Player.prototype.stop = function() {
203-
//where is no 'stop' method in html5 video player just pause instead
204-
this.pause()
209+
this._storedSrc = this.element.dom.src
210+
this.element.dom.pause()
211+
this.element.dom.src = ""
212+
this.element.dom.load()
213+
this.ui.ready = false
205214
}
206215

207216
Player.prototype.seek = function(delta) {

0 commit comments

Comments
 (0)