webrtc - How to make getUserMedia() method works on Chromium Web browser inside WinForms application? -
i'm trying access webcam winforms application using chromium webbrowser control, installed html file - shown below - server (on machine) tried navigate application error callback of getusermedia() method executed showing "permission denied error", on other hand it's working fine if tried navigate directly chrome. so, there know causes error ?
// client.js file (function () { window.onerror = function (errormsg, url, linenumber) { alert(errormsg, ',url: ' + url + ' ,line: ' + linenumber); return true; } })(); function hasusermedia() { //check if browser supports webrtc return !!(navigator.getusermedia || navigator.webkitgetusermedia || navigator.mozgetusermedia); } if (hasusermedia()) { navigator.getusermedia = navigator.getusermedia || navigator.webkitgetusermedia || navigator.mozgetusermedia; //enabling video , audio channels navigator.getusermedia({ video: true, audio: true }, function (stream) { var video = document.queryselector('video'); //inserting our stream video tag video.src = window.url.createobjecturl(stream); }, function (err) { alert(err.name + " : " + err.message ); }); } else { alert("webrtc not supported"); }
<!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <video autoplay></video> <script src="client.js"></script> </body> </html>
Comments
Post a Comment