RTC Room Engine
SDK 实现 视频设置相关功能。openLocalCamera
和closeLocalCamera
两个接口,来开启或关闭您本地的摄像头。openLocalCamera
接口需要传入 选择前后置摄像头 isFront
和 视频质量 quality
两个参数。isFront
为布尔值,true为打开前置摄像头,false为打开后置摄像头。quality
是 TUIVideoQuality
类型的枚举。枚举值类型 | 含义 |
quality360P | 低清360P |
quality540P | 标清540P |
quality720P | 高清720P |
quality1080P | 超清1080P |
quality1080P
为例,提供了开启本地麦克风和关闭本地摄像头的示例代码。openLocalCamera
和closeLocalCamera
两个接口,来开启或关闭您本地的摄像头。openLocalCamera
接口需要传入 选择前后置摄像头 isFront
和 视频质量 quality
两个参数。isFront
为布尔值,true为打开前置摄像头,false为打开后置摄像头。quality
是 VideoQuality
类型的枚举。枚举值类型 | 含义 |
Q_360P | 低清360P |
Q_540P | 标清540P |
Q_720P | 高清720P |
Q_1080P | 超清1080P |
Q_1080P
为例,提供了开启本地麦克风和关闭本地摄像头的示例代码。import RTCRoomEnginelet roomEngine = TUIRoomEngine.sharedInstance()// 开启本地摄像头let isFrontCamera = truelet videoQuality: TUIVideoQuality = .quality1080ProomEngine.openLocalCamera(isFront: isFrontCamera, quality: videoQuality) {// 开启成功} onError: { code, message in// 开启失败}// 关闭本地摄像头roomEngine.closeLocalCamera
()
TUIRoomEngine roomEngine = TUIRoomEngine.sharedInstance();// 开启本地摄像头boolean isFrontCamera = true;TUIRoomDefine.VideoQuality videoQuality = TUIRoomDefine.VideoQuality.Q_1080P;roomEngine.openLocalCamera(isFrontCamera, videoQuality, new TUIRoomDefine.ActionCallback() {@Overridepublic void onSuccess() {// 开启成功}@Overridepublic void onError(TUICommonDefine.Error error, String message) {// 开启失败}});// 关闭本地摄像头roomEngine.closeLocalCamera();
import RTCRoomEngineimport TXLiteAVSDK_Professionallet trtcCloud = TUIRoomEngine.sharedInstance().getTRTCCloud()let params = TRTCRenderParams()params.mirrorType = .enable // 关闭镜像时,将此处参数设置为 .disable 即可trtcCloud.setLocalRenderParams(params)trtcCloud.setVideoEncoderMirror(true)
TRTCCloud trtcCloud = TUIRoomEngine.sharedInstance().getTRTCCloud();TRTCCloudDef.TRTCRenderParams params = new TRTCCloudDef.TRTCRenderParams();params.mirrorType = TRTC_VIDEO_MIRROR_TYPE_ENABLE; // 关闭镜像时,将此处参数设置为 TRTC_VIDEO_MIRROR_TYPE_DISABLE 即可trtcCloud.setLocalRenderParams(params);trtcCloud.setVideoEncoderMirror(true);
switchCamera
接口切换摄像头时,需要传入一个 Bool 参数frontCamera
,传入 true 时切换为前置摄像头,传入 false 时切换为后置摄像头。以下是切换为前置摄像头的示例代码:import RTCRoomEngineTUIRoomEngine.sharedInstance().getMediaDeviceManager().switchCamera(true)
TUIRoomEngine.sharedInstance().getMediaDeviceManager().switchCamera(true);
TUIVideoQuality
与上文中提到的相同。下面以默认模式为例,调用updateVideoQuality
接口更新本地视频的编码质量:import RTCRoomEnginelet videoQuality: TUIVideoQuality = .quality1080PTUIRoomEngine.sharedInstance().updateVideoQuality(videoQuality)
VideoQuality
与上文中提到的相同。下面以默认模式为例,调用updateVideoQuality
接口更新本地视频的编码质量:TUIRoomDefine.VideoQuality videoQuality = TUIRoomDefine.VideoQuality.Q_1080P;TUIRoomEngine.sharedInstance().updateVideoQuality(videoQuality);
import RTCRoomEnginelet roomEngine = TUIRoomEngine.sharedInstance()// 开始推送本地视频(默认开启)roomEngine.startPushLocalVideo()// 停止推送本地视频roomEngine.stopPushLocalVideo()
TUIRoomEngine roomEngine = TUIRoomEngine.sharedInstance();// 开始推送本地视频(默认开启)roomEngine.startPushLocalVideo();// 停止推送本地视频roomEngine.stopPushLocalVideo();
本页内容是否解决了您的问题?