@@ -215,6 +215,7 @@ export class PlaylistController extends videojs.EventTarget {
215215 // Airplay source not yet implemented. Remote playback must be disabled.
216216 this . tech_ . el_ . disableRemotePlayback = true ;
217217 this . mediaSource = new window . ManagedMediaSource ( ) ;
218+
218219 videojs . log ( 'Using ManagedMediaSource' ) ;
219220 } else if ( window . MediaSource ) {
220221 this . mediaSource = new window . MediaSource ( ) ;
@@ -223,12 +224,16 @@ export class PlaylistController extends videojs.EventTarget {
223224 this . handleDurationChange_ = this . handleDurationChange_ . bind ( this ) ;
224225 this . handleSourceOpen_ = this . handleSourceOpen_ . bind ( this ) ;
225226 this . handleSourceEnded_ = this . handleSourceEnded_ . bind ( this ) ;
227+ this . load = this . load . bind ( this ) ;
228+ this . pause = this . pause . bind ( this ) ;
226229
227230 this . mediaSource . addEventListener ( 'durationchange' , this . handleDurationChange_ ) ;
228231
229232 // load the media source into the player
230233 this . mediaSource . addEventListener ( 'sourceopen' , this . handleSourceOpen_ ) ;
231234 this . mediaSource . addEventListener ( 'sourceended' , this . handleSourceEnded_ ) ;
235+ this . mediaSource . addEventListener ( 'startstreaming' , this . load ) ;
236+ this . mediaSource . addEventListener ( 'endstreaming' , this . pause ) ;
232237 // we don't have to handle sourceclose since dispose will handle termination of
233238 // everything, and the MediaSource should not be detached without a proper disposal
234239
@@ -1056,14 +1061,31 @@ export class PlaylistController extends videojs.EventTarget {
10561061 */
10571062 load ( ) {
10581063 this . mainSegmentLoader_ . load ( ) ;
1064+
10591065 if ( this . mediaTypes_ . AUDIO . activePlaylistLoader ) {
10601066 this . audioSegmentLoader_ . load ( ) ;
10611067 }
1068+
10621069 if ( this . mediaTypes_ . SUBTITLES . activePlaylistLoader ) {
10631070 this . subtitleSegmentLoader_ . load ( ) ;
10641071 }
10651072 }
10661073
1074+ /**
1075+ * Call pause on our SegmentLoaders
1076+ */
1077+ pause ( ) {
1078+ this . mainSegmentLoader_ . pause ( ) ;
1079+
1080+ if ( this . mediaTypes_ . AUDIO . activePlaylistLoader ) {
1081+ this . audioSegmentLoader_ . pause ( ) ;
1082+ }
1083+
1084+ if ( this . mediaTypes_ . SUBTITLES . activePlaylistLoader ) {
1085+ this . subtitleSegmentLoader_ . pause ( ) ;
1086+ }
1087+ }
1088+
10671089 /**
10681090 * Re-tune playback quality level for the current player
10691091 * conditions. This method will perform destructive actions like removing
0 commit comments