This commit is contained in:
yj 2024-08-07 17:14:09 +08:00
parent 9eb85d1bd2
commit 459d5c1a49
2 changed files with 28 additions and 7 deletions

View File

@ -108,6 +108,8 @@ const Meeting: React.FC = () => {
const [currentVideoId, setCurrentVideoId] = useState('') const [currentVideoId, setCurrentVideoId] = useState('')
let [currentSeconds, setCurrentSeconds] = useState(0) let [currentSeconds, setCurrentSeconds] = useState(0)
const [currentEffective, setCurrentEffective] = useState(0) const [currentEffective, setCurrentEffective] = useState(0)
const [isComputerAudio, setIsComputerAudio] = useState(true)
const [isFluencyPriority, setIsFluencyPriority] = useState(true)
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
const [modeOpen, setModeOpen] = useState(false) const [modeOpen, setModeOpen] = useState(false)
const [meetingMode, setMeetingMode] = useState('') const [meetingMode, setMeetingMode] = useState('')
@ -470,7 +472,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)
await agora.setDesktopCapturerVideo(sharedScreenItem) await agora.setDesktopCapturerVideo(sharedScreenItem, isComputerAudio, isFluencyPriority)
await allUserLook(user.screenShareId) await allUserLook(user.screenShareId)
} else { } else {
message.error('请选择应用!') message.error('请选择应用!')
@ -972,9 +974,14 @@ const Meeting: React.FC = () => {
})} })}
</div> </div>
<div> <div>
<Checkbox onChange={() => { <div>
<Checkbox onChange={(e) => {
}}></Checkbox> setIsComputerAudio(e.target.checked)
}} checked={isComputerAudio}></Checkbox>
<Checkbox onChange={(e) => {
setIsFluencyPriority(e.target.checked)
}} checked={isFluencyPriority}></Checkbox>
</div>
<div> <div>
<Button type="primary" onClick={() => { setIsSharedScreenModal(false) }} style={{ backgroundColor: '#31353A', marginRight: '14px' }}></Button> <Button type="primary" onClick={() => { setIsSharedScreenModal(false) }} style={{ backgroundColor: '#31353A', marginRight: '14px' }}></Button>
<Button type="primary" className='m-ant-btn' onClick={() => clickSharedScreen()}></Button> <Button type="primary" className='m-ant-btn' onClick={() => clickSharedScreen()}></Button>

View File

@ -154,6 +154,7 @@ const agora = {
// 停止共享屏幕 // 停止共享屏幕
stopScreenCapture: () => { stopScreenCapture: () => {
rtcEngine.stopScreenCapture(); rtcEngine.stopScreenCapture();
rtcEngine.enableLoopbackRecording(false)
}, },
// 取消或恢复发布本地音频流 // 取消或恢复发布本地音频流
muteLocalAudioStream: (mute: any) => { muteLocalAudioStream: (mute: any) => {
@ -183,11 +184,22 @@ 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: async (targetSource: any) => { setDesktopCapturerVideo: async (targetSource: any, isComputerAudio: boolean, isFluencyPriority: boolean) => {
// await rtcEngine.stopCameraCapture(option.sourceType)
const user = JSON.parse(storage.getItem('user') as string) const user = JSON.parse(storage.getItem('user') as string)
agora.stopScreenCapture(); agora.stopScreenCapture();
rtcEngine.enableLoopbackRecording(true) if (isComputerAudio) {
rtcEngine.enableLoopbackRecording(true)
}
let data = {};
if (isFluencyPriority) {
data = {
frameRate: 15,
dimensions: {
window: 3000,
height: 3000,
}
}
}
if ( if (
targetSource.type === targetSource.type ===
ScreenCaptureSourceType.ScreencapturesourcetypeScreen ScreenCaptureSourceType.ScreencapturesourcetypeScreen
@ -199,6 +211,7 @@ const agora = {
windowFocus: true, windowFocus: true,
enableHighLight: true, enableHighLight: true,
highLightColor: 0xFF99CC00, highLightColor: 0xFF99CC00,
...data
} }
); );
} else { } else {
@ -209,6 +222,7 @@ const agora = {
windowFocus: true, windowFocus: true,
enableHighLight: true, enableHighLight: true,
highLightColor: 0xFF99CC00, highLightColor: 0xFF99CC00,
...data
} }
); );
} }