Advanced playback configuration
The default player behavior can be configured through the playbackConfig
key when initialized.
// Simply pass the `playbackConfig` property to `PlayerConfig` when instantiating a player.
// With hooks
import { usePlayer } from 'bitmovin-player-react-native';
const player = usePlayer({
playbackConfig: {
// Specifies whether the playback starts immediately after loading a source or not. Default is false.
isAutoplayEnabled: true,
// Specifies if playback starts muted. Default is false.
isMuted: true,
// Specifies if time shift for live streams should be enabled. Default is true.
isTimeShiftEnabled: true,
// Whether background playback is enabled or not. Default is false.
// Only available for iOS.
isBackgroundPlaybackEnabled: true,
// Enable the Picture in Picture mode option on the player controls.
//
// Note iOS requires the audio session category of your app to be set to `playback` otherwise
// PiP mode won't work.
//
// Check out `Enabling Picture in Picture mode` section of README for more information
// on how to properly configure your app to support PiP.
isPictureInPictureEnabled: true,
},
});
// Without hooks
import { Player } from 'bitmovin-player-react-native';
const player = new Player({
// Make sure to use React.createRef if instantiating inside a component.
playbackConfig: {
isAutoplayEnabled: true,
isMuted: true,
isTimeShiftEnabled: true,
isBackgroundPlaybackEnabled: true,
isPictureInPictureEnabled: true,
},
});
Updated about 1 year ago