How to use webrtc insde google chrome extension? -


i have developped google chrome extension.

i trying integrate webrtc feature inside:

navigator.getusermedia = navigator.getusermedia || navigator.webkitgetusermedia || navigator.mozgetusermedia; console.log("step1"); navigator.getusermedia({audio: true, video: true}, function(stream){     console.log("step2");     $('#myvideo').prop('src', url.createobjecturl(stream));     window.localstream = stream;     console.log("step3");    }, function(error){      console.log(error);  }); 

i got error:

step1 navigatorusermediaerror {constraintname: "", message: "", name: "invalidstateerror"} 

any idea ?

do need special permission use webrtc inside extension ? , possible access webrtc in extension ?

regards

here screenshot of call "popup" (extension = popup + background) pop window = chrome extension

in order use webrtc or speech recognition api in background page of chrome extension, need open page extension in tab, (popup) window or iframe (within tab) (if use iframe, don't forget list page in web_accessible_resources). in page, invoke navigator.webkitgetusermedia trigger permission prompt. after user approves permission, extension (in particular background page) can request access microphone / camera again, , request automatically approved.

whether silent approval after one-time prompt desirable is debated, , reason audiocapture , videocapture permissions cannot used in extensions yet. audiocapture , videocapture permissions will become available in future though, recommend putting these permissions in manifest file if extension needs it, when current versions of chrome not recognize permission extensions.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -