JCClient¶
- public class JCClient¶
JumpChat client class. Create this object to use JumpChat services.
Fields¶
FOURCC_ABGR¶
- public static final int FOURCC_ABGR¶
Specify image format ABGR.
See also: JCVideoCaptureCallback.provideFrame(byte[],int,int,int), JCVideoCaptureCallback.provideFrame(byte[],int,int,int,long,int)
FOURCC_ARGB¶
- public static final int FOURCC_ARGB¶
Specify image format ARGB.
See also: JCVideoCaptureCallback.provideFrame(byte[],int,int,int), JCVideoCaptureCallback.provideFrame(byte[],int,int,int,long,int)
FOURCC_NV21¶
- public static final int FOURCC_NV21¶
Specify image format NV12.
See also: JCVideoCaptureCallback.provideFrame(byte[],int,int,int), JCVideoCaptureCallback.provideFrame(byte[],int,int,int,long,int)
FOURCC_YV12¶
- public static final int FOURCC_YV12¶
Specify image format YV12.
See also: JCVideoCaptureCallback.provideFrame(byte[],int,int,int), JCVideoCaptureCallback.provideFrame(byte[],int,int,int,long,int)
ROOM_TYPE_CUSTOM¶
ROOM_TYPE_DEFAULT¶
- public static final String ROOM_TYPE_DEFAULT¶
Default room type is JCClient.ROOM_TYPE_RANDOM.
ROOM_TYPE_RANDOM¶
SETTING_API_KEY¶
- public static final String SETTING_API_KEY¶
Specify the API key that should be used by the JumpChat web API.
See also: JCClient.JCClient(Callback,Context,Map)
SETTING_CREATE_VIDEO¶
- public static final String SETTING_CREATE_VIDEO¶
Settings to disable creating JCVideoView objects. This is mainly used when JCClient is only a broadcaster.
See also: JCClient.JCClient(Callback,Context,Map)
SETTING_SERVER_NAME¶
- public static final String SETTING_SERVER_NAME¶
Settings to specify the serverName to connect to. Use this if running a standalone JumpChat server.
See also: JCClient.JCClient(Callback,Context,Map)
SETTING_USER_AVATAR¶
- public static final String SETTING_USER_AVATAR¶
Specify the current user’s avatar. The string is a Base64 encoded JPEG.
See also: JCClient.JCClient(Callback,Context,Map)
SETTING_USER_ID¶
- public static final String SETTING_USER_ID¶
Specify the user id of the current user. Any unique string can be used to specify the user id.
See also: JCClient.JCClient(Callback,Context,Map)
SETTING_USER_NAME¶
- public static final String SETTING_USER_NAME¶
Specify the current user’s name.
See also: JCClient.JCClient(Callback,Context,Map)
SETTING_VIDEO_CAPTURE_CLASS¶
- public static final String SETTING_VIDEO_CAPTURE_CLASS¶
Specify the class to be used when override the video capturer. This is used when the developer wants to implement a custom video capturer.
See also: JCClient.JCClient(Callback,Context,Map)
Constructors¶
JCClient¶
- public JCClient(Callback callback, Context context)¶
JCClient constructor. You should generally not create more than one within the application.
Example:
JCClient mJC = new JCClient(callback, getApplicationContext(), activity);
Parameters: - callback – JCClient.Callback implementation
- context – Context object from Android application
JCClient¶
- public JCClient(Callback callback, Context context, Map<String, String> settings)¶
JCClient constructor. You should generally not create more than one within the application.
Settings map should use JCClient constants
Example:
Bitmap avatar = BitmapFactory.decodeResource(activity.getResources(), R.drawable.avatar) Map settings = new Map settings() {{ put(JCClient.SETTING_USER_ID, "userid-123456790"); put(JCClient.SETTING_USER_NAME, "JumpChat Android SDK Example"); put(JCClient.SETTING_USER_AVATAR, JCClient.encodeBitmap(avatar)); }}; JCClient jc = new JCClient(callback, getApplicationContext(), activity);
Parameters: - callback – JCClient.Callback implementation
- context – Context object from Android application
- settings – Provide custom settings for JumpChat client
Methods¶
checkVersion¶
- public void checkVersion(String clientName)¶
Request a version check for a given client name. If the application is not registered, an empty string will be returned in JCClient.Callback.onVersionCheck(String)
Parameters: - clientName – String of the client name.
See also: JCClient.Callback.onVersionCheck(String)
createRoom¶
- public void createRoom()¶
Request the server to create a new room. The result is ready, JCClient.Callback.onRoomCreated(String) is called.
See also: JCClient.Callback.onRoomCreated(String)
enableAudio¶
- public boolean enableAudio(boolean enabled)¶
Mute/Unmute the recording microphone. Returns the new state.
Parameters: - enabled – true if audio is enable, false otherwise
Returns: true if audio is enable, false otherwise
enableHD¶
- public boolean enableHD(boolean enable)¶
Enable/Disable capturing video in HD. HD resolutions is 1280x720. SD resolution is 640x480.
Parameters: - enable – true if HD is enable, false otherwise
Returns: true if HD is enable, false otherwise
enableVideo¶
- public boolean enableVideo(boolean enabled)¶
Enable/Disable the camera. Return the new state.
Parameters: - enabled – true if video is enable, false otherwise
Returns: true if video is enable, false otherwise
encodeBitmap¶
getAudioBandwidth¶
- public int getAudioBandwidth()¶
Get the audio bandwidth limit in kilo bits per second for audio. Zero means unlimited.
Returns: Bandwidth limit value in kbps
getAvatar¶
- public Bitmap getAvatar(String userid)¶
Retrieve the Bitmap avatar for a specific user.
Example:
Bitmap avatar = mJC.getAvatar(userid); ImageView view = (ImageView)findViewById(R.id.image_view); view.setImageBitmap(avatar);
Parameters: - userid – User id of the avatar. Can be me for current user’s avatar.
Returns: Bitmap avatar of the user, null otherwise.
getInstance¶
getJoinUrl¶
getName¶
getPassword¶
getRoomName¶
getSessId¶
getUsers¶
- public Map<String, JSONObject> getUsers()¶
Get a map of userid to JSONObject representing the user information.
Example:
Map users = mJC.getUsers(); for (Map.Entry entry : users.entrySet()) { System.out.println(entry.getKey() + "/" + entry.getValue().toString()); }
Returns: Map of the users
getVideoBandwidth¶
- public int getVideoBandwidth()¶
Get the video bandwidth limit in kilo bits per second for audio. Zero means unlimited.
Returns: Bandwidth limit value in kbps
isAdmin¶
- public boolean isAdmin()¶
Check if current user is admin. Shortcut for isAdmin("me").
Returns: true if user id admin, false otherwise
isAdmin¶
join¶
join¶
- public void join(String roomName, String roomType)¶
Join a room, given a room name and room type.
Parameters: - roomName – String with the name of the room.
- roomType – JCClient.ROOM_TYPE_RANDOM or JCClient.ROOM_TYPE_CUSTOM
joinUrl¶
leave¶
- public void leave()¶
Leave the joined room.
See also: JCClient.join(String), JCClient.join(String,String), JCClient.joinUrl(String)
muteAudioStream¶
- public void muteAudioStream(boolean mute)¶
Mute/Unmute all incoming audio streams
Parameters: - mute – true to mute audio, false otherwise
onActivityResult¶
onPause¶
- public void onPause()¶
Call from Activity.onPause() to release camera.
onResume¶
- public void onResume()¶
Call from Activity.onResume() to acquire camera.
selectCamera¶
- public void selectCamera(int cameraId)¶
Select camera to receive video from. Use JCClient.CAMERA_FRONT or CAMERA_BACK.
Parameters: - cameraId – Camera id to select to.
sendDataMessage¶
- public void sendDataMessage(JSONObject dataMsg)¶
Send data message to everyone in the room.
Parameters: - dataMsg – JSONObject representing the data
sendDataMessage¶
- public void sendDataMessage(String userid, JSONObject dataMsg)¶
Send data message to everyone a user in the room.
Parameters: - userid – Specific user id string to send data to.
- dataMsg – JSONObject representing the data
sendKick¶
sendKnockAnswer¶
sendLock¶
- public void sendLock(Boolean lock)¶
Request room to be locked. Only the admin can lock the room.
Parameters: - lock – true if locking, false otherwise
See also: Callback.onRoomInfoUpdated()
sendTextMessage¶
sendTextMessage¶
setAudioBandwidth¶
- public void setAudioBandwidth(int bw)¶
Set the audio bandwidth limit in kilo bits per second for audio. Zero means unlimited.
Parameters: - bw – Bandwidth limit value in kbps
setServerName¶
- public void setServerName(String serverName)¶
Set the server name if using a federated server or running your own server.
Parameters: - serverName – Name of the server
See also: JCClient.SETTING_SERVER_NAME
setVideoBandwidth¶
- public void setVideoBandwidth(int bw)¶
Set the audio bandwidth limit in kilo bits per second for audio. Zero means unlimited.
Parameters: - bw – Bandwidth limit value in kbps
toggleCamera¶
- public int toggleCamera()¶
Toggle between front and back camera.
Returns: JCClient.CAMERA_FRONT or CAMERA_BACK