Hanvod Posted August 6, 2018 Posted August 6, 2018 It seems like CEF doesnt allow me to use my microfone. <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title></title> <body> <h1 id="a">123</h1> <h1 id="b">123</h1> <h1 id="c">123</h1> <h1 id="d">123</h1> <script> document.getElementById("a").innerHTML = navigator.getUserMedia document.getElementById("b").innerHTML = navigator.webkitGetUserMedia document.getElementById("c").innerHTML = navigator.mozGetUserMedia navigator.webkitGetUserMedia({audio: true}, function(stream) {document.getElementById("d").innerHTML = stream}, function() {}) </script> </body> </html> First screenshot: Google Chrome, microfone using alowed, getUserMedia() and webkitGetUserMedia() exists, everything works fine Second screenshot: Google Chrome, microfone not alowed, getUserMedia() and webkitGetUserMedia() exists, stream is null, like it expected to be. Third screenshot: CEF in-game, getUserMedia() and webkitGetUserMedia() exists, but stream is null like if my microfone is disabled for some reason. Question: how to enable microfone inside CEF?
Ember Posted August 6, 2018 Posted August 6, 2018 (edited) Place them inside doc on ready $(document).ready(function () { document.getElementById("a").innerHTML = navigator.getUserMedia document.getElementById("b").innerHTML = navigator.webkitGetUserMedia document.getElementById("c").innerHTML = navigator.mozGetUserMedia navigator.webkitGetUserMedia({audio: true}, function(stream) {document.getElementById("d").innerHTML = stream}, function() {}) }); Edited August 6, 2018 by Mafiya
Hanvod Posted August 6, 2018 Author Posted August 6, 2018 (edited) 12 минуты назад, Mafiya сказал: Place them inside doc on ready Same result =( Edited August 6, 2018 by Hanvod
Ember Posted August 6, 2018 Posted August 6, 2018 (edited) <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title></title> <body> <body> <div id="container"> <audio controls autoplay></audio> </div> <script> const audio = document.querySelector('audio'); function cb(stream) { audio.srcObject = stream; } function errorCb(error) { console.log('error: ', error); } navigator.mediaDevices.getUserMedia({audio: true}).then(cb).catch(errorCb); </script> </body> </html> Edited August 6, 2018 by Mafiya
Ember Posted August 6, 2018 Posted August 6, 2018 (edited) 2 minutes ago, Hanvod said: sorry try the webkitgetusermedi <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title></title> <body> <body> <div id="container"> <audio controls autoplay></audio> </div> <script> const audio = document.querySelector('audio'); navigator.webkitGetUserMedia({audio:true}, function(stream) { audio.srcObject = stream; }, function(error){ } ); </script> </body> </html> Edited August 6, 2018 by Mafiya
Ember Posted August 6, 2018 Posted August 6, 2018 (edited) 3 minutes ago, Hanvod said: Nothing =( probably need https it will work on localhost because it's treated as a secure origin. read more: https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins Edited August 6, 2018 by Mafiya 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now