Fast channel capping
To enable fast channel zapping Here’s a step-by-step guide to implement fast channel zapping.
Pre-load content
To implement fast channel zapping, preloading the next content is essential. Follow these steps to set up content preloading.
-
Retrieve the playback URL and license URL (for DRM-protected content) by making a contentAuthorization call, similar to traditional playback.
-
Initialize the player using the fetched playback and license data using
createPlayer()API. -
After creating the player, call the
load()function. This prepares the player with the DRM license key, enabling seamless transitions between content.
let newPlayerConfig: PlayerConfig = {
mediaURL: // content url
mediaType: // mediaType
drmLicenseURL: // license url,
drmType: // drm Type,
autoPlayOnLoad: false
}
let preloadContentPlayer = await createPlayer(newPlayerConfig)
preloadContentPlayer.attachListener(playerListener)
preloadContentPlayer.load()
Note: set
autoPlayOnLoadfalse for pre-loaded contents which is by defaultfalse.
Warning: Pre-load the content in advance before trying to play it for smooth transition.
Precautions to be taken while player transition
-
Stop, remove player listener and then dispose the previously playing player when switching to the next content.
-
To play the preloaded content, attach the
QpNxgPlaybackViewto theplayerIdof the preloaded content's player once the player isLOADED
Note: For
Android, explicitly call theplay()API to start playback, in addition to attaching theQpNxgPlaybackViewwhere thisplay()API explicit calling is not required iniOSplayback starts as soon asQpNxgPlaybackViewis attached.
Note: Play and attach the view of pre-loaded content only on ensuring that pre-loaded content player is in
LOADEDstate.
// stop and dispose previous player
previousPlayer.stop()
previousPlayer.removeListener(playerListener);
previousPlayer.dispose()
// attach QpNxgPlaybackView with the playerId of preloaded content player.
<QpNxgPlaybackView
playerID= // playerId of pre-loadeded content player
</QpNxgPlaybackView>
//Only on Android to start playback
preloadContentPlayer.play()
- When playing preloaded live content, ensure to call
seekToLiveEdge()API
preloadContentPlayer.seekToLiveEdge()