This commit is contained in:
yj 2024-07-17 11:47:29 +08:00
parent 05fb261275
commit fc4cbb13d8
2 changed files with 9 additions and 8 deletions

View File

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

View File

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