Merge branch 'hotfix/stream-ended' of https://github.com/videojs/videojs-contrib…
…-hls into reorg-w-114 close #114 closes #115 Conflicts: src/videojs-hls.js
Showing
2 changed files
with
16 additions
and
1 deletions
... | @@ -158,6 +158,19 @@ videojs.Hls.prototype.handleSourceOpen = function() { | ... | @@ -158,6 +158,19 @@ videojs.Hls.prototype.handleSourceOpen = function() { |
158 | }); | 158 | }); |
159 | }; | 159 | }; |
160 | 160 | ||
161 | /** | ||
162 | * Reset the mediaIndex if play() is called after the video has | ||
163 | * ended. | ||
164 | */ | ||
165 | videojs.Hls.prototype.play = function() { | ||
166 | if (this.ended()) { | ||
167 | this.mediaIndex = 0; | ||
168 | } | ||
169 | |||
170 | // delegate back to the Flash implementation | ||
171 | return videojs.Flash.prototype.play.apply(this, arguments); | ||
172 | }; | ||
173 | |||
161 | videojs.Hls.prototype.duration = function() { | 174 | videojs.Hls.prototype.duration = function() { |
162 | var playlists = this.playlists; | 175 | var playlists = this.playlists; |
163 | if (playlists) { | 176 | if (playlists) { |
... | @@ -458,7 +471,9 @@ videojs.Hls.prototype.drainBuffer = function(event) { | ... | @@ -458,7 +471,9 @@ videojs.Hls.prototype.drainBuffer = function(event) { |
458 | // we're done processing this segment | 471 | // we're done processing this segment |
459 | segmentBuffer.shift(); | 472 | segmentBuffer.shift(); |
460 | 473 | ||
461 | if (mediaIndex === playlist.segments.length) { | 474 | // transition the sourcebuffer to the ended state if we've hit the end of |
475 | // the playlist | ||
476 | if (mediaIndex + 1 === playlist.segments.length) { | ||
462 | this.mediaSource.endOfStream(); | 477 | this.mediaSource.endOfStream(); |
463 | } | 478 | } |
464 | }; | 479 | }; | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment