Classic/VPC 환경에서 이용 가능합니다.
이 페이지에서는 플레이어 Picture in Picture 설정 방법을 설명합니다.
주의
현재 기능은 실제 기기에서만 동작합니다. 시뮬레이터에서는 동작하지 않습니다.
참고
Android, iOS에 공통으로 적용되는 사항입니다.
allowsPictureInPicture
PIP를 구현하려면 autoPause 옵션이 반드시 필요합니다.
const playerRef = useRef(null);
return (
<VpePlayer
...
ref={playerRef}
options={{
playlist: [ //재생소스
{
file: 'https://CDN도메인/example_video_01.mp4'
},
],
autoPause: false, //false : Background 재생 설정
allowsPictureInPicture: true, //PIP 설정
}}
...
/>
)
app.json 설정
PictureInPicture 기능을 지원하기 위해 관련 옵션을 추가해야 합니다.
Background play 기능을 사용하기 위해서는 옵션 추가가 필요합니다.
{
"expo": {
...
"plugins": [
...
[
"@sgrsoft/react-native-video",
{
"enableAndroidPictureInPicture": true
}
]
],
"ios": {
...
"infoPlist": {
"UIBackgroundModes": [
"audio",
"fetch"
]
}
...
},
"android": {
...
"edgeToEdgeEnabled": true,
"supportsPictureInPicture": true,
"permissions": [
"android.permission.FOREGROUND_SERVICE"
]
...
},
}
}
주의
상황에 따라 prebuild 혹은 pod install이 필요합니다.