You need to enable JavaScript to run this app.
文档中心
视频直播

视频直播

复制全文
下载 pdf
SDK API 参考
类型详情
复制全文
下载 pdf
类型详情

VeLiveVideoEffectLicenseType
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoEffectLicenseType
)

视频特效的许可证认证方式。

枚举值

类型值说明
VeLiveVideoEffectLicenseTypeOffLine0离线认证视频特效许可证。
VeLiveVideoEffectLicenseTypeOnLine1在线认证视频特效许可证。

VeLiveNetworkQuality
typedef NS_ENUM(
    NSInteger,
    VeLiveNetworkQuality
)

网络质量/状态。

枚举值

类型值说明
VeLiveNetworkQualityUnknown-1未查询到网络状态。
VeLiveNetworkQualityBad0网络差。
VeLiveNetworkQualityPoor1网络一般。
VeLiveNetworkQualityGood2网络状态佳。

VeLiveAudioChannel
typedef NS_ENUM(
    NSInteger,
    VeLiveAudioChannel
)

推流音频声道数,决定音频的立体感。

枚举值

类型值说明
VeLiveAudioChannelStereo2立体声,适用于音乐播放,提供更丰富的音频体验。

VeLiveVideoEncodeFrameType
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoEncodeFrameType
)

视频编码帧类型,指定视频编码后的帧类型。

枚举值

类型值说明
VeLiveVideoEncodeFrameTypeIDR1IDR 帧类型,关键帧,帧序列中的第一帧或者在视频切换点的帧。
VeLiveVideoEncodeFrameTypeSPSPPS2SPS/PPS 帧类型,序列参数集 SPS 和图像参数集 PPS 帧,通常与 IDR 帧一起发送。
VeLiveVideoEncodeFrameTypeB3B 帧类型,双向预测内插帧,根据前后帧来预测当前帧的内容。
VeLiveVideoEncodeFrameTypeP4P 帧类型,向前预测帧,只根据前一帧来预测当前帧的内容。

VeLiveVideoEncoderConfiguration
@interface VeLiveVideoEncoderConfiguration : NSObject

推流视频编码参数。

成员变量

类型名称
VeLiveVideoResolutionresolution
VeLiveVideoCodeccodec
intbitrate
intminBitrate
intmaxBitrate
intgopSize
intfps
BOOLenableBFrame
BOOLenableAccelerate

成员函数

返回名称
instancetypeinitWithResolution:

变量说明

resolution

@property (nonatomic, assign, readonly) VeLiveVideoResolution resolution;

推流视频分辨率,默认值为 VeLiveVideoResolution720P,详情请参见 VeLiveVideoResolution。

codec

@property (nonatomic, assign) VeLiveVideoCodec codec;

推流视频编码格式,默认值为 VeLiveVideoCodecH264,详情请参见 VeLiveVideoCodec。

bitrate

@property (nonatomic, assign) int bitrate;

视频目标编码码率,单位为 kbps,默认值由 resolution 参数值决定。

minBitrate

@property (nonatomic, assign) int minBitrate;

视频最小编码码率,单位为 kbps,默认值由 resolution 参数值决定;如果开启自适应码率,推流 SDK 根据网络情况进行编码码率自适应调整的最小码率。

maxBitrate

@property (nonatomic, assign) int maxBitrate;

视频最大编码码率,单位为 kbps,默认值由 resolution 参数值决定;如果开启自适应码率,推流 SDK 根据网络情况进行编码码率自适应调整的最大码率。

gopSize

@property (nonatomic, assign) int gopSize;

视频 GOP 大小,单位为 s,默认值为 2。

fps

@property (nonatomic, assign) int fps;

视频编码帧率,单位为 fps,默认值为 15。

enableBFrame

@property (nonatomic, assign) BOOL enableBFrame;

是否启用 B 帧,默认值为 NO,支持的取值包括:

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

enableAccelerate

@property (nonatomic, assign) BOOL enableAccelerate;

是否开启硬件编码,默认值为 YES,支持的取值包括:

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

函数说明

initWithResolution:

- (instancetype)initWithResolution:(VeLiveVideoResolution)resolution NS_DESIGNATED_INITIALIZER;

初始化方法,用于创建一个 VeLiveVideoEncoderConfiguration 对象,并指定视频的分辨率。

传入参数

参数名类型说明
resolutionVeLiveVideoResolution视频的分辨率,详情请参见 VeLiveVideoResolution。

