TEST: screen capture2

This commit is contained in:
w-okada 2023-07-19 19:17:31 +09:00
parent ba9b5de461
commit 7e4eed04e6
2 changed files with 23 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -298,14 +298,30 @@ export const DeviceArea = (_props: DeviceAreaProps) => {
// 共有スタート // 共有スタート
try { try {
displayMediaStream.current = await navigator.mediaDevices.getDisplayMedia({ // displayMediaStream.current = await navigator.mediaDevices.getDisplayMedia({
video: true, // video: true,
audio: true, // audio: true,
}); // });
const constraints = {
audio: {
mandatory: {
chromeMediaSource: "desktop",
},
},
video: {
mandatory: {
chromeMediaSource: "desktop",
},
},
};
// @ts-ignore
displayMediaStream.current = await navigator.mediaDevices.getUserMedia(constraints);
} catch (e) { } catch (e) {
console.log(e);
return; return;
} }
if (!displayMediaStream.current) { if (!displayMediaStream.current) {
console.log("no ms");
return; return;
} }
if (displayMediaStream.current?.getAudioTracks().length == 0) { if (displayMediaStream.current?.getAudioTracks().length == 0) {
@ -313,6 +329,8 @@ export const DeviceArea = (_props: DeviceAreaProps) => {
x.stop(); x.stop();
}); });
displayMediaStream.current = null; displayMediaStream.current = null;
console.log("no audio track");
return;
} }
try { try {