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