Does RTCPeerConnection work in Microsoft Edge?

I am currently working on VoIP using WebRTC. This will be a UWP application written in JavaScript.

Now I'm trying to check if this works or not by testing samples from https://webrtc.imtqy.com/samples on Microsoft Edge.

Turns out it works fine except for RTCPeerConnection .

For example, when I opened https://webrtc.imtqy.com/samples/src/content/peerconnection/audio in Edge, it gave me getUserMedia() error: NotFoundError when I pressed the call button. It works great in Chrome.

Another example: when I tried https://apprtc.appspot.com , it gave me

 Messages: Error getting user media: null getUserMedia error: Failed to get access to local media. Error name was NotFoundError. Continuing without sending a stream. Create PeerConnection exception: InvalidAccessError Version: gitHash: c135495bc71e5da61344f098a8209a255f64985f branch: master time: Fri Apr 8 13:33:05 2016 +0200 

So how should I fix this? Adapter.js also called. I also allow everything I need.

Or I should not use WebRTC for this project. If so, what should I use?

Hooray!

+5
source share
2 answers

Microsoft Edge implements ORTC, a lower-level decentralized cousin of WebRTC that does not have a comprehensive RTCPeerConnection object.

But the good news is that adapter.js , the official WebRTC polyfill, RTCPeerConnection gaskets for you on Edge, so you should be able to use WebRTC in the same way in all browsers.

For example, this demo works for me in Edge, Firefox, and Chrome.

 var pc1 = new RTCPeerConnection(), pc2 = new RTCPeerConnection(); navigator.mediaDevices.getUserMedia({ video: true, audio: true }) .then(stream => pc1.addStream(video1.srcObject = stream)) .catch(log); var add = (pc, can) => can && pc.addIceCandidate(can).catch(log); pc1.onicecandidate = e => add(pc2, e.candidate); pc2.onicecandidate = e => add(pc1, e.candidate); pc2.onaddstream = e => video2.srcObject = e.stream; pc1.oniceconnectionstatechange = e => log(pc1.iceConnectionState); pc1.onnegotiationneeded = e => pc1.createOffer().then(d => pc1.setLocalDescription(d)) .then(() => pc2.setRemoteDescription(pc1.localDescription)) .then(() => pc2.createAnswer()).then(d => pc2.setLocalDescription(d)) .then(() => pc1.setRemoteDescription(pc2.localDescription)) .catch(log); var log = msg => div.innerHTML += "<br>" + msg; 
 <video id="video1" width="160" height="120" autoplay muted></video> <video id="video2" width="160" height="120" autoplay></video><br> <div id="div"></div> <script src="https://webrtc.imtqy.com/adapter/adapter-latest.js"></script> 
+9
source

You must first check your privacy settings to allow Edge to access your multimedia devices. https://privacy.microsoft.com/en-us/windows-10-camera-and-privacy

0
source

Source: https://habr.com/ru/post/1247817/


All Articles