@@ -116,6 +116,8 @@ describe("Bigscreen Player", () => {
116116 isAudioDescribedAvailable : jest . fn ( ) ,
117117 isAudioDescribedEnabled : jest . fn ( ) ,
118118 setAudioDescribed : jest . fn ( ) ,
119+ setBitrateConstraint : jest . fn ( ) ,
120+ getPlaybackBitrate : jest . fn ( ) ,
119121 }
120122
121123 jest . spyOn ( PlayerComponent , "getLiveSupport" ) . mockReturnValue ( LiveSupport . SEEKABLE )
@@ -1669,4 +1671,35 @@ describe("Bigscreen Player", () => {
16691671 expect ( DebugTool . getDebugLogs ) . toHaveBeenCalledTimes ( 1 )
16701672 } )
16711673 } )
1674+
1675+ describe ( "Set and get playback bitrate" , ( ) => {
1676+ const mediaKind = "video"
1677+ const minBitrateKbps = 100
1678+ const maxBitrateKbps = 200
1679+
1680+ it ( "should set bitrate on the strategy" , async ( ) => {
1681+ await asyncInitialiseBigscreenPlayer ( createPlaybackElement ( ) , bigscreenPlayerData )
1682+ bigscreenPlayer . setBitrateConstraint ( mediaKind , minBitrateKbps , maxBitrateKbps )
1683+
1684+ expect ( mockPlayerComponentInstance . setBitrateConstraint ) . toHaveBeenLastCalledWith (
1685+ mediaKind ,
1686+ minBitrateKbps ,
1687+ maxBitrateKbps
1688+ )
1689+ } )
1690+
1691+ it ( "should not set the bitrate if playerComponent is not initialised" , async ( ) => {
1692+ bigscreenPlayer . setBitrateConstraint ( mediaKind , minBitrateKbps , maxBitrateKbps )
1693+
1694+ expect ( mockPlayerComponentInstance . setBitrateConstraint ) . not . toHaveBeenCalled ( )
1695+ } )
1696+
1697+ it ( "should return the bitrate given a media kind" , async ( ) => {
1698+ await asyncInitialiseBigscreenPlayer ( createPlaybackElement ( ) , bigscreenPlayerData )
1699+ mockPlayerComponentInstance . getPlaybackBitrate . mockReturnValue ( 100 )
1700+ bigscreenPlayer . getPlaybackBitrate ( mediaKind )
1701+
1702+ expect ( mockPlayerComponentInstance . getPlaybackBitrate ( ) ) . toBe ( 100 )
1703+ } )
1704+ } )
16721705} )
0 commit comments