This commit is contained in:
yj 2024-07-17 11:27:17 +08:00
parent 8c2b484401
commit 136a3f023a
2 changed files with 7 additions and 8 deletions

View File

@ -14,6 +14,7 @@ import StupWizard from '@/components/StupWizard';
import { onInvoke, onSignalr } from '@/utils/package/signalr'; import { onInvoke, onSignalr } from '@/utils/package/signalr';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import durationPlugin from 'dayjs/plugin/duration'; import durationPlugin from 'dayjs/plugin/duration';
import { VideoSourceType } from 'agora-electron-sdk';
dayjs.extend(durationPlugin); dayjs.extend(durationPlugin);
const { Column } = Table const { Column } = Table
const Meeting: React.FC = () => { const Meeting: React.FC = () => {
@ -111,7 +112,6 @@ const Meeting: React.FC = () => {
let [currentSeconds, setCurrentSeconds] = useState(0) let [currentSeconds, setCurrentSeconds] = useState(0)
const [currentEffective, setCurrentEffective] = useState(0) const [currentEffective, setCurrentEffective] = useState(0)
const [list] = useState<number[]>([1, 2, 3, 4, 5, 6, 7])
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
useEffect(() => { useEffect(() => {
let time = null as any; let time = null as any;
@ -123,6 +123,7 @@ const Meeting: React.FC = () => {
userid: userInfo.account, userid: userInfo.account,
token: state.token, token: state.token,
}) })
agora.setCameraCapture(VideoSourceType.VideoSourceCameraPrimary)
setCurrentVideoId(userInfo.account) setCurrentVideoId(userInfo.account)
setUser(userInfo) setUser(userInfo)
setIsInit(false) setIsInit(false)
@ -187,7 +188,7 @@ const Meeting: React.FC = () => {
}, []) }, [])
useEffect(() => { useEffect(() => {
console.log(currentVideoId);
}, [currentVideoId]) }, [currentVideoId])
// 加入房间时间 // 加入房间时间
@ -223,7 +224,7 @@ const Meeting: React.FC = () => {
setIsSharedScreenModal(true) setIsSharedScreenModal(true)
break; break;
case '停止共享': case '停止共享':
agora.stopScreenCapture() agora.setCameraCapture(VideoSourceType.VideoSourceCameraPrimary)
footerListTemplate[itemIndex][rowIndex].title = '共享屏幕' footerListTemplate[itemIndex][rowIndex].title = '共享屏幕'
break; break;
case '关闭声音': case '关闭声音':
@ -288,7 +289,7 @@ const Meeting: React.FC = () => {
const footerListTemplate = [...footerList] const footerListTemplate = [...footerList]
footerListTemplate[footerListIndex.itemIndex][footerListIndex.rowIndex].title = '停止共享' footerListTemplate[footerListIndex.itemIndex][footerListIndex.rowIndex].title = '停止共享'
setIsSharedScreenModal(false) setIsSharedScreenModal(false)
agora.setDesktopCapturerVideo(sharedScreenItem) agora.setDesktopCapturerVideo(sharedScreenItem, VideoSourceType.VideoSourceScreen)
} else { } else {
message.error('请选择应用!') message.error('请选择应用!')
} }

View File

@ -153,16 +153,14 @@ const agora = {
rtcEngine.muteLocalVideoStream(mute) rtcEngine.muteLocalVideoStream(mute)
}, },
// 摄像头采集 // 摄像头采集
setCameraCapture: () => { setCameraCapture: (sourceType: number) => {
rtcEngine.startCameraCapture(VideoSourceType.VideoSourceCamera, {}) rtcEngine.startCameraCapture(VideoSourceType.VideoSourceCamera, {})
agora.joinChannel(false)
}, },
// 加入频道 // 加入频道
setJoinChannel: (data: any) => { setJoinChannel: (data: any) => {
option.token = data.token; option.token = data.token;
option.channelId = data.channelId; option.channelId = data.channelId;
option.userid = Number(data.userid); option.userid = Number(data.userid);
rtcEngine.startCameraCapture(VideoSourceType.VideoSourceCamera, {})
agora.joinChannel(false) agora.joinChannel(false)
}, },
// 桌面捕获音频和视频的媒体源的信息 // 桌面捕获音频和视频的媒体源的信息
@ -170,7 +168,7 @@ const agora = {
return rtcEngine.getScreenCaptureSources({ width: 300, height: 300 }, { width: 300, height: 300 }, true); return rtcEngine.getScreenCaptureSources({ width: 300, height: 300 }, { width: 300, height: 300 }, true);
}, },
// 共享屏幕采集 // 共享屏幕采集
setDesktopCapturerVideo: (targetSource: any) => { setDesktopCapturerVideo: (targetSource: any, sourceType: number) => {
// rtcEngine.stopCameraCapture(VideoSourceType.VideoSourceCamera); // rtcEngine.stopCameraCapture(VideoSourceType.VideoSourceCamera);
agora.stopScreenCapture(); agora.stopScreenCapture();
if ( if (