Move capabilities detection earlier

master
Daniel Berteaud 10 years ago
parent b5a87581d5
commit b962a9e384
  1. 24
      public/js/vroom.js

@ -716,7 +716,18 @@ function initJoin(room){
} }
data.config.localVideoEl = 'webRTCVideoLocal'; data.config.localVideoEl = 'webRTCVideoLocal';
webrtc = new SimpleWebRTC(data.config); 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); $('#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 // Return the number of peers in the room
function countPeers(){ function countPeers(){
var count = Object.keys(peers).length; var count = Object.keys(peers).length;

Loading…
Cancel
Save