最近更新时间:2024.04.19 15:19:25
首次发布时间:2023.03.31 11:23:07
typedef NS_ENUM( NSInteger, VeLivePlayerResolutionSwitchReason )
直播播放器清晰度档位变化原因。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerResolutionSwitchByAuto | 0 | ABR 自动切档。 |
VeLivePlayerResolutionSwitchByManual | 1 | 手动切换档位。 |
@interface VeLivePlayerConfiguration : NSObject
播放器初始化相关配置。
类型 | 名称 |
---|---|
BOOL | enableSei |
BOOL | enableHardwareDecode |
BOOL | enableLiveDNS |
BOOL | enableStatisticsCallback |
NSInteger | statisticsCallbackInterval |
NSInteger | networkTimeoutMs |
NSInteger | retryIntervalTimeMs |
NSInteger | retryMaxCount |
返回 | 名称 |
---|---|
instancetype | init |
@property (nonatomic, assign) BOOL enableSei;
是否开启 SEI 消息的解析,默认值为 NO。
@property (nonatomic, assign) BOOL enableHardwareDecode;
是否开启硬件解码功能,默认值为 YES。开启硬件解码后,如果出现硬件解码启动失败或硬件解码失败的情况,播放器内部会自动切换为软解。
@property (nonatomic, assign) BOOL enableLiveDNS;
是否开启本地 DNS 预解析,默认值为 NO。开启本地 DNS 预解析可以缩短启播时间。如果本地 DNS 预解析出现异常,可能会影响播放器的正常使用。
@property (nonatomic, assign) BOOL enableStatisticsCallback;
是否开启播放信息周期性回调。默认值为 NO。周期性回调参数详细说明请参见 VeLivePlayerStatistics 。当 enableStatisticsCallback 为 YES,且 statisticsCallbackInterval 大于 0 时,播放器会在指定的时间间隔内,周期性地回调播放器状态信息。
@property (nonatomic, assign) NSInteger statisticsCallbackInterval;
播放信息周期性回调的时间间隔,单位为 s,默认值为 5。当 enableStatisticsCallback 为 YES,且 statisticsCallbackInterval
大于 0 时,播放器会在指定的时间间隔内,周期性地回调播放器状态信息。
@property (nonatomic, assign) NSInteger networkTimeoutMs;
网络超时时间,单位为 ms,默认值为 5000。播放器发起网络请求,如果超过了该时间仍未收到服务器响应,则认为网络请求失败。
@property (nonatomic, assign) NSInteger retryIntervalTimeMs;
重试时间间隔,单位为 ms,默认值为 5000,仅在无备流时生效。
@property (nonatomic, assign) NSInteger retryMaxCount;
在网络连接错误的情况下,播放器最大重试次数,默认值为 5。如果取值为 0,表示关闭播放器内部重试。
- (instancetype _Nonnull)init;
默认初始化方法。
@interface VeLivePlayerStream : NSObject
流地址信息。
类型 | 名称 |
---|---|
NSString* | url |
VeLivePlayerResolution | resolution |
int | bitrate |
VeLivePlayerProtocol | protocol |
VeLivePlayerFormat | format |
VeLivePlayerStreamType | type |
返回 | 名称 |
---|---|
instancetype | init |
@property (nonatomic, copy, nonnull) NSString* url;
播放地址。
@property (nonatomic, assign) VeLivePlayerResolution resolution;
清晰度档位,详情请参见 VeLivePlayerResolution。
@property (nonatomic, assign) int bitrate;
播放码率,单位为 kbps。
@property (nonatomic, assign) VeLivePlayerProtocol protocol;
传输协议,详情请参见 VeLivePlayerProtocol。
@property (nonatomic, assign) VeLivePlayerFormat format;
播放格式,详情请参见 VeLivePlayerFormat。
@property (nonatomic, assign) VeLivePlayerStreamType type;
播放流类型为主路或备路,详情请参见 VeLivePlayerStreamType。
- (instancetype)init;
单路直播流配置初始化方法。
typedef NS_ENUM( NSUInteger, VeLivePlayerLogLevel )
直播播放器日志打印级别。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerLogLevelVerbose | 0 | 输出 VERBOSE、DEBUG、INFO、WARNING 和 ERROR 级别的日志。 |
VeLivePlayerLogLevelDebug | 1 | 输出 DEBUG、INFO、WARNING 和 ERROR 级别的日志。 |
VeLivePlayerLogLevelInfo | 2 | 输出 INFO、WARNING 和 ERROR 级别的日志。 |
VeLivePlayerLogLevelWarn | 3 | 输出 WARNING 和 ERROR 级别的日志。 |
VeLivePlayerLogLevelError | 4 | 输出 ERROR 级别的日志。 |
VeLivePlayerLogLevelNone | 5 | 关闭日志打印。 |
@interface VeLivePlayerAudioFrame : NSObject
音频帧数据。
类型 | 名称 |
---|---|
VeLivePlayerAudioBufferType | bufferType |
int | sampleRate |
int | channels |
int | bitDepth |
CMTime | pts |
NSData* | data |
int | samples |
@property (nonatomic, readonly) VeLivePlayerAudioBufferType bufferType;
音频帧数据封装格式,详情请参见 VeLivePlayerAudioBufferType。
@property (nonatomic, readonly) int sampleRate;
音频采样率,单位为 Hz。
@property (nonatomic, readonly) int channels;
声道数。
@property (nonatomic, readonly) int bitDepth;
音频位深度。
@property (nonatomic, readonly) CMTime pts;
音频渲染时间戳,单位为 ms。
@property (nonatomic, strong, readonly) NSData* data;
PCM 音频数据。
@property (nonatomic, readonly) int samples;
音频采样点个数。
@interface VeLivePlayerVideoFrame : NSObject
视频帧数据。
类型 | 名称 |
---|---|
VeLivePlayerVideoBufferType | bufferType |
VeLivePlayerPixelFormat | pixelFormat |
NSInteger | width |
NSInteger | height |
int64_t | pts |
CVPixelBufferRef | pixelBuffer |
CMSampleBufferRef | sampleBuffer |
NSData* | data |
@property (nonatomic, readonly) VeLivePlayerVideoBufferType bufferType;
视频帧数据封装格式,详情请参见 VeLivePlayerVideoBufferType。
@property (nonatomic, readonly) VeLivePlayerPixelFormat pixelFormat;
视频帧像素格式,详情请参见 VeLivePlayerPixelFormat。
@property (nonatomic, readonly) NSInteger width;
视频宽度,单位为 px。
@property (nonatomic, readonly) NSInteger height;
视频高度,单位为 px。
@property (nonatomic, readonly) int64_t pts;
视频帧的渲染时间戳,单位为 ms。
@property (nonatomic, readonly, nullable) CVPixelBufferRef pixelBuffer;
pixelFormat
为 VeLivePlayerVideoBufferTypePixelBuffer
时的视频数据。
@property (nonatomic, readonly, nullable) CMSampleBufferRef sampleBuffer;
pixelFormat
为 VeLivePlayerVideoBufferTypeSampleBuffer
时的视频数据。
@property (nonatomic, strong, readonly, nullable) NSData* data;
pixelFormat
为 VeLivePlayerVideoBufferTypeNSData
时的视频数据。
@interface VeLivePlayerStreamData : NSObject
播放地址相关配置。
类型 | 名称 |
---|---|
BOOL | enableABR |
BOOL | enableMainBackupSwitch |
VeLivePlayerResolution | defaultResolution |
VeLivePlayerFormat | defaultFormat |
VeLivePlayerProtocol | defaultProtocol |
NSArray<VeLivePlayerStream*>* | mainStream |
NSArray<VeLivePlayerStream*>* | backupStream |
@property (nonatomic, assign) BOOL enableABR;
是否打开 ABR 平滑切档功能,默认为 NO。
@property (nonatomic, assign) BOOL enableMainBackupSwitch;
是否打开主备切换,默认为 NO。
@property (nonatomic, assign) VeLivePlayerResolution defaultResolution;
播放器的默认清晰度档位,默认使用原始流清晰度,详情请参见 VeLivePlayerResolution。
@property (nonatomic, assign) VeLivePlayerFormat defaultFormat;
播放器的默认播放格式,默认值为 FLV,详情请参见 VeLivePlayerFormat。
@property (nonatomic, assign) VeLivePlayerProtocol defaultProtocol;
播放器的默认播放传输层协议,默认值为 TCP,详情请参见 VeLivePlayerProtocol。
@property (nonatomic, copy, nullable) NSArray<VeLivePlayerStream *> * mainStream;
主路流地址列表,详情请参见 VeLivePlayerStream。
@property (nonatomic, copy, nullable) NSArray<VeLivePlayerStream *> * backupStream;
备路流地址列表,详情请参见 VeLivePlayerStream。
typedef NS_ENUM( NSInteger, VeLivePlayerAudioBufferType )
音频数据封装格式。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerAudioBufferUnknown | 0 | 未知格式。 |
VeLivePlayerAudioBufferTypeSampleBuffer | 1 | CVSampleBufferRef 格式,音频数据以样本缓冲区 sample buffer 的形式进行处理和渲染。 |
VeLivePlayerAudioBufferTypeNSData | 2 | NSData 格式,音频数据以 NSData 对象的形式进行处理和渲染。 |
typedef NS_ENUM( NSInteger, VeLivePlayerVideoBufferType )
视频数据封装格式。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerVideoBufferTypeUnknown | 0 | 未知格式。 |
VeLivePlayerVideoBufferTypePixelBuffer | 1 | CVPixelBufferRef 格式。 |
VeLivePlayerVideoBufferTypeSampleBuffer | 2 | CVSampleBufferRef 格式。 |
VeLivePlayerVideoBufferTypeNSData | 3 | NSData 格式。 |
typedef NS_ENUM( NSInteger, VeLivePlayerProtocol )
直播播放传输协议。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerProtocolTCP | 0 | TCP 协议。 |
VeLivePlayerProtocolQUIC | 1 | QUIC 协议。 |
VeLivePlayerProtocolTLS | 2 | TLS 协议。 |
typedef NS_ENUM( NSInteger, VeLivePlayerFillMode )
直播播放器画面的填充模式。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerFillModeAspectFill | 0 | 视频填满画布。视频帧等比缩放,直至填满画布,超出屏幕的部分将被裁剪,画面可能不完整。 |
VeLivePlayerFillModeAspectFit | 1 | 显示完整的视频帧。视频帧等比缩放,直至视频帧恰好在画布上全部显示。如果视频帧长宽比例与画布不同,视窗上未被视频帧填满区域将填充为黑色。 |
VeLivePlayerFillModeFullFill | 2 | 视频帧自适应画布。视频帧非等比缩放,直至填满画布。在此过程中,视频帧的长宽比例可能会发生变化。 |
typedef NS_ENUM( NSInteger, VeLivePlayerRotation )
视频顺时针旋转角度。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerRotation0 | 0 | 关闭旋转。 |
VeLivePlayerRotation90 | 90 | 顺时针旋转 90 度。 |
VeLivePlayerRotation180 | 180 | 顺时针旋转 180 度。 |
VeLivePlayerRotation270 | 270 | 顺时针旋转 270 度。 |
typedef NS_ENUM( NSInteger, VeLivePlayerMirror )
视频镜像。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerMirrorNone | 0 | 关闭镜像。 |
VeLivePlayerMirrorHorizontal | 1 | 水平镜像。 |
VeLivePlayerMirrorVertical | 2 | 垂直镜像。 |
typedef NS_ENUM( NSInteger, VeLivePlayerPixelFormat )
视频帧像素格式。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerPixelFormatUnknown | 0 | 未知格式。 |
VeLivePlayerPixelFormatNV12 | 1 | NV12 格式。 |
VeLivePlayerPixelFormatI420 | 2 | YUVI420 格式。 |
VeLivePlayerPixelFormatBGRA32 | 3 | BGRA 格式。 |
typedef NS_ENUM( NSInteger, VeLivePlayerStatus )
直播播放器状态。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerStatusPrepared | 0 | 播放器准备完成,等待渲染。 |
VeLivePlayerStatusPlaying | 1 | 正在播放,即首帧渲染完成且播放器未发生错误。 |
VeLivePlayerStatusPaused | 2 | 暂停播放状态。 |
VeLivePlayerStatusStopped | 3 | 停止播放状态。 |
VeLivePlayerStatusError | 4 | 播放器发生错误。 |
@interface VeLivePlayerStatistics : NSObject
播放周期性统计信息。
类型 | 名称 |
---|---|
NSURL* | url |
BOOL | isHardWareDecode |
int | delayMs |
int | stallTimeMs |
long | bandwidthEstimation |
NSString* | videoCodec |
int | width |
int | height |
float | fps |
long | bitrate |
long | videoBufferMs |
long | audioBufferMs |
VeLivePlayerFormat | format |
VeLivePlayerProtocol | protocol |
@property (nonatomic, strong, readonly, nullable) NSURL* url;
当前直播的播放地址。
@property (nonatomic, readonly) BOOL isHardWareDecode;
是否使用硬件解码。
@property (nonatomic, readonly) int delayMs;
当前播放延时,单位为 ms。仅在使用了火山引擎视频直播推流 SDK 时,支持统计播放延时。
@property (nonatomic, readonly) int stallTimeMs;
从当前视频开始播放起,累计的卡顿时长,单位为 ms。
@property (nonatomic, readonly) long bandwidthEstimation;
带宽预测 ,单位为 kbps。
@property (nonatomic, copy, readonly, nullable) NSString* videoCodec;
视频的编码类型。
@property (nonatomic, readonly) int width;
当前播放视频的宽度,单位为 px。
@property (nonatomic, readonly) int height;
当前播放视频的高度,单位为 px。
@property (nonatomic, readonly) float fps;
当前播放视频的帧率,单位为 fps。
@property (nonatomic, readonly) long bitrate;
实时下载的码率,单位为 kbps。
@property (nonatomic, readonly) long videoBufferMs;
视频播放的缓冲区 buffer 大小,单位为 ms。
@property (nonatomic, readonly) long audioBufferMs;
音频播放的缓冲区 buffer 大小,单位为 ms。
@property (nonatomic, readonly) VeLivePlayerFormat format;
当前播放的视频格式。
@property (nonatomic, readonly) VeLivePlayerProtocol protocol;
当前播放的传输协议。
typedef NS_ENUM( NSInteger, VeLivePlayerStreamType )
直播播放流类型。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerStreamTypeMain | 0 | 主路流。 |
VeLivePlayerStreamTypeBackup | 1 | 备路流。 |
typedef NS_ENUM( NSInteger, VeLivePlayerFormat )
直播播放格式。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerFormatFLV | 0 | FLV 格式。 |
VeLivePlayerFormatHLS | 1 | HLS 格式。 |
VeLivePlayerFormatRTM | 2 | RTM 格式。 |
typedef NS_ENUM( NSInteger, VeLivePlayerResolution )
直播播放器的清晰度档位。
类型 | 值 | 说明 |
---|---|---|
VeLivePlayerResolutionOrigin | 0 | 原始流。 |
VeLivePlayerResolutionUHD | 1 | UHD 超高清。 |
VeLivePlayerResolutionHD | 2 | HD 高清。 |
VeLivePlayerResolutionSD | 3 | SD 标清。 |
VeLivePlayerResolutionLD | 4 | LD 低清。 |