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

View File

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