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

回调

最近更新时间2023.09.27 15:15:23

首次发布时间2022.11.11 14:50:45

VeLiveMediaPlayerFrameListener
@protocol VeLiveMediaPlayerFrameListener <NSObject>

播放器音视频帧回调。通过该回调,您可以获取音频和视频帧的数据。

成员函数

返回名称
voidonVideoFrame:
voidonAudioFrame:

函数说明

onVideoFrame:

- (void)onVideoFrame:(VeLiveVideoFrame *)videoFrame;

播放器视频帧回调。当完成一个新的视频帧的解码后,触发该回调。

传入参数

参数名类型说明
videoFrameVeLiveVideoFrame*视频帧数据,包含了帧的时间戳和格式等信息,详情请参见 VeLiveVideoFrame

onAudioFrame:

- (void)onAudioFrame:(VeLiveAudioFrame *)audioFrame;

播放器音频帧回调。

传入参数

参数名类型说明
audioFrameVeLiveAudioFrame*音频帧,详情请参见 VeLiveAudioFrame
VeLiveMediaPlayerListener
@protocol VeLiveMediaPlayerListener <NSObject>

播放器播放回调。通过该回调,您可以获取与播放相关的事件和通知。

成员函数

返回名称
voidonStart
voidonProgress:
voidonStop
voidonError:

函数说明

onStart

- (void)onStart;

开始播放的回调。

onProgress:

- (void)onProgress:(long)timeMS;

播放进度的回调,每 100ms 触发一次。

传入参数

参数名类型说明
timeMSlong播放进度。单位为 ms

onStop

- (void)onStop;

停止播放的回调。

onError:

- (void)onError:(NSError *)error;

返错误状态的回调。

传入参数

参数名类型说明
errorNSError*错误消息
VeLivePusherObserver
@protocol VeLivePusherObserver <NSObject>

推流器回调。

成员函数

返回名称
voidonError:subcode:message:
voidonStatusChange:
voidonFirstVideoFrame:timestampMs:
voidonFirstAudioFrame:timestampMs:
voidonCameraOpened:
voidonMicrophoneOpened:
voidonNetworkQuality:
voidonAudioPowerQuality:value:

函数说明

onError:subcode:message:

- (void)onError:(int)code subcode:(int)subcode message:(nullable NSString *)msg;

推流错误回调。

传入参数

参数名类型说明
codeint错误码。详情请参见 VeLivePusherCode
subcodeint子错误码。详情请参见 VeLivePusherErrorCode
msgnullable NSString*错误信息

onStatusChange:

- (void)onStatusChange:(VeLivePushStatus)status;

推流状态变化回调。

传入参数

参数名类型说明
statusVeLivePushStatus变化后的推流状态。详情请参见 VeLivePushStatus

onFirstVideoFrame:timestampMs:

- (void)onFirstVideoFrame:(VeLiveFirstFrameType)type timestampMs:(int64_t)timestampMs;

首帧视频回调,当推流器发送出第一帧视频时,触发该回调。

传入参数

参数名类型说明
typeVeLiveFirstFrameType首帧的类型,详情请参见 VeLiveFirstFrameType
timestampMsint64_t时间戳,单位为 ms

onFirstAudioFrame:timestampMs:

- (void)onFirstAudioFrame:(VeLiveFirstFrameType)type timestampMs:(int64_t)timestampMs;

首帧音频回调,当推流器发送出第一帧音频时,触发该回调。

传入参数

参数名类型说明
typeVeLiveFirstFrameType首帧的类型,详情请参见 VeLiveFirstFrameType
timestampMsint64_t时间戳,单位为 ms

onCameraOpened:

- (void)onCameraOpened:(BOOL)open;

摄像头开启/关闭回调,当推流器的摄像头开启或关闭时,触发该回调。

传入参数

参数名类型说明
openBOOL摄像头的新状态是否为开启。
• YES:摄像头开启;
• NO:摄像头关闭。

onMicrophoneOpened:

- (void)onMicrophoneOpened:(BOOL)open;

麦克风开启/关闭回调,当推流器的麦克风开启或关闭时,触发该回调。

传入参数

参数名类型说明
openBOOL麦克风的新状态是否为开启。
• YES:麦克风开启;
• NO:麦克风关闭。

onNetworkQuality:

- (void)onNetworkQuality:(VeLiveNetworkQuality)quality;

网络质量状态回调,当推流器检测到网络质量发生变化时,触发该回调。

传入参数

参数名类型说明
qualityVeLiveNetworkQuality变化后的网络质量。详情请参见 VeLiveNetworkQuality

onAudioPowerQuality:value:

- (void)onAudioPowerQuality:(VeLiveAudioPowerLevel)level value:(float)value;

音量等级回调,当推流器采集的音频音量等级发生变化时,触发该回调。

传入参数

参数名类型说明
levelVeLiveAudioPowerLevel变化后的音量等级。详情请参见 VeLiveAudioPowerLevel
VeLivePusherStatisticsObserver
@protocol VeLivePusherStatisticsObserver <NSObject>

推流器周期性回调。

成员函数

返回名称
voidonStatistics:
voidonLogMonitor:

函数说明

onStatistics:

- (void)onStatistics:(VeLivePusherStatistics *)statistics;

推流周期性统计信息回调。

传入参数

参数名类型说明
statisticsVeLivePusherStatistics*周期性统计信息,默认每 5s 回调一次。详情请参见 VeLivePusherStatistics

onLogMonitor:

- (void)onLogMonitor:(NSDictionary *) logInfo;

周期性日志信息回调。

传入参数

