Simple-peer: TypeError: Error creating RTCPeerConnection in Safari/iOS

Created on 30 Oct 2017  路  4Comments  路  Source: feross/simple-peer

I'm using simplepeer.min.js client side to instantiate and connect peers. My code runs in Chrome on my Mac, however I get TypeError: Error creating RTCPeerConnection in Safari as well as both Chrome and Safari on my phone. Has anyone seen/dealt with this before?

Most helpful comment

Safari doesn't support the url configuration, only urls (url is non-standard).

{iceServers: [{urls: 'stun:stun.l.google.com:19302'}]}

All 4 comments

Hello, what iOS version You have?

If I'm not wrong, I think that apple only supports WebRTC in version 11.1 +

@MaciejWWojcik You're right, this feature was only recently enabled by Apple. I'm on 11.0.3 so it should be supported in my browsers.

Here's a sample of my code where I'm seeing the error:

`
script src="simplepeer.min.js" type="text/javascript"
script src="socket.io.js" type="text/javascript"
script type="text/javascript"
if(SimplePeer.WEBRTC_SUPPORT) {
var socket = io.connect();

        socket.on('connect', function() {
          socket.emit('room', 'SOME_STRING');
        });

        socket.on('peer', function(data) {

          var peerId = data.peerId;
          var peer = new SimplePeer ({
            initiator: data.initiator,
            channelName: 'SOME_STRING',
            config: {iceServers: [{url: 'stun:stun.l.google.com:19302'}]},
            trickle: true,
            objectMode: true
          });

          ...
}

/script
`

Safari doesn't support the url configuration, only urls (url is non-standard).

{iceServers: [{urls: 'stun:stun.l.google.com:19302'}]}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dnish picture dnish  路  5Comments

adammw picture adammw  路  5Comments

measwel picture measwel  路  4Comments

lroellin picture lroellin  路  3Comments

mullerivan picture mullerivan  路  4Comments