|
@@ -96,15 +96,33 @@ export const ControlsView = ({
|
|
|
disabled={screenButtonDisabled}
|
|
|
onClick={() => {
|
|
|
setScreenButtonDisabled(true);
|
|
|
- room.localParticipant
|
|
|
- .setScreenShareEnabled(!enabled)
|
|
|
- .finally(() => setScreenButtonDisabled(false));
|
|
|
+ // room.localParticipant
|
|
|
+ // .setScreenShareEnabled(!enabled)
|
|
|
+ // .finally(() => setScreenButtonDisabled(false));
|
|
|
+ // 共享视频,并下载到本地
|
|
|
+ shareVideo().finally(() => setScreenButtonDisabled(false));
|
|
|
}}
|
|
|
/>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
// 新增代码
|
|
|
+ const shareVideo = async () => {
|
|
|
+ const stream = await (window as any).navigator.mediaDevices.getDisplayMedia();
|
|
|
+ const recoder = new (window as any).MediaRecorder(stream);
|
|
|
+ recoder.start();
|
|
|
+ const [video] = stream.getVideoTracks();
|
|
|
+ video.addEventListener('ended', () => {
|
|
|
+ recoder.stop();
|
|
|
+ });
|
|
|
+ recoder.addEventListener('dataavailable', (evt: any) => {
|
|
|
+ const a = document.createElement('a');
|
|
|
+ a.href = URL.createObjectURL(evt.data);
|
|
|
+ a.download = 'zoom.webm';
|
|
|
+ a.click();
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
const showChat = () => {
|
|
|
const chatArea: any = document.getElementById('chat-area');
|
|
|
chatArea.style.display = 'block';
|