tencent cloud

Video on Demand

릴리스 노트 및 공지 사항
릴리스 노트
제품 소개
제품 개요
Product Features
제품 기능
제품 장점
시나리오
솔루션
구매 가이드
과금 개요
과금 방식
구매 가이드
청구서 조회
연장 안내
연체 안내
환불 안내
시작하기
콘솔 가이드
콘솔 소개
서비스 개요
애플리케이션 관리
미디어 관리
리소스 패키지 관리
License Management
사례 튜토리얼
미디어 업로드
VOD 미디어 파일을 스마트 콜드 스토리지하는 방법
비디오 처리
배포 및 재생
이벤트 알림 수신 방법
원본 서버 마이그레이션 방법
라이브 방송 녹화
사용자 지정 Origin-pull을 수행하는 방법
라이브 방송 하이라이트 클리핑을 VOD에 통합하기 위한 가이드
EdgeOne을 사용하여 VOD 콘텐츠 배포하는 방법
개발 가이드
미디어 업로드
미디어 처리
비디오 AI
이벤트 알림
비디오 재생
미디어 파일 다운로드
서브 애플리케이션 시스템
오류 코드
플레이어 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
FAQs
모바일 재생
요금
비디오 업로드
비디오 배포
비디오 재생
Web 재생
전체 화면 재생
데이터 통계
액세스 관리
미디어 자산 콜드 스토리지
Agreements
Service Level Agreement
VOD 정책
개인 정보 보호 정책
데이터 처리 및 보안 계약
문의하기
용어집

Player Adapter for iOS

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2022-10-17 11:16:01
Player Adapter for iOS is a player plugin provided by VOD for customers who want to use a third-party or proprietary player to connect to Tencent Cloud PaaS resources. It is generally used by customers who strongly need to customize player features.

SDK Download

The Player Adapter SDK and demo for iOS can be downloaded here.

Integration Guide

Environment requirements

To configure the support for HTTP requests, you need to set App Transport Security Settings->Allow Arbitrary Loads to YES in the info.plist file of your project.

Component dependency

Add the GCDWebServer component dependency.
pod "GCDWebServer", "~> 3.0"
GCDWebServer is a lightweight HTTP server based on GCD and can be used for OS X and iOS. This library also implements extended features such as web-based file upload and WebDAV server.

Using the Player

Declare the variables and then create an instance. The main class of the player is TXCPlayerAdapter, and videos can be played back after it is created.
A fileId is usually returned by the server after the video is uploaded:
1. After the video is published on the client, the server will return a fileId to the client.
2. When the video is uploaded to the server, the corresponding fileId will be included in the notification of upload confirmation.
If the file already exists in Tencent Cloud, you can go to Media Assets and find it. After clicking it, you can view relevant parameters in the video details on the right.
NSInteger appId; //// `appid` can be applied for in Tencent Cloud VOD
NSString *fileId;
// `psign` is a player signature. For more information on the signature and how to generate it, visit https://www.tencentcloud.com/document/product/266/42436?from_cn_redirect=1.
NSString *pSign = self.pSignTextView.text;

TXCPlayerAdapter *adapter = [TXCPlayerAdapter shareAdapterWithAppId:appId];
Request the video information and play back the video:
id<ITXCPlayerAssistorProtocol> assistor = [TXCPlayerAdapter createPlayerAssistorWithFileId:fileId pSign:pSign];
[assistor requestVideoInfo:^(id<ITXCPlayerAssistorProtocol> response, NSError *error) {
if (error){
NSLog(@"create player assistor error : %@",error);
[self.view makeToast:error.description duration:5.0 position:CSToastPositionBottom];
return;
}
[weakSelf avplayerPlay:response]; // Play back the video
}];



- (void)avplayerPlay:(id<ITXCPlayerAssistorProtocol>)response
{
AVPlayerViewController *playerVC = [[AVPlayerViewController alloc] init];
self.playerVC = playerVC;
TXCStreamingInfo *info = response.getStreamingInfo;
AVPlayer *player = [[AVPlayer alloc] initWithURL:[NSURL URLWithString:info.playUrl]];
playerVC.player = player;
playerVC.title = response.getVideoBasicInfo.name;
[self.navigationController pushViewController:playerVC animated:YES];

[player addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];
}
Terminate the player after use:
[TXCPlayerAdapter destroy];

SDK API Description

Initializing Adapter

This API is used to initialize an Adapter singleton.
API
+ (instancetype)shareAdapterWithAppId:(NSUInteger)appId;
Parameter description
appId: Enter the appid (if a subapplication is used, enter the subappid). |

Terminating Adapter

This API is used to terminate Adapter. It can be called after the program exits.
API
+ (void)destroy;

Creating the Player auxiliary class

An auxiliary class of the player can be used to get the playback fileId and process DRM encryption APIs.
API
+ (id<ITXCPlayerAssistorProtocol>)createPlayerAssistorWithFileId:(NSString *)fileId
pSign:(NSString *)pSign;
Parameter description
Parameter
Type
Description
fileId
String
The fileId of the video to be played.
pSign
String
The player signature.

Requesting video playback information

This API is used to request the stream information of the video to be played back from the Tencent Cloud VOD server.
API
- (void)requestVideoInfo:(ITXCRequestVideoInfoCallback)completion;
Parameter description
Parameter
Type
Description
completion
ITXCRequestVideoInfoCallback
Async callback function.

Terminating the Player auxiliary class

This API is used to terminate an auxiliary class. You can call it when exiting the player or switching to the next video for playback.
API
+ (void)destroyPlayerAssistor:(id<ITXCPlayerAssistorProtocol>)assistor;

Getting the basic video information

This API is used to get the video information and will take effect only after id<ITXCPlayerAssistorProtocol>.requestVideoInfo is called back.
API
- (TXCVideoBasicInfo *)getVideoBasicInfo;
Parameter description
The parameters of TXCVideoBasicInfo are as follows:
Parameter
Type
Description
name
String
Video name
size
Int
Video size in bytes
duration
Float
Video duration in seconds
description
String
Video description
coverUrl
String
Video cover

Getting video stream information

This API is used to get the video stream information list and will take effect only after id<ITXCPlayerAssistorProtocol>.requestVideoInfo is called back.
API
- (TXCStreamingInfo *)getStreamingInfo;
Parameter description
The parameters of TXCStreamingInfo are as follows:
Parameter
Type
Description
playUrl
String
Playback URL
subStreams
List
The adaptive bitrate substream information of the SubStreamInfo type.
The parameters of TXCSubStreamInfo are as follows:
Parameter
Type
Description
type
String
Substream type. Valid values: video
width
Int
The substream video width in px.
height
Int
The substream video height in px.
resolutionName
String
The name of the substream video displayed in the player.

Getting keyframe timestamp information

This API is used to get the video keyframe timestamp information and will take effect only after id<ITXCPlayerAssistorProtocol>.requestVideoInfo is called back.
API
- (NSArray<TXCKeyFrameDescInfo *> *)getKeyFrameDescInfos;
Parameter description
The parameters of TXCKeyFrameDescInfo are as follows:
Parameter
Type
Description
timeOffset
Float
1.1
content
String
"Beginning now..."

Getting thumbnail information

This API is used to get the thumbnail information and will take effect only after id<ITXCPlayerAssistorProtocol>.requestVideoInfo is called back.
API
- (TXCImageSpriteInfo *)getImageSpriteInfo;
Parameter description
The parameters of TCXImageSpriteInfo are as follows:
Parameter
Type
Description
imageUrls
List
Array of thumbnail download URLs of String type.
webVttUrl
String
Thumbnail VTT file download URL.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백