NERtc iOS SDK V4.6.10
|
The INERtcChannel
class provides methods that enable real-time communications in a specified channel.
More...
#import <INERtcChannel.h>
Instance Methods | |
(int) | - destroy |
Destroys an IRtcChannel instance to release resources. More... | |
(int) | - setChannelDelegate: |
Sets the channel delegate. More... | |
(NSString *) | - getChannelName |
Gets the current channel name. More... | |
(NERtcConnectionStateType) | - connectionState |
Gets the connection status. More... | |
(int) | - joinChannelWithToken:completion: |
Joins an RTC room. More... | |
(int) | - leaveChannel |
Leaves a room, such as hanging up or ending a call. More... | |
(int) | - enableLocalAudio: |
Enables or disables local audio capture. More... | |
(int) | - enableLocalVideo: |
Specifies whether to enable local video capture. More... | |
(int) | - enableMediaPub:withMediaType: |
Publishes or unpublishes the local audio stream. More... | |
(int) | - enableDualStreamMode: |
Enables or disables the dual-stream mode. More... | |
(int) | - setCameraCaptureConfig: |
Sets the camera capturer configuration. More... | |
(int) | - setLocalVideoConfig: |
Sets the video encoding profile. More... | |
(int) | - subscribeRemoteAudio:forUserID: |
Subscribes to or unsubscribes from audio streams from specified remote users. More... | |
(int) | - subscribeAllRemoteAudio: |
Subscribes to or unsubscribes from audio streams from all remote users. More... | |
(int) | - setAudioSubscribeOnlyBy: |
Sets the local audio stream can be subscribed by specified participants in a room. More... | |
(int) | - muteLocalAudio: |
Stops or resumes publishing the local audio stream. More... | |
(int) | - setupLocalVideoCanvas: |
Sets the local view. More... | |
(int) | - setLocalRenderScaleMode: |
Sets the local video display mode. More... | |
(int) | - setupRemoteVideoCanvas:forUserID: |
Sets views for remote users. More... | |
(int) | - setRemoteRenderScaleMode:forUserID: |
Sets the remote video display mode. More... | |
(int) | - subscribeRemoteVideo:forUserID:streamType: |
Subscribes to or unsubscribes from video streams from specified remote users. More... | |
(int) | - muteLocalVideo: |
Stops or resumes publishing the local video stream. More... | |
(int) | - setClientRole: |
Sets the role of a user in live streaming. More... | |
(int) | - adjustUserPlaybackSignalVolume:forUserID: |
Adjust the volume of local signal playback from a specified remote user. More... | |
(int) | - enableLocalSubStreamAudio: |
Enables or disables the audio substream. More... | |
(int) | - subscribeRemoteSubStreamAudio:forUserID: |
Subscribes or unsubscribes audio streams from specified remote users. More... | |
(int) | - muteLocalSubStreamAudio: |
Mutes or unmutes the local upstream audio stream. More... | |
(int) | - setupLocalSubStreamVideoCanvas: |
Sets the local substream canvas. More... | |
(int) | - startScreenCapture: |
Enables screen sharing. More... | |
(int) | - stopScreenCapture |
Disables screen sharing with the substream transmission. More... | |
(int) | - setLocalRenderSubStreamScaleMode: |
Sets the display mode of the local substream video for screen sharing. More... | |
(int) | - setupRemoteSubStreamVideoCanvas:forUserID: |
Sets a remote substream canvas. More... | |
(int) | - subscribeRemoteSubStreamVideo:forUserID: |
Subscribes to or unsubscribes from remote video substream for screen sharing. More... | |
(int) | - setRemoteRenderSubStreamVideoScaleMode:forUserID: |
Sets the display mode of to remote substream video for screen sharing. More... | |
(int) | - setRemoteHighPriorityAudioStream:forUserID:streamType: |
Sets a remote audio stream to high priority. More... | |
(int) | - setLocalCanvasWatermarkConfigs:withStreamType: |
Adds a watermark image to the local video. More... | |
(int) | - setRemoteCanvasWatermarkConfigs:forUserID:withStreamType: |
Adds a watermark to the remote video canvas. More... | |
(int) | - takeLocalSnapshot:callback: |
Takes a local video snapshot. More... | |
(int) | - takeRemoteSnapshot:forUserID:callback: |
Takes a snapshot of a remote video. More... | |
(int) | - sendSEIMsg:streamChannelType: |
Sends supplemental enhancement information (SEI) data through a specified mainstream or substream. More... | |
(int) | - sendSEIMsg: |
Sends SEI data through the mainstream. More... | |
(int) | - addLiveStreamTask:compeltion: |
Adds a streaming task in a room. More... | |
(int) | - updateLiveStreamTask:compeltion: |
Updates a streaming task. More... | |
(int) | - removeLiveStreamTask:compeltion: |
Deletes a streaming task. More... | |
(int) | - addChannelMediaStatsObserver: |
Registers a channel media stats observer. More... | |
(int) | - removeChannelMediaStatsObserver: |
Remove a channel media stats observer. More... | |
(int) | - cleanupChannelMediaStatsObserver |
Remove all channel media stats observers. More... | |
(int) | - startChannelMediaRelay: |
Starts to relay media streams across rooms. More... | |
(int) | - updateChannelMediaRelay: |
Updates the information of the destination room for media stream relay. More... | |
(int) | - stopChannelMediaRelay |
Stops media stream relay across rooms. More... | |
(int) | - setLocalMediaPriority:preemptive: |
Sets the priority of media streams from a local user. More... | |
(int) | - setLocalPublishFallbackOption: |
Sets the fallback option for the published local video stream based on the network conditions. More... | |
(int) | - setRemoteSubscribeFallbackOption: |
Sets the fallback option for the subscribed remote audio and video stream with poor network connections. More... | |
The INERtcChannel
class provides methods that enable real-time communications in a specified channel.
By creating multiple NERtcChannel instances, users can join multiple channels.
- (int) addChannelMediaStatsObserver: | (id< NERtcChannelMediaStatsObserver >) | observer |
Registers a channel media stats observer.
observer | The stats observer. For more information, see NERtcChannelMediaStatsObserver 。 |
- (int) addLiveStreamTask: | (NERtcLiveStreamTaskInfo *) | taskInfo | |
compeltion: | (NERtcLiveStreamCompletion) | completion | |
Adds a streaming task in a room.
After you call the method, the current user can receive a notification about the status of live streaming.
taskInfo | The information about the streaming task. For more information, NERtcLiveStreamTaskInfo . |
completion | The result. The callback is triggered after the method is called. For more information, see NERtcLiveStreamCompletion . |
- (int) adjustUserPlaybackSignalVolume: | (uint32_t) | volume | |
forUserID: | (uint64_t) | userID | |
Adjust the volume of local signal playback from a specified remote user.
After you join the room, you can call the method to set the volume of local audio playback from different remote users or repeatedly adjust the volume of audio playback from a specified remote user.
userID | The ID of a remote user. |
volume | The playback volume. Valid values: 0 to 100.
|
- (int) cleanupChannelMediaStatsObserver |
Remove all channel media stats observers.
- (NERtcConnectionStateType) connectionState |
Gets the connection status.
- (int) destroy |
Destroys an IRtcChannel instance to release resources.
- (int) enableDualStreamMode: | (BOOL) | enable |
Enables or disables the dual-stream mode.
The method sets the individual-stream mode or dual-stream mode. If the dual-stream mode is enabled on the publishing client, the receiver can choose to receive the high-quality stream or low-quality stream video. The high-quality stream has a high resolution and high bitrate. The low-quality stream has a low resolution and low bitrate.
enable | A value of YES indicates that the dual-stream mode is enabled. A value of NO indicates that the dual stream mode is disabled. |
- (int) enableLocalAudio: | (BOOL) | enabled |
Enables or disables local audio capture.
<brWhen an app joins a room, the voice module is enabled by default. <brThe method does not affect receiving or playing back the remote audio stream. The enableLocalAudio(NO) method is suitable for scenarios where a user wants to receive the remote audio stream without sending audio streams to other users in the room.
enabled | The option whether to enable local Audio capture. |
- (int) enableLocalSubStreamAudio: | (BOOL) | enabled |
Enables or disables the audio substream.
If the audio substream is enabled, remote clients will get notified by NERtcChannelDelegate#onNERtcChannelUserSubStreamAudioDidStart:
, and NERtcChannelDelegate#onNERtcChannelUserSubStreamAudioDidStop:
when the audio stream is disabled.
enabled | specifies whether to enable the audio substream.
|
- (int) enableLocalVideo: | (BOOL) | enabled |
Specifies whether to enable local video capture.
enabled | The option whether to enable local video capture. |
- (int) enableMediaPub: | (BOOL) | enabled | |
withMediaType: | (NERtcMediaPubType) | mediaType | |
Publishes or unpublishes the local audio stream.
When a user joins a room, the feature is enabled by default.
The method does not affect receiving or playback remote audio streams. The enableLocalAudio(false) method is suitable for scenarios where only downstream data is received without upstream data.
enabled | specifies whether to publish the local audio stream.
|
mediaType | media type. Only the audio is supported. |
- (NSString *) getChannelName |
Gets the current channel name.
- (int) joinChannelWithToken: | (NSString *) | token | |
completion: | (NERtcJoinChannelCompletion) | completion | |
Joins an RTC room.
If the specified room does not exist when you join the room, a room with the specified name is automatically created in the server provided by CommsEase.
token | The certification signature used in authentication (NERTC Token). Valid values:
|
completion | The callback when the operation is complete. |
- (int) leaveChannel |
Leaves a room, such as hanging up or ending a call.
A user must call the leaveChannel method to end the call before the user makes another call. After you leave the room by calling the method, the onNERtcEngineDidLeaveChannelWithResult callback is triggered on the local client, and the onNERtcEngineUserDidLeaveWithUserID callback is triggered on a remote client.
- (int) muteLocalAudio: | (BOOL) | muted |
Stops or resumes publishing the local audio stream.
The method is used to stop or resume publishing the local audio stream.
muted | The option whether to enable publishing the local audio stream. |
- (int) muteLocalSubStreamAudio: | (BOOL) | muted |
Mutes or unmutes the local upstream audio stream.
muted | specifies whether to mute a local audio stream.
|
- (int) muteLocalVideo: | (BOOL) | muted |
Stops or resumes publishing the local video stream.
If you call the method successfully, the remote client triggers the onNERtcEngineUser:videoMuted: callback.
muted | The option whether to stop publishing the local video stream. |
- (int) removeChannelMediaStatsObserver: | (id< NERtcChannelMediaStatsObserver >) | observer |
Remove a channel media stats observer.
observer | The stats observer. For more information, see NERtcChannelMediaStatsObserver 。 |
- (int) removeLiveStreamTask: | (NSString *) | taskId | |
compeltion: | (NERtcLiveStreamCompletion) | completion | |
Deletes a streaming task.
taskId | The ID of a streaming task. |
completion | The result. The callback is triggered after the method is called. For more information, see NERtcLiveStreamCompletion . |
- (int) sendSEIMsg: | (NSData *) | data |
Sends SEI data through the mainstream.
When you publish the local audio and video stream, SEI data is also sent to sync some additional information. After SEI data is sent, the receiver can retrieve the content by listening for the onRecvSEIMsg callback.
data | The custom SEI data. |
- (int) sendSEIMsg: | (NSData *) | data | |
streamChannelType: | (NERtcStreamChannelType) | type | |
Sends supplemental enhancement information (SEI) data through a specified mainstream or substream.
When you publish the local audio and video stream, SEI data is also sent to sync some additional information. After SEI data is sent, the receiver can retrieve the content by listening for the onRecvSEIMsg callback.
data | The custom SEI data. |
type | The type of the channel with which the SEI data is transmitted. For more information, see NERtcStreamChannelType . |
- (int) setAudioSubscribeOnlyBy: | (NSArray< NSNumber * > *) | uidArray |
Sets the local audio stream can be subscribed by specified participants in a room.
All participants in the room can subscribe to the local audio stream by default.
uidArray | The list of user IDs that can subscribe to the local audio stream. |
- (int) setCameraCaptureConfig: | (NERtcCameraCaptureConfiguration *) | config |
Sets the camera capturer configuration.
For a video call or live streaming, generally the SDK controls the camera output parameters. By default, the SDK matches the most appropriate resolution based on the user's setLocalVideoConfig configuration. When the default camera capture settings do not meet special requirements, we recommend using this method to set the camera capturer configuration:
config | The camera capturer configuration. |
0
A value of 0 returned indicates that the method call is successful. Otherwise, the method call fails. - (int) setChannelDelegate: | (id< NERtcChannelDelegate >) | channelDelegate |
Sets the channel delegate.
channelDelegate | The channel delegate. |
- (int) setClientRole: | (NERtcClientRole) | role |
Sets the role of a user in live streaming.
The method sets the role to host or audience. The permissions of a host and an audience are different.
role | The role of a user. For more information, see NERtcClientRole . |
- (int) setLocalCanvasWatermarkConfigs: | (nullable NERtcCanvasWatermarkConfig *) | config | |
withStreamType: | (NERtcStreamChannelType) | type | |
Adds a watermark image to the local video.
type | The type of video streams. You can set the value to mainstream or substream. For more information, see NERtcStreamChannelType . |
config | The configuration of the watermark for the canvas. You can set text watermark, image watermark, and timestamp watermark. A value of null indicates removing the watermark. For more information, see NERtcCanvasWatermarkConfig . |
- (int) setLocalMediaPriority: | (NERtcMediaPriorityType) | priority | |
preemptive: | (BOOL) | preemptive | |
Sets the priority of media streams from a local user.
If a user has a high priority, the media stream from the user also has a high priority. In unreliable network connections, the SDK guarantees the quality of the media stream from users with a high priority.
priority | The priority of the local media stream. The default value is kNERtcMediaPriorityNormal, which indicates the normal priority. For more information, see NERtcMediaPriorityType . |
preemptive | The option whether to enable the preempt mode.
|
- (int) setLocalPublishFallbackOption: | (NERtcStreamFallbackOptions) | option |
Sets the fallback option for the published local video stream based on the network conditions.
The quality of the published local audio and video streams is degraded with poor quality network connections. After you call this method and set the option to kNERtcStreamFallbackOptionAudioOnly:
option | The fallback options for publishing audio and video streams. The default value is disabled. For more information, see NERtcStreamFallbackOptions . |
- (int) setLocalRenderScaleMode: | (NERtcVideoRenderScaleMode) | mode |
Sets the local video display mode.
mode | The video display mode. For more information, see NERtcVideoRenderScaleMode . |
- (int) setLocalRenderSubStreamScaleMode: | (NERtcVideoRenderScaleMode) | mode |
Sets the display mode of the local substream video for screen sharing.
Use this method if you want to enable screen sharing through the local substream. Apps can call this method multiple times to change the display mode.
mode | The video display mode. For more information, see NERtcVideoRenderScaleMode . |
- (int) setLocalVideoConfig: | (NERtcVideoEncodeConfiguration *) | config |
Sets the video encoding profile.
config | The video encoding profile. For more information, see NERtcVideoEncodeConfiguration . |
- (int) setRemoteCanvasWatermarkConfigs: | (nullable NERtcCanvasWatermarkConfig *) | config | |
forUserID: | (uint64_t) | userID | |
withStreamType: | (NERtcStreamChannelType) | type | |
Adds a watermark to the remote video canvas.
userID | The ID of a remote user. |
type | The type of video streams. You can set the value to mainstream or substream. For more information, see NERtcStreamChannelType . |
config | The configuration of the watermark for the canvas. You can set text watermark, image watermark, and timestamp watermark. A value of null indicates to remove the watermark. For more information, see NERtcCanvasWatermarkConfig . |
- (int) setRemoteHighPriorityAudioStream: | (BOOL) | enable | |
forUserID: | (uint64_t) | userID | |
streamType: | (NERtcAudioStreamType) | streamType | |
Sets a remote audio stream to high priority.
If a remote audio stream is set to high priority during automatic stream subscription, users can hear the audio stream with high priority.
enable | enables or disables the high priority of a remote audio stream
|
userID | User ID |
streamType | The type of subscribed audio stream. The default type is kNERtcAudioStreamMain. |
- (int) setRemoteRenderScaleMode: | (NERtcVideoRenderScaleMode) | mode | |
forUserID: | (uint64_t) | userID | |
Sets the remote video display mode.
mode | The video display mode. For more information, see NERtcVideoRenderScaleMode . |
userID | The ID of a remote user. |
- (int) setRemoteRenderSubStreamVideoScaleMode: | (NERtcVideoRenderScaleMode) | mode | |
forUserID: | (uint64_t) | userID | |
Sets the display mode of to remote substream video for screen sharing.
mode | The video display mode. For more information, see NERtcVideoRenderScaleMode . |
userID | The ID of a remote user. |
- (int) setRemoteSubscribeFallbackOption: | (NERtcStreamFallbackOptions) | option |
Sets the fallback option for the subscribed remote audio and video stream with poor network connections.
The quality of the subscribed audio and video streams is degraded with unreliable network connections. After you set the fallback options for the subscribed audio and video stream by using this method:
option | The fallback option for subscribing to audio and video streams. The default setting is to fall back to the low-quality video stream in the poor network. For more information, see NERtcStreamFallbackOptions . |
- (int) setupLocalSubStreamVideoCanvas: | (NERtcVideoCanvas *) | canvas |
Sets the local substream canvas.
This method is used to set the display information about the local screen sharing with the substream video. The app associates with the video view of local substream by calling this method. During application development, in most cases, before joining a room, you must first call this method to set the local video view after the SDK is initialized.
canvas | The video canvas. For more information, see NERtcVideoCanvas . To delete the canvas setting, set the value to nil. |
- (int) setupLocalVideoCanvas: | (NERtcVideoCanvas *_Nullable) | canvas |
Sets the local view.
This method is used to set the display information about the local video. The method is applicable only to local users. Remote users are not affected. Apps can call this API operation to associate with the view that plays local video streams. During application development, in most cases, before joining a room, you must first call this method to set the local video view after the SDK is initialized.
canvas | The video canvas. For more information, see NERtcVideoCanvas . If you want to delete the canvas, you can set the value to nil. |
- (int) setupRemoteSubStreamVideoCanvas: | (NERtcVideoCanvas *) | canvas | |
forUserID: | (uint64_t) | userID | |
Sets a remote substream canvas.
The method associates a remote user with a substream view. You can assign a specified userID to use a corresponding canvas.
userID | The ID of a remote user. |
canvas | The video canvas. For more information, see NERtcVideoCanvas . To delete the canvas setting, set the value to nil. |
- (int) setupRemoteVideoCanvas: | (NERtcVideoCanvas *_Nullable) | canvas | |
forUserID: | (uint64_t) | userID | |
Sets views for remote users.
This method is used to associate remote users with display views and configure the rendering mode and mirror mode for remote views displayed locally. The method affects only the video screen viewed by local users.
userID | The ID of a remote user. |
canvas | The video window. if you want to delete the canvas, you can set the value to nil. |
- (int) startChannelMediaRelay: | (NERtcChannelMediaRelayConfiguration *_Nonnull) | config |
Starts to relay media streams across rooms.
config | The configuration for media stream relay across rooms. For more information, see NERtcChannelMediaRelayConfiguration . |
- (int) startScreenCapture: | (NERtcVideoSubStreamEncodeConfiguration *) | config |
Enables screen sharing.
The content of the screen sharing is published through the substream.
You can call the method only after you join a room.
If you join a room and call this method to enable the substream, the onUserSubStreamVideoStart callback is triggered on the remote client.
config | The encoding configuration of the local substream. For more information, see NERtcVideoSubStreamEncodeConfiguration . |
- (int) stopChannelMediaRelay |
Stops media stream relay across rooms.
If the host leave the room, media stream replay across rooms automatically stops. You can also call stopChannelMediaRelay. In this case, the host leaves all destination rooms.
- (int) stopScreenCapture |
Disables screen sharing with the substream transmission.
If you use the method to disable the substream after you join a room, the onNERtcEngineUserSubStreamDidStop callback is triggered on the remote client.
- (int) subscribeAllRemoteAudio: | (BOOL) | subscribe |
Subscribes to or unsubscribes from audio streams from all remote users.
subscribe | The option whether to unsubscribe from audio streams from all remote users. |
- (int) subscribeRemoteAudio: | (BOOL) | subscribe | |
forUserID: | (uint64_t) | userID | |
Subscribes to or unsubscribes from audio streams from specified remote users.
After a user joins a room, audio streams from all remote users are subscribed by default. You can call this method to subscribe to or unsubscribe from audio streams from all remote users.
subscribe | The option whether to subscribe to specified audio streams. |
userID | The ID of a specified remote user. |
- (int) subscribeRemoteSubStreamAudio: | (BOOL) | subscribe | |
forUserID: | (uint64_t) | userID | |
Subscribes or unsubscribes audio streams from specified remote users.
After a user joins a room, audio streams from all remote users are subscribed by default. You can call this method to subscribe or unsubscribe audio streams from all remote users.
userID | indicates the user ID. |
subscribe | specifies whether to subscribe specified audio streams.
|
- (int) subscribeRemoteSubStreamVideo: | (BOOL) | subscribe | |
forUserID: | (uint64_t) | userID | |
Subscribes to or unsubscribes from remote video substream for screen sharing.
You can receive the video substream data only after you subscribe to the video substream.
subscribe | The option whether to subscribe to remote video substream for screen sharing. |
userID | The ID of a remote user. |
- (int) subscribeRemoteVideo: | (BOOL) | subscribe | |
forUserID: | (uint64_t) | userID | |
streamType: | (NERtcRemoteVideoStreamType) | streamType | |
Subscribes to or unsubscribes from video streams from specified remote users.
After a user joins a room, the video streams from remote users are not subscribed by default. If you want to view video streams from specified remote users, you can call this method to subscribe to the video streams from the user when the user joins the room or publishes the video streams.
subscribe | The option whether to unsubscribe from local video streams. |
userID | The ID of a specified user. |
streamType | The type of the video streams. For more information, see NERtcRemoteVideoStreamType . |
- (int) takeLocalSnapshot: | (NERtcStreamChannelType) | streamType | |
callback: | (NERtcTakeSnapshotCallback) | callback | |
Takes a local video snapshot.
The takeLocalSnapshot method takes a local video snapshot on the local mainstream or local substream. The callback that belongs to the NERtcTakeSnapshotCallback class returns the data of the snapshot image.
streamType | The video stream type of the snapshot. You can set the value to mainstream or substream. |
callback | The snapshot callback. |
- (int) takeRemoteSnapshot: | (NERtcStreamChannelType) | streamType | |
forUserID: | (uint64_t) | userID | |
callback: | (NERtcTakeSnapshotCallback) | callback | |
Takes a snapshot of a remote video.
The takeRemoteSnapshot method takes a snapshot from the remote video published through the mainstream or substream with a specified uid. The callback that belongs to the NERtcTakeSnapshotCallback class returns the data of the snapshot image.
userID | The ID of a remote user. |
streamType | The video stream type of the snapshot. You can set the value to mainstream or substream. |
callback | The snapshot callback. |
- (int) updateChannelMediaRelay: | (NERtcChannelMediaRelayConfiguration *_Nonnull) | config |
Updates the information of the destination room for media stream relay.
You can call this method to relay the media stream to multiple rooms or exit the current room.
config | The configuration for media stream relay across rooms. For more information, see NERtcChannelMediaRelayConfiguration . |
- (int) updateLiveStreamTask: | (NERtcLiveStreamTaskInfo *) | taskInfo | |
compeltion: | (NERtcLiveStreamCompletion) | completion | |
Updates a streaming task.
taskInfo | The information about the streaming task. For more information, see NERtcLiveStreamTaskInfo . |
completion | The result. The callback is triggered after the method is called. For more information, see NERtcLiveStreamCompletion . |