参数名类型说明
logInfoNSDictionary*周期性日志信息
VeLiveFileRecordingListener
@protocol VeLiveFileRecordingListener <NSObject>

直播录制回调。

成员函数

返回名称
voidonFileRecordingStarted
voidonFileRecordingStopped
voidonFileRecordingError:message:

函数说明

onFileRecordingStarted

- (void)onFileRecordingStarted;

直播录制开始回调。

onFileRecordingStopped

- (void)onFileRecordingStopped;

直播录制停止回调。

onFileRecordingError:message:

- (void)onFileRecordingError:(int)errorCode message:(nullable NSString *)msg;

直播录制错误回调。

传入参数

参数名类型说明
errorCodeint错误码,详情请参见 VeLivePusherCode
msgnullable NSString*错误信息
VeLiveSnapshotListener
@protocol VeLiveSnapshotListener <NSObject>

直播截图回调。

成员函数

返回名称
voidonSnapshotComplete:

函数说明

onSnapshotComplete:

- (void)onSnapshotComplete:(UIImage *)image;

截图成功回调。

传入参数

参数名类型说明
imageUIImage*视频的截图

注意
调用 snapshot: 截图成功后,会收到这个回调。

VeLiveVideoFrameFilter
@protocol VeLiveVideoFrameFilter <NSObject>

自定义的视频处理回调。

成员函数

返回名称
intonVideoProcess:dstFrame:

函数说明

onVideoProcess:dstFrame:

- (int)onVideoProcess:(VeLiveVideoFrame *)srcFrame dstFrame:(VeLiveVideoFrame *)dstFrame;

自定义的视频处理方法。

传入参数

参数名类型说明
srcFrameVeLiveVideoFrame*源视频帧,详情请参见 VeLiveVideoFrame
dstFrameVeLiveVideoFrame*处理后的视频帧,详情请参见 VeLiveVideoFrame

返回值

  • =0:处理成功;
  • <0:处理失败,该帧会被 SDK 丢弃;
  • >0:处理失败,该帧会被 SDK 继续传递到编码器。
VeLiveAudioFrameFilter
@protocol VeLiveAudioFrameFilter <NSObject>

自定义的音频处理回调。

成员函数

返回名称
intonAudioProcess:dstFrame:

函数说明

onAudioProcess:dstFrame:

- (int)onAudioProcess:(VeLiveAudioFrame *)srcFrame dstFrame:(VeLiveAudioFrame *)dstFrame;

自定义的音频处理方法。

传入参数

参数名类型说明
srcFrameVeLiveAudioFrame*源音频帧,详情请参见 VeLiveAudioFrame
dstFrameVeLiveAudioFrame*处理后的音频帧,详情请参见 VeLiveAudioFrame
• =0:处理成功;
• ≠0:处理失败,该帧会被 SDK 继续传递到编码器;
VeLiveVideoFrameListener
@protocol VeLiveVideoFrameListener <NSObject>

视频帧订阅回调。

成员函数

返回名称
VeLiveVideoFrameSourcegetObservedVideoFrameSource
voidonCaptureVideoFrame:
voidonPreEncodeVideoFrame:

函数说明

getObservedVideoFrameSource

- (VeLiveVideoFrameSource)getObservedVideoFrameSource;

设置当前 Listener 需要的视频帧来源。

返回值
您所要订阅的视频数据的位置信息,详情请参见 VeLiveVideoFrameSource

onCaptureVideoFrame:

- (void)onCaptureVideoFrame:(VeLiveVideoFrame *)frame;

采集视频帧回调。只有当您通过 getObservedVideoFrameSource 返回 VeLiveVideoFrameSourceCapture 时,才会触发该回调。

传入参数

参数名类型说明
frameVeLiveVideoFrame*视频帧数据,详情请参见 VeLiveVideoFrame

onPreEncodeVideoFrame:

- (void)onPreEncodeVideoFrame:(VeLiveVideoFrame *)frame;

编码前视频帧回调。只有当您通过 getObservedVideoFrameSource 返回 VeLiveVideoFrameSourcePreEncode 时,才会触发该回调。

传入参数

参数名类型说明
frameVeLiveVideoFrame*视频帧数据,详情请参见 VeLiveVideoFrame
VeLiveAudioFrameListener
@protocol VeLiveAudioFrameListener <NSObject>

音频帧订阅回调。

成员函数

返回名称
VeLiveAudioFrameSourcegetObservedAudioFrameSource
voidonCaptureAudioFrame:
voidonPreEncodeAudioFrame:

函数说明

getObservedAudioFrameSource

- (VeLiveAudioFrameSource)getObservedAudioFrameSource;

设置当前 Listener 需要的音频帧来源。

返回值
订阅的音频帧位置信息,详情请参见 VeLiveAudioFrameSource

onCaptureAudioFrame:

- (void)onCaptureAudioFrame:(VeLiveAudioFrame *)frame;

采集音频帧回调。只有当您通过 getObservedAudioFrameSource 返回 VeLiveAudioFrameSourceCapture 时,才会触发该回调。

传入参数

参数名类型说明
frameVeLiveAudioFrame*音频帧数据,详情请参见 VeLiveAudioFrame

onPreEncodeAudioFrame:

- (void)onPreEncodeAudioFrame:(VeLiveAudioFrame *)frame;

编码前音频帧回调。只有当您通过 getObservedAudioFrameSource 返回 VeLiveAudioFrameSourcePreEncode 时,才会触发该回调。

传入参数

参数名类型说明
frameVeLiveAudioFrame*音频帧数据,详情请参见 VeLiveAudioFrame