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 } `, })