This commit is contained in:
yj 2024-07-17 11:12:58 +08:00
parent 10e5312584
commit 92ffd98bbc
1 changed files with 5 additions and 22 deletions

View File

@ -17,7 +17,7 @@ const option: any = {
token: '', token: '',
channelId: '', channelId: '',
userid: '', userid: '',
sourceType: VideoSourceType.VideoSourceCameraPrimary, sourceType: '',
} }
let iMediaRecorder: any = ''; let iMediaRecorder: any = '';
let rtcEngine: any = ''; let rtcEngine: any = '';
@ -78,7 +78,8 @@ const agora = {
setupLocalVideo: (item: any) => { setupLocalVideo: (item: any) => {
rtcEngine.setupLocalVideo({ rtcEngine.setupLocalVideo({
renderMode: RenderModeType.RenderModeFit, renderMode: RenderModeType.RenderModeFit,
sourceType: option.sourceType, sourceType: VideoSourceType.VideoSourceCameraPrimary,
// sourceType: option.isCamera ? VideoSourceType.VideoSourceCameraPrimary : VideoSourceType.VideoSourceScreen,
uid: item.account, uid: item.account,
view: item.view, view: item.view,
setupMode: VideoViewSetupMode.VideoViewSetupAdd, setupMode: VideoViewSetupMode.VideoViewSetupAdd,
@ -141,16 +142,6 @@ const agora = {
}, },
// 摄像头采集 // 摄像头采集
setCameraCapture: (sourceType: number) => { setCameraCapture: (sourceType: number) => {
option.sourceType = sourceType
// agora.stopScreenCapture()
// if (sourceType !== option.sourceType) {
// rtcEngine.destroyRendererByConfig(option.sourceType, option.channelId, option.account)
// agora.setupLocalVideo({
// account: Number(option.userid),
// view: document.getElementById(`video-${option.userid}`),
// channelId: option.channelId,
// })
// }
rtcEngine.startCameraCapture(VideoSourceType.VideoSourceCamera, {}) rtcEngine.startCameraCapture(VideoSourceType.VideoSourceCamera, {})
}, },
// 加入频道 // 加入频道
@ -166,17 +157,9 @@ const agora = {
}, },
// 共享屏幕采集 // 共享屏幕采集
setDesktopCapturerVideo: (targetSource: any, sourceType: number) => { setDesktopCapturerVideo: (targetSource: any, sourceType: number) => {
if (sourceType !== option.sourceType) { // rtcEngine.stopCameraCapture(VideoSourceType.VideoSourceCamera);
rtcEngine.stopCameraCapture(option.sourceType)
rtcEngine.destroyRendererByConfig(option.sourceType, option.channelId, option.account)
option.sourceType = sourceType
agora.setupLocalVideo({
account: Number(option.userid),
view: document.getElementById(`video-${option.userid}`),
channelId: option.channelId,
})
}
agora.stopScreenCapture(); agora.stopScreenCapture();
// rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceCameraPrimary, option.channelId, option.account)
if ( if (
targetSource.type === targetSource.type ===
ScreenCaptureSourceType.ScreencapturesourcetypeScreen ScreenCaptureSourceType.ScreencapturesourcetypeScreen