NERtc iOS SDK
V4.4.301
|
The common interface of NERtcEngine. 更多...
#import <INERtcEngine.h>
构造函数 | |
(NERtcConnectionStateType) | - connectionState |
Gets the connection status. 更多... | |
(int) | - setupEngineWithContext: |
Creates an NERtcEngine instance and initializes the NERTC SDK. 更多... | |
(int) | - joinChannelWithToken:channelName:myUid:completion: |
Joins an RTC room. 更多... | |
(int) | - leaveChannel |
Leaves a room, such as hanging up or ending a call. 更多... | |
(int) | - switchChannelWithToken:channelName:completion: |
Switches to a different RTC room. 更多... | |
(int) | - enableLocalAudio: |
Enables or disables local audio capture. 更多... | |
(int) | - enableLocalVideo: |
Specifies whether to enable local video capture. 更多... | |
(int) | - setChannelProfile: |
Sets a room scene. 更多... | |
(int) | - setLocalVideoConfig: |
Sets the video encoding profile. 更多... | |
(int) | - setAudioProfile:scenario: |
Sets the audio encoding profile. 更多... | |
(int) | - setupLocalVideoCanvas: |
Sets the local view. 更多... | |
(int) | - setupRemoteVideoCanvas:forUserID: |
Sets views for remote users. 更多... | |
(int) | - switchCamera |
Switches between the front and rear cameras. 更多... | |
(int) | - setClientRole: |
Sets the role of a user in live streaming. 更多... | |
(int) | - setParameters: |
Sets parameters for audio and video calls. 更多... | |
The common interface of NERtcEngine.
- (NERtcConnectionStateType) connectionState |
Gets the connection status.
- (int) enableLocalAudio: | (BOOL) | enabled |
Enables or disables local audio capture.
When an app joins a room, the voice module is enabled by default.
The 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) enableLocalVideo: | (BOOL) | enabled |
Specifies whether to enable local video capture.
enabled | The option whether to enable local video capture. |
- (int) joinChannelWithToken: | (NSString *) | token | |
channelName: | (NSString *) | channelName | |
myUid: | (uint64_t) | uId | |
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 YunXin.
token | The certification signature used in authentication (NERTC Token). Valid values:
|
channelName | The name of the room. Users that use the same name can join the same room. < br>The name must be of STRING type and must be 1 to 64 characters in length. The following 89 characters are supported: a-z, A-Z, 0-9, space, !#$%&()+-:;≤.,>? @[]^_{|}~” |
uid | The unique identifier of a user. The uid of each user in a room must unique. uid is optional, The default value is 0. If the uid is not specified (set to 0), the SDK automatically assigns a random uid and returns the uid in NERtcJoinChannelCompletion. The application layer must keep and maintain the return value. The SDK does not maintain the return value. |
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) setAudioProfile: | (NERtcAudioProfileType) | profile | |
scenario: | (NERtcAudioScenarioType) | scenario | |
Sets the audio encoding profile.
profile | The sample rate, bitrate, encoding mode, and the number of channels. For more information, see NERtcAudioProfileType. |
scenario | The type of an audio scenario. For more information, see NERtcAudioScenarioType. |
- (int) setChannelProfile: | (NERtcChannelProfileType) | channelProfile |
Sets a room scene.
You can set a room scene for a call or live event. Different QoS policies are applied to different scenes.
channelProfile | The room scene. For more information, see NERtcEngineEnum.NERtcChannelProfileType. |
- (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) setLocalVideoConfig: | (NERtcVideoEncodeConfiguration *) | config |
Sets the video encoding profile.
config | The video encoding profile. For more information, see NERtcVideoEncodeConfiguration. |
- (int) setParameters: | (NSDictionary *) | parameters |
Sets parameters for audio and video calls.
parameters | The parameters that you want to specify. For more information about the key parameters, see the definition in NERtcEngineBase.h. |
- (int) setupEngineWithContext: | (NERtcEngineContext *) | context |
Creates an NERtcEngine instance and initializes the NERTC SDK.
context | The RTC engine context object passed. For more information, see NERtcEngineContext. |
- (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) setupRemoteVideoCanvas: | (NERtcVideoCanvas *) | 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) switchCamera |
Switches between the front and rear cameras.
Make sure that you call this method after the camera starts. For example, you can call this method after you call startPreview or joinChannel.
- (int) switchChannelWithToken: | (NSString *) | token | |
channelName: | (NSString *) | channelName | |
completion: | (NERtcJoinChannelCompletion) | completion | |
Switches to a different RTC room.
In live streaming, the audience can call this method to switch from the current room to another room.
After you successfully switch to the destination room, the local client receives a message sent by onNERtcEngineDidLeaveChannelWithResult. The remote user receives messages sent by onNERtcEngineUserDidLeaveWithUserID and onNERtcEngineUserDidJoinWithUserID.
token | The certification signature generated in the server and used for authentication. Valid values:
|
channelName | The room name that a user wants to switch to. |
completion | The callback when the operation is complete. |