TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://thewidlarzgroup.github.io/react-native-video/
MIT License
7.17k stars 2.89k forks source link

[iOS] Picture In Picture not start automatically for the next Video in a series of videos #3433

Open prudhvi-k23 opened 10 months ago

prudhvi-k23 commented 10 months ago

Reproducible sample code My code block is as follows:

<Video key="video_player" style={styles.videoStyle} testID={'video_player'} ref={setActivePlayer} allowsExternalPlayback progressUpdateInterval={progressUpdateInterval} source={{ uri: playerSource.url }} poster={video.poster} resizeMode={'contain'} repeat={false} paused={isPaused} rate={playbackSpeed} onBuffer={onBuffer} onLoad={onLoad} onAudioBecomingNoisy={onAudioBecomingNoisy} onReadyForDisplay={onReadyForDisplay} onLoadStart={onLoadStart} onProgress={onProgress} onEnd={onVideoEnd} onError={onError} selectedTextTrack={selectedTextTrack} textTracks={playerSource.textTracks} pictureInPicture={pictureInPicture} playInBackground={!pictureInPicture} playWhenInactive={true} />

Environment info

Library version: react-native-video : 5.2.1 Device: iOS

Steps To Reproduce

1.Start video playing 2.Press the home button

  1. Video enters into PIP mode
  2. Before next video starts, PIP window is disappearing and only audio is playing. ...

Expected behaviour

1.Start video playing 2.Press the home button

  1. Video enters into PIP mode
  2. Next Video should play after the first video in PIP mode

Anyone please help me out of this. After video ending, PIP mode goes off and background mode is activating (only audio playing). Is this the expected behaviour in react-native-video or should I change the code in any event method?

Thanks in advance.

KrzysztofMoch commented 9 months ago

Hey @prudhvi-k23, cloud you test it on latest beta ? It probably wont work 😅, so after confirm I will add this to Road Map

prudhvi-k23 commented 9 months ago

Hi @KrzysztofMoch , tested in latest beta. Not working. Here, the video component that I've shared above is getting destroyed after end of every video, and new component is getting created for the next video. So, next video is not displaying in the PIP mode (as PIP mode only starts after we press the Home button).

Is is possible to play a series of videos in PIP mode one after another? Suppose if the first is in PIP mode, and after end of the first video , the next video should start in PIP mode. How to achieve this in React Native?

KrzysztofMoch commented 9 months ago

Hmm I don't think it will be possible to achieve what you want with react-native-video. We probably would need to reimplement iOS to use AVQueuePlayer 😕

everttwn commented 4 months ago

Hi, did you find a workaround to this problem?

KrzysztofMoch commented 4 months ago

In theory you can start pip from component ref when changing source