function createPeerConnection() {
var pc_config = {"iceServers": [{"url": "stun:stun.l.google.com:19302"}]};
try {
pc = new webkitRTCPeerConnection(pc_config);
pc.onicecandidate = onIceCandidate;
console.log("Created webkitRTCPeerConnnection with config \"" + JSON.stringify(pc_config) + "\".");
} catch (e) {
try {
var stun_server = "";
if (pc_config.iceServers.length !== 0) {
stun_server = pc_config.iceServers[0].url.replace('stun:', 'STUN ');
}
pc = new webkitPeerConnection00(stun_server, onIceCandidate00);
isRTCPeerConnection = false;
console.log("Created webkitPeerConnnection00 with config \"" + stun_server + "\".");
} catch (e) {
console.log("Failed to create PeerConnection, exception: " + e.message);
alert("Cannot create PeerConnection object; Is the 'PeerConnection' flag enabled in about:flags?");
return;
}
}
webGLandHTML5