- Print
Step8. PIP (Picture In Picture)
- Print
While watching the broadcast, you can switch to Picture-in-Picture (PIP) mode to perform other tasks.
In-app PIP
On the Shoplive Player screen, you can switch the currently playing broadcast screen to a small window within the app by selecting the PIP icon or using the Swipe down gesture.
Unlike the preview feature, switching to in-app Picture-in-Picture (PIP) mode will continue playing the audio of the broadcast.
Set the screen ratio for PIP mode
You can set the size of PIP within the app.
// default: 0.4
// 0.1 scale
ShopLive.pipScale = 0.1
// 0.8 scale
ShopLive.pipScale = 0.8
Use the OS PIP
Requirements
OS PIP is supported only on iOS 14 or later. More information about OS PIP support can be found in the relevant Apple Developer Guide.
To use OS PIP, it is necessary to activate the option in Project
Check the information below.
While broadcast is playing, you can switch to the home screen or another app through the home button or home indicator, and continue watching the broadcast in a small window within iOS.
Set up your project as follows.
When enabling background options in Project, be careful about app review
To provide Picture-in-Picture (PIP) capability, background audio permission is required. When using background audio (during PIP transition), it is necessary to provide an explanation for its use and offer a way for reviewers to access and execute PIP, such as an entry method or deep link, to pass the review process.
Switch to in-app PIP using the API
Switch to PIP within the app
ShopLive.startPictureInPicture()
Switch to full screen
ShopLive.stopPictureInPicture()
API Reference: startPictureInPicture(with: , scale: ), stopPictureInPicture()
Close the PIP within the app by swiping out
You can exit or leave the player by moving them off the screen.
// Set whether to allow the in-app Picture-in-Picture (PIP) to be moved out of the screen for termination.
ShopLive.setEnabledPipSwipeOut(true)
// Keep in-app PIP even after swipiing it out of the screen
ShopLive.setEnabledPipSwipeOut(false)