public interface TcrSession
Modifier and Type | Interface and Description |
---|---|
static class |
TcrSession.Event
Session event definitions.
|
static interface |
TcrSession.Observer
This interface represents the observer of TcrSession.
|
Modifier and Type | Method and Description |
---|---|
void |
changeSeat(java.lang.String userId,
MultiUser.Role targetRole,
int targetPlayerIndex,
AsyncCallback<java.lang.Void> callback)
Switch the role and seat of a user (`userID`) to `targetRole` and `targetPlayerIndex` respectively.
|
CustomDataChannel |
createCustomDataChannel(int port,
CustomDataChannel.Observer observer)
Creates a custom data channel.
|
Gamepad |
getGamepad()
Return the interface to interact with the cloud Gamepad in this session.
|
Keyboard |
getKeyboard()
Return the interface to interact with the cloud keyboard in this session.
|
LoginHelper |
getLoginHelper()
Deprecated.
This interface is not recommended for use.
|
MotionSensor |
getMotionSensor()
Return the interface to interact with the cloud Sensor in this session.
|
Mouse |
getMouse()
Return the interface to interact with the cloud Mouse in this session.
|
java.lang.String |
getRequestId()
Get the current connection's requestId.
|
TouchScreen |
getTouchScreen()
Return the interface to interact with the cloud TouchScreen in this session.
|
void |
pasteText(java.lang.String text)
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. |
void |
pauseStreaming()
Pause the media stream.
|
void |
release()
Release the session.
|
void |
requestChangeSeat(java.lang.String userId,
MultiUser.Role targetRole,
int targetPlayerIndex,
AsyncCallback<java.lang.Void> callback)
Apply to the room owner to switch the role and seat of a player (`userID`) to `targetRole` and
`targetPlayerIndex` respectively.
|
void |
restartCloudApp()
Restart the cloud application process.
|
void |
resumeStreaming()
Resume the media stream.
|
void |
sendCustomAudioData(java.nio.ByteBuffer audioData,
long captureTimeNs)
Send custom audio data.
|
void |
setAudioSink(AudioSink audioSink)
Sets a audio sink for this session.
|
void |
setDisableCloudInput(boolean disableCloudInput)
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 |
setEnableAudioPlaying(boolean enable)
Set whether the SDK plays audio.
|
void |
setEnableLocalAudio(boolean enableLocalAudio)
Enable or disable the local audio track that is captured from the mic.
|
void |
setEnableLocalVideo(boolean enableLocalVideo)
Enable or disable the local video track that is captured from the camera.
|
void |
setLocalVideoProfile(int width,
int height,
int fps,
int minBitrate,
int maxBitrate,
boolean isFrontCamera)
Set the local video profile.
|
void |
setMicMute(java.lang.String userID,
int micStatus,
AsyncCallback<java.lang.Void> callback)
Change the mic status of the `
userID ` user. |
void |
setRemoteAudioPlayProfile(float volume)
Set the playing profile of the remote audio.
|
void |
setRemoteDesktopResolution(int width,
int height)
Set the resolution of Cloud Desktop.
|
void |
setRemoteVideoProfile(int fps,
int minBitrate,
int maxBitrate,
AsyncCallback<java.lang.String> callback)
Deprecated.
|
void |
setVideoSink(VideoSink videoSink)
Sets a video sink for this session.
|
boolean |
start(java.lang.String serverSession)
Starts the session.
|
void |
syncRoomInfo()
Refresh the information of all seats.
|
boolean start(java.lang.String serverSession)
serverSession
- The ServerSession
returned from CreateSession
API.void release()
java.lang.String getRequestId()
start(String)
.void setVideoSink(VideoSink videoSink)
You may use this interface to post-process or render video images.
videoSink
- The view sink to be set.This can be null to remove any existing one.void setAudioSink(AudioSink audioSink)
audioSink
- The audio sink to be set.void setEnableAudioPlaying(boolean enable)
enable
- true to enable audio playback, false otherwise.void pauseStreaming()
void resumeStreaming()
@Deprecated void setRemoteVideoProfile(int fps, int minBitrate, int maxBitrate, AsyncCallback<java.lang.String> callback)
void setRemoteAudioPlayProfile(float volume)
volume
- The volume scalar in the range of [0,10] that will be set on this remote audio stream.void setLocalVideoProfile(int width, int height, int fps, int minBitrate, int maxBitrate, boolean isFrontCamera)
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. Suggested value: 30.minBitrate
- The minimum bitrate in kbps must be greater than or equal to 0. Suggested value: 512.maxBitrate
- The maximum bitrate in kbps must be greater than 0. Suggested value: 1024.isFrontCamera
- whether to use the front camera. Suggested value: true.void setEnableLocalVideo(boolean enableLocalVideo)
enableLocalVideo
- true to enable the local video, false otherwise.void setEnableLocalAudio(boolean enableLocalAudio)
enableLocalAudio
- true to enable the local audio, false otherwise.void sendCustomAudioData(java.nio.ByteBuffer audioData, long captureTimeNs)
TcrSessionConfig.enableCustomAudioCapture
is true.audioData
- A ByteBuffer containing the audio data. This buffer MUST contain PCM data
(16-bit) according to the configured audio format.captureTimeNs
- The capture time of the audio data, in nanoseconds. This timestamp should be a
monotonically increasing value, used for synchronizing the audio data.TcrSessionConfig.Builder.enableCustomAudioCapture(boolean, int, boolean)
void restartCloudApp()
void pasteText(java.lang.String text)
text
- The text to be sentvoid setDisableCloudInput(boolean disableCloudInput)
disableCloudInput
- true disables the cloud input. void setRemoteDesktopResolution(int width, int height)
width
- Width of cloud desktop.height
- Height of cloud desktop.LoginHelper getLoginHelper()
start(String)
function,
otherwise the return value will be null.Keyboard getKeyboard()
Mouse getMouse()
Gamepad getGamepad()
TouchScreen getTouchScreen()
MotionSensor getMotionSensor()
CustomDataChannel createCustomDataChannel(int port, CustomDataChannel.Observer observer)
port
- The cloud port number uniquely identifying the data channel.observer
- The CustomDataChannel.Observer
.CustomDataChannel
void changeSeat(java.lang.String userId, MultiUser.Role targetRole, int targetPlayerIndex, AsyncCallback<java.lang.Void> callback)
AsyncCallback.onSuccess(Object)
` will be called back.
TcrCode.MULTI_PLAYER_ASSIGN_SEAT_FAILED
`
will be passed in to `code
` of the `AsyncCallback.onFailure(int, String)
` callback.
TcrCode.MULTI_PLAYER_NO_AUTHORIZED
` will be passed in to `code
` of the `AsyncCallback.onFailure(int, String)
` callback.
TcrCode.ERR_TIMEOUT
` will be passed in to
`code
` of the `AsyncCallback.onFailure(int, String)
` callback.userId
- The target user IDtargetRole
- The target role `MultiUser.Role
`targetPlayerIndex
- The target seat. This parameter can take effect only for the `Player` role and
will be `0` for the `Viewer` role.callback
- The callback for the setting result.
`AsyncCallback.onSuccess(Object)
` will be called back if the setting succeeds.
`AsyncCallback.onFailure(int, String)
` will be called back if the setting fails.void requestChangeSeat(java.lang.String userId, MultiUser.Role targetRole, int targetPlayerIndex, AsyncCallback<java.lang.Void> callback)
AsyncCallback.onSuccess(Object)
` will be called back.
TcrCode.MULTI_PLAYER_IGNORED_HOST_SUBMIT
` will be passed in to `code
` of the `AsyncCallback.onFailure(int, String)
` callback.
TcrCode.ERR_TIMEOUT
` will be passed in to
`code
` of the `AsyncCallback.onFailure(int, String)
` callback.userId
- The target player IDtargetRole
- The target role `MultiUser.Role
`targetPlayerIndex
- The target seat. This parameter can take effect only for the `Player` role and
will be `0` for the `Viewer` role.callback
- The callback for the setting result.void setMicMute(java.lang.String userID, int micStatus, AsyncCallback<java.lang.Void> callback)
userID
` user.
AsyncCallback.onSuccess(Object)
` will be called back.
userID
` of another user, `AsyncCallback.onFailure(int,
String)
` will be called back, and TcrCode.MULTI_PLAYER_NO_AUTHORIZED
will be passed in to `code
`.
userID
` is incorrect, `AsyncCallback.onFailure(int, String)
` will be called back, and
`TcrCode.MULTI_PLAYER_NO_SUCH_USER
` will be passed in to `code
`.micStatus
- The mic status. Valid values: `MultiUser.MIC_STATUS_DISABLE
`, `MultiUser.MIC_STATUS_OFF
`, `MultiUser.MIC_STATUS_ON
`.callback
- The callback for the setting result.void syncRoomInfo()
TcrSession.Event.MULTI_USER_SEAT_INFO
callback.