@@ -215,6 +215,7 @@ export class PlaylistController extends videojs.EventTarget {
215
215
// Airplay source not yet implemented. Remote playback must be disabled.
216
216
this . tech_ . el_ . disableRemotePlayback = true ;
217
217
this . mediaSource = new window . ManagedMediaSource ( ) ;
218
+
218
219
videojs . log ( 'Using ManagedMediaSource' ) ;
219
220
} else if ( window . MediaSource ) {
220
221
this . mediaSource = new window . MediaSource ( ) ;
@@ -223,12 +224,16 @@ export class PlaylistController extends videojs.EventTarget {
223
224
this . handleDurationChange_ = this . handleDurationChange_ . bind ( this ) ;
224
225
this . handleSourceOpen_ = this . handleSourceOpen_ . bind ( this ) ;
225
226
this . handleSourceEnded_ = this . handleSourceEnded_ . bind ( this ) ;
227
+ this . load = this . load . bind ( this ) ;
228
+ this . pause = this . pause . bind ( this ) ;
226
229
227
230
this . mediaSource . addEventListener ( 'durationchange' , this . handleDurationChange_ ) ;
228
231
229
232
// load the media source into the player
230
233
this . mediaSource . addEventListener ( 'sourceopen' , this . handleSourceOpen_ ) ;
231
234
this . mediaSource . addEventListener ( 'sourceended' , this . handleSourceEnded_ ) ;
235
+ this . mediaSource . addEventListener ( 'startstreaming' , this . load ) ;
236
+ this . mediaSource . addEventListener ( 'endstreaming' , this . pause ) ;
232
237
// we don't have to handle sourceclose since dispose will handle termination of
233
238
// everything, and the MediaSource should not be detached without a proper disposal
234
239
@@ -1056,14 +1061,31 @@ export class PlaylistController extends videojs.EventTarget {
1056
1061
*/
1057
1062
load ( ) {
1058
1063
this . mainSegmentLoader_ . load ( ) ;
1064
+
1059
1065
if ( this . mediaTypes_ . AUDIO . activePlaylistLoader ) {
1060
1066
this . audioSegmentLoader_ . load ( ) ;
1061
1067
}
1068
+
1062
1069
if ( this . mediaTypes_ . SUBTITLES . activePlaylistLoader ) {
1063
1070
this . subtitleSegmentLoader_ . load ( ) ;
1064
1071
}
1065
1072
}
1066
1073
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
+
1067
1089
/**
1068
1090
* Re-tune playback quality level for the current player
1069
1091
* conditions. This method will perform destructive actions like removing
0 commit comments