From b962a9e384502cb3d45ad45c842a6588ac26de4a Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 23 Jun 2015 14:32:53 +0200 Subject: [PATCH] Move capabilities detection earlier --- public/js/vroom.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index 2ba7fd2..7189f5a 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -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;