- Android
- iOS
- JavaScript
- Flutter
- ReactNative
The SDK uses the ICallSession call-session object to manage audio and video calls. For outgoing calls, obtain the call session from the return value of startSingleCall or startMultiCall. For incoming calls, obtain it through the onCallReceive callback. You can also retrieve the session for a specified callId with the following method.
ICallSession callSession = JIM.getInstance().getCallManager().getCallSession(callId);
After obtaining a call session, developers can access call properties and accept or hang up calls.
// accept the incoming call
void accept();
// hang up the call
void hangup();
// enable or disable the camera
void enableCamera(boolean isEnable);
// set the user's video view
void setVideoView(String userId, View view);
// start the preview
void startPreview(View view);
// mute or unmute the microphone
void muteMicrophone(boolean isMute);
// mute or unmute the speaker
void muteSpeaker(boolean isMute);
// enable or disable loudspeaker output
// true uses the loudspeaker; false uses the earpiece
void setSpeakerEnable(boolean isEnable);
// switch cameras; true uses the front camera by default
void useFrontCamera(boolean isEnable);
// invite users to join the call (not supported when isMultiCall is false)
void inviteUsers(List<String> userIdList);
// call ID
String getCallId();
// whether this is a group call; false indicates a one-to-one call
boolean isMultiCall();
// media type (audio/video)
CallConst.CallMediaType getMediaType();
// call status
CallConst.CallStatus getCallStatus();
// call start time (when the current user was invited in a group call; this may differ from the overall call start time)
long getStartTime();
// time when the current user joined the call
long getConnectTime();
// time when the current user left the call
long getFinishTime();
// call initiator's user ID
String getOwner();
// ID of the user who invited the current user to the call
String getInviter();
// call end reason
CallConst.CallFinishReason getFinishReason();
// call participants (excluding the current user)
List<CallMember> getMembers();
// current user
CallMember getCurrentCallMember();
// extra field
String getExtra();
The SDK uses the id<JCallSession> call-session object to manage audio and video calls. For outgoing calls, obtain the call session from the return value of startSingleCall:mediaType:delegate: or startMultiCall:mediaType:delegate:. For incoming calls, obtain it through the callDidReceive: callback. You can also retrieve the session for a specified callId with the following method.
id<JCallSession> callSession = [JIM.shared.callManager getCallSession:@"callId1"];
After obtaining a call session, developers can access call properties and accept or hang up calls.
@protocol JCallSession <NSObject>
/// call ID
@property (nonatomic, copy) NSString *callId;
/// whether this is a group call; NO indicates a one-to-one call
@property (nonatomic, assign) BOOL isMultiCall;
/// media type (audio/video)
@property (nonatomic, assign) JCallMediaType mediaType;
/// call status
@property (nonatomic, assign) JCallStatus callStatus;
/// call start time (when the current user was invited in a group call; this may differ from the overall call start time)
@property (nonatomic, assign) long long startTime;
/// time when the current user joined the call
@property (nonatomic, assign) long long connectTime;
/// time when the current user left the call
@property (nonatomic, assign) long long finishTime;
/// call initiator's user ID
@property (nonatomic, copy) NSString *owner;
/// ID of the user who invited the current user to the call
@property (nonatomic, copy) NSString *inviter;
/// call end reason
@property (nonatomic, assign) JCallFinishReason finishReason;
/// call participants (excluding the current user)
@property (nonatomic, copy, readonly) NSArray <JCallMember *> *members;
/// current user
@property (nonatomic, strong, readonly) JCallMember *currentCallMember;
/// extra field
@property (nonatomic, copy) NSString *extra;
- (void)addDelegate:(id<JCallSessionDelegate>)delegate;
/// accept the incoming call
- (void)accept;
/// hang up the call
- (void)hangup;
/// enable or disable the camera
/// - Parameter isEnable: whether enabled
- (void)enableCamera:(BOOL)isEnable;
/// set the user's video view
/// - Parameters:
/// - view: video view
/// - userId: user ID (the current user or another user in the call)
- (void)setVideoView:(UIView *)view
forUserId:(NSString *)userId;
/// start the preview
/// - Parameter view: video view used for preview
- (void)startPreview:(UIView *)view;
/// mute or unmute the microphone
/// - Parameter isMute: whether muted
- (void)muteMicrophone:(BOOL)isMute;
/// mute or unmute the speaker
/// - Parameter isMute: whether muted
- (void)muteSpeaker:(BOOL)isMute;
/// enable or disable loudspeaker output
/// - Parameter isEnable: YES uses the loudspeaker; NO uses the earpiece
- (void)setSpeakerEnable:(BOOL)isEnable;
/// switch cameras; YES uses the front camera by default
/// - Parameter isEnable: YES uses the front camera; NO uses the rear camera
- (void)useFrontCamera:(BOOL)isEnable;
/// invite users to join the call (not supported when isMultiCall is NO)
/// - Parameter userIdList: list of user IDs to invite
- (void)inviteUsers:(NSArray <NSString *> *)userIdList;
The SDK uses the CallSession call-session object to manage audio and video calls. For outgoing calls, obtain the call session from the return value of startSingleCall or startMultiCall. For incoming calls, obtain it through the CallEvent.INVITED callback. You can also retrieve the session for a specified callId with the following method.
const callSession = juggleCall.getCallSession(callId);
After obtaining a call session, developers can access call properties and accept or hang up calls.
// start a one-to-one call
await callSession.startSingleCall({
memberId: 'user_id',
isEnableCamera: true,
isMuteMicrophone: false,
ext: ''
});
// start a group call
await callSession.startMultiCall({
memberIds: ['user_id1', 'user_id2'],
isEnableCamera: true,
isMuteMicrophone: false,
ext: ''
});
// accept the incoming call
await callSession.accept({
isEnableCamera: true,
isMuteMicrophone: false
});
// hang up the call
await callSession.hangup();
// mute or unmute the microphone
await callSession.muteMicrophone(true);
// mute or unmute the speaker
await callSession.muteSpeaker(true);
// invite users to join the call
await callSession.inviteUsers({
memberIds: ['user_id'],
isEnableCamera: true
});
// set the user's video view
await callSession.setVideoView({
userId: 'user_id',
videoElement: HTMLVideoElement
});
/// call ID
callId: string;
/// whether this is a group call; false indicates a one-to-one call
isMultiCall: boolean;
/// call status
callStatus: number;
/// call start time (when the current user was invited in a group call; this may differ from the overall call start time)
startTime: number;
/// time when the current user joined the call
connectTime: number;
/// time when the current user left the call
finishTime: number;
/// user who invited the current user to the call
inviter: object;
/// call participants (excluding the current user)
members: Array;
/// extra field
ext: string;
The SDK uses the CallSession call-session object to manage audio and video calls. For outgoing calls, obtain the call session from the return value of startSingleCall or startMultiCall. For incoming calls, obtain it through the onCallReceive callback. You can also retrieve the session for a specified callId with the following method.
CallSession callSession = await JuggleIm.instance.getCallSession(callId);
After obtaining a call session, developers can access call properties and accept or hang up calls.
// accept the incoming call
Future<void> accept() async;
// hang up the call
Future<void> hangup() async;
// enable or disable the camera
Future<void> enableCamera(bool isEnable) async;
// set the user's video view
Future<void> setVideoView(String userId, VideoView view) async;
// start the preview
Future<void> startPreview(VideoView view) async;
// mute or unmute the microphone
Future<void> muteMicrophone(bool isMute) async
// mute or unmute the speaker
Future<void> muteSpeaker(bool isMute) async;
// enable or disable loudspeaker output
// true uses the loudspeaker; false uses the earpiece
Future<void> setSpeakerEnable(bool isEnable) async;
// switch cameras; true uses the front camera by default
Future<void> useFrontCamera(bool isEnable) async;
// invite users to join the call (not supported when isMultiCall is false)
Future<void> inviteUsers(List<String> userIdList) async;
/// call ID
String callId = '';
/// whether this is a group call; false indicates a one-to-one call
bool isMultiCall = false;
/// media type (audio 0 / video 1)
int mediaType = 0;
/// call status (see CallStatus)
int callStatus = 0;
/// call start time (when the current user was invited in a group call; this may differ from the overall call start time)
int startTime = 0;
/// time when the current user joined the call
int connectTime = 0;
/// time when the current user left the call
int finishTime = 0;
/// call initiator's user ID
String owner = '';
/// ID of the user who invited the current user to the call
String inviterId = '';
/// call end reason (see CallFinishReason)
int finishReason = 0;
/// call participants (excluding the current user)
List<CallMember> members = [];
/// extra field
String extra = '';
The SDK uses the CallSession call-session object to manage audio and video calls. For outgoing calls, obtain the call session from the return value of startSingleCall or startMultiCall. For incoming calls, obtain it through the onCallReceive callback. You can also retrieve the session for a specified callId with the following method.
import JuggleIMCall from 'juggleim-rnsdk';
const callSession = await JuggleIMCall.getCallSession(callId);
After obtaining a call session, developers can access call properties and accept or hang up calls.
// accept the incoming call
await callSession.accept();
// hang up the call
await callSession.hangup();
// enable or disable the camera
await callSession.enableCamera(boolean);
// mute or unmute the microphone
await callSession.muteMicrophone(boolean);
// mute or unmute the speaker
await callSession.muteSpeaker(boolean);
// enable or disable loudspeaker output
// true uses the loudspeaker; false uses the earpiece
await callSession.setSpeakerEnable(boolean);
// switch cameras; true uses the front camera by default
await callSession.useFrontCamera(boolean);
// invite users to join the call (not supported when isMultiCall is false)
await callSession.inviteUsers(userIdList);
// set the user's video view
await callSession.setVideoView(userId: string, view: Component | null);
// start the preview
await callSession.startPreview(view);
/**
* stop the preview
* Used by the callee to stop the preview after hanging up before answering.
* After answering, the preview does not need to be stopped manually; call completion handles it automatically.
*
* Use cases:
* - As the callee, start the preview after receiving an incoming call, then hang up before answering; stop the preview
* - If the call was answered, do not call this method; the preview stops automatically when the call ends
*/
await callSession.stopPreview();
/// call ID
callId: string;
/// whether this is a group call; false indicates a one-to-one call
isMultiCall: boolean;
/// media type (audio 0 / video 1)
mediaType: number;
/// call status (see CallStatus)
callStatus: number;
/// call start time
startTime: number;
/// time when the current user joined the call
connectTime: number;
/// time when the current user left the call
finishTime: number;
/// call initiator's user ID
owner: string;
/// ID of the user who invited the current user to the call
inviterId: string;
/// call end reason (see CallFinishReason)
finishReason: number;
/// call participants (excluding the current user)
members: CallMember[];
/// current user
currentCallMember: CallMember;
/// extra field
extra: string;