You need to enable JavaScript to run this app.
导航

类型详情

最近更新时间2024.04.19 15:19:25

首次发布时间2023.03.31 11:23:07

VeLivePlayerResolutionSwitchReason
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerResolutionSwitchReason
)

直播播放器清晰度档位变化原因。

枚举值

类型说明
VeLivePlayerResolutionSwitchByAuto0ABR 自动切档。
VeLivePlayerResolutionSwitchByManual1手动切换档位。

VeLivePlayerConfiguration
@interface VeLivePlayerConfiguration : NSObject

播放器初始化相关配置。

成员变量

类型名称
BOOLenableSei
BOOLenableHardwareDecode
BOOLenableLiveDNS
BOOLenableStatisticsCallback
NSIntegerstatisticsCallbackInterval
NSIntegernetworkTimeoutMs
NSIntegerretryIntervalTimeMs
NSIntegerretryMaxCount

成员函数

返回名称
instancetypeinit

变量说明

enableSei

@property (nonatomic, assign) BOOL enableSei;

是否开启 SEI 消息的解析,默认值为 NO。

  • YES:开启;
  • NO:关闭。

enableHardwareDecode

@property (nonatomic, assign) BOOL enableHardwareDecode;

是否开启硬件解码功能,默认值为 YES。开启硬件解码后,如果出现硬件解码启动失败或硬件解码失败的情况,播放器内部会自动切换为软解。

  • YES:开启;
  • NO:关闭。

enableLiveDNS

@property (nonatomic, assign) BOOL enableLiveDNS;

是否开启本地 DNS 预解析,默认值为 NO。开启本地 DNS 预解析可以缩短启播时间。如果本地 DNS 预解析出现异常,可能会影响播放器的正常使用。

  • YES:开启;
  • NO:关闭。

enableStatisticsCallback

@property (nonatomic, assign) BOOL enableStatisticsCallback;

是否开启播放信息周期性回调。默认值为 NO。周期性回调参数详细说明请参见 VeLivePlayerStatistics 。当 enableStatisticsCallback 为 YES,且 statisticsCallbackInterval 大于 0 时,播放器会在指定的时间间隔内,周期性地回调播放器状态信息。

  • YES:开启;
  • NO:关闭。

statisticsCallbackInterval

@property (nonatomic, assign) NSInteger statisticsCallbackInterval;

播放信息周期性回调的时间间隔,单位为 s,默认值为 5。当 enableStatisticsCallback 为 YES,且 statisticsCallbackInterval 大于 0 时,播放器会在指定的时间间隔内,周期性地回调播放器状态信息。

networkTimeoutMs

@property (nonatomic, assign) NSInteger networkTimeoutMs;

网络超时时间,单位为 ms,默认值为 5000。播放器发起网络请求,如果超过了该时间仍未收到服务器响应,则认为网络请求失败。

retryIntervalTimeMs

@property (nonatomic, assign) NSInteger retryIntervalTimeMs;

重试时间间隔,单位为 ms,默认值为 5000,仅在无备流时生效。

  • 在无备流的场景下,若遇到网络异常等问题导致播放中断,播放器会立即进行重试,前三次重试为立即执行,第四次及之后的重试将按照设置的重试时间间隔执行;
  • 在有备流的场景下,重试时间间隔将不生效,所有重试均会立即执行。

retryMaxCount

@property (nonatomic, assign) NSInteger retryMaxCount;

在网络连接错误的情况下,播放器最大重试次数,默认值为 5。如果取值为 0,表示关闭播放器内部重试。

  • 在无备流的场景下,每次重试,会消耗一次重试次数;
  • 在有备流的场景下,每次主备流切换,会消耗一次重试次数。

函数说明

init

- (instancetype _Nonnull)init;

默认初始化方法。

VeLivePlayerStream
@interface VeLivePlayerStream : NSObject

流地址信息。

成员变量

类型名称
NSString*url
VeLivePlayerResolutionresolution
intbitrate
VeLivePlayerProtocolprotocol
VeLivePlayerFormatformat
VeLivePlayerStreamTypetype

成员函数

返回名称
instancetypeinit

变量说明

url

@property (nonatomic, copy, nonnull) NSString* url;

播放地址。

resolution

@property (nonatomic, assign) VeLivePlayerResolution resolution;

清晰度档位,详情请参见 VeLivePlayerResolution

bitrate

@property (nonatomic, assign) int bitrate;

播放码率,单位为 kbps。

protocol

@property (nonatomic, assign) VeLivePlayerProtocol protocol;

传输协议,详情请参见 VeLivePlayerProtocol

format

@property (nonatomic, assign) VeLivePlayerFormat format;

播放格式,详情请参见 VeLivePlayerFormat

type

@property (nonatomic, assign) VeLivePlayerStreamType type;

播放流类型为主路或备路,详情请参见 VeLivePlayerStreamType

函数说明

init

- (instancetype)init;

单路直播流配置初始化方法。

VeLivePlayerLogLevel
typedef NS_ENUM(
    NSUInteger,
    VeLivePlayerLogLevel
)

直播播放器日志打印级别。

枚举值

类型说明
VeLivePlayerLogLevelVerbose0输出 VERBOSE、DEBUG、INFO、WARNING 和 ERROR 级别的日志。
VeLivePlayerLogLevelDebug1输出 DEBUG、INFO、WARNING 和 ERROR 级别的日志。
VeLivePlayerLogLevelInfo2输出 INFO、WARNING 和 ERROR 级别的日志。
VeLivePlayerLogLevelWarn3输出 WARNING 和 ERROR 级别的日志。
VeLivePlayerLogLevelError4输出 ERROR 级别的日志。
VeLivePlayerLogLevelNone5关闭日志打印。

VeLivePlayerAudioFrame
@interface VeLivePlayerAudioFrame : NSObject

音频帧数据。

成员变量

类型名称
VeLivePlayerAudioBufferTypebufferType
intsampleRate
intchannels
intbitDepth
CMTimepts
NSData*data
intsamples

变量说明

bufferType

@property (nonatomic, readonly) VeLivePlayerAudioBufferType bufferType;

音频帧数据封装格式,详情请参见 VeLivePlayerAudioBufferType

sampleRate

@property (nonatomic, readonly) int sampleRate;

音频采样率,单位为 Hz。

channels

@property (nonatomic, readonly) int channels;

声道数。

  • 1:单声道;
  • 2:双声道。

bitDepth

@property (nonatomic, readonly) int bitDepth;

音频位深度。

pts

@property (nonatomic, readonly) CMTime pts;

音频渲染时间戳,单位为 ms。

data

@property (nonatomic, strong, readonly) NSData* data;

PCM 音频数据。

samples

@property (nonatomic, readonly) int samples;

音频采样点个数。

VeLivePlayerVideoFrame
@interface VeLivePlayerVideoFrame : NSObject

视频帧数据。

成员变量

类型名称
VeLivePlayerVideoBufferTypebufferType
VeLivePlayerPixelFormatpixelFormat
NSIntegerwidth
NSIntegerheight
int64_tpts
CVPixelBufferRefpixelBuffer
CMSampleBufferRefsampleBuffer
NSData*data

变量说明

bufferType

@property (nonatomic, readonly) VeLivePlayerVideoBufferType bufferType;

视频帧数据封装格式,详情请参见 VeLivePlayerVideoBufferType

pixelFormat

@property (nonatomic, readonly) VeLivePlayerPixelFormat pixelFormat;

视频帧像素格式,详情请参见 VeLivePlayerPixelFormat

width

@property (nonatomic, readonly) NSInteger width;

视频宽度,单位为 px。

height

@property (nonatomic, readonly) NSInteger height;

视频高度,单位为 px。

pts

@property (nonatomic, readonly) int64_t pts;

视频帧的渲染时间戳,单位为 ms。

pixelBuffer

@property (nonatomic, readonly, nullable) CVPixelBufferRef pixelBuffer;

pixelFormatVeLivePlayerVideoBufferTypePixelBuffer 时的视频数据。

sampleBuffer

@property (nonatomic, readonly, nullable) CMSampleBufferRef sampleBuffer;

pixelFormatVeLivePlayerVideoBufferTypeSampleBuffer 时的视频数据。

data

@property (nonatomic, strong, readonly, nullable) NSData* data;

pixelFormatVeLivePlayerVideoBufferTypeNSData 时的视频数据。