返回值

创建的 VeLiveVideoEncoderConfiguration 对象。

VeLiveVideoFrameSource
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoFrameSource
)

视频帧来源。

枚举值

类型值说明
VeLiveVideoFrameSourceCapture1<<0采集到的原始视频帧。这是从设备的摄像头或其他视频输入源获取的视频帧。
VeLiveVideoFrameSourcePreEncode1<<1编码前的视频帧。这是通过各种处理(例如滤镜、旋转等)后,准备进行编码的视频帧。

VeLiveAudioBufferType
typedef NS_ENUM(
    NSInteger,
    VeLiveAudioBufferType
)

推流音频数据类型。

枚举值

类型值说明
VeLiveAudioBufferTypeUnknown-1未知的音频数据类型。
VeLiveAudioBufferTypeSampleBuffer0音频数据类型为 CMSampleBufferRef。
VeLiveAudioBufferTypeNSData1音频数据类型为 NSData。

VeLivePusherConfiguration
@interface VeLivePusherConfiguration : NSObject

推流引擎初始化配置。

成员变量

类型名称
VeLiveVideoCaptureConfiguration*videoCaptureConfig
VeLiveAudioCaptureConfiguration*audioCaptureConfig
intreconnectIntervalSeconds
intreconnectCount
NSDictionary*extraParameters

变量说明

videoCaptureConfig

@property (nonatomic, strong, nullable) VeLiveVideoCaptureConfiguration *videoCaptureConfig;

视频采集参数设置,用于调整和设置视频采集相关的参数。详情请参见 VeLiveVideoCaptureConfiguration。

audioCaptureConfig

@property (nonatomic, strong, nullable) VeLiveAudioCaptureConfiguration *audioCaptureConfig;

音频采集参数设置,用于调整和设置音频采集相关的参数。详情请参见 VeLiveAudioCaptureConfiguration。

reconnectIntervalSeconds

@property (nonatomic, assign) int reconnectIntervalSeconds;

推流失败后,尝试重连的时间间隔。单位为 s,默认值为 5。

reconnectCount

@property (nonatomic, assign) int reconnectCount;

推流失败后,尝试重连的次数。默认值为 3。

extraParameters

@property (nonatomic, strong) NSDictionary *extraParameters;

设置扩展参数,用于实现某些特殊功能或配置,默认不需要设置。

VeLiveVideoCaptureType
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoCaptureType
)

视频采集类型。

枚举值

类型值说明
VeLiveVideoCaptureFrontCamera0使用前置摄像头进行视频采集。
VeLiveVideoCaptureBackCamera1使用后置摄像头进行视频采集。
VeLiveVideoCaptureExternal4使用外部设备或源进行视频采集。
VeLiveVideoCaptureCustomImage5使用指定的静态图片作为视频源。
VeLiveVideoCaptureLastFrame6使用最近采集的一帧图像重复作为视频源。
VeLiveVideoCaptureDummyFrame7使用黑色帧作为视频源,一般用于调试或特殊需求。

VeLiveFileRecorderConfiguration
@interface VeLiveFileRecorderConfiguration : NSObject

推流端本地文件录制配置。

成员变量

类型名称
intwidth
intheight
intfps
intbitrate

变量说明

width

@property (nonatomic, assign) int width;

录制的视频宽度,单位为 px,默认值为 360。

height

@property (nonatomic, assign) int height;

录制的视频高度,单位为 px,默认值为 640。

fps

@property (nonatomic, assign) int fps;

录制的视频帧率,默认值为 15,取值范围为 [1,15]。

bitrate

@property (nonatomic, assign) int bitrate;

录制的视频编码码率,单位为 kbps,默认值为 2000。

VeLiveVideoBufferType
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoBufferType
)

推流视频数据类型。

枚举值

类型值说明
VeLiveVideoBufferTypeUnKnown-1未知视频数据类型,当未指定输入视频数据的格式时,会默认为此类型。
VeLiveVideoBufferTypePixelBuffer0视频数据类型为 CVPixelBuffer。
VeLiveVideoBufferTypeSampleBuffer1视频数据类型为 CMSampleBufferRef。
VeLiveVideoBufferTypeNSData2视频数据类型为 NSData。
VeLiveVideoBufferTypeTexture3视频数据类型为 OpenGL 纹理。

VeLiveMixVideoLayout
@interface VeLiveMixVideoLayout : NSObject

视频混流设置。包含视频流 ID、位置、大小、透明度、层级和渲染模式等属性。

成员变量

类型名称
intstreamId
floatx
floaty
floatwidth
floatheight
floatalpha
intzOrder
VeLivePusherRenderModerenderMode
BOOLenableAlpha
BOOLenablePreview
BOOLenableStream

变量说明

streamId

@property (nonatomic, assign) int streamId;

视频流 ID,唯一标识,用于区分不同的视频流。

x

@property (nonatomic, assign) float x;

视频流对应区域左上角的横坐标,该坐标是相对整体画面的归一化比例,取值的范围为 [0.0,1.0]。

y

@property (nonatomic, assign) float y;

视频流对应区域左上角的纵坐标,该坐标是相对整体画面的归一化比例,取值的范围为 [0.0,1.0]。

width

@property (nonatomic, assign) float width;

视频流对应区域宽度,该宽度是相对整体画面的归一化比例,取值的范围为 [0.0,1.0]。

height

@property (nonatomic, assign) float height;

视频流对应区域高度,该高度是相对整体画面的归一化比例,取值的范围为 [0.0,1.0]。

alpha

@property (nonatomic, assign) float alpha;

视频流在混流中的透明度,取值范围为 [0.0,1.0],取值 0.0 表示全透明,取值 1.0 表示不透明。

zOrder

@property (nonatomic, assign) int zOrder;

视频流在混流中的层级。取值范围为 [0,100],取值 0 表示最底层,取值越大,层级越高。

renderMode

@property (nonatomic, assign) VeLivePusherRenderMode renderMode;

视频流的渲染模式。详情请参见 VeLivePusherRenderMode。

enableAlpha

@property (nonatomic, assign) BOOL enableAlpha;

是否保留视频流原 Alpha 通道值,默认为保留,当 alpha 取值在 [0.0, 1.0] 之间时,则忽略该配置。

  • YES:保留;
  • NO:不保留。

enablePreview

@property (nonatomic, assign) BOOL enablePreview;

是否在本地预览画面中显示该视频流。默认值为 NO。

  • YES:显示。
  • NO:不显示。

enableStream

@property (nonatomic, assign) BOOL enableStream;

是否将该视频流混入推向远端的视频流中。默认值为 YES。

  • YES:混入。
  • NO:不混入。远端用户将看不到该视频流。
VeLiveMixAudioLayout
@interface VeLiveMixAudioLayout : NSObject

音频混流设置。包含音频流 ID 属性。

成员变量

类型名称
intstreamId
floatvolume

变量说明

streamId

@property (nonatomic, assign) int streamId;

音频流 ID,唯一标识,用于区分不同的音频流。

volume

@property (nonatomic, assign) float volume;

混流音频的音量,范围为 [0.0,4.0]。当你将 VeLiveAudioMixType 设置为 VeLiveAudioMixPlayAndPush 时,该属性同时控制混流音频在拉流端和本地的播放音量。

VeLiveAudioProfile
typedef NS_ENUM(
    NSInteger,
    VeLiveAudioProfile
)

AAC 音频编码档位。

枚举值

类型值说明
VeLiveAudioAACProfileLC0LC-AAC 编码方式。
VeLiveAudioAACProfileHEv11HEv1-AAC 编码方式。
VeLiveAudioAACProfileHEv22HEv2-AAC 编码方式。

VeLiveVideoFrame
@interface VeLiveVideoFrame : NSObject <NSCopying>

视频帧的数据信息。

成员变量

类型名称
VeLiveVideoBufferTypebufferType
VeLivePixelFormatpixelFormat
VeLiveVideoRotationrotation
intwidth
intheight
CMTimepts
GLuinttextureId
CVPixelBufferRefpixelBuffer
CMSampleBufferRefsampleBuffer
NSData*data

成员函数

返回名称
voidreleaseCallback

变量说明

bufferType

@property (nonatomic, assign) VeLiveVideoBufferType bufferType;

视频数据包装格式。默认值为 VeLiveVideoBufferTypeUnknown,详情请参见 VeLiveVideoBufferType。

pixelFormat

@property (nonatomic, assign) VeLivePixelFormat pixelFormat;

视频帧像素格式。bufferType 为 VeLiveVideoBufferTypeNSData 时,需要指定数据格式。详情请参见 VeLivePixelFormat。

rotation

@property (nonatomic, assign) VeLiveVideoRotation rotation;

视频帧顺时针旋转角度。详情请参见 VeLiveVideoRotation。

width

@property (nonatomic, assign) int width;

视频宽度,单位为 px。

height

@property (nonatomic, assign) int height;

视频高度,单位为 px。

pts

@property (nonatomic, assign) CMTime pts;

视频帧时间戳,单位为 μs。

textureId

@property (nonatomic, assign) GLuint textureId;

bufferType 为 VeLiveVideoBufferTypeTexture 时的视频数据。

pixelBuffer

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

bufferType 为 VeLiveVideoBufferTypePixelBuffer 时的视频数据。

sampleBuffer

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

bufferType 为 VeLiveVideoBufferTypeSampleBuffer 时的视频数据。

data

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

bufferType 为 VeLiveVideoBufferTypeNSData 时的视频数据。

函数说明

releaseCallback

@property (nonatomic, copy) void (^releaseCallback)(void);

释放回调函数,用于在 SDK 内部处理完 VideoFrame 后通知外部释放相关资源。此回调主要用于 SDK 外部为 VideoFrame 申请内存,以便 SDK 内部使用。但无法预知内部何时使用完毕。

VeLiveVideoFluencyLevel
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoFluencyLevel
)

视频流畅度等级,用于评估和描述视频播放的流畅程度。

枚举值

类型值说明
VeLiveVideoFluencyLevelSmooth0流畅,帧率能达到预设的目标帧率。
VeLiveVideoFluencyLevelSluggish1一般卡顿,帧率比预设的目标帧率低 1fps~3fps。
VeLiveVideoFluencyLevelBlocked2严重卡顿,帧率比预设的目标帧率低 4fps 以上。
VeLiveVideoFluencyLevelStuck3完全卡住,帧率低于 2fps。

VeLiveVideoMirrorType
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoMirrorType
)

视频镜像类型。

枚举值

类型值说明
VeLiveVideoMirrorCapture0对采集画面的镜像控制。开启时,预览和推流画面都会呈现为镜像状态。
VeLiveVideoMirrorPreview1对预览画面的镜像控制。开启时,只有主播预览画面呈现镜像状态。
VeLiveVideoMirrorPushStream2对编码前画面的镜像控制。开启时,主播推流画面呈现镜像状态。

VeLiveAudioCaptureConfiguration
@interface VeLiveAudioCaptureConfiguration : NSObject

音频采集相关配置。

成员变量

类型名称
VeLiveAudioSampleRatesampleRate
VeLiveAudioChannelchannel

变量说明

sampleRate

@property (nonatomic, assign) VeLiveAudioSampleRate sampleRate;

音频采样率,默认值为 VeLiveAudioSampleRate44100,详情请参见 VeLiveAudioSampleRate。

channel

@property (nonatomic, assign) VeLiveAudioChannel channel;

音频采集声道数,默认值为 VeLiveAudioChannelStereo,详情请参见 VeLiveAudioChannel。

VeLiveVideoResolution
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoResolution
)

推流视频分辨率档位枚举值。

枚举值

类型值说明
VeLiveVideoResolution360P0360P 分辨率。档位详细配置如下所示。
  • 横屏分辨率:640x360
  • 竖屏分辨率:360x640
  • 帧率:15fps
  • 目标码率:500kbps
  • 最小码率:250kbps
  • 最大码率:800kbps
VeLiveVideoResolution480P1480P 分辨率。档位详细配置如下所示。
  • 横屏分辨率:864x480
  • 竖屏分辨率:480x864
  • 帧率:15fps
  • 目标码率:800kbps
  • 最小码率:320kbps
  • 最大码率:1266kbps
VeLiveVideoResolution540P2540P 分辨率。档位详细配置如下所示。
  • 横屏 960x540
  • 竖屏 540x960
  • 帧率:15fps
  • 目标码率:1000kbps
  • 最小码率:500kbps
  • 最大码率:1520kbps
VeLiveVideoResolution720P3720P 分辨率。档位详细配置如下所示。
  • 横屏 1280x720
  • 竖屏 720x1280
  • 帧率:15fps
  • 目标码率:1200kbps
  • 最小码率:800kbps
  • 最大码率:1900kbps
VeLiveVideoResolution1080P41080P 分辨率。档位详细配置如下所示。
  • 横屏 1920x1080
  • 竖屏 1080x1920
  • 帧率:20 fps
  • 目标码率:2500kbps
  • 最小码率:1000kbps
  • 最大码率:3800kbps
VeLiveVideoResolutionScreen10屏幕推流分辨率。档位详细配置如下所示。
  • 帧率:15fps
  • 目标码率:2500kbps
  • 最小码率:1000kbps
  • 最大码率:3800kbps

VeLiveVideoRotation
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoRotation
)

视频帧旋转角度。以 App 方向为旋转参考系。

枚举值

类型值说明
VeLiveVideoRotation00不旋转。
VeLiveVideoRotation901顺时针旋转 90 度。
VeLiveVideoRotation1802顺时针旋转 180 度。
VeLiveVideoRotation2703顺时针旋转 270 度。

VeLiveStreamMixDescription
@interface VeLiveStreamMixDescription : NSObject

音视频混流布局。包含了视频混流布局、音频混流布局和画布背景色等属性。

成员变量

类型名称
NSArray<VeLiveMixVideoLayout*>*mixVideoStreams
NSArray<VeLiveMixAudioLayout*>*mixAudioStreams
NSString*backgroundColor

变量说明

mixVideoStreams

@property (nonatomic, copy) NSArray<VeLiveMixVideoLayout*> *mixVideoStreams;

视频混流布局设置的数组,其中每个元素代表一路视频流的布局。详情请参见 VeLiveMixVideoLayout。

mixAudioStreams

@property (nonatomic, copy) NSArray<VeLiveMixAudioLayout*> *mixAudioStreams;

音频混流设置的数组,其中每个元素代表一路音频流的。详情请参见 VeLiveMixAudioLayout。

backgroundColor

@property (nonatomic, copy) NSString *backgroundColor;

视频混流画布的背景色设置,采用 #RRGGBB 格式。

VeLiveAudioCaptureType
typedef NS_ENUM(
    NSInteger,
    VeLiveAudioCaptureType
)

音频采集类型。

枚举值

类型值说明
VeLiveAudioCaptureMicrophone0使用默认麦克风设备进行音频采集。
VeLiveAudioCaptureVoiceCommunication1使用语音通话模式进行音频采集,此模式下会启动硬件的 3A 功能,即自动增益控制、自动频率控制和自动噪声抑制。
VeLiveAudioCaptureExternal2使用外部设备或源进行音频采集。
VeLiveAudioCaptureMuteFrame3使用静音帧作为音频源。

VeLiveVideoCodec
typedef NS_ENUM(
    NSInteger,
    VeLiveVideoCodec
)

视频编码格式。

枚举值

类型值说明
VeLiveVideoCodecH2640使用 H.264 视频编码。
VeLiveVideoCodecByteVC11使用火山引擎自研 ByteVC1 视频编码。

VeLiveVideoEncodeFrame
@interface VeLiveVideoEncodeFrame : NSObject

视频编码帧,此类用于描述一个编码后的视频帧,包含时间戳、帧类型和编码数据。

成员变量

类型名称
CMTimepts
CMTimedts
VeLiveVideoEncodeFrameTypevideoEcodeFrameType
NSData*data

变量说明

pts

@property (nonatomic, assign) CMTime pts;

编码帧展示时间戳,单位为 μs。

dts

@property (nonatomic, assign) CMTime dts;

编码帧 dts 时间,即解码时间戳,单位为 μs。

videoEcodeFrameType

@property (nonatomic, assign) VeLiveVideoEncodeFrameType videoEcodeFrameType;

编码帧的类型,详细请参见 VeLiveVideoEncodeFrameType:。

data

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

编码帧的数据,使用 NSData 表示。

VeLiveAudioEncoderConfiguration
@interface VeLiveAudioEncoderConfiguration : NSObject

推流音频编码参数。

成员变量

类型名称
intbitrate
VeLiveAudioSampleRatesampleRate
VeLiveAudioChannelchannel
VeLiveAudioProfileprofile

变量说明

bitrate

@property (nonatomic, assign) int bitrate;

音频编码码率,单位为 kbps,默认值为 64。

sampleRate

@property (nonatomic, assign) VeLiveAudioSampleRate sampleRate;

音频编码采样率,默认值为 VeLiveAudioSampleRate44100,详情请参见 VeLiveAudioSampleRate。

channel

@property (nonatomic, assign) VeLiveAudioChannel channel;

音频声道数,默认值为 VeLiveAudioChannelStereo,详情请参见 VeLiveAudioChannel。

profile

@property (nonatomic, assign) VeLiveAudioProfile profile;

AAC 编码类型,默认值为 VeLiveAudioAACProfileLC。详情请参见 VeLiveAudioProfile。

VeLivePusherLogLevel
typedef NS_ENUM(
    NSInteger,
    VeLivePusherLogLevel
)

输出的日志级别。

枚举值

类型值说明
VeLivePusherLogLevelVerbose0输出 VERBOSE、DEBUG、INFO、WARNING 和 ERROR 级别的日志。
VeLivePusherLogLevelDebug1输出 DEBUG、INFO、WARNING 和 ERROR 级别的日志。
VeLivePusherLogLevelInfo2输出 INFO、WARNING 和 ERROR 级别的日志。
VeLivePusherLogLevelWarn3输出 WARNING 和 ERROR 级别的日志。
VeLivePusherLogLevelError4输出 ERROR 级别的日志。
VeLivePusherLogLevelNone5关闭日志。

VeLiveAudioMixType
typedef NS_ENUM(
    NSInteger,
    VeLiveAudioMixType
)

音频混流类型。

枚举值

类型值说明
VeLiveAudioMixPush0拉流端可以听到混音效果,本地无法听到。
VeLiveAudioMixPlayAndPush1拉流端和本地都可以听到混音效果。

VeLivePusherRenderMode
typedef NS_ENUM(
    NSInteger,
    VeLivePusherRenderMode
)

推流渲染模式。

枚举值

类型值说明
VeLivePusherRenderModeHidden0视窗填满优先。视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。
VeLivePusherRenderModeFit1视频帧内容全部显示优先。视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成背景颜色。
VeLivePusherRenderModeFill2视频帧自适应画布。视频帧非等比缩放,直至画布被填满。在此过程中,视频帧的长宽比例可能会发生变化。

VeLiveVideoEffectLicenseConfiguration
@interface VeLiveVideoEffectLicenseConfiguration : NSObject

视频特效许可证配置。

成员变量

类型名称
VeLiveVideoEffectLicenseTypetype
NSString*path
NSString*key
NSString*secret
NSString*url

成员函数

返回名称
instancetypeinitWithPath:
instancetypeinitWithKey:secret:url:

变量说明

type

@property (nonatomic, assign, readonly) VeLiveVideoEffectLicenseType type;

获取视频特效许可证类型。许可证类型请参见 VeLiveVideoEffectLicenseType。

path

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

获取视频特效许可证的本地路径。当 VeLiveVideoEffectLicenseType 为 VeLiveVideoEffectLicenseTypeOffLine 时,该属性返回许可证文件的本地路径。

key

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

获取视频特效许可证的在线认证 key。当 VeLiveVideoEffectLicenseType 为 VeLiveVideoEffectLicenseTypeOnLine 时,该属性返回在线认证的 key。

secret

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

获取视频特效许可证的在线认证 secret。当 VeLiveVideoEffectLicenseType 为 VeLiveVideoEffectLicenseTypeOnLine 时,该属性返回在线认证的 secret。

url

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

获取视频特效许可证的在线认证地址。当 VeLiveVideoEffectLicenseType 为 VeLiveVideoEffectLicenseTypeOnLine 时,该属性返回在线认证地址。

函数说明

initWithPath:

- (instancetype)initWithPath:(NSString *)path NS_DESIGNATED_INITIALIZER;

初始化配置为本地验证模式。

传入参数

参数名类型说明
pathNSString*视频特效许可证的本地缓存路径。可通过 path 获取

返回值

返回 VeLiveVideoEffectLicenseConfiguration 类的实例,该实例使用指定的本地路径进行许可证验证。

initWithKey:secret:url:

- (instancetype)initWithKey:(NSString *)key secret:(NSString *)secret url:(nullable NSString *)url NS_DESIGNATED_INITIALIZER;

初始化配置为在线验证模式。

传入参数

参数名类型说明
keyNSString*视频特效许可证的在线认证 key,可通过 key 获取。
secretNSString*视频特效许可证的在线认证 secret,可通过 secret 获取。
urlnullable NSString*视频特效许可证的在线认证地址,如果传入 nil,会使用默认 url,可通过 url 获取在线认证地址。

返回值

返回 VeLiveVideoEffectLicenseConfiguration 类的实例,该实例使用指定的 key、secret 和 url 进行在线许可证验证。

VeLiveAudioFrameSource
typedef NS_ENUM(
    NSInteger,
    VeLiveAudioFrameSource
)

音频帧来源。

枚举值

类型值说明
VeLiveAudioFrameSourceCapture1<<0采集到的原始音频帧。这是从设备的麦克风或其他音频输入源获取的音频帧。
VeLiveAudioFrameSourcePreEncode1<<1编码前的音频帧。这是通过各种处理(例如噪音消除、回声消除等)后,准备进行编码的音频帧。

VeLivePushStatus
typedef NS_ENUM(
    NSInteger,
    VeLivePushStatus
)

推流器与服务器的连接状态。

枚举值

类型值说明
VeLivePushStatusNone0初始状态。
VeLivePushStatusConnecting1正在连接服务器。
VeLivePushStatusConnectSuccess2连接服务器成功。
VeLivePushStatusReconnecting3重连服务器中。
VeLivePushStatusConnectStop4推流连接被终止。
VeLivePushStatusConnectError5推流连接失败。
VeLivePushStatusDisconnected6与服务器断开连接。

VeLiveFirstFrameType
typedef NS_ENUM(
    NSInteger,
    VeLiveFirstFrameType
)

定义了推流中首帧的类型,包括音视频的采集首帧、渲染首帧、编码完成首帧和发送首帧。

枚举值

类型值说明
VeLiveFirstCaptureFrame0视频/音频采集首帧,采集首帧是从音频设备或视频设备(如麦克风、摄像头)获取的第一帧数据。
VeLiveFirstRenderFrame1视频渲染首帧,渲染首帧是在渲染过程中在屏幕上显示的第一帧视频数据。
VeLiveFirstEncodedFrame2视频/音频编码完成首帧,编码完成首帧是编码为某种特定格式的第一帧数据。
VeLiveFirstSendFrame3视频/音频发送首帧,发送首帧是在发送过程中,通过网络传输的第一帧数据。
VeLiveFirstAppAudioCaptureFrame4录屏采集开始后,获得的第一个 app 音频帧。

VeLiveAudioSampleRate
typedef NS_ENUM(
    NSInteger,
    VeLiveAudioSampleRate
)

推流音频采样率。

枚举值

类型值说明
VeLiveAudioSampleRate441004410044.1k 采样,适用于大多数音频处理场景,是音乐 CD 的标准采样率。

VeLivePusherStatistics
@interface VeLivePusherStatistics : NSObject

推流周期性统计信息。

成员变量

类型名称
intcaptureWidth
intcaptureHeight
intcaptureFps
intencodeWidth
intencodeHeight
intencodeFps
intencodeVideoBitrate
intencodeAudioBitrate
inttransportFps
inttransportVideoBitrate
intfps
intvideoBitrate
intminVideoBitrate
intmaxVideoBitrate
NSString*url
NSString*codec

变量说明

captureWidth

@property (nonatomic, assign) int captureWidth;

视频采集宽度,单位为 px。

captureHeight

@property (nonatomic, assign) int captureHeight;

视频采集高度,单位为 px。

captureFps

@property (nonatomic, assign) int captureFps;

视频采集帧率,单位为 fps。

encodeWidth

@property (nonatomic, assign) int encodeWidth;

视频编码宽度,单位为 px。

encodeHeight

@property (nonatomic, assign) int encodeHeight;

视频编码高度,单位为 px。

encodeFps

@property (nonatomic, assign) int encodeFps;

视频编码帧率,单位为 fps。

encodeVideoBitrate

@property (nonatomic, assign) int encodeVideoBitrate;

视频编码码率,单位为 kbps。

encodeAudioBitrate

@property (nonatomic, assign) int encodeAudioBitrate;

音频编码码率,单位为 kbps。

transportFps

@property (nonatomic, assign) int transportFps;

视频发送帧率,可用展示实时帧率,单位为 fps。

transportVideoBitrate

@property (nonatomic, assign) int transportVideoBitrate;

视频发送码率,可用于展示实时码率,单位为 kbps。

fps

@property (nonatomic, assign) int fps;

视频推流帧率,即您通过 setVideoEncoderConfiguration: 方法设置的帧率,单位为 fps。

videoBitrate

@property (nonatomic, assign) int videoBitrate;

视频推流码率,即您通过 setVideoEncoderConfiguration 方法设置的码率,单位为 kbps。

minVideoBitrate

@property (nonatomic, assign) int minVideoBitrate;

视频推流最小码率,即您通过 setVideoEncoderConfiguration: 方法设置的最小码率,单位为 kbps。

maxVideoBitrate

@property (nonatomic, assign) int maxVideoBitrate;

视频推流最大码率,即您通过 setVideoEncoderConfiguration: 方法设置的最大码率,单位为 kbps。

url

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

推流地址。

codec

@property (nonatomic, copy, nullable) NSString *codec;

视频编码格式。

VeLivePixelFormat
typedef NS_ENUM(
    NSInteger,
    VeLivePixelFormat
)

视频帧的数据格式。

枚举值

类型值说明
VeLivePixelFormatUnknown-1未知格式。
VeLivePixelFormatI4200I420 格式。
VeLivePixelFormatNV121NV12 格式。
VeLivePixelFormatNV212NV21 格式。
VeLivePixelFormatBGRA323RAGBA 格式。
VeLivePixelFormat2DTexture4OpenGL 2D 纹理。

VeLiveVideoCaptureConfiguration
@interface VeLiveVideoCaptureConfiguration : NSObject

视频采集相关配置。

成员变量

类型名称
intwidth
intheight
intfps
OSTypepixelFormat
BOOLisDefaultFrontCameraMirrored

变量说明

width

@property (nonatomic, assign) int width;

视频采集宽度,单位为 px,默认值为 720。

height

@property (nonatomic, assign) int height;

视频采集高度,单位为 px,默认值为 1280。

fps

@property (nonatomic, assign) int fps;

视频采集帧率,单位为 fps,默认值为 15。

pixelFormat

@property (nonatomic, assign) OSType pixelFormat;

视频采集帧类型,默认为 kCVPixelFormatType_420YpCbCr8BiPlanarFullRange。

注意

支持以下视频帧类型:

  • kCVPixelFormatType_32BGRA
  • kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
  • kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
  • kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange

isDefaultFrontCameraMirrored

@property (nonatomic, assign) BOOL isDefaultFrontCameraMirrored;

前置摄像头采集时,是否默认为镜像状态。默认值为 YES。取值如下:

  • YES:镜像状态。
  • NO:非镜像状态。
VeLiveAudioFrame
@interface VeLiveAudioFrame : NSObject

音频帧的数据信息。

成员变量

类型名称
VeLiveAudioBufferTypebufferType
VeLiveAudioSampleRatesampleRate
VeLiveAudioChannelchannels
CMTimepts
CMSampleBufferRefsampleBuffer
NSData*data

变量说明

bufferType

@property (nonatomic, assign) VeLiveAudioBufferType bufferType;

音频数据类型,默认值为 VeLiveAudioBufferTypeUnknown,详情请参见 VeLiveAudioBufferType。

sampleRate

@property (nonatomic, assign) VeLiveAudioSampleRate sampleRate;

音频采样率。详情请参见 VeLiveAudioSampleRate。

channels

@property (nonatomic, assign) VeLiveAudioChannel channels;

音频声道数。详情请参见 VeLiveAudioChannel。

pts

@property (nonatomic, assign) CMTime pts;

当 bufferType 取值为 VeLiveAudioBufferNSData 时的音频帧时间戳,单位为 μs。

sampleBuffer

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

当 bufferType 取值为 VeLiveAudioBufferTypeSampleBuffer 时的音频数据。

data

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

当 bufferType 取值为 VeLiveAudioBufferTypeNSData 时的音频数据。音频帧数据为 float32 格式小端字节序存储。

VeLiveAudioPowerLevel
typedef NS_ENUM(
    NSInteger,
    VeLiveAudioPowerLevel
)

音量等级,用于评估和控制音频的响度。

枚举值

类型值说明
VeLiveAudioPowerLevelSilent0无声,音量 ≤ 1dB。
VeLiveAudioPowerLevelQuiet1安静,音量 15dB 以下。
VeLiveAudioPowerLevelLight2轻声,接近耳语音量,音量为 16dB~30dB 之间。
VeLiveAudioPowerLevelNormal3正常,音量适宜,类似正常对话的音量,音量为 30dB~60dB 之间。
VeLiveAudioPowerLevelLoud4较大,音量较高,类似咖啡馆、餐厅的环境噪音,音量为 61dB~85dB 之间。
VeLiveAudioPowerLevelNoisy5吵闹,音量极高,类似于繁忙的街道或者是音乐会现场,音量超过 85dB。
最近更新时间:2026.01.06 19:52:23
这个页面对您有帮助吗?
有用
有用
无用
无用