
- [AppDelegate application:didFinishLaunchingWithOptions:] 中进行如下设置:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {NSString * const licenceURL = @"<获取到的 licenseUrl>";NSString * const licenceKey = @"<获取到的 key>";//TXLiveBase 位于 "TXLiveBase.h" 头文件中[TXLiveBase setLicenceURL:licenceURL key:licenceKey];NSLog(@"SDK Version = %@", [TXLiveBase getSDKVersionStr]);}


/*** 画中画状态回调** 画中画状态回调*/- (void)onPlayer:(TXVodPlayer *)player pictureInPictureStateDidChange:(TX_VOD_PLAYER_PIP_STATE)pipState withParam:(NSDictionary *)param;/*** 画中画错误信息回调** 画中画错误信息回调*/- (void)onPlayer:(TXVodPlayer *)player pictureInPictureErrorDidOccur:(TX_VOD_PLAYER_PIP_ERROR_TYPE)errorType withParam:(NSDictionary *)param;
// 1.播放之前先设置“自动切换 Picture-In-Picture功能”是否允许// YES 表示允许 NO 表示不允许,默认为NO[TXVodPlayer setPictureInPictureSeamlessEnabled:YES];// 2、进入画中画if (![TXVodPlayer isSupportPictureInPicture]) {// 设备不支持画中画直接退出return;}// 手动调用进入画中画[_vodPlayer enterPictureInPicture];// 3、退后台操作 如果设备支持无缝切换画中画,退后台不暂停播放。// 注意:isSupportSeamlessPictureInPicture这个接口,需要在应用程序加载高级版License以后才能使用。同时,此接口只能判断设备本身// 是否支持自动切换画中画,因系统限制,无法判断用户对于自动画中画的设置权限,需自行引导。if ([self.vodplayer isSupportSeamlessPictureInPicture]) {// 不做处理} else {// 暂停播放[self.vodplayer pause];}// 4.退出画中画[_vodPlayer exitPictureInPicture];
文档反馈