Skip to main content

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.

  1. Retrieve the playback URL and license URL (for DRM-protected content) by making a contentAuthorization call, similar to traditional playback.

  2. Initialize the player using the fetched playback and license data using createPlayer() API.

  3. 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 autoPlayOnLoad false for pre-loaded contents which is by default false.

Warning: Pre-load the content in advance before trying to play it for smooth transition.

Precautions to be taken while player transition

  1. Stop, remove player listener and then dispose the previously playing player when switching to the next content.

  2. To play the preloaded content, attach the QpNxgPlaybackView to the playerId of the preloaded content's player once the player is LOADED

Note: For Android, explicitly call the play() API to start playback, in addition to attaching the QpNxgPlaybackView where this play() API explicit calling is not required in iOS playback starts as soon as QpNxgPlaybackView is attached.

Note: Play and attach the view of pre-loaded content only on ensuring that pre-loaded content player is in LOADED state.

// 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()
  1. When playing preloaded live content, ensure to call seekToLiveEdge() API
preloadContentPlayer.seekToLiveEdge()