File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -3533,6 +3533,14 @@ class Player extends Component {
3533
3533
* Begin loading the src data.
3534
3534
*/
3535
3535
load ( ) {
3536
+ // Workaround to use the load method with the VHS.
3537
+ // Does not cover the case when the load method is called directly from the mediaElement.
3538
+ if ( this . tech_ . vhs ) {
3539
+ this . src ( this . currentSource ( ) ) ;
3540
+
3541
+ return ;
3542
+ }
3543
+
3536
3544
this . techCall_ ( 'load' ) ;
3537
3545
}
3538
3546
Original file line number Diff line number Diff line change @@ -3231,6 +3231,34 @@ QUnit.test('turning on audioPosterMode when audioOnlyMode is already on will tur
3231
3231
} ) ;
3232
3232
} ) ;
3233
3233
3234
+ QUnit . test ( 'player#load resets the media element to its initial state' , function ( assert ) {
3235
+ const player = TestHelpers . makePlayer ( { } ) ;
3236
+
3237
+ player . src ( { src : 'http://vjs.zencdn.net/v/oceans2.mp4' , type : 'video/mp4' } ) ;
3238
+
3239
+ // Declaring spies here avoids spying on previous calls
3240
+ const techGet_ = sinon . spy ( player , 'techCall_' ) ;
3241
+ const src = sinon . spy ( player , 'src' ) ;
3242
+
3243
+ player . load ( ) ;
3244
+
3245
+ // Case when the VHS tech is not used
3246
+ assert . ok ( techGet_ . calledOnce , 'techCall_ was called once' ) ;
3247
+ assert . ok ( src . notCalled , 'src was not called' ) ;
3248
+
3249
+ // Simulate the VHS tech
3250
+ player . tech_ . vhs = true ;
3251
+ player . load ( ) ;
3252
+
3253
+ // Case when the VHS tech is used
3254
+ assert . ok ( techGet_ . calledOnce , 'techCall_ remains the same' ) ;
3255
+ assert . ok ( src . calledOnce , 'src was called' ) ;
3256
+
3257
+ techGet_ . restore ( ) ;
3258
+ src . restore ( ) ;
3259
+ player . dispose ( ) ;
3260
+ } ) ;
3261
+
3234
3262
QUnit . test ( 'crossOrigin value should be maintained after loadMedia is called' , function ( assert ) {
3235
3263
const fixture = document . getElementById ( 'qunit-fixture' ) ;
3236
3264
You can’t perform that action at this time.
0 commit comments