Skip to content

Commit

Permalink
Put getUserMedia call further away from onReady code, to prevent poss…
Browse files Browse the repository at this point in the history
…ible race condition
  • Loading branch information
bokner committed Sep 12, 2013
1 parent bf0053d commit 6ee3ccd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions priv/www/geofilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ function init_xmpp() {
if (RTC.browser == 'firefox') {
connection.jingle.media_constraints.mandatory['MozDontOfferDataChannel'] = true;
}
getUserMediaWithConstraints(['audio', 'video']);
// Connect to XMPP server
connection.connect(client.id + '@' + DOMAIN + "/" + client.geonum, "", onConnect);
} else {
//setStatus('webrtc capable browser required');
}
Expand Down Expand Up @@ -326,6 +327,9 @@ function onGetStunAndTurn(iceservers) {
}
// Don't need TURN service, disconnect
turn_service_connection.disconnect();
// Initialize local media
getUserMediaWithConstraints(['audio', 'video']);

}

function setStatus(txt) {
Expand Down Expand Up @@ -456,7 +460,6 @@ function onMediaReady(event, stream) {

RTC.attachMediaStream($('#local_video'), localStream);

connection.connect(client.id + '@' + DOMAIN + "/" + client.geonum, "", onConnect);
}

function onMediaFailure() {
Expand Down

0 comments on commit 6ee3ccd

Please sign in to comment.