Permalink
Browse files

show relay-first strategy

  • Loading branch information...
fippo committed Apr 20, 2015
1 parent 18d5322 commit bc8a3ac137bf49795f2ed1487cdfdfab6451540b
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/content/peerconnection/munge-sdp/js/main.js
@@ -48,6 +48,8 @@ var sdpConstraints = {
}
};
var restartIce = false;
getSources();
function getSources() {
@@ -137,7 +139,7 @@ function createPeerConnection() {
if (audioTracks.length > 0) {
trace('Using audio device: ' + audioTracks[0].label);
}
var servers = null;
var servers = {iceServers: [{"username":"bring","credential":"your","url":"turn:own.server"}]};
localPeerConnection = new RTCPeerConnection(servers);
trace('Created local peer connection object localPeerConnection');
localPeerConnection.onicecandidate = iceCallback1;
@@ -169,7 +171,7 @@ function maybeAddLineBreakToEnd(sdp) {
function createOffer() {
localPeerConnection.createOffer(gotDescription1,
onCreateSessionDescriptionError);
onCreateSessionDescriptionError, {mandatory: {RestartIce: restartIce}});
}
function onCreateSessionDescriptionError(error) {
@@ -254,6 +256,7 @@ function gotRemoteStream(e) {
function iceCallback1(event) {
if (event.candidate) {
if (!restartIce && event.candidate.candidate.indexOf('typ relay') === -1) return;
remotePeerConnection.addIceCandidate(new RTCIceCandidate(event.candidate),
onAddIceCandidateSuccess, onAddIceCandidateError);
trace('Local ICE candidate: \n' + event.candidate.candidate);
@@ -262,6 +265,7 @@ function iceCallback1(event) {
function iceCallback2(event) {
if (event.candidate) {
if (!restartIce && event.candidate.candidate.indexOf('typ relay') === -1) return;
localPeerConnection.addIceCandidate(new RTCIceCandidate(event.candidate),
onAddIceCandidateSuccess, onAddIceCandidateError);
trace('Remote ICE candidate: \n ' + event.candidate.candidate);

1 comment on commit bc8a3ac

@fippo

This comment has been minimized.

Show comment
Hide comment
@fippo

fippo Apr 20, 2015

Owner

@juberti: what I was talking about. Don't think it makes sense to make a PR, just needed this for a blog post.

Owner

fippo commented on bc8a3ac Apr 20, 2015

@juberti: what I was talking about. Don't think it makes sense to make a PR, just needed this for a blog post.

Please sign in to comment.