Compare commits

...

2 Commits

Author SHA1 Message Date
yj 6d98f0fc0f 去除多余代码 2025-01-17 15:08:43 +08:00
yj c6887b2747 修改共享屏幕token 2025-01-17 15:08:27 +08:00
3 changed files with 34 additions and 30 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "WGShare.Metting", "name": "WGShare.Metting",
"private": true, "private": true,
"version": "0.6.3", "version": "0.6.5",
"main": "main.js", "main": "main.js",
"authors": "yj", "authors": "yj",
"description": "智汇享", "description": "智汇享",

View File

@ -1766,31 +1766,35 @@ const Meeting: React.FC = () => {
agora.setSubscribeVideoBlocklist([Number(user.screenShareId)], 1) agora.setSubscribeVideoBlocklist([Number(user.screenShareId)], 1)
} }
if (data) { if (data) {
const footerListTemplate = [...footerList] GetRoomRtcToken(state.channelId).then(async res => {
footerListTemplate[footerListIndex.itemIndex][footerListIndex.rowIndex].title = '停止共享' if (res.code === 200) {
setIsSharedScreenModal(false) const footerListTemplate = [...footerList]
await agora.setDesktopCapturerVideo(sharedScreenItem, isComputerAudio, isFluencyPriority) footerListTemplate[footerListIndex.itemIndex][footerListIndex.rowIndex].title = '停止共享'
await allUserLook(user.screenShareId, user.userName) setIsSharedScreenModal(false)
const isOpen = await getKeyOpenChildWindow('shareScreenWindow') await agora.setDesktopCapturerVideo(sharedScreenItem, isComputerAudio, isFluencyPriority, res.data)
setIsScreenCapture(true) await allUserLook(user.screenShareId, user.userName)
if (!isOpen) { const isOpen = await getKeyOpenChildWindow('shareScreenWindow')
window.electron.createChildWindow('show') setIsScreenCapture(true)
setKeyOpenChildWindow('shareScreenWindow', true) if (!isOpen) {
window.electron.setMainWindowSize({ window.electron.createChildWindow('show')
width: 250, setKeyOpenChildWindow('shareScreenWindow', true)
height: 160, window.electron.setMainWindowSize({
}) width: 250,
window.electron.setPosition('right') height: 160,
setTimeout(() => { })
agora.setupLocalVideo({ window.electron.setPosition('right')
uid: Number(user.uid), setTimeout(() => {
view: document.getElementById(`meetingAbsoluteVideo`) as HTMLElement, agora.setupLocalVideo({
channelId: state.channelId, uid: Number(user.uid),
sourceType: VideoSourceType.VideoSourceCameraPrimary, view: document.getElementById(`meetingAbsoluteVideo`) as HTMLElement,
type: true channelId: state.channelId,
}) sourceType: VideoSourceType.VideoSourceCameraPrimary,
}, 1500); type: true
} })
}, 1500);
}
}
})
} else { } else {
message.error('请选择应用!') message.error('请选择应用!')
} }

View File

@ -329,10 +329,10 @@ export const agora = {
) )
}, },
// 共享屏幕单独用户 // 共享屏幕单独用户
joinChannelEx: async (uid: any) => { joinChannelEx: async (uid: any, token: string) => {
await agora.leaveChannelEx(uid) await agora.leaveChannelEx(uid)
await rtcEngine.joinChannelEx( await rtcEngine.joinChannelEx(
option.token, token,
{ channelId: option.channelId, localUid: Number(uid) }, { channelId: option.channelId, localUid: Number(uid) },
{ {
autoSubscribeAudio: false,//设置是否自动订阅所有音频流 autoSubscribeAudio: false,//设置是否自动订阅所有音频流
@ -465,7 +465,7 @@ export const agora = {
return await rtcEngine.getScreenCaptureSources(thumbSize, iconSize, includeScreen) return await rtcEngine.getScreenCaptureSources(thumbSize, iconSize, includeScreen)
}, },
// 共享屏幕采集 // 共享屏幕采集
setDesktopCapturerVideo: async (targetSource: any, isComputerAudio: boolean, isFluencyPriority: boolean) => { setDesktopCapturerVideo: async (targetSource: any, isComputerAudio: boolean, isFluencyPriority: boolean, token:string) => {
const user = JSON.parse(storage.getItem('user') as string) const user = JSON.parse(storage.getItem('user') as string)
agora.stopScreenCapture(); agora.stopScreenCapture();
if (isComputerAudio) { if (isComputerAudio) {
@ -501,7 +501,7 @@ export const agora = {
} }
); );
} }
await agora.joinChannelEx(user.screenShareId) await agora.joinChannelEx(user.screenShareId, token)
}, },
// 获取系统中所有的视频设备列表。 // 获取系统中所有的视频设备列表。
getVideoDeviceManager: async (): Promise<any> => { getVideoDeviceManager: async (): Promise<any> => {