From b4618bbf380fd0a09683fbbe5e7cae319c9b2962 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Mon, 9 Sep 2024 14:41:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=A4=A7=E5=B0=8F=E6=B5=81?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/package/agora.ts | 44 +++++++++++++++++++++++++++++++++++++- vite.config.ts | 8 +++++-- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/utils/package/agora.ts b/src/utils/package/agora.ts index 691dd73..99b88e4 100644 --- a/src/utils/package/agora.ts +++ b/src/utils/package/agora.ts @@ -6,7 +6,9 @@ import { ScreenCaptureSourceType, RenderModeType, ChannelProfileType, - AudioAinsMode + AudioAinsMode, + SimulcastStreamMode, + VideoStreamType } from "agora-electron-sdk"; import { GetRoomRtcToken } from "@/api/Home/Index"; import { storage } from '@/utils'; @@ -127,6 +129,19 @@ export const agora = { // // 用户音量提示回调。 onAudioVolumeIndication: async (_connection: any, speakers: any, _speakerNumber: any, _totalVolume: any,) => { await onAudioVolumeIndication(speakers) + }, + onVideoSizeChanged: async (connection: any, + sourceType: VideoSourceType, + uid: number, + width: number, + height: number, + rotation: number) => { + console.log(connection, + sourceType, + uid, + width, + height, + rotation); } }); }, @@ -209,6 +224,16 @@ export const agora = { joinChannel: async () => { await rtcEngine.enableAudioVolumeIndication(100, 1, true) await rtcEngine.joinChannel(option.token, option.channelId, option.uid); + await rtcEngine.setDualStreamMode( + SimulcastStreamMode.EnableSimulcastStream, + { + dimensions: { + width: 160, + height: 160 + }, + framerate: 5, + } + ); }, // 更新频道配置 updateChannelMediaOptions: async (bool: boolean) => { @@ -220,6 +245,23 @@ export const agora = { publishCameraTrack: true,//设置是否发布摄像头采集的视频 publishScreenTrack: false,//设置是否发布屏幕采集的视频 }) + // if (bool) { + // setTimeout(() => { + // rtcEngine.setRemoteVideoStreamType( + // Number(option.uid), + // VideoStreamType.VideoStreamHigh, + // ) + // console.log(111111); + // setTimeout(() => { + // rtcEngine.setRemoteVideoStreamType( + // Number(option.uid), + // VideoStreamType.VideoStreamLow, + // ) + // console.log(222222); + // }, 10000); + // }, 10000); + // // VideoStreamType.VideoStreamHigh, + // } }, // 共享屏幕单独用户 joinChannelEx: async (uid: any) => { diff --git a/vite.config.ts b/vite.config.ts index 2a9a83b..7487160 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -61,7 +61,9 @@ export default defineConfig({ ScreenCaptureSourceType, VideoSourceType, VideoViewSetupMode, - AudioAinsMode + AudioAinsMode, + SimulcastStreamMode, + VideoStreamType } = require("agora-electron-sdk") export { createAgoraRtcEngine, @@ -71,7 +73,9 @@ export default defineConfig({ ScreenCaptureSourceType, VideoSourceType, VideoViewSetupMode, - AudioAinsMode + AudioAinsMode, + SimulcastStreamMode, + VideoStreamType } `, })