VeLivePlayerStreamData
@interface VeLivePlayerStreamData : NSObject

播放地址相关配置。

成员变量

类型名称
BOOLenableABR
BOOLenableMainBackupSwitch
VeLivePlayerResolutiondefaultResolution
VeLivePlayerFormatdefaultFormat
VeLivePlayerProtocoldefaultProtocol
NSArray<VeLivePlayerStream*>*mainStream
NSArray<VeLivePlayerStream*>*backupStream

变量说明

enableABR

@property (nonatomic, assign) BOOL enableABR;

是否打开 ABR 平滑切档功能,默认为 NO。

  • YES:开启;
  • NO:关闭。

enableMainBackupSwitch

@property (nonatomic, assign) BOOL enableMainBackupSwitch;

是否打开主备切换,默认为 NO。

  • YES:开启;
  • NO:关闭。

defaultResolution

@property (nonatomic, assign) VeLivePlayerResolution defaultResolution;

播放器的默认清晰度档位,默认使用原始流清晰度,详情请参见 VeLivePlayerResolution

defaultFormat

@property (nonatomic, assign) VeLivePlayerFormat defaultFormat;

播放器的默认播放格式,默认值为 FLV,详情请参见 VeLivePlayerFormat

defaultProtocol

@property (nonatomic, assign) VeLivePlayerProtocol defaultProtocol;

播放器的默认播放传输层协议,默认值为 TCP,详情请参见 VeLivePlayerProtocol

mainStream

@property (nonatomic, copy, nullable) NSArray<VeLivePlayerStream *> * mainStream;

主路流地址列表,详情请参见 VeLivePlayerStream

backupStream

@property (nonatomic, copy, nullable) NSArray<VeLivePlayerStream *> * backupStream;

备路流地址列表,详情请参见 VeLivePlayerStream

VeLivePlayerAudioBufferType
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerAudioBufferType
)

音频数据封装格式。

枚举值

类型说明
VeLivePlayerAudioBufferUnknown0未知格式。
VeLivePlayerAudioBufferTypeSampleBuffer1CVSampleBufferRef 格式,音频数据以样本缓冲区 sample buffer 的形式进行处理和渲染。
VeLivePlayerAudioBufferTypeNSData2NSData 格式,音频数据以 NSData 对象的形式进行处理和渲染。

VeLivePlayerVideoBufferType
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerVideoBufferType
)

视频数据封装格式。

枚举值

类型说明
VeLivePlayerVideoBufferTypeUnknown0未知格式。
VeLivePlayerVideoBufferTypePixelBuffer1CVPixelBufferRef 格式。
VeLivePlayerVideoBufferTypeSampleBuffer2CVSampleBufferRef 格式。
VeLivePlayerVideoBufferTypeNSData3NSData 格式。

VeLivePlayerProtocol
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerProtocol
)

直播播放传输协议。

枚举值

类型说明
VeLivePlayerProtocolTCP0TCP 协议。
VeLivePlayerProtocolQUIC1QUIC 协议。
VeLivePlayerProtocolTLS2TLS 协议。

VeLivePlayerFillMode
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerFillMode
)

直播播放器画面的填充模式。

枚举值

类型说明
VeLivePlayerFillModeAspectFill0视频填满画布。视频帧等比缩放,直至填满画布,超出屏幕的部分将被裁剪,画面可能不完整。
VeLivePlayerFillModeAspectFit1显示完整的视频帧。视频帧等比缩放,直至视频帧恰好在画布上全部显示。如果视频帧长宽比例与画布不同,视窗上未被视频帧填满区域将填充为黑色。
VeLivePlayerFillModeFullFill2视频帧自适应画布。视频帧非等比缩放,直至填满画布。在此过程中,视频帧的长宽比例可能会发生变化。

VeLivePlayerRotation
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerRotation
)

视频顺时针旋转角度。

枚举值

类型说明
VeLivePlayerRotation00关闭旋转。
VeLivePlayerRotation9090顺时针旋转 90 度。
VeLivePlayerRotation180180顺时针旋转 180 度。
VeLivePlayerRotation270270顺时针旋转 270 度。

VeLivePlayerMirror
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerMirror
)

视频镜像。

