Browse Source

webrtc: disallow publishing screen on devices that don't support it (#2066) (#2471)

pull/2475/head
Alessandro Ros 2 years ago committed by GitHub
parent
commit
3b4cac5af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      internal/core/webrtc_publish_index.html

21
internal/core/webrtc_publish_index.html

@ -523,15 +523,18 @@ const populateDevices = () => { @@ -523,15 +523,18 @@ const populateDevices = () => {
}
}
// add screen
const opt = document.createElement('option');
opt.value = "screen";
opt.text = "screen";
document.getElementById('video_device').appendChild(opt);
// set default
document.getElementById('video_device').value = document.getElementById('video_device').children[1].value;
if (document.getElementById('audio_device').children.length > 1) {
if (navigator.mediaDevices.getDisplayMedia !== undefined) {
const opt = document.createElement('option');
opt.value = "screen";
opt.text = "screen";
document.getElementById('video_device').appendChild(opt);
}
if (document.getElementById('video_device').children.length !== 0) {
document.getElementById('video_device').value = document.getElementById('video_device').children[1].value;
}
if (document.getElementById('audio_device').children.length !== 0) {
document.getElementById('audio_device').value = document.getElementById('audio_device').children[1].value;
}
});

Loading…
Cancel
Save