Reputation: 195
var peerConnectionConfig = {'iceServers': [{'url': 'stun:stun.services.mozilla.com'}, {'url': 'stun:stun.l.google.com:19302'}]};
window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
var peerConnection = new RTCPeerConnection(peerConnectionConfig);
var promise = peerConnection.createOffer();
I'm trying to create an offer with PeerConnection as shown in MDN but I'm getting the following error in Chrome:
Uncaught TypeError: Failed to execute 'createOffer' on 'RTCPeerConnection': 2 arguments required, but only 0 present.
Upvotes: 1
Views: 2205
Reputation: 25034
I think the issue is because chrome does not return a promise, it expects a success and error callbacks functions as parameters, you can circumvent these differences and avoid manually handling prefix differences by using adapter.js
Upvotes: 2