@@ -4278,11 +4278,20 @@ QUnit.test('configures eme for HLS on source buffer creation', function(assert)
4278
4278
} ) ;
4279
4279
4280
4280
QUnit . test ( 'eme handles keystatuschange where status is output-restricted' , function ( assert ) {
4281
+ const originalWarn = videojs . log . warn ;
4282
+ let warning = '' ;
4283
+ let qualitySwitches = 0 ;
4284
+
4285
+ videojs . log . warn = ( ...text ) => {
4286
+ warning += [ ...text ] . join ( '' ) ;
4287
+ } ;
4288
+
4281
4289
this . player . eme = {
4282
4290
options : {
4283
4291
previousSetting : 1
4284
4292
}
4285
4293
} ;
4294
+
4286
4295
this . player . src ( {
4287
4296
src : 'manifest/main.m3u8' ,
4288
4297
type : 'application/x-mpegURL' ,
@@ -4295,39 +4304,64 @@ QUnit.test('eme handles keystatuschange where status is output-restricted', func
4295
4304
4296
4305
this . clock . tick ( 1 ) ;
4297
4306
4298
- const media = {
4299
- attributes : {
4300
- CODECS : 'avc1.420015, mp4a.40.2c'
4307
+ const playlists = [
4308
+ {
4309
+ attributes : {
4310
+ RESOLUTION : {
4311
+ width : 1280 ,
4312
+ height : 720
4313
+ }
4314
+ }
4301
4315
} ,
4302
- contentProtection : {
4303
- keySystem1 : {
4304
- pssh : 'test'
4316
+ {
4317
+ attributes : {
4318
+ RESOLUTION : {
4319
+ width : 1920 ,
4320
+ height : 1080
4321
+ }
4322
+ }
4323
+ } ,
4324
+ {
4325
+ attributes : {
4326
+ RESOLUTION : {
4327
+ width : 848 ,
4328
+ height : 480
4329
+ }
4305
4330
}
4306
4331
}
4307
- } ;
4332
+ ] ;
4308
4333
4309
4334
this . player . tech_ . vhs . playlists = {
4310
- main : { playlists : [ media ] } ,
4311
- media : ( ) => media
4335
+ main : { playlists } ,
4336
+ media : ( ) => playlists [ 0 ]
4312
4337
} ;
4313
4338
4314
- const excludes = [ ] ;
4339
+ this . player . tech_ . vhs . playlistController_ . main = ( ) => {
4340
+ return {
4341
+ playlists
4342
+ } ;
4343
+ } ;
4315
4344
4316
- this . player . tech_ . vhs . playlistController_ . excludePlaylist = ( exclude ) => {
4317
- excludes . push ( exclude ) ;
4345
+ this . player . tech_ . vhs . playlistController_ . fastQualityChange_ = ( ) => {
4346
+ qualitySwitches ++ ;
4318
4347
} ;
4319
4348
4320
4349
this . player . tech_ . vhs . playlistController_ . sourceUpdater_ . trigger ( 'createdsourcebuffers' ) ;
4321
4350
this . player . tech_ . trigger ( { type : 'keystatuschange' , status : 'output-restricted' } ) ;
4322
4351
4323
- assert . deepEqual ( excludes , [ {
4324
- playlistExclusionDuration : Infinity ,
4325
- error : {
4326
- message : 'DRM keystatus changed to output-restricted. Playlist will fail to play. ' +
4327
- 'Check for HDCP content.'
4328
- } ,
4329
- playlistToExclude : undefined
4330
- } ] , 'excluded playlist' ) ;
4352
+ assert . equal ( playlists [ 0 ] . excludeUntil , Infinity , 'first HD playlist excluded' ) ;
4353
+ assert . equal ( playlists [ 1 ] . excludeUntil , Infinity , 'second HD playlist excluded' ) ;
4354
+ assert . equal ( playlists [ 2 ] . excludeUntil , undefined , 'non-HD playlist not excluded' ) ;
4355
+ assert . equal ( qualitySwitches , 1 , 'fastQualityChange_ called once' ) ;
4356
+ assert . equal (
4357
+ warning ,
4358
+ 'DRM keystatus changed to "output-restricted." Removing the following HD playlists ' +
4359
+ 'that will most likely fail to play and clearing the buffer. ' +
4360
+ 'This may be due to HDCP restrictions on the stream and the capabilities of the current device.' +
4361
+ [ playlists [ 0 ] , playlists [ 1 ] ] . join ( '' )
4362
+ ) ;
4363
+
4364
+ videojs . log . warn = originalWarn ;
4331
4365
} ) ;
4332
4366
4333
4367
QUnit . test ( 'eme handles keystatuschange where status is usable' , function ( assert ) {
0 commit comments