react-native-jw-media-player
react-native-jw-media-player copied to clipboard
How to hide PIP icon?
Hi @chaimPaneth, How do I hide the pip icon? I have tried setting the pipEnabled={false}
on the player and also on the config but it doesn't work. Clicking the pip icon on android crashes the app and on IOS it does nothing. I just wanted to get rid of it. here is my config
<JWPlayer
ref={playerRef}
style={styles.player}
pipEnabled={false}
config={{
license:
Platform.OS === "android"
? "NdTmxf/nTJMfrwsss1F8sFxxUoHsQsQDaEUxxyWEgms2zS7s87Ka3DX6bXSq"
: "14VMgmaF1pf2bG+/YHDULia3Iz9ddvdsd5aMeYnHdsG+aRrDNiDs+UiXcd",
backgroundAudioEnabled: false,
pipEnabled: false,
autostart: true,
nextUpDisplay: false,
playlist,
...(isIOS && {
interfaceBehavior: "normal",
// enableLockScreenControls: false,
// offlineMessage: "You are currently offline",
}),
...(!isIOS && {
hideUIGroup: "casting_menu",
nativeFullScreen: true,
landscapeOnFullScreen: true,
}),
}}
onPlaylistItem={({ nativeEvent }) => {
setPlaying(playlist[nativeEvent.index].title);
}}
onSetupPlayerError={({ nativeEvent }) =>
console.log("jwplayer setup error", nativeEvent)
}
onPlayerError={({ nativeEvent }) =>
console.log("jwplayer player err", nativeEvent)
}
/>
Hi @manamelacedric
In latest version 0.2.11 there is a new object allowsPictureInPicturePlayback: boolean
on the config
prop you might wanna check it out.
This was introduced in the latest jw ios sdk
@chaimPaneth @manamelacedric Fixed this one here https://github.com/chaimPaneth/react-native-jw-media-player/pull/203
@manamelacedric Unfortunately, this isn't possible on the JW Player iOS SDK itself.
According to the docs, the picture-in-picture (PIP) button is added to the top-right of the player when the feature is available on the device.
While trying to hide the Chromecast icon on iOS, I found that pip icon can also be hidden with this:
const jwPlayer = useRef<JWPlayer>(null);
useEffect(() => {
jwPlayer.current?.setVisibility(false, ['pip']);
}, [jwPlayer.current]);
PS: setVisibility(visibility: Boolean, controls: JWControlType[])
is only available on iOS.