@@ -57,17 +57,18 @@ shaka.media.MediaSourceEngine = class {
57
57
* MediaSourceEngine is destroyed, it will destroy the displayer.
58
58
* @param {!shaka.media.MediaSourceEngine.PlayerInterface } playerInterface
59
59
* Interface for common player methods.
60
+ * @param {shaka.extern.MediaSourceConfiguration } config
60
61
* @param {?shaka.lcevc.Dec } [lcevcDec] Optional - LCEVC Decoder Object
61
62
*/
62
- constructor ( video , textDisplayer , playerInterface , lcevcDec ) {
63
+ constructor ( video , textDisplayer , playerInterface , config , lcevcDec ) {
63
64
/** @private {HTMLMediaElement} */
64
65
this . video_ = video ;
65
66
66
67
/** @private {?shaka.media.MediaSourceEngine.PlayerInterface} */
67
68
this . playerInterface_ = playerInterface ;
68
69
69
70
/** @private {?shaka.extern.MediaSourceConfiguration} */
70
- this . config_ = null ;
71
+ this . config_ = config ;
71
72
72
73
/** @private {shaka.extern.TextDisplayer} */
73
74
this . textDisplayer_ = textDisplayer ;
@@ -258,20 +259,23 @@ shaka.media.MediaSourceEngine = class {
258
259
259
260
// Store the object URL for releasing it later.
260
261
this . url_ = shaka . media . MediaSourceEngine . createObjectURL ( mediaSource ) ;
261
-
262
- this . video_ . removeAttribute ( 'src' ) ;
263
- if ( this . source_ ) {
264
- this . video_ . removeChild ( this . source_ ) ;
265
- }
266
- if ( this . secondarySource_ ) {
267
- this . video_ . removeChild ( this . secondarySource_ ) ;
268
- }
269
- this . source_ = shaka . util . Dom . createSourceElement ( this . url_ ) ;
270
- this . video_ . appendChild ( this . source_ ) ;
271
- if ( this . secondarySource_ ) {
272
- this . video_ . appendChild ( this . secondarySource_ ) ;
262
+ if ( this . config_ . useSourceElements ) {
263
+ this . video_ . removeAttribute ( 'src' ) ;
264
+ if ( this . source_ ) {
265
+ this . video_ . removeChild ( this . source_ ) ;
266
+ }
267
+ if ( this . secondarySource_ ) {
268
+ this . video_ . removeChild ( this . secondarySource_ ) ;
269
+ }
270
+ this . source_ = shaka . util . Dom . createSourceElement ( this . url_ ) ;
271
+ this . video_ . appendChild ( this . source_ ) ;
272
+ if ( this . secondarySource_ ) {
273
+ this . video_ . appendChild ( this . secondarySource_ ) ;
274
+ }
275
+ this . video_ . load ( ) ;
276
+ } else {
277
+ this . video_ . src = this . url_ ;
273
278
}
274
- this . video_ . load ( ) ;
275
279
276
280
return mediaSource ;
277
281
}
@@ -286,6 +290,9 @@ shaka.media.MediaSourceEngine = class {
286
290
'Secondary source is used only with ManagedMediaSource' ) ;
287
291
return ;
288
292
}
293
+ if ( ! this . config_ . useSourceElements ) {
294
+ return ;
295
+ }
289
296
if ( this . secondarySource_ ) {
290
297
this . video_ . removeChild ( this . secondarySource_ ) ;
291
298
}
0 commit comments