e3c7a1bc by Jon-Carlos Rivera

Merge pull request #407 from videojs/fix-handlesourceopen

There are cases when a mediasource is re-opened and we need to account for that
2 parents 16c73e94 a77ffa48
...@@ -292,7 +292,12 @@ videojs.Hls.getMediaIndexForLive_ = function(selectedPlaylist) { ...@@ -292,7 +292,12 @@ videojs.Hls.getMediaIndexForLive_ = function(selectedPlaylist) {
292 }; 292 };
293 293
294 videojs.Hls.prototype.handleSourceOpen = function() { 294 videojs.Hls.prototype.handleSourceOpen = function() {
295 this.setupSourceBuffer_(); 295 // Only attempt to create the source buffer if none already exist.
296 // handleSourceOpen is also called when we are "re-opening" a source buffer
297 // after `endOfStream` has been called (in response to a seek for instance)
298 if (!this.sourceBuffer) {
299 this.setupSourceBuffer_();
300 }
296 301
297 // if autoplay is enabled, begin playback. This is duplicative of 302 // if autoplay is enabled, begin playback. This is duplicative of
298 // code in video.js but is required because play() must be invoked 303 // code in video.js but is required because play() must be invoked
......