This commit is contained in:
parent
6b6d895ee3
commit
b6ba3c8bf6
|
|
@ -5,6 +5,7 @@ import { agora } from '@/utils/package/agora';
|
|||
import { Button, Empty, Select, message } from 'antd';
|
||||
import { useEffect, useState } from "react";
|
||||
import { useLocation } from 'react-router';
|
||||
import { VideoStreamType } from 'agora-electron-sdk';
|
||||
const UserVideo: React.FC = () => {
|
||||
const { state } = useLocation();
|
||||
const [from, setFrom] = useState<any>({
|
||||
|
|
@ -65,6 +66,7 @@ const UserVideo: React.FC = () => {
|
|||
view: document.getElementById(`video-${item.screenShareId}`),
|
||||
channelId: state.channelId + 'a',
|
||||
})
|
||||
await agora.setRemoteVideoStreamType(item.uid, VideoStreamType.VideoStreamLow, false)
|
||||
})
|
||||
}, [userList])
|
||||
// 监听缓存变化
|
||||
|
|
|
|||
|
|
@ -251,9 +251,9 @@ const Meeting: React.FC = () => {
|
|||
useEffect(() => {
|
||||
roomUserList.forEach(async (item: any) => {
|
||||
if (item.uid === currentVideoId) {
|
||||
await agora.setRemoteVideoStreamType(item.uid, VideoStreamType.VideoStreamHigh)
|
||||
await agora.setRemoteVideoStreamType(item.uid, VideoStreamType.VideoStreamHigh, true)
|
||||
} else {
|
||||
await agora.setRemoteVideoStreamType(item.uid, VideoStreamType.VideoStreamLow)
|
||||
await agora.setRemoteVideoStreamType(item.uid, VideoStreamType.VideoStreamLow, true)
|
||||
}
|
||||
});
|
||||
}, [currentVideoId, roomUserList]);
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ export const agora = {
|
|||
joinChannel: async () => {
|
||||
await rtcEngine.enableAudioVolumeIndication(100, 1, true)
|
||||
await rtcEngine.joinChannel(option.token, option.channelId, option.uid);
|
||||
await rtcEngine.setDualStreamMode(
|
||||
await rtcEngine.setDualStreamModeEx(
|
||||
SimulcastStreamMode.EnableSimulcastStream,
|
||||
{
|
||||
dimensions: {
|
||||
|
|
@ -219,7 +219,8 @@ export const agora = {
|
|||
height: 180
|
||||
},
|
||||
framerate: 5,
|
||||
}
|
||||
},
|
||||
{ channelId: option.channelId, localUid: Number(option.uid) }
|
||||
);
|
||||
},
|
||||
// 更新频道配置
|
||||
|
|
@ -234,10 +235,11 @@ export const agora = {
|
|||
})
|
||||
},
|
||||
// 设置接收大小流
|
||||
setRemoteVideoStreamType: async (uid: number, type: VideoStreamType) => {
|
||||
await rtcEngine.setRemoteVideoStreamType(
|
||||
setRemoteVideoStreamType: async (uid: number, type: VideoStreamType, bool: boolean) => {
|
||||
await rtcEngine.setRemoteVideoStreamTypeEx(
|
||||
Number(uid),
|
||||
type,
|
||||
bool ? { channelId: option.channelId, localUid: Number(option.uid) } : { channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) }
|
||||
)
|
||||
},
|
||||
// 共享屏幕单独用户
|
||||
|
|
@ -271,6 +273,17 @@ export const agora = {
|
|||
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||
}
|
||||
);
|
||||
await rtcEngine.setDualStreamModeEx(
|
||||
SimulcastStreamMode.EnableSimulcastStream,
|
||||
{
|
||||
dimensions: {
|
||||
width: 320,
|
||||
height: 180
|
||||
},
|
||||
framerate: 5,
|
||||
},
|
||||
{ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) }
|
||||
);
|
||||
},
|
||||
// 退出第二个房间
|
||||
allLeaveChannelEx: async () => {
|
||||
|
|
@ -303,7 +316,6 @@ export const agora = {
|
|||
},
|
||||
// 摄像头采集
|
||||
startCameraCapture: async (bool: boolean = false) => {
|
||||
console.log(bool);
|
||||
await rtcEngine.startCameraCapture(VideoSourceType.VideoSourceCamera, {
|
||||
format: {
|
||||
width: bool ? 160 : 1280,
|
||||
|
|
|
|||
Loading…
Reference in New Issue