hyphenate_SDK3.0  3.8.1
hyphenatejavaIMSDK
| Public 成员函数 | 静态 Public 属性 | Protected 成员函数 | 所有成员列表
com.hyphenate.chat.EMCallManager类 参考

class  CallStateUnion
 
class  EMACallListenerDelegate
 
interface  EMCallPushProvider
 
interface  EMCameraDataProcessor
 

Public 成员函数

String getIncomingCallBroadcastAction ()
 
void setCameraDataProcessor (EMCameraDataProcessor processor)
 
void setPushProvider (EMCallPushProvider provider)
 
CallState getCallState ()
 
EMVideoCallHelper getVideoCallHelper ()
 
void makeVideoCall (String username) throws EMServiceNotReadyException
 
void makeVideoCall (String username, String ext) throws EMServiceNotReadyException
 
void makeVideoCall (String username, String ext, boolean recordOnServer, boolean mergeStream) throws EMServiceNotReadyException
 
void makeVoiceCall (String username) throws EMServiceNotReadyException
 
void makeVoiceCall (String username, String ext) throws EMServiceNotReadyException
 
void makeVoiceCall (String username, String ext, boolean recordOnServer, boolean mergeStream) throws EMServiceNotReadyException
 
void addCallStateChangeListener (EMCallStateChangeListener listener)
 
void removeCallStateChangeListener (EMCallStateChangeListener listener)
 
synchronized void setSurfaceView (EMCallSurfaceView localSurface, EMCallSurfaceView oppositeSurface)
 
void answerCall () throws EMNoActiveCallException
 
void rejectCall () throws EMNoActiveCallException
 
void endCall () throws EMNoActiveCallException
 
boolean isDirectCall ()
 
void pauseVoiceTransfer () throws HyphenateException
 
void resumeVoiceTransfer () throws HyphenateException
 
void pauseVideoTransfer () throws HyphenateException
 
void resumeVideoTransfer () throws HyphenateException
 
void muteRemoteAudio (boolean mute)
 
void muteRemoteVideo (boolean mute)
 
void setCameraFacing (int facing) throws HyphenateException
 
synchronized void switchCamera ()
 
int getCameraFacing ()
 
EMCallOptions getCallOptions ()
 
EMCallSession getCurrentCallSession ()
 
void inputExternalVideoData (byte[] data, int width, int height, int rotation)
 
void inputExternalVideoData (byte[] data, RtcConnection.FORMAT format, int width, int height, int stride, int sliceHeight, int rotation)
 
int inputExternalAudioData (byte[] data, int length)
 
void setWaterMark (EMWaterMarkOption waterMark)
 
void clearWaterMark ()
 

静态 Public 属性

static final String IncomingCallAction = ".action.incomingcall"
 

Protected 成员函数

 EMCallManager (EMClient client, EMACallManager manager)
 
void changeState (final CallState state, final CallError callError)
 

成员函数说明

void com.hyphenate.chat.EMCallManager.addCallStateChangeListener ( EMCallStateChangeListener  listener)

设置通话状态监听

参数
listener
void com.hyphenate.chat.EMCallManager.answerCall ( ) throws EMNoActiveCallException

接听通话

异常
EMNoActiveCallException
void com.hyphenate.chat.EMCallManager.endCall ( ) throws EMNoActiveCallException

挂断通话

异常
EMNoActiveCallException
int com.hyphenate.chat.EMCallManager.getCameraFacing ( )

获取当前正在使用的摄像头

返回
值可以是
int com.hyphenate.chat.EMCallManager.inputExternalAudioData ( byte[]  data,
int  length 
)

从外部直接输入音频数据 (发送的数据为计算出来的10ms的pcm byte数据 该功能目前只支持单声道,)

参数
data发送的自定义音频数据(计算出来的10ms的pcm byte数据)
length发送的自定义音频数据长度 ,是计算出来的10ms所需要的pcm byte数据长度, 计算方式: length = sampleRate * 10 / 1000 * bytesPerSample * channels. 参数说明:sampleRate 音频采样率 channels 音频声道(目前本sdk只支持单声道) bytesPerSample = BITS_PER_SAMPLE/8( 一般 BITS_PER_SAMPLE=16 , 默认的音频数据格式是PCM 16位每个样本.)
返回
0 - 输入成功 -1 - 输入失败,缓冲区未满 -2 - 输入失败,缓冲区满
void com.hyphenate.chat.EMCallManager.inputExternalVideoData ( byte[]  data,
int  width,
int  height,
int  rotation 
)

从外部直接输入视频数据, 仅支持NV21数据格式

参数
data
width
height
rotation
void com.hyphenate.chat.EMCallManager.inputExternalVideoData ( byte[]  data,
RtcConnection.FORMAT  format,
int  width,
int  height,
int  stride,
int  sliceHeight,
int  rotation 
)

从外部直接输入视频数据

