-
Notifications
You must be signed in to change notification settings - Fork 1
sdk_api
Su, Jia edited this page May 16, 2018
·
8 revisions
- 鉴权
本sdk使用简单,初次使用需要在魔方服务后台申请token,用于客户鉴权,使用下面的接口鉴权
/**
* @token
* @enableVideo 是否使用视频,false表示不使用视频,纯音频连麦
* @listener 鉴权结果回调
*/
void authorize(String token, final boolean enableVideo, KMCAuthResultListener listener)
- 加入一个频道
/**
* @channel 标识通话的频道名称,长度在64字节以内的字符串
* @uid 用户ID,32位无符号整数。建议设置范围:1到(2^32-1),并保证唯一性。
* 如果不指定(即设为0),SDK 会自动分配一个
*/
void joinChannel(String channel, int uid)
- 离开频道,即挂断或退出通话
void leaveChannel()
- 本地视频数据使用下面的接口发送到远端
/**
* @buf 视频数据
* @width 宽
* @height 高
* @orientation 旋转角度
* @pts 时间戳
*/
void sendVideoFrame(byte[] buf, int width, int height,
int orientation, long pts)
- 远端视频数据回调
/**
* @buffer 视频数据
* @format 视频参数
* @pts 时间戳
*/
void onReceiveRemoteVideoFrame(ByteBuffer buffer, VideoFormat format, long pts)
- 本地音频数据回调
/**
* @buffer 音频数据
* @format 音频参数
* @pts 时间戳
*/
void onReceiveLocalAudioFrame(ByteBuffer buffer, AudioFormat format, long pts)
- 远端音频数据回调
/**
* @buffer 音频数据
* @format 音频参数
* @pts 时间戳
*/
void onReceiveRemoteAudioFrame(ByteBuffer buffer, AudioFormat format, long pts)
- 设置连麦的视频属性
该方法设置连麦时视频编码属性(Profile)。每个属性对应一套视频参数,如分辨率、帧率、码率等。
声网支持的profile,请查询声网文档
/**
* @profile 视频pfile
* @swap 是否交换宽高
*/
void setVideoProfile(int profile, boolean swap)
- 注册事件回调
/**
* @listener 事件回调
*/
void registerEventListener(KMCAgoraEventListener listener)
- 获取MediaManager对象
/**
* 获取MediaManger对象
* 通过MediaManager对象的getRtcEngine()方法可以获取当前RtcEngine
*/
MediaManager getMediaManager()
- 允许/禁止往网络发送本地音频流
/**
* 允许/禁止往网络发送本地音频流
* 该方法不影响录音状态,并没有禁用麦克风
* @param mute true 允许, false 禁止
*/
void muteLocalAudioStream(boolean mute)
- 允许/禁止播放远端用户的音频流
/**
* 允许/禁止播放远端用户的音频流,即对所有远端用户进行静音与否
* 该方法不影响音频数据流的接收,只是不播放音频流
* @param mute true 静音
*/
void muteAllRemoteAudioStreams(boolean mute)
- 设置声网log路径
public void setAgoraLogPath(String path)
- 开启或关闭日志
/**
* enable stat module or not
* the stat module is enabled by default
* @param enable
*/
public void enableStat(boolean enable)
- 设置log回调
/**
* set the log listener
* @param listener
*/
public void setLogListener(OnLogEventListener listener)