1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<!DOCTYPE html> <meta charset="utf-8"> <script> window.onmessage = m => { navigator.mediaDevices.getUserMedia({video: true}) .then(() => 'ok') .catch(e => e.name) .then(r => { window.parent.postMessage({ id: m.data.id, result: r }, '*'); }); } </script>