枚举值

类型说明
VeLivePlayerMirrorNone0关闭镜像。
VeLivePlayerMirrorHorizontal1水平镜像。
VeLivePlayerMirrorVertical2垂直镜像。

VeLivePlayerPixelFormat
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerPixelFormat
)

视频帧像素格式。

枚举值

类型说明
VeLivePlayerPixelFormatUnknown0未知格式。
VeLivePlayerPixelFormatNV121NV12 格式。
VeLivePlayerPixelFormatI4202YUVI420 格式。
VeLivePlayerPixelFormatBGRA323BGRA 格式。

VeLivePlayerStatus
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerStatus
)

直播播放器状态。

枚举值

类型说明
VeLivePlayerStatusPrepared0播放器准备完成,等待渲染。
VeLivePlayerStatusPlaying1正在播放,即首帧渲染完成且播放器未发生错误。
VeLivePlayerStatusPaused2暂停播放状态。
VeLivePlayerStatusStopped3停止播放状态。
VeLivePlayerStatusError4播放器发生错误。

VeLivePlayerStatistics
@interface VeLivePlayerStatistics : NSObject

播放周期性统计信息。

成员变量

类型名称
NSURL*url
BOOLisHardWareDecode
intdelayMs
intstallTimeMs
longbandwidthEstimation
NSString*videoCodec
intwidth
intheight
floatfps
longbitrate
longvideoBufferMs
longaudioBufferMs
VeLivePlayerFormatformat
VeLivePlayerProtocolprotocol

变量说明

url

@property (nonatomic, strong, readonly, nullable) NSURL* url;

当前直播的播放地址。

isHardWareDecode

@property (nonatomic, readonly) BOOL isHardWareDecode;

是否使用硬件解码。

  • YES:硬解;
  • NO:非硬解。

delayMs

@property (nonatomic, readonly) int delayMs;

当前播放延时,单位为 ms。仅在使用了火山引擎视频直播推流 SDK 时,支持统计播放延时。

stallTimeMs

@property (nonatomic, readonly) int stallTimeMs;

从当前视频开始播放起,累计的卡顿时长,单位为 ms。

bandwidthEstimation

@property (nonatomic, readonly) long bandwidthEstimation;

带宽预测 ,单位为 kbps。

videoCodec

@property (nonatomic, copy, readonly, nullable) NSString* videoCodec;

视频的编码类型。

width

@property (nonatomic, readonly) int width;

当前播放视频的宽度,单位为 px。

height

@property (nonatomic, readonly) int height;

当前播放视频的高度,单位为 px。

fps

@property (nonatomic, readonly) float fps;

当前播放视频的帧率,单位为 fps。

bitrate

@property (nonatomic, readonly) long bitrate;

实时下载的码率,单位为 kbps。

videoBufferMs

@property (nonatomic, readonly) long videoBufferMs;

视频播放的缓冲区 buffer 大小,单位为 ms。

audioBufferMs

@property (nonatomic, readonly) long audioBufferMs;

音频播放的缓冲区 buffer 大小,单位为 ms。

format

@property (nonatomic, readonly) VeLivePlayerFormat format;

当前播放的视频格式。

protocol

@property (nonatomic, readonly) VeLivePlayerProtocol protocol;

当前播放的传输协议。

VeLivePlayerStreamType
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerStreamType
)

直播播放流类型。

枚举值

类型说明
VeLivePlayerStreamTypeMain0主路流。
VeLivePlayerStreamTypeBackup1备路流。

VeLivePlayerFormat
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerFormat
)

直播播放格式。

枚举值

类型说明
VeLivePlayerFormatFLV0FLV 格式。
VeLivePlayerFormatHLS1HLS 格式。
VeLivePlayerFormatRTM2RTM 格式。

VeLivePlayerResolution
typedef NS_ENUM(
    NSInteger,
    VeLivePlayerResolution
)

直播播放器的清晰度档位。

枚举值

类型说明
VeLivePlayerResolutionOrigin0原始流。
VeLivePlayerResolutionUHD1UHD 超高清。
VeLivePlayerResolutionHD2HD 高清。
VeLivePlayerResolutionSD3SD 标清。
VeLivePlayerResolutionLD4LD 低清。