概述
ChatGameSDK是即时通讯的消息和媒体通道,提供基本的数据传输能力,ChatGameSDK可以方便地帮助开发者进行消息收发、文件共享、群组消息、视频电话、视频直播、在线教育等。 ChatGameSDK不提供数据存储和管理,不侵入开发者APP的用户和数据;开发者在集成ChatGameSDK时,需要自己管理用户数据、用户关系、消息存储、文件存储。ok
接口说明
登录
public boolean loginToMessageServer(String userName, String sessionId, String hostname, String language, String regionCode, new ConnectCallback(){ @Override public void messageServerLoginSuccess(int status, String msg) {} @Override public void messageServerLoginError(int status, String msg) {} @Override public void messageServerKickoff(int status, String msg) {} });
消息
boolean sendTextMessageToUser(String peerName, String content, String[] clientUUID); boolean sendImageUrlToUser(String peerName, String url, String[] clientUUID); boolean sendAudioMessageToUser(String peerName, String url, String[] clientUUID); boolean sendVideoMessageToUser(String peerName, String describe, String shortUrl, String videoUrl, String[] clientUUID); boolean sendTextMessageToGroup(String groupName, String content, String[] clientUUID); boolean sendImageUrlToGroup(String groupName, String url, String[] clientUUID); boolean sendAudioMessageToGroup(String groupName, String url, String[] clientUUID); boolean sendVideoMessageToGroup(String groupName, String describe, String shortUrl, String videoUrl, String[] clientUUID); boolean sendSystemMessage(int messageType, String from, String to, long expired, String pushMessage, String message, String[] clientUUID) boolean messageReceived(long msgUUID); boolean sendUnReliableForwardDataInCall(byte[] data, String[] clientUUID); boolean sendReliableForwardDataInCall(byte[] data, String[] clientUUID); public synchronized void setMessageListener(new MessageListener() { @Override public void messageResponse(String clientUUID, long msgUUID, MessageStatus status, long timestamp) {} @Override public void textMessageReceive(long msgUUID, String clientUUID, String peerName, String content, long timestamp) {} @Override public void audioMessageReceive(long msgUUID, String clientUUID, String peerName, String url, long timestamp) {} @Override public void videoMessageReceive(long msgUUID, String clientUUID, String peerName, String describe, String imageurl, String videoUrl, long timestamp) {} @Override public void imageReceive(long msgUUID, String clientUUID, String peerName, String url, long timestamp) {} @Override public void forwardReceive(long msgUUID, String clientUUID, String peerName, byte[] data, long timestamp) {} @Override public void groupMessageReceive(long msgUUID, String clientUUID, String groupName, String peerName, String content, long timestamp) {} @Override public void groupImageReceive(long msgUUID, String clientUUID, String groupName, String peerName, String url, long timestamp) {} @Override public void groupAudioMessageReceive(long msgUUID, String clientUUID, String groupName, String peerName, String url, long timestamp) {} @Override public void groupVideoMessageReceive(long msgUUID, String clientUUID, String groupName, String peerName, String describe, String imageurl, String videoUrl, long timestamp) {} @Override public void systemNotify(long msgUUID, String clientUUID, String content, long timestamp); });
电话
boolean videoCall(String peerName, String[] roomID, byte[] extraData); boolean audioCall(String peerName, String[] roomID, byte[] extraData); boolean groupCall(String groupID, String roomID, int ssrc, int csrc, String relayServer, byte[] extraData); boolean acceptVideo(byte[] extraData); boolean acceptAudio(byte[] extraData); boolean reject(); boolean hangup(); boolean busy(); boolean setAudioSDP(String sdp); boolean setVideoSdp(String voipSdp); boolean setOSInfo(String OSInfo); public synchronized void setCallListener(new CallListener(){ @Override public void videoIncoming(int status, String peer_name,byte[] extraData); @Override public void audioIncoming(int status, String peer_name,byte[] extraData); @Override public void videoAccept(int status, String peer_name, byte[] extraData); @Override public void audioAccept(int status, String peer_name, byte[] extraData); @Override public void reject(int status, String peer_name); @Override public void hangup(int status, String peer_name); @Override public void busy(int status, String peer_name); @Override public void missVideoCall(int status, String peer_name,byte[] extraData, String roomId); @Override public void missAudioCall(int status, String peer_name,byte[] extraData, String roomId); @Override public void groupAccept(int status, String groupId, byte[] extraData); @Override public void groupReject(int status, String groupId, byte[] extraData); @Override public void groupHangup(int status, String groupId, byte[] extraData); @Override public void sendMediaDataStart(int status, String peer_name, CallType call_type, NetworkType peer_nettype, int cpuLevel, int screen_aspect, String peer_sdp, String peer_os, String voip_sdp, int recommendBitrate); @Override public void waitingData(int status, String peer_name, int timeOut); @Override public void recoverData(int status, String peer_name); @Override public void setQosParameter(String voipQos); });