TcrSession Class Reference

Inherits from NSObject
Declared in TcrSession.h
TcrSession.m

– 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.

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

– getMouse

Return the interface to interact with the cloud Mouse in this session.

- (id<Mouse> _Nonnull)getMouse

Return Value

The interface to interact with the cloud Mouse in this session.

Discussion

Return the interface to interact with the cloud Mouse in this session.

Declared In

TcrSession.h

– getGamepad

Return the interface to interact with the cloud Gamepad in this session.

- (id<Gamepad> _Nonnull)getGamepad

Return Value

The interface to interact with the cloud Gamepad in this session.

Discussion

Return the interface to interact with the cloud Gamepad 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

– 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.
false enables the cloud input, allowing the soft keyboard to appear for user interaction with the cloud application via touch screen.

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: 60.

minBitrate

The minimum bitrate in Kbps. Value range: [1000,15000]. Default value: 1000.

maxBitrate

The maximum bitrate in Kbps. Value range: [1000,15000]. Default value: 15000.

Discussion

Set the remote video profile.

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 {@link Role}

targetPlayerIndex

The target seat. This parameter can take effect only for the Player role and will be 0 for the Viewer role.

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 {@link Role}

targetPlayerIndex

The target seat. This parameter can take effect only for the Player role and will be 0 for the Viewer role.

Discussion

Switch the role and seat of a user (userID) to targetRole and targetPlayerIndex respectively.

Declared In

TcrSession.h