文档中心
本地服务端录制
API 参考
Agora Recording Java API Reference
Agora On-Premise Recording SDK Java API Reference
|
void | onLeaveChannel (int reason) |
|
void | onError (int error, int stat_code) |
|
void | onWarning (int warn) |
|
void | onJoinChannelSuccess (String channelId, long uid) |
|
void | onRemoteVideoStreamStateChanged (long uid, REMOTE_STREAM_STATE state, REMOTE_STREAM_STATE_CHANGED_REASON reason) |
|
void | onRemoteAudioStreamStateChanged (long uid, REMOTE_STREAM_STATE state, REMOTE_STREAM_STATE_CHANGED_REASON reason) |
|
void | onUserOffline (long uid, int reason) |
|
void | onUserJoined (long uid, String recordingDir) |
|
void | onActiveSpeaker (long uid) |
|
void | audioFrameReceived (long uid, AudioFrame frame) |
|
void | videoFrameReceived (long uid, int type, VideoFrame frame, int rotation) |
|
void | recordingPathCallBack (String path) |
|
void | onAudioVolumeIndication (AudioVolumeInfo[] infos) |
|
void | onFirstRemoteVideoDecoded (long uid, int width, int height, int elapsed) |
|
void | onFirstRemoteAudioFrame (long uid, int elapsed) |
|
void | onReceivingStreamStatusChanged (boolean receivingAudio, boolean receivingVideo) |
|
void | onConnectionLost () |
|
void | onConnectionInterrupted () |
|
void | onRejoinChannelSuccess (String channelId, long uid) |
|
void | onConnectionStateChanged (CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason) |
|
void | onRemoteVideoStats (long uid, RemoteVideoStats stats) |
|
void | onRemoteAudioStats (long uid, RemoteAudioStats stats) |
|
void | onRecordingStats (RecordingStats stats) |
|
void | onLocalUserRegistered (long uid, String userAccount) |
|
void | onUserInfoUpdated (long uid, String userAccount) |
|
◆ onLeaveChannel()
void io.agora.recording.RecordingEventHandler.onLeaveChannel |
( |
int |
reason | ) |
|
◆ onError()
void io.agora.recording.RecordingEventHandler.onError |
( |
int |
error, |
|
|
int |
stat_code |
|
) |
| |
该回调方法表示 SDK 运行时出现了(网络或媒体相关的)错误。通常情况下,SDK 上报的错误意味着 SDK 无法自动恢复,需要 App 干预或提示用户。
- 参数
-
◆ onWarning()
void io.agora.recording.RecordingEventHandler.onWarning |
( |
int |
warn | ) |
|
该回调方法表示 SDK 运行时出现了(网络或媒体相关的)警告。通常情况下,SDK 上报的警告信息应用程序可以忽略,SDK 会自动恢复。
- 参数
-
◆ onJoinChannelSuccess()
void io.agora.recording.RecordingEventHandler.onJoinChannelSuccess |
( |
String |
channelId, |
|
|
long |
uid |
|
) |
| |
◆ onRemoteVideoStreamStateChanged()
远端用户视频流状态改变回调。
该回调在远端用户视频流状态发生变化时触发,并报告该用户当前的视频流状态和引起变化的原因。
- 参数
-
◆ onRemoteAudioStreamStateChanged()
远端用户音频流状态改变回调。
该回调在远端用户音频流状态发生变化时触发,并报告该用户当前的音频流状态和引起变化的原因。
- 参数
-
◆ onUserOffline()
void io.agora.recording.RecordingEventHandler.onUserOffline |
( |
long |
uid, |
|
|
int |
reason |
|
) |
| |
该回调方法提示有用户离开了频道(或掉线)。
SDK 判断用户离开频道(或掉线)的依据是:在一定时间内(15 秒)没有收到对方的任何数据包。 在网络较差的情况下,可能会有误报。建议可靠的掉线检测应该由信令来做。
- 参数
-
◆ onUserJoined()
void io.agora.recording.RecordingEventHandler.onUserJoined |
( |
long |
uid, |
|
|
String |
recordingDir |
|
) |
| |
该回调方法提示有用户加入了频道,并返回新加入用户的 UID。
如果在录制端加入之前,已经有用户在频道中,SDK 也会上报这些已在频道中的用户 UID。频道内有多少用户,该回调就会调用几次。
- 参数
-
uid | 用户的 UID。 |
recordingDir | 录制的媒体文件和 log 的存放路径。 |
◆ onActiveSpeaker()
void io.agora.recording.RecordingEventHandler.onActiveSpeaker |
( |
long |
uid | ) |
|
◆ audioFrameReceived()
void io.agora.recording.RecordingEventHandler.audioFrameReceived |
( |
long |
uid, |
|
|
AudioFrame |
frame |
|
) |
| |
◆ videoFrameReceived()
void io.agora.recording.RecordingEventHandler.videoFrameReceived |
( |
long |
uid, |
|
|
int |
type, |
|
|
VideoFrame |
frame, |
|
|
int |
rotation |
|
) |
| |
当收到视频数据时,会触发该回调。
当你将 RecordingConfig 中的 decodeVideo 设置为 1
、2
或 3
时,可通过该回调接收原始视频数据。
当你将 RecordingConfig 中的 decodeVideo 设置为 4
或 5
时,可通过该回调接收 JPG 文件格式的视频数据。
该回调可用于实现高级功能,如鉴黄。这些功能可以通过采集并分析 I 帧实现。
- 参数
-
uid | createChannel 方法中指定的远端用户的 UID。 如果先前未分配 UID,则 Agora 服务器会自动分配 UID。 |
type | 返回的视频数据的格式:
-
0: YUV
-
1: H.264
-
2: JPG
-
3: H.265
-
4: JPG 文件
|
frame | 返回的视频数据。详见 VideoFrame。 |
rotation | 旋转角度:0, 90, 180, or 270. |
◆ recordingPathCallBack()
void io.agora.recording.RecordingEventHandler.recordingPathCallBack |
( |
String |
path | ) |
|
◆ onAudioVolumeIndication()
void io.agora.recording.RecordingEventHandler.onAudioVolumeIndication |
( |
AudioVolumeInfo[] |
infos | ) |
|
◆ onFirstRemoteVideoDecoded()
void io.agora.recording.RecordingEventHandler.onFirstRemoteVideoDecoded |
( |
long |
uid, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
elapsed |
|
) |
| |
该回调提示本地已接收到首帧远端视频并完成解码。
本地收到首帧远端视频流并解码成功时,触发此调用。
- 参数
-
uid | 用户 ID,指定是哪个用户的视频流。 |
width | 视频流宽(像素)。 |
height | 视频流高(像素)。 |
elapsed | 从本地用户调用 createChannel 到该回调触发的延迟(毫秒)。 |
◆ onFirstRemoteAudioFrame()
void io.agora.recording.RecordingEventHandler.onFirstRemoteAudioFrame |
( |
long |
uid, |
|
|
int |
elapsed |
|
) |
| |
◆ onReceivingStreamStatusChanged()
void io.agora.recording.RecordingEventHandler.onReceivingStreamStatusChanged |
( |
boolean |
receivingAudio, |
|
|
boolean |
receivingVideo |
|
) |
| |
该回调提示接收音频流或视频流的状态发生改变。
- 参数
-
receivingAudio | 录制端是否在接收音频流。 |
receivingVideo | 录制端是否在接收视频流。 |
◆ onConnectionLost()
void io.agora.recording.RecordingEventHandler.onConnectionLost |
( |
| ) |
|
◆ onConnectionInterrupted()
void io.agora.recording.RecordingEventHandler.onConnectionInterrupted |
( |
| ) |
|
网络连接中断回调。
SDK 在和服务器建立连接后,失去网络连接超过 4 秒,就会触发该回调。在触发事件后,SDK 会主动重连服务器,所以该事件可以用于 UI 提示。
无论是哪种回调,除非应用程序主动调用 leaveChannel,不然 SDK 会一直自动重连。
◆ onRejoinChannelSuccess()
void io.agora.recording.RecordingEventHandler.onRejoinChannelSuccess |
( |
String |
channelId, |
|
|
long |
uid |
|
) |
| |
重新加入频道回调。
有时由于网络原因,录制客户端可能会和服务器失去连接,SDK 会进行自动重连,自动重连成功后触发此回调方法。
- 参数
-
channelId | 频道名。 |
uid | 录制端的 UID。 |
◆ onConnectionStateChanged()
网络连接状态已改变回调。
该回调在网络连接状态发生改变的时候触发,并告知用户当前的网络连接状态和网络状态改变的原因。
- 参数
-
◆ onRemoteVideoStats()
void io.agora.recording.RecordingEventHandler.onRemoteVideoStats |
( |
long |
uid, |
|
|
RemoteVideoStats |
stats |
|
) |
| |
远端视频流统计信息回调。
该回调报告远端用户端到端的视频流统计信息,针对每个发送视频流的远端用户(通信模式)/主播(直播模式)每 2 秒触发一次。如果远端有多个用户/主播发送视频流,该回调每 2 秒会被触发多次。
- 参数
-
◆ onRemoteAudioStats()
void io.agora.recording.RecordingEventHandler.onRemoteAudioStats |
( |
long |
uid, |
|
|
RemoteAudioStats |
stats |
|
) |
| |
远端音频流统计信息回调。
该回调描述远端用户端到端的音频流统计信息,针对每个发送音频流的远端用户(通信模式)/主播(直播模式)每 2 秒触发一次。如果远端有多个用户/主播发送音频流,该回调每 2 秒会被触发多次。
- 参数
-
◆ onRecordingStats()
void io.agora.recording.RecordingEventHandler.onRecordingStats |
( |
RecordingStats |
stats | ) |
|
录制统计信息回调。
录制 SDK 定期向录制端报告当前录制的统计信息,每两秒触发一次。
- 参数
-
◆ onLocalUserRegistered()
void io.agora.recording.RecordingEventHandler.onLocalUserRegistered |
( |
long |
uid, |
|
|
String |
userAccount |
|
) |
| |
该回调表示本地用户已成功注册 User Account。
录制端调用 createChannelWithUserAccount 方法成功注册 User Account 后,SDK 会触发该回调,并报告录制端的 UID 和 User Account。
- 参数
-
uid | 录制端的 UID。 |
userAccount | 录制端的 User Account。 |
◆ onUserInfoUpdated()
void io.agora.recording.RecordingEventHandler.onUserInfoUpdated |
( |
long |
uid, |
|
|
String |
userAccount |
|
) |
| |
该回调提示远端用户的信息已更新。
远端用户加入频道后, SDK 会获取到该远端用户的 UID 和 User Account,在本地触发 onUserInfoUpdated
。
- 参数
-
uid | 远端用户的 UID。 |
userAccount | 录制端的 User Account。 |