RTC Room Engine
SDK to implement video settings features.RTC Room Engine
SDK, you need to complete the SDK login.openLocalCamera
and closeLocalCamera
APIs respectively.openLocalCamera
API requires two parameters: isFront
to select the front or rear camera, and quality
for video quality. isFront
is a boolean value, where true opens the front camera and false opens the rear camera. quality
is an enumeration of type TUIVideoQuality
.Enumeration value types | Meaning |
quality360P | 360p: SD |
quality540P | 540p: SD |
quality720P | 720p: HD |
quality1080P | 1080p: FHD |
quality1080P
, providing sample code for turning on the local microphone and turning off the local camera.openLocalCamera
and closeLocalCamera
APIs respectively.openLocalCamera
API requires two parameters: select front or rear camera isFront
and video quality quality
. isFront
is a boolean value, true for turning on the front-facing camera, false for turning on the rear camera. quality
is an enumeration of type VideoQuality
.Enumeration value types | Meaning |
Q_360P | 360p: SD |
Q_540P | 540p: SD |
Q_720P | 720p: HD |
Q_1080P | 1080p: FHD |
Q_1080P
, providing sample code for turning on the local microphone and turning off the local camera.import RTCRoomEnginelet roomEngine = TUIRoomEngine.sharedInstance()// Turn on the local cameralet isFrontCamera = truelet videoQuality: TUIVideoQuality = .quality1080ProomEngine.openLocalCamera(isFront: isFrontCamera, quality: videoQuality) {// Turned on successfully} onError: { code, message in// Failed to enable}// Turn off the local cameraroomEngine.closeLocalCamera
()
TUIRoomEngine roomEngine = TUIRoomEngine.sharedInstance();// Turn on the local cameraboolean isFrontCamera = true;TUIRoomDefine.VideoQuality videoQuality = TUIRoomDefine.VideoQuality.Q_1080P;roomEngine.openLocalCamera(isFrontCamera, videoQuality, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// Enabled successfully}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// Failed to enable}});// Turn off the local cameraroomEngine.closeLocalCamera();
import RTCRoomEngineimport TXLiteAVSDK_Professionallet trtcCloud = TUIRoomEngine.sharedInstance().getTRTCCloud()let params = TRTCRenderParams()params.mirrorType = .enable // To disable the mirror, set this parameter to .disabletrtcCloud.setLocalRenderParams(params)trtcCloud.setVideoEncoderMirror(true)
TRTCCloud trtcCloud = TUIRoomEngine.sharedInstance().getTRTCCloud();TRTCCloudDef.TRTCRenderParams params = new TRTCCloudDef.TRTCRenderParams();params.mirrorType = TRTC_VIDEO_MIRROR_TYPE_ENABLE; // To disable the mirror, set this parameter to TRTC_VIDEO_MIRROR_TYPE_DISABLEtrtcCloud.setLocalRenderParams(params);trtcCloud.setVideoEncoderMirror(true);
switchCamera
API to switch the camera, you need to pass a Bool parameter frontCamera
. Passing true switches to the front camera, and passing false switches to the rear camera. Here is an example code to switch to the front camera:import RTCRoomEngineTUIRoomEngine.sharedInstance().getMediaDeviceManager().switchCamera(true)
TUIRoomEngine.sharedInstance().getMediaDeviceManager().switchCamera(true);
TUIVideoQuality
is the same as mentioned above. Here is an example of using the default mode to call the updateVideoQuality
API to update the local video encoding quality:import RTCRoomEnginelet videoQuality: TUIVideoQuality = .quality1080PTUIRoomEngine.sharedInstance().updateVideoQuality(videoQuality)
VideoQuality
is the same as mentioned above. Here is an example of using the default mode to call the updateVideoQuality
API to update the local video encoding quality:TUIRoomDefine.VideoQuality videoQuality = TUIRoomDefine.VideoQuality.Q_1080P;TUIRoomEngine.sharedInstance().updateVideoQuality(videoQuality);
import RTCRoomEnginelet roomEngine = TUIRoomEngine.sharedInstance()// Start pushing local video (enabled by default)roomEngine.startPushLocalVideo()// Stop pushing local videoroomEngine.stopPushLocalVideo()
TUIRoomEngine roomEngine = TUIRoomEngine.sharedInstance();// Start pushing local video (enabled by default)roomEngine.startPushLocalVideo();// Stop pushing local videoroomEngine.stopPushLocalVideo();
TUIRoomObserver
callback onUserVideoStateChanged.
Was this page helpful?