Move capabilities detection earlier

This commit is contained in:
Daniel Berteaud 2015-06-23 14:32:53 +02:00
parent b5a87581d5
commit b962a9e384
1 changed files with 12 additions and 12 deletions

View File

@ -716,7 +716,18 @@ function initJoin(room){
}
data.config.localVideoEl = 'webRTCVideoLocal';
webrtc = new SimpleWebRTC(data.config);
initVroom(room);
// If browser doesn't support webRTC or dataChannels
if (!webrtc.capabilities.support || !webrtc.capabilities.supportGetUserMedia || !webrtc.capabilities.supportDataChannel){
$('.connecting-msg').not('#no-webrtc-msg').remove();
$('#no-webrtc-msg').slideDown();
}
else{
// Hide screen sharing btn if not supported, disable it on mobile
if (!webrtc.capabilities.supportScreenSharing || !$.browser.desktop){
$('.btn-share-screen').remove();
}
initVroom(room);
}
}
});
}
@ -749,17 +760,6 @@ function initVroom(room) {
$('#name_local').css('background-color', peers.local.color);
// If browser doesn't support webRTC or dataChannels
if (!webrtc.capabilities.support || !webrtc.capabilities.supportGetUserMedia || !webrtc.capabilities.supportDataChannel){
$('.connecting-msg').not('#no-webrtc-msg').remove();
$('#no-webrtc-msg').slideDown();
}
// Hide screen sharing btn if not supported, disable it on mobile
if (!webrtc.capabilities.supportScreenSharing || !$.browser.desktop){
$('.btn-share-screen').remove();
}
// Return the number of peers in the room
function countPeers(){
var count = Object.keys(peers).length;