chaimPaneth / react-native-jw-media-player

React-Native Android/iOS bridge for JWPlayer SDK (https://www.jwplayer.com/)
MIT License
197 stars 92 forks source link

Picture-In-Picture does not open when app is backgrounded on iOS #347

Open paulrinaldi opened 8 months ago

paulrinaldi commented 8 months ago

Versioning & OS: iPhone 15 Pro iOS 17.2 "react-native-jw-media-player": "^0.2.44"

Relevant code block

<JWPlayer
  playerId={"myPlayer"}
  onLayout={this.props.onLayout}
  onTime={(event) => {
    ...
  }}
  onPlay={() => {
    ...
  }}
  onPause={() => {
     ...
   }}
  ref={p => (this.JWPlayer = p)}
  key={this.props.tag}
  style={[{flex: 1}]}
  config={{
     autostart: true,
     fullScreenOnLandscape: true,
     landscapeOnFullScreen: true,
     portraitOnExitFullScreen: true,
     exitFullScreenOnPortrait: true,
     enableLockScreenControls: false,
     backgroundAudioEnabled: true,
     playlist: [
       {
         tracks: this.getTracks(),
         file: this.props.url,
         image: getStoryImageUri(
           this.props.mediaItemImage,
           DEFAULT_CONTENT_IMAGE
         ),
       }
     ],
    license: Platform.select({ios: "...", android: "..."})
  }}
  pipEnabled={true}
/>

Steps to Reproduce: Load JW Player with a video url and press play.

Screenshot 2024-03-08 at 2 46 24 PM

Press home button on iPhone.

Actual: The home screen is visible.

Screenshot 2024-03-08 at 2 46 45 PM

Expected: The home screen is visible. A small window of the video still present and playing.

Would this be because iPhone 15 Pro doesn't support PiP? [Edit: I doubt this is the case, due to reddit discussion]

Or perhaps more likely, PiP is disabled somehow as the docs point out.

paulrinaldi commented 8 months ago

Added Capability via XCode 'Background Modes' and within that selected Audio, Airplay, and Picture in Picture...

paulrinaldi commented 8 months ago

Still same result.