Hello, I have a strange problem with casting on android. First, cast button sometimes is not even displayed near target device. If cast is connected, app is closing and there is no way to stop the casting, and start with another video. What could be the reason for such strange behaviour? I’ve made all the necessary changes in build.gradle and AndroidManifest.xml files. And here is a code setting up a cast source from player
if (isAndroid) {
BitmovinCastManager.initialize();
BitmovinCastManager.updateContext();
}
useEffect(() => {
if (isAndroid) {
BitmovinCastManager.updateContext();
}
}, [file]);
useFocusEffect(
useCallback(() => {
const source = new Source({
url: file,
type: !isAndroid ? SourceType.HLS : SourceType.DASH,
title: title,
poster: poster,
metadata: { platform: Platform.OS },
});
source.remoteControl = {
castSourceConfig: {
url: file,
type: SourceType.DASH,
title: title,
},
};
player.loadSource(source);
return () => {
player.destroy();
};
}, [player, file]),
);
Please, help me to make it work stable, also here is a code for a PlayerView, maybe I need to handle some props events here?
<PlayerView
style={styles.playerView}
player={player}
onReady={onReady}
onTimeChanged={handleTimeChanged}
onPlaybackFinished={handleEnd}
onPlay={handleTogglePlay}
onPaused={handleTogglePlay}
/>
And also here is a player setup using usePlayer
const player = usePlayer({
remoteControlConfig: {
isCastEnabled: true,
},
playbackConfig: {
isAutoplayEnabled: false,
isMuted: appSettings?.default_no_music ?? false,
isBackgroundPlaybackEnabled: true,
},
});