JMRTCSession Class Reference

Inherits from NSObject
Declared in JMRTCSession.h

– init

不支持使用的初始化方法

- (instancetype _Nonnull)init

Declared In

JMRTCSession.h

  channelId

@abstract当前通话的频道id

@property (nonatomic, assign, readonly) SInt64 channelId

Declared In

JMRTCSession.h

  mediaType

@abstract当前用户使用的媒体类型

@property (nonatomic, assign, readonly) JMRTCMediaType mediaType

Declared In

JMRTCSession.h

  inviter

邀请当前用户加入通话的邀请者

@property (nonatomic, strong, readonly) JMSGUser *inviter

Declared In

JMRTCSession.h

  invitingMembers

正在邀请中的用户

@property (nonatomic, strong, readonly) NSArray<__kindofJMSGUser*> *invitingMembers

Declared In

JMRTCSession.h

  joinedMembers

已经加入通话的用户

@property (nonatomic, strong, readonly) NSArray<__kindofJMSGUser*> *joinedMembers

Declared In

JMRTCSession.h

  startTime

连接建立时间

@property (nonatomic, assign, readonly) long long startTime

Declared In

JMRTCSession.h

– accept:

接听来电

此接口只能在收到通话邀请回调 [JMRTCDelegate onCallReceiveInvite:] 之后才能调用;

调用成功后,双方都会触发 [JMRTCDelegate onCallConnected:] 回调,通知上层通话连接已建立;

并且 SDK 会触发 [JMRTCDelegate onCallMemberJoin:] 通知当前已经在通话频道内的用户有新用户加入。

- (void)accept:(JMRTCCompletionHandler _Nullable)handler

Declared In

JMRTCSession.h

– hangup:

挂断通话

调用成功后,挂断方会触发 [JMRTCDelegate onCallDisconnect::disconnectReason:]通知上层连接断开,通话结束;

其他用户会触发 [JMRTCDelegate onCallMemberLeave:reason:]通知上层有用户离开.

- (void)hangup:(JMRTCCompletionHandler _Nullable)handler

Discussion

注意:SDK 一般情况不会主动调用 hangup,挂断通话操作由上层决定。此接口可以在邀请阶段以及通话阶段由任意通话中用户发起

Declared In

JMRTCSession.h

– refuse:

拒绝通话邀请

此接口只能在收到通话邀请回调 [JMRTCDelegate onCallReceiveInvite:] 之后才能调用;

调用成功后,拒绝方会触发 [JMRTCDelegate onCallDisconnect:disconnectReason:]通知上层连接断开,通话结束;

其他用户会触发 [JMRTCDelegate onCallMemberLeave:reason:]通知上层有用户离开.

- (void)refuse:(JMRTCCompletionHandler _Nullable)handler

Discussion

此接口可以在邀请阶段以及通话阶段由任意通话中用户发起

Declared In

JMRTCSession.h

– inviteUsers:handler:

邀请用户加入通话

被邀请方收到邀请时,会触发 [JMRTCDelegate onCallReceiveInvite:] 回调;

通话中的其他用户,会触发 [JMRTCDelegate onCallOtherUserInvited:fromUser:] 回调

- (void)inviteUsers:(NSArray<__kindofJMSGUser*> *_Nonnull)users handler:(JMRTCCompletionHandler _Nullable)handler

Parameters

users

用户列表

handler

回调,error=nil 时表示操作成功

Discussion

在通话已经建立的前提下,再邀请其他用户加入当前通话. 如果被邀请人中包含未登录用户只会向已登录用户发起邀请.

Declared In

JMRTCSession.h

– setVideoView:user:

设置用户视频展示 View

- (void)setVideoView:(UIView *_Nonnull)view user:(JMSGUser *_Nonnull)user

Parameters

view

视频的View

user

用户(自己或他人)

Discussion

在发起通话邀请之后,设置视频的展示 view

Declared In

JMRTCSession.h

  isMuted

静音状态

@property (nonatomic, assign, readonly) BOOL isMuted

Declared In

JMRTCSession.h

– setMuted:

设置静音状态

- (BOOL)setMuted:(BOOL)muted

Parameters

muted

是否静音

Declared In

JMRTCSession.h

  isSpeakerphoneEnabled

@abstract扬声器状态,是否开启扬声器

@property (nonatomic, assign, readonly) BOOL isSpeakerphoneEnabled

Discussion

音频通话的默认值为NO,视频通话的默认值为YES。

Declared In

JMRTCSession.h

– setSpeakerEnabled:

设置扬声器状态

- (BOOL)setSpeakerEnabled:(BOOL)enabled

Parameters

enabled

是否开启扬声器,音频通话默:NO,视频通话默认:YES

Discussion

只在视频或语音通话连接建立之后调用有效

Declared In

JMRTCSession.h

  isVideoStreamEnabled

是否开启视频流输出

@property (nonatomic, assign, readonly) BOOL isVideoStreamEnabled

Declared In

JMRTCSession.h

– setVideoStreamEnabled:

设置视频流状态

- (BOOL)setVideoStreamEnabled:(BOOL)enabled

Parameters

enabled

开启/关闭,音频通话默:NO,视频通话默认:YES

Discussion

该方法不影响本地视频流获取,没有禁用摄像头,只是暂停发送本地视频流,只在视频通话连接建立之后调用有效。

通话中的其他用户,会触发 [JMRTCDelegate onCallUserVideoStreamEnabled:byUser:] 回调

Declared In

JMRTCSession.h

– switchCameraMode

切换前后摄像头

- (BOOL)switchCameraMode

Declared In

JMRTCSession.h