I use WebRTC and understand that it is not supported in all browsers. However, Chrome and Firefox support it (in new versions, I have the latest versions installed) if you have the correct prefix for certain variables. For example, I have the following for PeerConnection for cross-browser support:
var PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
Now that it should be supported by a cross browser, I have the following code:
var servers = { iceservers: [ {url: "stun:23.21.150.121"}, {url: "stun:stun.1.google.com:19302"} ] }; var pc = PeerConnection(servers);
But in Chrome, it gets an error on the last line ( var pc = PeerConnection(servers); ). Mistake:
Failed to construct 'RTCPeerConnection': Malformed RTCConfiguration"}
Obviously, Chrome doesn't like my configuration option in the PeerConnection declaration. But my question is: why am I getting this error and how does it only happen in Chrome? (FireFox works great)
javascript google-chrome webrtc
chRyNaN
source share