最近更新时间:2023.10.11 19:17:23
首次发布时间:2021.04.14 14:20:55
本文为您介绍 H.265 接入的使用说明。
建议使用高级版 SDK,包含了基于大数据沉淀的 H.265 硬解机型黑名单,仅需集成少量代码即可对接大数据机型画像,同时包含基于机型画像的档位灵活切换软硬解策略,有效避免播放失败、花屏、黑屏等问题。
pod 'TTSDK', 'x.x.x.x', :subspecs => [ 'Player', # 点播 // 使用稳定版高级版本 SDK(x.x.x.x-premium) ]
更多版本详见历史版本。
说明
详细说明可参考设置播放数据源。
NSString *localVideoPath = @"file://xxx.xx"; [self.engine setLocalURL:localVideoPath]; [self.engine play];
// 设置播放源信息 NSString *videoUrl = @"you video url"; /// cacheKey 为该 url 对应的唯一标识,建议使用 url md5 值 NSString *cacheKey = [videoUrl md5]; TTVideoEngineUrlSource *urlSource = [[TTVideoEngineUrlSource alloc] initWithUrl:videoUrl cacheKey:cacheKey]; [self.engine setVideoEngineVideoSource:urlSource]; [self.engine play];
// vid 方式播放,需要同时设置 playAuthToken 和 resolution NSString *vid = @"vid"; NSString *playAuthToken = @"play auth token"; TTVideoEngineResolutionType resolution = TTVideoEngineResolutionTypeFullHD; // 指定视频播放分辨率档位 TTVideoEngineVidSource *vidSource = [[TTVideoEngineVidSource alloc] initWithVid:vid playAuthToken:playAuthToken resolution:resolution]; [self.engine setVideoEngineVideoSource:vidSource]; [self.engine play];
说明
播放出错有如下回调示例。
/** video engine finished @param videoEngine videoengine @param error error info */ - (void)videoEngineDidFinish:(TTVideoEngine *)videoEngine error:(nullable NSError *)error;