Sign in to follow this  
Hanvod

Let CEF use microfone

Recommended Posts

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

pwtCvgH.png

Second screenshot: Google Chrome, microfone not alowed, getUserMedia() and webkitGetUserMedia() exists, stream is null, like it expected to be.

kd8tqHP.png

Third screenshot: CEF in-game, getUserMedia() and webkitGetUserMedia() exists, but stream is null like if my microfone is disabled for some reason.

2dN3ZHn.png

Question: how to enable microfone inside CEF?

 

 

Share this post


Link to post
Share on other sites

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 by Mafiya

Share this post


Link to post
Share on other sites
12 минуты назад, Mafiya сказал:

Place them inside doc on ready

Same result =(

qMFGeUV.png

Edited by Hanvod

Share this post


Link to post
Share on other sites
<!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 by Mafiya

Share this post


Link to post
Share on other sites
2 minutes ago, Hanvod said:

zY6c1k2.png

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 by Mafiya

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.