Skip to main content

Multi player support

Multi Player Support (MultiView) enables simultaneous playback of multiple video streams within a single application session. This feature allows independent player instances to be created, each managing its own playback lifecycle, DRM authorization, and heartbeat session. Both Android and iOS platforms are supported, with platform-specific configurations required to enable concurrent playback behavior.

Changes for Android

Determine Maximum number of concurrent video decoders (Multi-stream playback)

Provides the maximum number of player's secured hardware decoders that can be instantiated for multi-stream playback. The secured decoder is used for playing DRM content.


import { deviceInformation } from '@quickplay/rn-qp-nxg-player';

const maxDecoderInstancesInfo = await deviceInformation.getMaxSecuredDecoderInstancesInfo();

Handle Audio Focus Implementation

To enable simultaneous playback of multiple players without interrupting previous playback due to loss of audio focus, we introduced a new property in PlaybackProperties called handleAudioFocus. When set to false, multiple players can play at the same time. By default, it is set to true, allowing single playback with audio focus.


let playbackProperty: PlaybackProperties = {
...
handleAudioFocus: false // To initiate Multiple playbacks
}

let playerConfig: PlayerConfig = {
...
playbackProperties: playbackProperty
}

Changes for iOS

To enable simultaneous playback of multiple players without interrupting previous playback, we introduced a property called enablePrefetch. When set to false, multiple players can play at the same time. By default it is et to tru, allowing single playback.


let playerConfig: PlayerConfig = {
...
enablePrefetch: false // To initiate Multiple playbacks
}

MultistreamMode Implentation

The heartbeat token is now unique for each player created. A new parameter, multistreamMode, has been added to the heartbeatConfig, which is set to false when there is only one player and switches to true when multiple players are active. Additionally, the heartbeat token is automatically removed whenever a player is disposed of


// When creating first player
let heartbeatConfiguration: HeartbeatConfig = {
...
multistreaMode: false // The default value of multiStreamMode is set to false, but it automatically updates to true based on the player count
}

// When creating multiple players
let heartbeatConfiguration: HeartbeatConfig = {
...
multistreaMode: true // The default value of multiStreamMode is set to false, but it automatically updates to true based on the player count
}

let playerConfig: PlayerConfig = {
...
heartbeatConfig: heartbeatConfiguration
}

Introduced the setMultiStreamMode API, which allows each player to toggle multi-stream mode based on the multiStreamMode value in the heartbeatConfig


const multiStreamMode = playerConfig?.heartbeatConfig?.multiStreamMode
player.setMultiStreamMode(multiStreamMode)