tencent cloud

Video on Demand

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Product Features
Features
Strengths
Scenarios
Solutions
Professional Edition
Introduction to Video On Demand Professional Edition
Quick Start
Console Guide
Development Guide
Purchase Guide
Billing Overview
Billing Modes
Purchase Guide
Viewing Bills
Renewal
Overdue Policy
Refund Policy
Getting Started
Console Guide
Console Overview
Service Overview
Application Management
Media Management
Package Management
License Management
Real-Time Log Analysis
Practical Tutorial
Media Upload
Smart Cold Storage of VOD Media Asset Files
Video Processing
Distribution and Playback
How to Receive Event Notification
How to Migrate Files from Origin Server to VOD
Live Recording
How to Pull from Custom Origin Servers
How to Use EdgeOne to Distribute Content in VOD
Development Guide
Media Upload
Media Processing
Video AI
Event Notification
Video Playback
Media Encryption and Copyright Protection
Broadcast Channel
CAM
Media File Download
Subapplication System
Error Codes
Player SDK
Overview
Basic Concepts
Features
Free Demo
Free Trial License
Purchase Guide
SDK Download
Licenses
Player Guide
Integration (UI Included)
Integration (No UI)
Advanced Features
API Documentation
Player Adapter
Player SDK Policy
Server APIs
History
Introduction
API Category
Other APIs
Media Processing APIs
Task Management APIs
Media Upload APIs
Media Management APIs
Event Notification Relevant API
Media Categorization APIs
Domain Name Management APIs
Distribution APIs
AI-based Sample Management APIs
Region Management APIs
Data Statistics APIs
Carousel-Related APIs
Just In Time Transcode APIs
No longer recommended APIs
Making API Requests
AI-based image processing APIs
Parameter Template APIs
Task Flow APIs
Data Types
Error Codes
Video on Demand API 2024-07-18
FAQs
Mobile Playback
Fees
Video Upload
Video Publishing
Video Playback
Web Playback
Full Screen Playback
Statistics
Access Management
Cold Storage
Agreements
Service Level Agreement
VOD Policy
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

iOS

PDF
Focus Mode
Font Size
Last updated: 2024-04-17 11:49:14

Introduction

Application scenarios

Advanced Picture-in-Picture (PIP) is an upgraded version of the basic PIP, mainly used for encrypted video PIP, offline playback PIP, and seamless switching from foreground to PIP scenes. It optimizes the implementation and logic, and achieves a true "instant switch" effect without long waiting times.
Advantages of Advanced PIP:
Encrypted video PIP: integrated with the existing player for encrypted playback, realizing PIP playback based on encrypted templates without the need to switch player types.
Offline playback PIP: supports local video PIP playback, including ordinary videos, encrypted videos, etc.
"Instant switch" effect: no need to click the PIP button to switch, just go to the background and PIP will start immediately, achieving a true "instant switch".

Requirements

System version: iOS ≥ 14.0, iPad ≥ 9.0 .
Hardware devices: iPhone 8 and above.
SDK version: 11.4 or above.

Integration Steps

Upgrade SDK version and configure resources

1. Upgrade SDK version:

Advanced Picture-in-Picture requires the use of the SDK. Before using the advanced Picture-in-Picture version, the SDK version needs to be upgraded to version 11.3 or above for the advanced version, or version 11.4 or above for the basic version, otherwise it cannot be used. At the same time, the basic and advanced versions of Picture-in-Picture can coexist with compatibility and no functional conflicts. If you want to upgrade the SDK version, please refer to the SDK integration guide.

2. Introduce bundle resources

Because the SDK needs to use resources from TXVodPlayer.bundle, the bundle file needs to be downloaded and introduced into the project before compilation. Please do not modify the bundle or the names of the resources used inside, as doing so may cause seamless switching of picture-in-picture to fail.




3. Activate the premium version license for the player

