TcrSession Class Reference
Inherits from | NSObject |
---|---|
Declared in | TcrSession.h TcrSession.m |
– initWithParams:andDelegate:
Initialize local resources, asynchronously callback results
- (instancetype)initWithParams:(NSDictionary *)params andDelegate:(id<TcrSessionObserver>)Observer
Parameters
params |
Optional, the following key-value pairs can be selected: - @“preferredCodec”: Optional values are @“H264” or @“H265”. Used to set the preferred codec. If the value is not @“H264” or @“H265”, the setting is invalid. If this field is set, the session will try to use the preferred codec for communication. If the preferred codec is not available, other available codecs will be used. If this field is not set or the setting is invalid, the session will use the default codec. - @“local_video”: Optional value is of bool type. Used to enable the local camera. - @“local_audio”: Optional value is of bool type. Used to enable the local microphone. - @“enableCustomAudioCapture”:@{@“sampleRate”:NSInteger, @“useStereoInput”: BOOL}, enable custom audio capture and bring the sample rate and channel count of the custom captured audio (both parameters are required).
|
---|---|
Observer |
The delegate of the TcrSession, listening for callback of events. |
Discussion
Initialize local resources, asynchronously callback results
Declared In
TcrSession.h
– setTcrSessionObserver:
setOberServer for session
- (void)setTcrSessionObserver:(id<TcrSessionObserver>)Observer
Parameters
Observer |
session Observer |
---|
Discussion
setOberServer for session
Declared In
TcrSession.h
– start:
Starts the session. This method should only be called once.
- (BOOL)start:(NSString *_Nonnull)serverSession
Parameters
serverSession |
The ServerSessionreturned from CreateSessionAPI. |
---|
Return Value
true if success, false otherwise.
Discussion
Starts the session. This method should only be called once.
Declared In
TcrSession.h
– createCustomDataChannel:observer:
Creates a custom data channel.
- (CustomDataChannel *_Nonnull)createCustomDataChannel:(int)port observer:(id<CustomDataChannelObserver> _Nullable)observer
Parameters
port |
The cloud port number uniquely identifying the data channel. |
---|---|
observer |
The {@link CustomDataChannel.Observer}. |
Return Value
the created data channel.
Discussion
Creates a custom data channel.
See Also
Declared In
TcrSession.h
– getKeyboard
Return the interface to interact with the cloud keyboard in this session.
- (id<Keyboard> _Nonnull)getKeyboard
Return Value
The interface to interact with the cloud keyboard in this session.
Discussion
Return the interface to interact with the cloud keyboard in this session.
Declared In
TcrSession.h
– getTouchScreen
Return the interface to interact with the cloud TouchScreen in this session.
- (id<TouchScreen> _Nonnull)getTouchScreen
Return Value
The interface to interact with the cloud TouchScreen in this session.
Discussion
Return the interface to interact with the cloud TouchScreen in this session.
Declared In
TcrSession.h
– pasteText:
Send the text to the input box in the cloud application.
The input box of the cloud application must have obtained the focus and allow the user to paste text from the
clipboard.
- (void)pasteText:(NSString *_Nonnull)text
Parameters
text |
The text to be sent |
---|
Discussion
Send the text to the input box in the cloud application.
The input box of the cloud application must have obtained the focus and allow the user to paste text from the
clipboard.
For Android cloud applications, sent text replaces the input box content.
For Windows cloud applications, sent text is added to the existing content in the input box.
Declared In
TcrSession.h
– pauseStreaming
Pause the media stream.
- (void)pauseStreaming
Discussion
Pause the media stream.
Declared In
TcrSession.h
– resumeStreaming
Resume the media stream.
- (void)resumeStreaming
Discussion
Resume the media stream.
Declared In
TcrSession.h
– releaseSession
Release the session.
The session will disconnect from the sever, and the local resources of this
session will be released. Once released, this session instance cannot be used anymore.
- (void)releaseSession
Discussion
Release the session.
The session will disconnect from the sever, and the local resources of this
session will be released. Once released, this session instance cannot be used anymore.
Declared In
TcrSession.h
– setEnableAudioPlaying:
Set whether the SDK plays audio.
- (void)setEnableAudioPlaying:(BOOL)enable
Parameters
enable |
true to enable audio playback, false otherwise. |
---|
Discussion
Set whether the SDK plays audio.
Declared In
TcrSession.h
– setEnableLocalAudio:
Enable or disable the local audio track that is captured from the mic.
- (void)setEnableLocalAudio:(BOOL)enable
Parameters
enable |
true to enable the local audio, false otherwise. |
---|
Discussion
Enable or disable the local audio track that is captured from the mic.
Declared In
TcrSession.h
– setEnableLocalVideo:
Enable or disable the local video track that is captured from the camera.
- (void)setEnableLocalVideo:(BOOL)enable
Parameters
enable |
true to enable the local video, false otherwise. |
---|
Discussion
Enable or disable the local video track that is captured from the camera.
Declared In
TcrSession.h
– setLocalVideoProfile:height:fps:minBitrate:maxBitrate:isFrontCamera:
Set the local video profile.
- (void)setLocalVideoProfile:(int)width height:(int)height fps:(int)fps minBitrate:(int)minBitrate maxBitrate:(int)maxBitrate isFrontCamera:(BOOL)isFrontCamera
Parameters
width |
The frame width, range[128, 1920]. Suggested value: 640. |
---|---|
height |
The frame height, range[128, 1920]. Suggested value: 480. |
fps |
The frame rate must be greater than 0 Default value: |
minBitrate |
The minimum bitrate in Kbps. Value range: [1000,15000]. Default value: |
maxBitrate |
The maximum bitrate in Kbps. Value range: [1000,15000]. Default value: |
Discussion
Set the local video profile.
Declared In
TcrSession.h
– setDisableCloudInput:
Disable the Cloud input.
When the cloud input is disable, the cloud application’s soft keyboard won’t appear.
This function is only supported for mobile cloud applications.
- (void)setDisableCloudInput:(BOOL)disableCloudInput
Parameters
disableCloudInput |
true disables the cloud input. |
---|
Discussion
Disable the Cloud input.
When the cloud input is disable, the cloud application’s soft keyboard won’t appear.
This function is only supported for mobile cloud applications.
Declared In
TcrSession.h
– setAudioSink:
Sets a audio sink for this session. After that, the SDK will callback the audio data to the audioSink
- (void)setAudioSink:(id<AudioSink> _Nullable)audioSink
Parameters
audioSink |
The audio sink to be set. |
---|
Discussion
Sets a audio sink for this session. After that, the SDK will callback the audio data to the audioSink
Declared In
TcrSession.h
– restartCloudApp
Restart the cloud application process.
- (void)restartCloudApp
Discussion
Restart the cloud application process.
Declared In
TcrSession.h
– setRemoteAudioProfile:
Set the playing profile of the remote audio.
- (void)setRemoteAudioProfile:(float)volume
Parameters
volume |
The volume scalar in the range of [0,10] that will be set on this remote audio stream. |
---|
Discussion
Set the playing profile of the remote audio.
Declared In
TcrSession.h
– setRemoteDesktopResolution:height:
Set the resolution of Cloud Desktop. If the cloud PC application is in full-screen mode, the resolution of the
downstream video stream will also change accordingly.
This method is currently only valid for scenarios where the cloud is a PC application, and the scenario where the
cloud is a mobile application is to be supported.
- (void)setRemoteDesktopResolution:(int)width height:(int)height
Parameters
width |
Width of cloud desktop. |
---|---|
height |
Height of cloud desktop. |
Discussion
Set the resolution of Cloud Desktop. If the cloud PC application is in full-screen mode, the resolution of the
downstream video stream will also change accordingly.
This method is currently only valid for scenarios where the cloud is a PC application, and the scenario where the
cloud is a mobile application is to be supported.
Declared In
TcrSession.h
– setRemoteVideoProfile:minBitrate:maxBitrate:
Set the remote video profile.
- (void)setRemoteVideoProfile:(int)fps minBitrate:(int)minBitrate maxBitrate:(int)maxBitrate
Parameters
fps |
The frame rate. Value range: [10,60]. Default value: |
---|---|
minBitrate |
The minimum bitrate in Kbps. Value range: [1000,15000]. Default value: |
maxBitrate |
The maximum bitrate in Kbps. Value range: [1000,15000]. Default value: |
Discussion
Set the remote video profile.
Declared In
TcrSession.h
– sendCustomAudioData:captureTimeNs:
Send custom audio data.
This method is only effective when custom audio capture is enabled.
To enable custom audio capture, see initWithParams
- (BOOL)sendCustomAudioData:(NSData *_Nonnull)audioData captureTimeNs:(uint64_t)captureTimeNs
Return Value
The result of send custom audio data.
Parameters
audioData |
The non-null NSData object containing the PCM data(16-bit) to be sent. |
---|---|
captureTimeNs |
The capture time of the audio data in nanoseconds. |
Discussion
Send custom audio data.
This method is only effective when custom audio capture is enabled.
To enable custom audio capture, see initWithParams
Declared In
TcrSession.h
– setRenderView:
Set the rendering view for this session, and thus the SDK will render the streaming content to the view.
- (void)setRenderView:(TcrRenderView *_Nullable)renderView
Parameters
renderView |
The rendering view to be set. This can be null to remove any existing renderView. |
---|
Discussion
Set the rendering view for this session, and thus the SDK will render the streaming content to the view.
Declared In
TcrSession.h
– setVideoSink:
Sets a video sink for this session. After that, the SDK will callback the decoded video frame data to the videoSink.
- (void)setVideoSink:(id<VideoSink> _Nullable)videoSink
Parameters
videoSink |
The view sink to be set.This can be null to remove any existing one. |
---|
Discussion
Sets a video sink for this session. After that, the SDK will callback the decoded video frame data to the videoSink.
You may use this interface to post-process or render video images.
Declared In
TcrSession.h
– requestChangeSeat:targetRole:targetPlayerIndex:blk:
Apply to the room owner to switch the role and seat of a player (userID
) to targetRole
and
targetPlayerIndex
respectively.
- (void)requestChangeSeat:(NSString *_Nonnull)userId targetRole:(NSString *_Nonnull)targetRole targetPlayerIndex:(int)targetPlayerIndex blk:(void ( ^ ) ( int retCode ))finishBlk
Parameters
userId |
The target user ID |
---|---|
targetRole |
The target role |
targetPlayerIndex |
The target seat. This parameter can take effect only for the |
Discussion
Apply to the room owner to switch the role and seat of a player (userID
) to targetRole
and
targetPlayerIndex
respectively.
Declared In
TcrSession.h
– changeSeat:targetRole:targetPlayerIndex:blk:
Switch the role and seat of a user (userID
) to targetRole
and targetPlayerIndex
respectively.
- (void)changeSeat:(NSString *_Nonnull)userId targetRole:(NSString *_Nonnull)targetRole targetPlayerIndex:(int)targetPlayerIndex blk:(void ( ^ ) ( int retCode ))finishBlk
Parameters
userId |
The target user ID |
---|---|
targetRole |
The target role |
targetPlayerIndex |
The target seat. This parameter can take effect only for the |
Discussion
Switch the role and seat of a user (userID
) to targetRole
and targetPlayerIndex
respectively.
Declared In
TcrSession.h