Merge branch '2x-browser-detection' of https://github.com/riadvice/bigbluebutton into riadvice-2x-browser-detection

This commit is contained in:
Richard Alam 2017-10-13 06:52:32 -07:00
commit f197aaff62
13 changed files with 144 additions and 113 deletions

View File

@ -369,6 +369,7 @@ bbb.video.publish.closeBtn.accessName = Close the webcam settings dialog box
bbb.video.publish.closeBtn.label = Cancel
bbb.video.publish.titleBar = Publish Webcam Window
bbb.video.streamClose.toolTip = Close stream for: {0}
bbb.video.message.browserhttp = This server is not configured with SSL. As a result, {0} disables sharing of your webcam.
bbb.screensharePublish.title = Screen Sharing: Presenter's Preview
bbb.screensharePublish.pause.tooltip = Pause screen share
bbb.screensharePublish.pause.label = Pause

View File

@ -97,11 +97,9 @@ function determineBrowser()
var nameOffset,verOffset,ix;
// In Opera, the true version is after "Opera" or after "Version"
if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
if ((verOffset=nAgt.indexOf("OPR/"))!=-1) {
browserName = "Opera";
fullVersion = nAgt.substring(verOffset+6);
if ((verOffset=nAgt.indexOf("Version"))!=-1)
fullVersion = nAgt.substring(verOffset+8);
fullVersion = nAgt.substring(verOffset+4);
}
// In MSIE, the true version is after "MSIE" in userAgent
else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {

View File

@ -44,12 +44,6 @@ package org.bigbluebutton.main.api
return false;
}
public function getBrowserInfo():Array {
if (ExternalInterface.available) {
return ExternalInterface.call("determineBrowser");
}
return ["unknown", 0, 0];
}
}
}

View File

@ -44,18 +44,16 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.phone.events.JoinVoiceConferenceCommand;
import org.bigbluebutton.modules.phone.events.UseFlashModeCommand;
import org.bigbluebutton.modules.phone.models.PhoneOptions;
import org.bigbluebutton.util.browser.BrowserCheck;
import org.bigbluebutton.util.i18n.ResourceUtil;
private static const LOGGER:ILogger = getClassLogger(AudioSelectionWindow);
private var phoneOptions:PhoneOptions;
private var browserInfo:Array;
private function init():void {
phoneOptions = Options.getOptions(PhoneOptions) as PhoneOptions;
browserInfo = JSAPI.getInstance().getBrowserInfo();
if (!phoneOptions.listenOnlyMode)
btnListenOnly.enabled = false;
@ -75,23 +73,22 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
// If Puffin browser is deteted and version is less than 4.6
if (browserInfo[0] == "Puffin" && String(browserInfo[2]).substr(0, 3) < "4.6") {
if (BrowserCheck.isPuffinBelow46()) {
vboxListen.percentWidth = 100;
}
}
private function onMicClick():void {
LOGGER.debug("AudioSelectionWindow - Share Microphone Clicked");
var dispatcher:Dispatcher = new Dispatcher();
if (browserInfo[0] == "Puffin" && String(browserInfo[2]).substr(0, 3) >= "4.6") {
dispatcher.dispatchEvent(new UseFlashModeCommand());
}
else {
if (BrowserCheck.isPuffin46AndAbove() || (!BrowserCheck.isHttps() && ((BrowserCheck.isChrome() && BrowserCheck.browserMajorVersion >= "60") || (BrowserCheck.isOpera() && BrowserCheck.browserMajorVersion >= "47")))) {
dispatcher.dispatchEvent(new UseFlashModeCommand());
} else {
var command:JoinVoiceConferenceCommand = new JoinVoiceConferenceCommand();
command.mic = true;
dispatcher.dispatchEvent(command);
}
PopUpUtil.removePopUp(this);
}

View File

@ -150,6 +150,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.phone.events.WebRTCEchoTestEvent;
import org.bigbluebutton.modules.phone.events.WebRTCMediaEvent;
import org.bigbluebutton.modules.phone.models.PhoneOptions;
import org.bigbluebutton.util.browser.BrowserCheck;
import org.bigbluebutton.modules.users.model.UsersOptions;
import org.bigbluebutton.modules.users.views.BreakoutRoomSettings;
import org.bigbluebutton.modules.videoconf.events.ShareCameraRequestEvent;
@ -492,21 +493,19 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function versionCheck():void {
var browserOptions : BrowserVersionsOptions = Options.getOptions(BrowserVersionsOptions) as BrowserVersionsOptions;
if (!StringUtils.isEmpty(browserOptions.chrome) && !StringUtils.isEmpty(browserOptions.firefox) && !StringUtils.isEmpty(browserOptions.flash)) {
//find browser version
var browserVersion:Array = ExternalInterface.call("determineBrowser");
//check browser version
if ((browserVersion[0].toString().toLowerCase() == "chrome" && browserVersion[1] < browserOptions.chrome) || browserVersion[0].toString().toLowerCase() == "firefox" && browserVersion[1] < browserOptions.firefox) {
if ((BrowserCheck.isChrome() && BrowserCheck.browserMajorVersion < browserOptions.chrome) || BrowserCheck.isFirefox() && BrowserCheck.browserMajorVersion < browserOptions.firefox) {
globalDispatcher.dispatchEvent(new ClientStatusEvent(ClientStatusEvent.WARNING_MESSAGE_EVENT,
ResourceUtil.getInstance().getString("bbb.clientstatus.browser.title"),
ResourceUtil.getInstance().getString("bbb.clientstatus.browser.message", [browserVersion[0]+" "+browserVersion[1]]),
ResourceUtil.getInstance().getString("bbb.clientstatus.browser.message", [BrowserCheck.browserName+" "+BrowserCheck.browserMajorVersion]),
'bbb.clientstatus.browser.message'));
}
//find flash version
var flashVersion:Object = getFlashVersion();
//check flash version
if ((flashVersion.os == 'LNX' && browserVersion[0].toString().toLowerCase() != "chrome" && flashVersion.major < 11) ||
((flashVersion.os != 'LNX' || browserVersion[0].toString().toLowerCase() == "chrome") && flashVersion.major < browserOptions.flash)) {
if ((flashVersion.os == 'LNX' && !BrowserCheck.isChrome() && flashVersion.major < 11) ||
((flashVersion.os != 'LNX' || BrowserCheck.isChrome()) && flashVersion.major < browserOptions.flash)) {
globalDispatcher.dispatchEvent(new ClientStatusEvent(ClientStatusEvent.WARNING_MESSAGE_EVENT,
ResourceUtil.getInstance().getString("bbb.clientstatus.flash.title"),
ResourceUtil.getInstance().getString("bbb.clientstatus.flash.message", [flashVersion.major+"."+flashVersion.minor+"."+flashVersion.build]),
@ -629,9 +628,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function handleWebRTCMediaRequestEvent(event:WebRTCMediaEvent):void {
var options:PhoneOptions = new PhoneOptions();
if (!options.showMicrophoneHint) return;
var browser:String = ExternalInterface.call("determineBrowser")[0];
var browserPermissionHelper:BrowserPermissionHelper = PopUpUtil.createModalPopUp(mdiCanvas, BrowserPermissionHelper, false) as BrowserPermissionHelper;
if (browser == "Firefox") {
if (BrowserCheck.isFirefox()) {
if (browserPermissionHelper) {
if (Capabilities.os.indexOf("Mac") >= 0){
browserPermissionHelper.currentState = "firefoxMicMacOSX";
@ -642,7 +640,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
browserPermissionHelper.x = 50;
browserPermissionHelper.y = 200;
}
} else if (browser == "Chrome") {
} else if (BrowserCheck.isChrome()) {
if (browserPermissionHelper) {
browserPermissionHelper.currentState = "chromeMic";
browserPermissionHelper.x = 50;
@ -666,7 +664,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function handleShareCameraRequestEvent(event:ShareCameraRequestEvent):void {
if (ExternalInterface.call("determineBrowser")[0] == "Chrome") {
if (BrowserCheck.isChrome()) {
// Show browserPermissionHelper component after showing the webcam window due event listeners registration order
setTimeout(showbrowserPermissionHelper, 100);
}

View File

@ -14,7 +14,6 @@ package org.bigbluebutton.modules.phone.managers
import org.as3commons.logging.util.jsonXify;
import org.bigbluebutton.core.Options;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.main.api.JSAPI;
import org.bigbluebutton.main.events.ClientStatusEvent;
import org.bigbluebutton.main.model.users.AutoReconnect;
import org.bigbluebutton.modules.phone.events.AudioSelectionWindowEvent;
@ -36,8 +35,6 @@ package org.bigbluebutton.modules.phone.managers
private static const LOGGER:ILogger = getClassLogger(WebRTCCallManager);
private const MAX_RETRIES:Number = 3;
private var browserType:String = "unknown";
private var browserVersion:int = 0;
private var dispatcher:Dispatcher = new Dispatcher();
private var echoTestDone:Boolean = false;
@ -50,11 +47,6 @@ package org.bigbluebutton.modules.phone.managers
private var reconnecting:Boolean = false;
public function WebRTCCallManager() {
var browserInfo:Array = JSAPI.getInstance().getBrowserInfo();
if (browserInfo != null) {
browserType = browserInfo[0];
browserVersion = browserInfo[1];
}
options = Options.getOptions(PhoneOptions) as PhoneOptions;
// only show the warning if the admin has enabled WebRTC

View File

@ -36,7 +36,7 @@ package org.bigbluebutton.modules.screenshare.managers {
import org.bigbluebutton.modules.screenshare.model.ScreenshareModel;
import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions;
import org.bigbluebutton.modules.screenshare.services.ScreenshareService;
import org.bigbluebutton.modules.screenshare.utils.BrowserCheck;
import org.bigbluebutton.util.browser.BrowserCheck;
public class ScreenshareManager {
private static const LOGGER:ILogger = getClassLogger(ScreenshareManager);

View File

@ -1,51 +0,0 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2016 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.modules.screenshare.utils
{
import flash.external.ExternalInterface;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
public class BrowserCheck {
private static const LOGGER:ILogger = getClassLogger(BrowserCheck);
public static function isWebRTCSupported():Boolean {
/*LOGGER.debug("isWebRTCSupported - ExternalInterface.available=[{0}], isWebRTCAvailable=[{1}]", [ExternalInterface.available, ExternalInterface.call("isWebRTCAvailable")]);*/
return (ExternalInterface.available && ExternalInterface.call("isWebRTCAvailable"));
}
public static function isChrome():Boolean {
var browser:Array = ExternalInterface.call("determineBrowser");
return browser[0] == "Chrome";
}
public static function isFirefox():Boolean {
var browser:Array = ExternalInterface.call("determineBrowser");
return browser[0] == "Firefox";
}
public static function isHttps():Boolean {
var url:String = ExternalInterface.call("window.location.href.toString");
var httpsPattern:RegExp = /^https/;
return httpsPattern.test(url);
}
}
}

View File

@ -26,6 +26,7 @@ package org.bigbluebutton.modules.screenshare.utils
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.core.Options;
import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions;
import org.bigbluebutton.util.browser.BrowserCheck;
public class WebRTCScreenshareUtility {
private static const LOGGER:ILogger = getClassLogger(WebRTCScreenshareUtility);

View File

@ -128,8 +128,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
os = "";
}
browser = ExternalInterface.call("determineBrowser")[0];
windowControls.maximizeRestoreBtn.enabled = false;
titleBarOverlay.tabIndex = dsOptions.baseTabIndex;

View File

@ -18,7 +18,7 @@
*/
package org.bigbluebutton.modules.videoconf.model {
import org.bigbluebutton.core.Options;
import org.bigbluebutton.main.api.JSAPI;
import org.bigbluebutton.util.browser.BrowserCheck;
public class VideoConfOptions extends Options {
public var uri:String = "rtmp://localhost/video";
@ -58,10 +58,8 @@ package org.bigbluebutton.modules.videoconf.model {
}
override protected function handleExtraData():void {
var browserInfo:Array = JSAPI.getInstance().getBrowserInfo();
// If we are using Puffin browser
if (browserInfo[0] == "Puffin" && String(browserInfo[2]).substr(0, 3) < "4.6") {
if (BrowserCheck.isPuffinBelow46()) {
showButton = false;
}
}

View File

@ -42,25 +42,31 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<fx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import com.asfusion.mate.events.Dispatcher;
import mx.controls.Alert;
import mx.controls.Menu;
import mx.events.MenuEvent;
import mx.styles.IStyleManager2;
import mx.styles.StyleManager;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.common.Media;
import org.bigbluebutton.core.events.LockControlEvent;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.model.users.events.ChangeMyRole;
import org.bigbluebutton.main.views.MainToolbar;
import org.bigbluebutton.modules.videoconf.events.ShareCameraRequestEvent;
import org.bigbluebutton.modules.videoconf.events.StopShareCameraRequestEvent;
import org.bigbluebutton.util.browser.BrowserCheck;
import org.bigbluebutton.util.i18n.ResourceUtil;
import mx.controls.Menu;
import mx.events.MenuEvent;
import mx.styles.IStyleManager2;
import mx.styles.StyleManager;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.common.Media;
import org.bigbluebutton.core.events.LockControlEvent;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.model.users.events.ChangeMyRole;
import org.bigbluebutton.main.views.MainToolbar;
import org.bigbluebutton.modules.videoconf.events.ShareCameraRequestEvent;
import org.bigbluebutton.modules.videoconf.events.StopShareCameraRequestEvent;
import org.bigbluebutton.util.i18n.ResourceUtil;
private static const LOGGER:ILogger = getClassLogger(ToolbarPopupButton);
@ -177,6 +183,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function openPublishWindow():void{
if (!BrowserCheck.isHttps() && ((BrowserCheck.isChrome() && BrowserCheck.browserMajorVersion >= "60") || (BrowserCheck.isOpera() && BrowserCheck.browserMajorVersion >= "47"))) {
Alert.show(ResourceUtil.getInstance().getString("bbb.video.message.browserhttp", [BrowserCheck.browserName]));
return;
}
this.enabled = false;
if(_currentState == ON_STATE) {
LOGGER.debug("[ToolbarPopupButton:openPublishWindow] Close window");

View File

@ -0,0 +1,95 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2016 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.util.browser {
import flash.external.ExternalInterface;
import org.as3commons.lang.StringUtils;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
public class BrowserCheck {
private static const LOGGER:ILogger = getClassLogger(BrowserCheck);
private static var _browserName:String;
private static var _majorVersion:String;
private static var _fullVersion:String;
// The function below is called in $cinit, while the class is used for the first time.
getBrowserInfo();
public static function isWebRTCSupported():Boolean {
/*LOGGER.debug("isWebRTCSupported - ExternalInterface.available=[{0}], isWebRTCAvailable=[{1}]", [ExternalInterface.available, ExternalInterface.call("isWebRTCAvailable")]);*/
return (ExternalInterface.available && ExternalInterface.call("isWebRTCAvailable"));
}
public static function get browserName():String {
return _browserName;
}
public static function get browserMajorVersion():String {
return _majorVersion;
}
public static function get browserFullVersion():String {
return _fullVersion;
}
public static function isChrome():Boolean {
return _browserName.toLowerCase() == "chrome";
}
public static function isOpera():Boolean {
return _browserName.toLowerCase() == "opera";
}
public static function isFirefox():Boolean {
return _browserName.toLowerCase() == "firefox";
}
public static function isPuffinBelow46():Boolean {
return _browserName.toLowerCase() == "puffin" && String(_fullVersion).substr(0, 3) < "4.6";
}
public static function isPuffin46AndAbove():Boolean {
return browserName.toLowerCase() == "puffin" && String(_fullVersion).substr(0, 3) >= "4.6";
}
private static function getBrowserInfo():void {
if (ExternalInterface.available && StringUtils.isEmpty(browserName)) {
var browserInfo:Array = ExternalInterface.call("determineBrowser");
_browserName = browserInfo[0];
_majorVersion = String(browserInfo[1]);
_fullVersion = String(browserInfo[2]);
} else {
_browserName = "unknown";
_majorVersion = "0";
_fullVersion = "0";
}
}
public static function isHttps():Boolean {
var url:String = ExternalInterface.call("window.location.href.toString");
var httpsPattern:RegExp = /^https/;
return httpsPattern.test(url);
}
}
}