WebKit Bugzilla
Attachment 370251 Details for
Bug 198040
: getDisplayMedia fails when called from a promise created during a user gesture
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
getDisplayMedia example
index.html (text/html), 911 bytes, created by
philipp.weissensteiner
on 2019-05-20 07:46:54 PDT
(
hide
)
Description:
getDisplayMedia example
Filename:
MIME Type:
Creator:
philipp.weissensteiner
Created:
2019-05-20 07:46:54 PDT
Size:
911 bytes
patch
obsolete
><!DOCTYPE html> ><html> > <head> > <meta charset="UTF-8" /> > <title>getDisplayMedia</title> > </head> > <body> > <button onclick="getMedia()">get media</button> > <video id="video-1" width="400" height="300"></video> > <video id="video-2" width="400" height="300"></video> > </body> > <script> > function assignVideo(id, stream) { > const video = document.getElementById(id); > video.srcObject = stream; > video.play(); > } > > async function getMedia() { > // const camera = await navigator.mediaDevices.getUserMedia({ video: true }); > // assignVideo('video-1', camera); > const devices = await navigator.mediaDevices.enumerateDevices(); > console.log(devices); > > // calling getUserMedia here works > const screen = await navigator.mediaDevices.getDisplayMedia({ > video: true > }); > assignVideo('video-2', screen); > } > </script> ></html>
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>getDisplayMedia</title> </head> <body> <button onclick="getMedia()">get media</button> <video id="video-1" width="400" height="300"></video> <video id="video-2" width="400" height="300"></video> </body> <script> function assignVideo(id, stream) { const video = document.getElementById(id); video.srcObject = stream; video.play(); } async function getMedia() { // const camera = await navigator.mediaDevices.getUserMedia({ video: true }); // assignVideo('video-1', camera); const devices = await navigator.mediaDevices.enumerateDevices(); console.log(devices); // calling getUserMedia here works const screen = await navigator.mediaDevices.getDisplayMedia({ video: true }); assignVideo('video-2', screen); } </script> </html>
View Attachment As Raw
Actions:
View
Attachments on
bug 198040
: 370251