The advanced picture-in-picture version requires the mobile player premium version license. You can refer to the mobile player license guide to obtain it. If you have obtained the corresponding License, you can go to Tencent Cloud Cube Console > License Management > Mobile License to obtain the corresponding LicenseURL and LicenseKey. If you do not apply for the Player Advanced Package License, entering Picture-in-Picture will be invalid.
After obtaining the License information, before calling the relevant interface of the SDK, initialize the License through the following interface. It is recommended to make the following settings in - [AppDelegate application:didFinishLaunchingWithOptions:]:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSString * const licenceURL = @"<your license Url>";
NSString * const licenceKey = @"<your license key>";

//TXLiveBase is in "TXLiveBase.h"
[TXLiveBase setLicenceURL:licenceURL key:licenceKey];
NSLog(@"SDK Version = %@", [TXLiveBase getSDKVersionStr]);
}

Quick access to picture-in-picture function

1. Permission granted

Picture-in-picture (PictureInPicture) has been launched in iOS 9, but it was only available on the iPad before. To use picture-in-picture, the iPhone needs to be updated to iOS 14. Currently, Tencent Cloud Player can support in-app and out-of-app picture-in-picture capabilities, which greatly meets the needs of users. You need to enable background mode before use. The steps are: Select the corresponding Target > Signing & Capabilities > Background Modes in XCode and check "Audio, AirPlay, and Picture in Picture".

img



2. Set configuration options

In order to use the automatic picture-in-picture function, you need to turn on the automatic picture-in-picture button in the settings. The specific path is to select on iPhone or iPad: Settings > General > Picture-in-Picture > Automatically turn on Picture-in-Picture, select to turn it on.




3. Set proxy

In order to facilitate monitoring of the picture-in-picture status, vodDelegate needs to be set to implement the picture-in-picture related callbacks in TXVodPlayListener. You can perform related business operations based on various status and error messages in the callback, such as continuing to play, pausing or exiting picture-in-picture, etc.
/**
* Picture-in-picture status callback
*
*/
- (void)onPlayer:(TXVodPlayer *)player pictureInPictureStateDidChange:(TX_VOD_PLAYER_PIP_STATE)pipState withParam:(NSDictionary *)param;

/**
* Picture-in-picture error message callback
*
*/
- (void)onPlayer:(TXVodPlayer *)player pictureInPictureErrorDidOccur:(TX_VOD_PLAYER_PIP_ERROR_TYPE)errorType withParam:(NSDictionary *)param;

4. Code example using picture-in-picture capability

Note:
To use the automatic picture-in-picture function, make sure the player is in the playing state. If the player is paused or stopped, the automatic picture-in-picture function cannot be used.
The isSupportSeamlessPictureInPicture interface can only be used after the application loads the advanced version License. At the same time, this interface can only determine whether the device itself supports automatic switching of picture-in-picture. Due to system limitations, it cannot determine the user's setting permission for automatic picture-in-picture, and needs to be guided by itself.
Before playing, set whether to allow "automatic switching of picture-in-picture function".

// 1. Before playing, set whether the "automatic switching Picture-In-Picture function" is allowed.
// YES means allowed, NO means not allowed, the default is NO
[TXVodPlayer setPictureInPictureSeamlessEnabled:YES];

// 2. Enter picture-in-picture
if (![TXVodPlayer isSupportPictureInPicture]) {
//The device does not support picture-in-picture and exit directly.
return;
}

// Manually call to enter picture-in-picture
[_vodPlayer enterPictureInPicture];

// 3. Exit the background operation. If the device supports seamless switching of picture-in-picture, the playback will not be paused when exiting the background.
// Note: The isSupportSeamlessPictureInPicture interface can only be used after the application loads the advanced version License. At the same time, this interface can only determine the device itself
// Whether automatic switching of picture-in-picture is supported? Due to system limitations, it is impossible to determine the user's setting permissions for automatic picture-in-picture. You need to guide it yourself.
if ([self.vodplayer isSupportSeamlessPictureInPicture]) {
// No processing
} else {
// Pause playback
[self.vodplayer pause];
}

// 4. Exit picture-in-picture
[_vodPlayer exitPictureInPicture];


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback