typedef NS_ENUM( NSInteger, VeLiveVideoEffectLicenseType )
视频特效的许可证认证方式。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoEffectLicenseTypeOffLine | 0 | 离线认证视频特效许可证。 |
| VeLiveVideoEffectLicenseTypeOnLine | 1 | 在线认证视频特效许可证。 |
typedef NS_ENUM( NSInteger, VeLiveNetworkQuality )
网络质量/状态。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveNetworkQualityUnknown | -1 | 未查询到网络状态。 |
| VeLiveNetworkQualityBad | 0 | 网络差。 |
| VeLiveNetworkQualityPoor | 1 | 网络一般。 |
| VeLiveNetworkQualityGood | 2 | 网络状态佳。 |
typedef NS_ENUM( NSInteger, VeLiveAudioChannel )
推流音频声道数,决定音频的立体感。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveAudioChannelStereo | 2 | 立体声,适用于音乐播放,提供更丰富的音频体验。 |
typedef NS_ENUM( NSInteger, VeLiveVideoEncodeFrameType )
视频编码帧类型,指定视频编码后的帧类型。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoEncodeFrameTypeIDR | 1 | IDR 帧类型,关键帧,帧序列中的第一帧或者在视频切换点的帧。 |
| VeLiveVideoEncodeFrameTypeSPSPPS | 2 | SPS/PPS 帧类型,序列参数集 SPS 和图像参数集 PPS 帧,通常与 IDR 帧一起发送。 |
| VeLiveVideoEncodeFrameTypeB | 3 | B 帧类型,双向预测内插帧,根据前后帧来预测当前帧的内容。 |
| VeLiveVideoEncodeFrameTypeP | 4 | P 帧类型,向前预测帧,只根据前一帧来预测当前帧的内容。 |
@interface VeLiveVideoEncoderConfiguration : NSObject
推流视频编码参数。
| 类型 | 名称 |
|---|---|
| VeLiveVideoResolution | resolution |
| VeLiveVideoCodec | codec |
| int | bitrate |
| int | minBitrate |
| int | maxBitrate |
| int | gopSize |
| int | fps |
| BOOL | enableBFrame |
| BOOL | enableAccelerate |
| 返回 | 名称 |
|---|---|
| instancetype | initWithResolution: |
@property (nonatomic, assign, readonly) VeLiveVideoResolution resolution;
推流视频分辨率,默认值为 VeLiveVideoResolution720P,详情请参见 VeLiveVideoResolution。
@property (nonatomic, assign) VeLiveVideoCodec codec;
推流视频编码格式,默认值为 VeLiveVideoCodecH264,详情请参见 VeLiveVideoCodec。
@property (nonatomic, assign) int bitrate;
视频目标编码码率,单位为 kbps,默认值由 resolution 参数值决定。
@property (nonatomic, assign) int minBitrate;
视频最小编码码率,单位为 kbps,默认值由 resolution 参数值决定;如果开启自适应码率,推流 SDK 根据网络情况进行编码码率自适应调整的最小码率。
@property (nonatomic, assign) int maxBitrate;
视频最大编码码率,单位为 kbps,默认值由 resolution 参数值决定;如果开启自适应码率,推流 SDK 根据网络情况进行编码码率自适应调整的最大码率。
@property (nonatomic, assign) int gopSize;
视频 GOP 大小,单位为 s,默认值为 2。
@property (nonatomic, assign) int fps;
视频编码帧率,单位为 fps,默认值为 15。
@property (nonatomic, assign) BOOL enableBFrame;
是否启用 B 帧,默认值为 NO,支持的取值包括:
YES:开启;NO:关闭。@property (nonatomic, assign) BOOL enableAccelerate;
是否开启硬件编码,默认值为 YES,支持的取值包括:
YES:开启;NO:关闭。- (instancetype)initWithResolution:(VeLiveVideoResolution)resolution NS_DESIGNATED_INITIALIZER;
初始化方法,用于创建一个 VeLiveVideoEncoderConfiguration 对象,并指定视频的分辨率。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| resolution | VeLiveVideoResolution | 视频的分辨率,详情请参见 VeLiveVideoResolution。 |
返回值
创建的 VeLiveVideoEncoderConfiguration 对象。
typedef NS_ENUM( NSInteger, VeLiveVideoFrameSource )
视频帧来源。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoFrameSourceCapture | 1<<0 | 采集到的原始视频帧。这是从设备的摄像头或其他视频输入源获取的视频帧。 |
| VeLiveVideoFrameSourcePreEncode | 1<<1 | 编码前的视频帧。这是通过各种处理(例如滤镜、旋转等)后,准备进行编码的视频帧。 |
typedef NS_ENUM( NSInteger, VeLiveAudioBufferType )
推流音频数据类型。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveAudioBufferTypeUnknown | -1 | 未知的音频数据类型。 |
| VeLiveAudioBufferTypeSampleBuffer | 0 | 音频数据类型为 CMSampleBufferRef。 |
| VeLiveAudioBufferTypeNSData | 1 | 音频数据类型为 NSData。 |
@interface VeLivePusherConfiguration : NSObject
推流引擎初始化配置。
| 类型 | 名称 |
|---|---|
| VeLiveVideoCaptureConfiguration* | videoCaptureConfig |
| VeLiveAudioCaptureConfiguration* | audioCaptureConfig |
| int | reconnectIntervalSeconds |
| int | reconnectCount |
| NSDictionary* | extraParameters |
@property (nonatomic, strong, nullable) VeLiveVideoCaptureConfiguration *videoCaptureConfig;
视频采集参数设置,用于调整和设置视频采集相关的参数。详情请参见 VeLiveVideoCaptureConfiguration。
@property (nonatomic, strong, nullable) VeLiveAudioCaptureConfiguration *audioCaptureConfig;
音频采集参数设置,用于调整和设置音频采集相关的参数。详情请参见 VeLiveAudioCaptureConfiguration。
@property (nonatomic, assign) int reconnectIntervalSeconds;
推流失败后,尝试重连的时间间隔。单位为 s,默认值为 5。
@property (nonatomic, assign) int reconnectCount;
推流失败后,尝试重连的次数。默认值为 3。
@property (nonatomic, strong) NSDictionary *extraParameters;
设置扩展参数,用于实现某些特殊功能或配置,默认不需要设置。
typedef NS_ENUM( NSInteger, VeLiveVideoCaptureType )
视频采集类型。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoCaptureFrontCamera | 0 | 使用前置摄像头进行视频采集。 |
| VeLiveVideoCaptureBackCamera | 1 | 使用后置摄像头进行视频采集。 |
| VeLiveVideoCaptureExternal | 4 | 使用外部设备或源进行视频采集。 |
| VeLiveVideoCaptureCustomImage | 5 | 使用指定的静态图片作为视频源。 |
| VeLiveVideoCaptureLastFrame | 6 | 使用最近采集的一帧图像重复作为视频源。 |
| VeLiveVideoCaptureDummyFrame | 7 | 使用黑色帧作为视频源,一般用于调试或特殊需求。 |
@interface VeLiveFileRecorderConfiguration : NSObject
推流端本地文件录制配置。
| 类型 | 名称 |
|---|---|
| int | width |
| int | height |
| int | fps |
| int | bitrate |
@property (nonatomic, assign) int width;
录制的视频宽度,单位为 px,默认值为 360。
@property (nonatomic, assign) int height;
录制的视频高度,单位为 px,默认值为 640。
@property (nonatomic, assign) int fps;
录制的视频帧率,默认值为 15,取值范围为 [1,15]。
@property (nonatomic, assign) int bitrate;
录制的视频编码码率,单位为 kbps,默认值为 2000。
typedef NS_ENUM( NSInteger, VeLiveVideoBufferType )
推流视频数据类型。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoBufferTypeUnKnown | -1 | 未知视频数据类型,当未指定输入视频数据的格式时,会默认为此类型。 |
| VeLiveVideoBufferTypePixelBuffer | 0 | 视频数据类型为 CVPixelBuffer。 |
| VeLiveVideoBufferTypeSampleBuffer | 1 | 视频数据类型为 CMSampleBufferRef。 |
| VeLiveVideoBufferTypeNSData | 2 | 视频数据类型为 NSData。 |
| VeLiveVideoBufferTypeTexture | 3 | 视频数据类型为 OpenGL 纹理。 |
@interface VeLiveMixVideoLayout : NSObject
视频混流设置。包含视频流 ID、位置、大小、透明度、层级和渲染模式等属性。
| 类型 | 名称 |
|---|---|
| int | streamId |
| float | x |
| float | y |
| float | width |
| float | height |
| float | alpha |
| int | zOrder |
| VeLivePusherRenderMode | renderMode |
| BOOL | enableAlpha |
| BOOL | enablePreview |
| BOOL | enableStream |
@property (nonatomic, assign) int streamId;
视频流 ID,唯一标识,用于区分不同的视频流。
@property (nonatomic, assign) float x;
视频流对应区域左上角的横坐标,该坐标是相对整体画面的归一化比例,取值的范围为 [0.0,1.0]。
@property (nonatomic, assign) float y;
视频流对应区域左上角的纵坐标,该坐标是相对整体画面的归一化比例,取值的范围为 [0.0,1.0]。
@property (nonatomic, assign) float width;
视频流对应区域宽度,该宽度是相对整体画面的归一化比例,取值的范围为 [0.0,1.0]。
@property (nonatomic, assign) float height;
视频流对应区域高度,该高度是相对整体画面的归一化比例,取值的范围为 [0.0,1.0]。
@property (nonatomic, assign) float alpha;
视频流在混流中的透明度,取值范围为 [0.0,1.0],取值 0.0 表示全透明,取值 1.0 表示不透明。
@property (nonatomic, assign) int zOrder;
视频流在混流中的层级。取值范围为 [0,100],取值 0 表示最底层,取值越大,层级越高。
@property (nonatomic, assign) VeLivePusherRenderMode renderMode;
视频流的渲染模式。详情请参见 VeLivePusherRenderMode。
@property (nonatomic, assign) BOOL enableAlpha;
是否保留视频流原 Alpha 通道值,默认为保留,当 alpha 取值在 [0.0, 1.0] 之间时,则忽略该配置。
YES:保留;NO:不保留。@property (nonatomic, assign) BOOL enablePreview;
是否在本地预览画面中显示该视频流。默认值为 NO。
YES:显示。NO:不显示。@property (nonatomic, assign) BOOL enableStream;
是否将该视频流混入推向远端的视频流中。默认值为 YES。
YES:混入。NO:不混入。远端用户将看不到该视频流。@interface VeLiveMixAudioLayout : NSObject
音频混流设置。包含音频流 ID 属性。
| 类型 | 名称 |
|---|---|
| int | streamId |
| float | volume |
@property (nonatomic, assign) int streamId;
音频流 ID,唯一标识,用于区分不同的音频流。
@property (nonatomic, assign) float volume;
混流音频的音量,范围为 [0.0,4.0]。当你将 VeLiveAudioMixType 设置为 VeLiveAudioMixPlayAndPush 时,该属性同时控制混流音频在拉流端和本地的播放音量。
typedef NS_ENUM( NSInteger, VeLiveAudioProfile )
AAC 音频编码档位。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveAudioAACProfileLC | 0 | LC-AAC 编码方式。 |
| VeLiveAudioAACProfileHEv1 | 1 | HEv1-AAC 编码方式。 |
| VeLiveAudioAACProfileHEv2 | 2 | HEv2-AAC 编码方式。 |
@interface VeLiveVideoFrame : NSObject <NSCopying>
视频帧的数据信息。
| 类型 | 名称 |
|---|---|
| VeLiveVideoBufferType | bufferType |
| VeLivePixelFormat | pixelFormat |
| VeLiveVideoRotation | rotation |
| int | width |
| int | height |
| CMTime | pts |
| GLuint | textureId |
| CVPixelBufferRef | pixelBuffer |
| CMSampleBufferRef | sampleBuffer |
| NSData* | data |
| 返回 | 名称 |
|---|---|
| void | releaseCallback |
@property (nonatomic, assign) VeLiveVideoBufferType bufferType;
视频数据包装格式。默认值为 VeLiveVideoBufferTypeUnknown,详情请参见 VeLiveVideoBufferType。
@property (nonatomic, assign) VeLivePixelFormat pixelFormat;
视频帧像素格式。bufferType 为 VeLiveVideoBufferTypeNSData 时,需要指定数据格式。详情请参见 VeLivePixelFormat。
@property (nonatomic, assign) VeLiveVideoRotation rotation;
视频帧顺时针旋转角度。详情请参见 VeLiveVideoRotation。
@property (nonatomic, assign) int width;
视频宽度,单位为 px。
@property (nonatomic, assign) int height;
视频高度,单位为 px。
@property (nonatomic, assign) CMTime pts;
视频帧时间戳,单位为 μs。
@property (nonatomic, assign) GLuint textureId;
bufferType 为 VeLiveVideoBufferTypeTexture 时的视频数据。
@property (nonatomic, assign, nullable) CVPixelBufferRef pixelBuffer;
bufferType 为 VeLiveVideoBufferTypePixelBuffer 时的视频数据。
@property (nonatomic, assign, nullable) CMSampleBufferRef sampleBuffer;
bufferType 为 VeLiveVideoBufferTypeSampleBuffer 时的视频数据。
@property (nonatomic, strong, nullable) NSData *data;
bufferType 为 VeLiveVideoBufferTypeNSData 时的视频数据。
@property (nonatomic, copy) void (^releaseCallback)(void);
释放回调函数,用于在 SDK 内部处理完 VideoFrame 后通知外部释放相关资源。此回调主要用于 SDK 外部为 VideoFrame 申请内存,以便 SDK 内部使用。但无法预知内部何时使用完毕。
typedef NS_ENUM( NSInteger, VeLiveVideoFluencyLevel )
视频流畅度等级,用于评估和描述视频播放的流畅程度。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoFluencyLevelSmooth | 0 | 流畅,帧率能达到预设的目标帧率。 |
| VeLiveVideoFluencyLevelSluggish | 1 | 一般卡顿,帧率比预设的目标帧率低 1fps~3fps。 |
| VeLiveVideoFluencyLevelBlocked | 2 | 严重卡顿,帧率比预设的目标帧率低 4fps 以上。 |
| VeLiveVideoFluencyLevelStuck | 3 | 完全卡住,帧率低于 2fps。 |
typedef NS_ENUM( NSInteger, VeLiveVideoMirrorType )
视频镜像类型。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoMirrorCapture | 0 | 对采集画面的镜像控制。开启时,预览和推流画面都会呈现为镜像状态。 |
| VeLiveVideoMirrorPreview | 1 | 对预览画面的镜像控制。开启时,只有主播预览画面呈现镜像状态。 |
| VeLiveVideoMirrorPushStream | 2 | 对编码前画面的镜像控制。开启时,主播推流画面呈现镜像状态。 |
@interface VeLiveAudioCaptureConfiguration : NSObject
音频采集相关配置。
| 类型 | 名称 |
|---|---|
| VeLiveAudioSampleRate | sampleRate |
| VeLiveAudioChannel | channel |
@property (nonatomic, assign) VeLiveAudioSampleRate sampleRate;
音频采样率,默认值为 VeLiveAudioSampleRate44100,详情请参见 VeLiveAudioSampleRate。
@property (nonatomic, assign) VeLiveAudioChannel channel;
音频采集声道数,默认值为 VeLiveAudioChannelStereo,详情请参见 VeLiveAudioChannel。
typedef NS_ENUM( NSInteger, VeLiveVideoResolution )
推流视频分辨率档位枚举值。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoResolution360P | 0 | 360P 分辨率。档位详细配置如下所示。
|
| VeLiveVideoResolution480P | 1 | 480P 分辨率。档位详细配置如下所示。
|
| VeLiveVideoResolution540P | 2 | 540P 分辨率。档位详细配置如下所示。
|
| VeLiveVideoResolution720P | 3 | 720P 分辨率。档位详细配置如下所示。
|
| VeLiveVideoResolution1080P | 4 | 1080P 分辨率。档位详细配置如下所示。
|
| VeLiveVideoResolutionScreen | 10 | 屏幕推流分辨率。档位详细配置如下所示。
|
typedef NS_ENUM( NSInteger, VeLiveVideoRotation )
视频帧旋转角度。以 App 方向为旋转参考系。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoRotation0 | 0 | 不旋转。 |
| VeLiveVideoRotation90 | 1 | 顺时针旋转 90 度。 |
| VeLiveVideoRotation180 | 2 | 顺时针旋转 180 度。 |
| VeLiveVideoRotation270 | 3 | 顺时针旋转 270 度。 |
@interface VeLiveStreamMixDescription : NSObject
音视频混流布局。包含了视频混流布局、音频混流布局和画布背景色等属性。
| 类型 | 名称 |
|---|---|
| NSArray<VeLiveMixVideoLayout*>* | mixVideoStreams |
| NSArray<VeLiveMixAudioLayout*>* | mixAudioStreams |
| NSString* | backgroundColor |
@property (nonatomic, copy) NSArray<VeLiveMixVideoLayout*> *mixVideoStreams;
视频混流布局设置的数组,其中每个元素代表一路视频流的布局。详情请参见 VeLiveMixVideoLayout。
@property (nonatomic, copy) NSArray<VeLiveMixAudioLayout*> *mixAudioStreams;
音频混流设置的数组,其中每个元素代表一路音频流的。详情请参见 VeLiveMixAudioLayout。
@property (nonatomic, copy) NSString *backgroundColor;
视频混流画布的背景色设置,采用 #RRGGBB 格式。
typedef NS_ENUM( NSInteger, VeLiveAudioCaptureType )
音频采集类型。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveAudioCaptureMicrophone | 0 | 使用默认麦克风设备进行音频采集。 |
| VeLiveAudioCaptureVoiceCommunication | 1 | 使用语音通话模式进行音频采集,此模式下会启动硬件的 3A 功能,即自动增益控制、自动频率控制和自动噪声抑制。 |
| VeLiveAudioCaptureExternal | 2 | 使用外部设备或源进行音频采集。 |
| VeLiveAudioCaptureMuteFrame | 3 | 使用静音帧作为音频源。 |
typedef NS_ENUM( NSInteger, VeLiveVideoCodec )
视频编码格式。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveVideoCodecH264 | 0 | 使用 H.264 视频编码。 |
| VeLiveVideoCodecByteVC1 | 1 | 使用火山引擎自研 ByteVC1 视频编码。 |
@interface VeLiveVideoEncodeFrame : NSObject
视频编码帧,此类用于描述一个编码后的视频帧,包含时间戳、帧类型和编码数据。
| 类型 | 名称 |
|---|---|
| CMTime | pts |
| CMTime | dts |
| VeLiveVideoEncodeFrameType | videoEcodeFrameType |
| NSData* | data |
@property (nonatomic, assign) CMTime pts;
编码帧展示时间戳,单位为 μs。
@property (nonatomic, assign) CMTime dts;
编码帧 dts 时间,即解码时间戳,单位为 μs。
@property (nonatomic, assign) VeLiveVideoEncodeFrameType videoEcodeFrameType;
编码帧的类型,详细请参见 VeLiveVideoEncodeFrameType:。
@property (nonatomic, strong, nullable) NSData *data;
编码帧的数据,使用 NSData 表示。
@interface VeLiveAudioEncoderConfiguration : NSObject
推流音频编码参数。
| 类型 | 名称 |
|---|---|
| int | bitrate |
| VeLiveAudioSampleRate | sampleRate |
| VeLiveAudioChannel | channel |
| VeLiveAudioProfile | profile |
@property (nonatomic, assign) int bitrate;
音频编码码率,单位为 kbps,默认值为 64。
@property (nonatomic, assign) VeLiveAudioSampleRate sampleRate;
音频编码采样率,默认值为 VeLiveAudioSampleRate44100,详情请参见 VeLiveAudioSampleRate。
@property (nonatomic, assign) VeLiveAudioChannel channel;
音频声道数,默认值为 VeLiveAudioChannelStereo,详情请参见 VeLiveAudioChannel。
@property (nonatomic, assign) VeLiveAudioProfile profile;
AAC 编码类型,默认值为 VeLiveAudioAACProfileLC。详情请参见 VeLiveAudioProfile。
typedef NS_ENUM( NSInteger, VeLivePusherLogLevel )
输出的日志级别。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLivePusherLogLevelVerbose | 0 | 输出 VERBOSE、DEBUG、INFO、WARNING 和 ERROR 级别的日志。 |
| VeLivePusherLogLevelDebug | 1 | 输出 DEBUG、INFO、WARNING 和 ERROR 级别的日志。 |
| VeLivePusherLogLevelInfo | 2 | 输出 INFO、WARNING 和 ERROR 级别的日志。 |
| VeLivePusherLogLevelWarn | 3 | 输出 WARNING 和 ERROR 级别的日志。 |
| VeLivePusherLogLevelError | 4 | 输出 ERROR 级别的日志。 |
| VeLivePusherLogLevelNone | 5 | 关闭日志。 |
typedef NS_ENUM( NSInteger, VeLiveAudioMixType )
音频混流类型。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveAudioMixPush | 0 | 拉流端可以听到混音效果,本地无法听到。 |
| VeLiveAudioMixPlayAndPush | 1 | 拉流端和本地都可以听到混音效果。 |
typedef NS_ENUM( NSInteger, VeLivePusherRenderMode )
推流渲染模式。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLivePusherRenderModeHidden | 0 | 视窗填满优先。视频帧等比缩放,直至视窗被视频填满。如果视频帧长宽比例与视窗不同,视频帧的多出部分将无法显示。 |
| VeLivePusherRenderModeFit | 1 | 视频帧内容全部显示优先。视频尺寸等比缩放,优先保证视频内容全部显示。当视频尺寸与显示窗口尺寸不一致时,会把窗口未被填满的区域填充成背景颜色。 |
| VeLivePusherRenderModeFill | 2 | 视频帧自适应画布。视频帧非等比缩放,直至画布被填满。在此过程中,视频帧的长宽比例可能会发生变化。 |
@interface VeLiveVideoEffectLicenseConfiguration : NSObject
视频特效许可证配置。
| 类型 | 名称 |
|---|---|
| VeLiveVideoEffectLicenseType | type |
| NSString* | path |
| NSString* | key |
| NSString* | secret |
| NSString* | url |
| 返回 | 名称 |
|---|---|
| instancetype | initWithPath: |
| instancetype | initWithKey:secret:url: |
@property (nonatomic, assign, readonly) VeLiveVideoEffectLicenseType type;
获取视频特效许可证类型。许可证类型请参见 VeLiveVideoEffectLicenseType。
@property (nonatomic, copy, readonly, nullable) NSString *path;
获取视频特效许可证的本地路径。当 VeLiveVideoEffectLicenseType 为 VeLiveVideoEffectLicenseTypeOffLine 时,该属性返回许可证文件的本地路径。
@property (nonatomic, copy, readonly, nullable) NSString *key;
获取视频特效许可证的在线认证 key。当 VeLiveVideoEffectLicenseType 为 VeLiveVideoEffectLicenseTypeOnLine 时,该属性返回在线认证的 key。
@property (nonatomic, copy, readonly, nullable) NSString *secret;
获取视频特效许可证的在线认证 secret。当 VeLiveVideoEffectLicenseType 为 VeLiveVideoEffectLicenseTypeOnLine 时,该属性返回在线认证的 secret。
@property (nonatomic, copy, readonly, nullable) NSString *url;
获取视频特效许可证的在线认证地址。当 VeLiveVideoEffectLicenseType 为 VeLiveVideoEffectLicenseTypeOnLine 时,该属性返回在线认证地址。
- (instancetype)initWithPath:(NSString *)path NS_DESIGNATED_INITIALIZER;
初始化配置为本地验证模式。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| path | NSString* | 视频特效许可证的本地缓存路径。可通过 path 获取 |
返回值
返回 VeLiveVideoEffectLicenseConfiguration 类的实例,该实例使用指定的本地路径进行许可证验证。
- (instancetype)initWithKey:(NSString *)key secret:(NSString *)secret url:(nullable NSString *)url NS_DESIGNATED_INITIALIZER;
初始化配置为在线验证模式。
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| key | NSString* | 视频特效许可证的在线认证 key,可通过 key 获取。 |
| secret | NSString* | 视频特效许可证的在线认证 secret,可通过 secret 获取。 |
| url | nullable NSString* | 视频特效许可证的在线认证地址,如果传入 nil,会使用默认 url,可通过 url 获取在线认证地址。 |
返回值
返回 VeLiveVideoEffectLicenseConfiguration 类的实例,该实例使用指定的 key、secret 和 url 进行在线许可证验证。
typedef NS_ENUM( NSInteger, VeLiveAudioFrameSource )
音频帧来源。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveAudioFrameSourceCapture | 1<<0 | 采集到的原始音频帧。这是从设备的麦克风或其他音频输入源获取的音频帧。 |
| VeLiveAudioFrameSourcePreEncode | 1<<1 | 编码前的音频帧。这是通过各种处理(例如噪音消除、回声消除等)后,准备进行编码的音频帧。 |
typedef NS_ENUM( NSInteger, VeLivePushStatus )
推流器与服务器的连接状态。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLivePushStatusNone | 0 | 初始状态。 |
| VeLivePushStatusConnecting | 1 | 正在连接服务器。 |
| VeLivePushStatusConnectSuccess | 2 | 连接服务器成功。 |
| VeLivePushStatusReconnecting | 3 | 重连服务器中。 |
| VeLivePushStatusConnectStop | 4 | 推流连接被终止。 |
| VeLivePushStatusConnectError | 5 | 推流连接失败。 |
| VeLivePushStatusDisconnected | 6 | 与服务器断开连接。 |
typedef NS_ENUM( NSInteger, VeLiveFirstFrameType )
定义了推流中首帧的类型,包括音视频的采集首帧、渲染首帧、编码完成首帧和发送首帧。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveFirstCaptureFrame | 0 | 视频/音频采集首帧,采集首帧是从音频设备或视频设备(如麦克风、摄像头)获取的第一帧数据。 |
| VeLiveFirstRenderFrame | 1 | 视频渲染首帧,渲染首帧是在渲染过程中在屏幕上显示的第一帧视频数据。 |
| VeLiveFirstEncodedFrame | 2 | 视频/音频编码完成首帧,编码完成首帧是编码为某种特定格式的第一帧数据。 |
| VeLiveFirstSendFrame | 3 | 视频/音频发送首帧,发送首帧是在发送过程中,通过网络传输的第一帧数据。 |
| VeLiveFirstAppAudioCaptureFrame | 4 | 录屏采集开始后,获得的第一个 app 音频帧。 |
typedef NS_ENUM( NSInteger, VeLiveAudioSampleRate )
推流音频采样率。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveAudioSampleRate44100 | 44100 | 44.1k 采样,适用于大多数音频处理场景,是音乐 CD 的标准采样率。 |
@interface VeLivePusherStatistics : NSObject
推流周期性统计信息。
| 类型 | 名称 |
|---|---|
| int | captureWidth |
| int | captureHeight |
| int | captureFps |
| int | encodeWidth |
| int | encodeHeight |
| int | encodeFps |
| int | encodeVideoBitrate |
| int | encodeAudioBitrate |
| int | transportFps |
| int | transportVideoBitrate |
| int | fps |
| int | videoBitrate |
| int | minVideoBitrate |
| int | maxVideoBitrate |
| NSString* | url |
| NSString* | codec |
@property (nonatomic, assign) int captureWidth;
视频采集宽度,单位为 px。
@property (nonatomic, assign) int captureHeight;
视频采集高度,单位为 px。
@property (nonatomic, assign) int captureFps;
视频采集帧率,单位为 fps。
@property (nonatomic, assign) int encodeWidth;
视频编码宽度,单位为 px。
@property (nonatomic, assign) int encodeHeight;
视频编码高度,单位为 px。
@property (nonatomic, assign) int encodeFps;
视频编码帧率,单位为 fps。
@property (nonatomic, assign) int encodeVideoBitrate;
视频编码码率,单位为 kbps。
@property (nonatomic, assign) int encodeAudioBitrate;
音频编码码率,单位为 kbps。
@property (nonatomic, assign) int transportFps;
视频发送帧率,可用展示实时帧率,单位为 fps。
@property (nonatomic, assign) int transportVideoBitrate;
视频发送码率,可用于展示实时码率,单位为 kbps。
@property (nonatomic, assign) int fps;
视频推流帧率,即您通过 setVideoEncoderConfiguration: 方法设置的帧率,单位为 fps。
@property (nonatomic, assign) int videoBitrate;
视频推流码率,即您通过 setVideoEncoderConfiguration 方法设置的码率,单位为 kbps。
@property (nonatomic, assign) int minVideoBitrate;
视频推流最小码率,即您通过 setVideoEncoderConfiguration: 方法设置的最小码率,单位为 kbps。
@property (nonatomic, assign) int maxVideoBitrate;
视频推流最大码率,即您通过 setVideoEncoderConfiguration: 方法设置的最大码率,单位为 kbps。
@property (nonatomic, copy, nullable) NSString *url;
推流地址。
@property (nonatomic, copy, nullable) NSString *codec;
视频编码格式。
typedef NS_ENUM( NSInteger, VeLivePixelFormat )
视频帧的数据格式。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLivePixelFormatUnknown | -1 | 未知格式。 |
| VeLivePixelFormatI420 | 0 | I420 格式。 |
| VeLivePixelFormatNV12 | 1 | NV12 格式。 |
| VeLivePixelFormatNV21 | 2 | NV21 格式。 |
| VeLivePixelFormatBGRA32 | 3 | RAGBA 格式。 |
| VeLivePixelFormat2DTexture | 4 | OpenGL 2D 纹理。 |
@interface VeLiveVideoCaptureConfiguration : NSObject
视频采集相关配置。
| 类型 | 名称 |
|---|---|
| int | width |
| int | height |
| int | fps |
| OSType | pixelFormat |
| BOOL | isDefaultFrontCameraMirrored |
@property (nonatomic, assign) int width;
视频采集宽度,单位为 px,默认值为 720。
@property (nonatomic, assign) int height;
视频采集高度,单位为 px,默认值为 1280。
@property (nonatomic, assign) int fps;
视频采集帧率,单位为 fps,默认值为 15。
@property (nonatomic, assign) OSType pixelFormat;
视频采集帧类型,默认为 kCVPixelFormatType_420YpCbCr8BiPlanarFullRange。
注意
支持以下视频帧类型:
@property (nonatomic, assign) BOOL isDefaultFrontCameraMirrored;
前置摄像头采集时,是否默认为镜像状态。默认值为 YES。取值如下:
YES:镜像状态。NO:非镜像状态。@interface VeLiveAudioFrame : NSObject
音频帧的数据信息。
| 类型 | 名称 |
|---|---|
| VeLiveAudioBufferType | bufferType |
| VeLiveAudioSampleRate | sampleRate |
| VeLiveAudioChannel | channels |
| CMTime | pts |
| CMSampleBufferRef | sampleBuffer |
| NSData* | data |
@property (nonatomic, assign) VeLiveAudioBufferType bufferType;
音频数据类型,默认值为 VeLiveAudioBufferTypeUnknown,详情请参见 VeLiveAudioBufferType。
@property (nonatomic, assign) VeLiveAudioSampleRate sampleRate;
音频采样率。详情请参见 VeLiveAudioSampleRate。
@property (nonatomic, assign) VeLiveAudioChannel channels;
音频声道数。详情请参见 VeLiveAudioChannel。
@property (nonatomic, assign) CMTime pts;
当 bufferType 取值为 VeLiveAudioBufferNSData 时的音频帧时间戳,单位为 μs。
@property (nonatomic, assign, nullable) CMSampleBufferRef sampleBuffer;
当 bufferType 取值为 VeLiveAudioBufferTypeSampleBuffer 时的音频数据。
@property (nonatomic, strong, nullable) NSData *data;
当 bufferType 取值为 VeLiveAudioBufferTypeNSData 时的音频数据。音频帧数据为 float32 格式小端字节序存储。
typedef NS_ENUM( NSInteger, VeLiveAudioPowerLevel )
音量等级,用于评估和控制音频的响度。
| 类型 | 值 | 说明 |
|---|---|---|
| VeLiveAudioPowerLevelSilent | 0 | 无声,音量 ≤ 1dB。 |
| VeLiveAudioPowerLevelQuiet | 1 | 安静,音量 15dB 以下。 |
| VeLiveAudioPowerLevelLight | 2 | 轻声,接近耳语音量,音量为 16dB~30dB 之间。 |
| VeLiveAudioPowerLevelNormal | 3 | 正常,音量适宜,类似正常对话的音量,音量为 30dB~60dB 之间。 |
| VeLiveAudioPowerLevelLoud | 4 | 较大,音量较高,类似咖啡馆、餐厅的环境噪音,音量为 61dB~85dB 之间。 |
| VeLiveAudioPowerLevelNoisy | 5 | 吵闹,音量极高,类似于繁忙的街道或者是音乐会现场,音量超过 85dB。 |