参数
data
width
height
stride,usedin NV12 format, usally same as width
sliceHeight,usedin NV12 format, usally same as height
rotation
boolean com.hyphenate.chat.EMCallManager.isDirectCall ( )

返回当前通话时是否为P2P直连

返回
void com.hyphenate.chat.EMCallManager.makeVideoCall ( String  username) throws EMServiceNotReadyException

发起呼叫,进行视频通话请求,进行视频呼叫前,请先在Activity.onCreate中先执行setSurfaceView。

参数
username被呼叫的用户id
异常
EMServiceNotReadyException呼叫过程中遇到异常
void com.hyphenate.chat.EMCallManager.makeVideoCall ( String  username,
String  ext 
) throws EMServiceNotReadyException

发起呼叫,进行视频通话请求,进行视频呼叫前,请先在Activity.onCreate中先执行setSurfaceView。

参数
username被呼叫的用户id
ext扩展字段,用户可以用来传输自定义的内容
异常
EMServiceNotReadyException呼叫过程中遇到异常
void com.hyphenate.chat.EMCallManager.makeVideoCall ( String  username,
String  ext,
boolean  recordOnServer,
boolean  mergeStream 
) throws EMServiceNotReadyException

发起呼叫,进行视频通话请求,进行视频呼叫前,请先在Activity.onCreate中先执行setSurfaceView。

参数
username被呼叫的用户id
ext扩展字段,用户可以用来传输自定义的内容
recordOnServer是否在服务器端录制该通话
mergeStream服务器端录制时是否合并流
异常
EMServiceNotReadyException呼叫过程中遇到异常
void com.hyphenate.chat.EMCallManager.makeVoiceCall ( String  username) throws EMServiceNotReadyException

发起呼叫,进行语音通话请求

参数
username被呼叫的用户id
异常
EMServiceNotReadyException呼叫过程中遇到异常 如果IM没有连接,或者之前通话的连接没有断开,会抛出次异常
void com.hyphenate.chat.EMCallManager.makeVoiceCall ( String  username,
String  ext 
) throws EMServiceNotReadyException

发起呼叫,进行语音通话请求

参数
username被呼叫的用户id
ext扩展字段,用户可以用来传输自定义的内容
异常
EMServiceNotReadyException呼叫过程中遇到异常 如果IM没有连接,或者之前通话的连接没有断开,会抛出次异常
void com.hyphenate.chat.EMCallManager.makeVoiceCall ( String  username,
String  ext,
boolean  recordOnServer,
boolean  mergeStream 
) throws EMServiceNotReadyException

发起呼叫,进行语音通话请求

参数
username被呼叫的用户id
ext扩展字段,用户可以用来传输自定义的内容
recordOnServer是否在服务器端录制该通话
mergeStream服务器端录制时是否合并流
异常
EMServiceNotReadyException呼叫过程中遇到异常 如果IM没有连接,或者之前通话的连接没有断开,会抛出次异常
void com.hyphenate.chat.EMCallManager.muteRemoteAudio ( boolean  mute)

mute远端音频

void com.hyphenate.chat.EMCallManager.muteRemoteVideo ( boolean  mute)

~ mute远端视频

void com.hyphenate.chat.EMCallManager.pauseVideoTransfer ( ) throws HyphenateException

实时通话时停止视频数据传输

void com.hyphenate.chat.EMCallManager.pauseVoiceTransfer ( ) throws HyphenateException

实时通话时暂停语音数据传输

void com.hyphenate.chat.EMCallManager.rejectCall ( ) throws EMNoActiveCallException

拒绝接听

异常
EMNoActiveCallException
void com.hyphenate.chat.EMCallManager.removeCallStateChangeListener ( EMCallStateChangeListener  listener)

移除通话监听

参数
listener
void com.hyphenate.chat.EMCallManager.resumeVideoTransfer ( ) throws HyphenateException

实时通话时恢复视频数据传输

void com.hyphenate.chat.EMCallManager.resumeVoiceTransfer ( ) throws HyphenateException

实时通话时恢复语音数据传输

void com.hyphenate.chat.EMCallManager.setCameraDataProcessor ( EMCameraDataProcessor  processor)

Not implemented. This method will be removed in future versions.

参数
processor
void com.hyphenate.chat.EMCallManager.setCameraFacing ( int  facing) throws HyphenateException

开启相机拍摄

参数
facing参数可以是CameraInfo.CAMERA_FACING_BACK, 或者CameraInfo.CAMERA_FACING_FRONT
异常
HyphenateException如果cameraIndex不是CameraInfo.CAMERA_FACING_BACK,也不是CameraInfo.CAMERA_FACING_FRONT,会抛出异常.
synchronized void com.hyphenate.chat.EMCallManager.setSurfaceView ( EMCallSurfaceView  localSurface,
EMCallSurfaceView  oppositeSurface 
)

这里一定要在{Activity::onCreate()}方法中调用,防止无法准确获取到 surface 大小

参数
localSurface默认本地预览画面控件
oppositeSurface默认远端画面控件

该类的文档由以下文件生成: