@@ -4618,11 +4618,20 @@ QUnit.test('configures eme for HLS on source buffer creation', function(assert)
4618
4618
} ) ;
4619
4619
4620
4620
QUnit . test ( 'eme handles keystatuschange where status is output-restricted' , function ( assert ) {
4621
+ const originalWarn = videojs . log . warn ;
4622
+ let warning = '' ;
4623
+ let qualitySwitches = 0 ;
4624
+
4625
+ videojs . log . warn = ( ...text ) => {
4626
+ warning += [ ...text ] . join ( '' ) ;
4627
+ } ;
4628
+
4621
4629
this . player . eme = {
4622
4630
options : {
4623
4631
previousSetting : 1
4624
4632
}
4625
4633
} ;
4634
+
4626
4635
this . player . src ( {
4627
4636
src : 'manifest/master.m3u8' ,
4628
4637
type : 'application/x-mpegURL' ,
@@ -4635,36 +4644,64 @@ QUnit.test('eme handles keystatuschange where status is output-restricted', func
4635
4644
4636
4645
this . clock . tick ( 1 ) ;
4637
4646
4638
- const media = {
4639
- attributes : {
4640
- CODECS : 'avc1.420015, mp4a.40.2c'
4647
+ const playlists = [
4648
+ {
4649
+ attributes : {
4650
+ RESOLUTION : {
4651
+ width : 1280 ,
4652
+ height : 720
4653
+ }
4654
+ }
4641
4655
} ,
4642
- contentProtection : {
4643
- keySystem1 : {
4644
- pssh : 'test'
4656
+ {
4657
+ attributes : {
4658
+ RESOLUTION : {
4659
+ width : 1920 ,
4660
+ height : 1080
4661
+ }
4662
+ }
4663
+ } ,
4664
+ {
4665
+ attributes : {
4666
+ RESOLUTION : {
4667
+ width : 848 ,
4668
+ height : 480
4669
+ }
4645
4670
}
4646
4671
}
4647
- } ;
4672
+ ] ;
4648
4673
4649
4674
this . player . tech_ . vhs . playlists = {
4650
- master : { playlists : [ media ] } ,
4651
- media : ( ) => media
4675
+ master : { playlists } ,
4676
+ media : ( ) => playlists [ 0 ]
4652
4677
} ;
4653
4678
4654
- const excludes = [ ] ;
4679
+ this . player . tech_ . vhs . masterPlaylistController_ . master = ( ) => {
4680
+ return {
4681
+ playlists
4682
+ } ;
4683
+ } ;
4655
4684
4656
- this . player . tech_ . vhs . masterPlaylistController_ . blacklistCurrentPlaylist = ( exclude ) => {
4657
- excludes . push ( exclude ) ;
4685
+ this . player . tech_ . vhs . masterPlaylistController_ . fastQualityChange_ = ( ) => {
4686
+ qualitySwitches ++ ;
4658
4687
} ;
4659
4688
4660
4689
this . player . tech_ . vhs . masterPlaylistController_ . sourceUpdater_ . trigger ( 'createdsourcebuffers' ) ;
4661
4690
this . player . tech_ . trigger ( { type : 'keystatuschange' , status : 'output-restricted' } ) ;
4662
4691
4663
- assert . deepEqual ( excludes , [ {
4664
- blacklistDuration : Infinity ,
4665
- message : 'DRM keystatus changed to output-restricted. Playlist will fail to play. Check for HDCP content.' ,
4666
- playlist : undefined
4667
- } ] , 'excluded playlist' ) ;
4692
+ assert . equal ( playlists [ 0 ] . excludeUntil , Infinity , 'first HD playlist excluded' ) ;
4693
+ assert . equal ( playlists [ 1 ] . excludeUntil , Infinity , 'second HD playlist excluded' ) ;
4694
+ assert . equal ( playlists [ 2 ] . excludeUntil , undefined , 'non-HD playlist not excluded' ) ;
4695
+ assert . equal ( qualitySwitches , 1 , 'fastQualityChange_ called once' ) ;
4696
+ assert . equal (
4697
+ warning ,
4698
+ 'DRM keystatus changed to "output-restricted." Removing the following HD playlists ' +
4699
+ 'that will most likely fail to play and clearing the buffer. ' +
4700
+ 'This may be due to HDCP restrictions on the stream and the capabilities of the current device.' +
4701
+ [ playlists [ 0 ] , playlists [ 1 ] ] . join ( '' )
4702
+ ) ;
4703
+
4704
+ videojs . log . warn = originalWarn ;
4668
4705
} ) ;
4669
4706
4670
4707
QUnit . test ( 'eme handles keystatuschange where status is usable' , function ( assert ) {
0 commit comments