Help dialogs for ext install

This commit is contained in:
perroned 2016-10-05 14:35:35 +00:00
parent 26ab092182
commit a194ddbba4
7 changed files with 322 additions and 99 deletions

View File

@ -278,38 +278,34 @@ Verto.prototype.makeShare = function () {
return;
}
getChromeExtensionStatus(this.chromeExtension, function (status) {
if (status != 'installed-enabled') {
_this.logError('No chrome Extension');
_this.onFail();
return -1;
}
// bring up Chrome screen picker
getScreenConstraints(function (error, screenConstraints) {
if (error) {
getMyScreenConstraints(function (constraints) {
if (constraints == null || constraints == "" || constraints.streamId == null || constraints.streamId == "") {
_this.onFail();
return _this.logError(error);
return _this.logError(constraints);
}
screenInfo = screenConstraints.mandatory;
screenInfo = constraints.streamId;
_this.logger(screenInfo);
_this.doShare(screenInfo);
});
});
}, _this.chromeExtension);
}
};
Verto.prototype.doShare = function (screenConstraints) {
//debugger;
this.share_call = window.vertoHandle.newCall({
destination_number: this.destination_number,
caller_id_name: this.caller_id_name,
caller_id_number: this.caller_id_number,
outgoingBandwidth: "76800",
incomingBandwidth: "118154",
videoParams: screenConstraints,
outgoingBandwidth: "default",
incomingBandwidth: "default",
videoParams: {
chromeMediaSource: "desktop",
chromeMediaSourceId: screenConstraints,
maxWidth: 640,
maxHeight: 480
},
useVideo: true,
screenShare: true,
@ -526,3 +522,54 @@ window.vertoExtensionGetChromeExtensionStatus = function (extensionid, callback)
getChromeExtensionStatus(extensionid, callback);
};
// a function to check whether the browser (Chrome only) is in an isIncognito
// session. Requires 1 mandatory callback that only gets called if the browser
// session is incognito. The callback for not being incognito is optional.
// Attempts to retrieve the chrome filesystem API.
window.checkIfIncognito = function(isIncognito, isNotIncognito = function () {}) {
isIncognito = Verto.normalizeCallback(isIncognito);
isNotIncognito = Verto.normalizeCallback(isNotIncognito);
var fs = window.RequestFileSystem || window.webkitRequestFileSystem;
if (!fs) {
isNotIncognito();
return;
}
fs(window.TEMPORARY, 100, function(){isNotIncognito()}, function(){isIncognito()});
};
window.checkChromeExtInstalled = function (callback, chromeExtensionId) {
callback = Verto.normalizeCallback(callback);
if (typeof chrome === "undefined" || !chrome || !chrome.runtime) {
// No API, so no extension for sure
callback(false);
return;
}
chrome.runtime.sendMessage(
chromeExtensionId,
{ getVersion: true },
function (response) {
if (!response || !response.version) {
// Communication failure - assume that no endpoint exists
callback(false);
return;
}
callback(true);
}
);
}
window.getMyScreenConstraints = function(theCallback, extensionId) {
theCallback = Verto.normalizeCallback(theCallback);
chrome.runtime.sendMessage(extensionId, {
getStream: true,
sources: [
"window",
"screen"
]},
function(response) {
console.log(response);
theCallback(response);
});
};

View File

@ -0,0 +1,38 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2015 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.events
{
import flash.events.Event;
import org.bigbluebutton.main.api.JSLog;
public class WebRTCPublishWindowChangeState extends Event
{
public static const DISPLAY_INSTALL:String = "WebRTC Deskshare Display Install Screen";
public static const DISPLAY_RETRY:String = "WebRTC Deskshare Display Retry Screen";
public static const DISPLAY_FALLBACK:String = "WebRTC Deskshare Display Fallback Screen";
public function WebRTCPublishWindowChangeState(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
{
JSLog.warn("new WebRTCPublishWindowChangeState", type);
super(type, bubbles, cancelable);
}
}
}

View File

@ -32,6 +32,8 @@ package org.bigbluebutton.modules.screenshare.managers
import org.bigbluebutton.modules.screenshare.events.WebRTCViewStreamEvent;
import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions;
import org.bigbluebutton.modules.screenshare.events.ShareWindowEvent;
import org.bigbluebutton.modules.screenshare.events.WebRTCPublishWindowChangeState;
import org.bigbluebutton.modules.screenshare.view.components.WebRTCDesktopPublishWindow;
import org.bigbluebutton.modules.screenshare.services.WebRTCDeskshareService;
import org.bigbluebutton.modules.screenshare.utils.BrowserCheck;
import org.bigbluebutton.modules.screenshare.events.DeskshareToolbarEvent;
@ -103,8 +105,6 @@ package org.bigbluebutton.modules.screenshare.managers
JSLog.warn("WebRTCDeskshareManager::stopWebRTCDeskshare", {});
viewWindowManager.stopViewing();
globalDispatcher.dispatchEvent(new ShareWindowEvent(ShareWindowEvent.CLOSE));
if (ExternalInterface.available) {
ExternalInterface.call("vertoExitScreenShare");
}
@ -162,52 +162,14 @@ package org.bigbluebutton.modules.screenshare.managers
sharing = false;
}
private function canIUseVertoOnThisBrowser(onFailure:Function, onSuccess:Function):void {
private function canIUseVertoOnThisBrowser(newOnWebRTCBrokeFailure:Function = null, newOnNoWebRTCFailure:Function = null, newOnSuccess:Function = null):void {
LOGGER.debug("DeskshareManager::canIUseVertoOnThisBrowser");
JSLog.warn("WebRTCDeskshareManager::canIUseVertoOnThisBrowser", {});
var options:ScreenshareOptions = new ScreenshareOptions();
options.parseOptions();
var onNoWebRTCFailure:Function, onWebRTCBrokeFailure:Function, onSuccess:Function;
if (options.tryWebRTCFirst && BrowserCheck.isWebRTCSupported()) {
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent WebRTC Supported", {});
if (BrowserCheck.isFirefox()) {
onSuccess("Firefox, lets try");
} else {
if (chromeExtensionKey != null) {
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent chrome extension key exists - ", chromeExtensionKey);
if (ExternalInterface.available) {
var success:Function = function(status:String):void {
ExternalInterface.addCallback("gCETCallback", null);
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent inside onSuccess", {});
if (status == "installed-enabled") {
JSLog.warn("Chrome Extension exists", {});
onSuccess("worked");
} else {
onFailure("No Chrome Extension");
}
};
ExternalInterface.addCallback("gCETCallback", success);
ExternalInterface.call("vertoExtensionGetChromeExtensionStatus", chromeExtensionKey, "gCETCallback");
}
} else {
onFailure("No chromeExtensionKey in config.xml");
return;
}
}
} else {
onFailure("Web browser doesn't support WebRTC");
return;
}
}
/*handle start sharing event*/
public function handleStartSharingEvent():void {
LOGGER.debug("WebRTCDeskshareManager::handleStartSharingEvent");
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent", {});
var onFailure:Function = function(message:String):void {
onNoWebRTCFailure = (newOnNoWebRTCFailure != null) ? newOnNoWebRTCFailure : function(message:String):void {
JSLog.warn(message, {});
usingWebRTC = false;
// send out event to fallback to Java
@ -216,14 +178,58 @@ package org.bigbluebutton.modules.screenshare.managers
return;
};
var onSuccess:Function = function(message:String):void {
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent onSuccess", {});
onWebRTCBrokeFailure = (newOnWebRTCBrokeFailure != null) ? newOnWebRTCBrokeFailure : function(message:String):void {
JSLog.warn(message, {});
publishWindowManager.openWindow();
globalDispatcher.dispatchEvent(new WebRTCPublishWindowChangeState(WebRTCPublishWindowChangeState.DISPLAY_INSTALL));
};
onSuccess = (newOnSuccess != null) ? newOnSuccess : function(message:String):void {
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent onSuccess", message);
usingWebRTC = true;
startWebRTCDeskshare();
};
canIUseVertoOnThisBrowser(onFailure, onSuccess);
if (options.tryWebRTCFirst && BrowserCheck.isWebRTCSupported()) {
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent WebRTC Supported", {});
if (BrowserCheck.isFirefox()) {
onSuccess("Firefox, lets try");
} else {
if (chromeExtensionKey != null) {
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent chrome extension link exists - ", chromeExtensionKey);
if (ExternalInterface.available) {
var success2:Function = function(exists:Boolean):void {
ExternalInterface.addCallback("success2", null);
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent inside onSuccess2", {});
if (exists) {
JSLog.warn("Chrome Extension exists", {});
onSuccess("worked");
} else {
onWebRTCBrokeFailure("No Chrome Extension");
JSLog.warn("no chrome extension", {});
}
};
ExternalInterface.addCallback("success2", success2);
ExternalInterface.call("checkChromeExtInstalled", "success2", chromeExtensionKey);
}
} else {
onNoWebRTCFailure("No chromeExtensionKey in config.xml");
return;
}
}
} else {
onNoWebRTCFailure("Web browser doesn't support WebRTC");
return;
}
}
/*handle start sharing event*/
public function handleStartSharingEvent():void {
LOGGER.debug("WebRTCDeskshareManager::handleStartSharingEvent");
JSLog.warn("WebRTCDeskshareManager::handleStartSharingEvent", {});
canIUseVertoOnThisBrowser();
}
public function handleShareWindowCloseEvent():void {
@ -291,7 +297,5 @@ package org.bigbluebutton.modules.screenshare.managers
var dispatcher:Dispatcher = new Dispatcher();
dispatcher.dispatchEvent(new WebRTCViewStreamEvent(WebRTCViewStreamEvent.START));
}
}
}

View File

@ -64,9 +64,17 @@ package org.bigbluebutton.modules.screenshare.managers
closeWindow(shareWindow);
}
private function openWindow(window:IBbbModuleWindow):void {
public function openWindow(window:IBbbModuleWindow = null):void {
var event:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
if (window == null) {
shareWindow = new WebRTCDesktopPublishWindow();
shareWindow.visible = true;
event.window = shareWindow;
} else {
event.window = window;
}
globalDispatcher.dispatchEvent(event);
}
@ -77,10 +85,14 @@ package org.bigbluebutton.modules.screenshare.managers
}
public function startViewing(rtmp:String, videoWidth:Number, videoHeight:Number):void{
if (shareWindow != null) {
shareWindow.startVideo(rtmp, videoWidth, videoHeight);
} else {
shareWindow = new WebRTCDesktopPublishWindow();
shareWindow.visible = true;
openWindow(shareWindow);
shareWindow.startVideo(rtmp, videoWidth, videoHeight);
}
}
}
}

View File

@ -34,6 +34,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.screenshare.events.ShareStartedEvent;
import org.bigbluebutton.modules.screenshare.events.UseJavaModeCommand;
import org.bigbluebutton.modules.screenshare.events.WebRTCShareWindowEvent;
import org.bigbluebutton.modules.screenshare.events.ShareWindowEvent;
import org.bigbluebutton.modules.screenshare.events.WebRTCStreamEvent;
import org.bigbluebutton.modules.screenshare.events.WebRTCViewStreamEvent;
import org.bigbluebutton.modules.screenshare.events.WebRTCViewWindowEvent;
@ -106,6 +107,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MethodInvoker generator="{WebRTCDeskshareManager}" method="handleShareWindowCloseEvent"/>
</EventHandlers>
<EventHandlers type="{ShareWindowEvent.CLOSE}">
<MethodInvoker generator="{WebRTCDeskshareManager}" method="handleRequestStopSharingEvent"/>
</EventHandlers>
<EventHandlers type="{WebRTCConnectionEvent.SUCCESS}">
<MethodInvoker generator="{WebRTCDeskshareManager}" method="handleConnectionSuccessEvent"/>
</EventHandlers>

View File

@ -25,6 +25,7 @@ package org.bigbluebutton.modules.screenshare.model
[Bindable] public var showButton:Boolean = true;
[Bindable] public var baseTabIndex:int;
[Bindable] public var tryWebRTCFirst:Boolean = false;
[Bindable] public var chromeExtensionLink:String = null;
[Bindable] public var chromeExtensionKey:String = null;
[Bindable] public var helpUrl:String;
@ -43,9 +44,13 @@ package org.bigbluebutton.modules.screenshare.model
if (vxml.@tryWebRTCFirst != undefined) {
tryWebRTCFirst = (vxml.@tryWebRTCFirst.toString().toUpperCase() == "TRUE") ? true : false;
}
if (vxml.@chromeExtensionLink != undefined) {
chromeExtensionLink = vxml.@chromeExtensionLink.toString();
}
if (vxml.@chromeExtensionKey != undefined) {
chromeExtensionKey = vxml.@chromeExtensionKey.toString();
}
if (vxml.@help != undefined){
helpUrl = vxml.@help;
}

View File

@ -39,12 +39,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mate:Listener type="{LocaleChangeEvent.LOCALE_CHANGED}" method="localeChanged" />
<mate:Listener type="{StopSharingButtonEvent.STOP_SHARING}" method="stopSharingEvent" />
<mate:Listener type="{ShortcutEvent.REMOTE_FOCUS_DESKTOP}" method="remoteFocus" />
<mate:Listener type="{WebRTCPublishWindowChangeState.DISPLAY_INSTALL}" method="displayInstall" />
<mate:Listener type="{WebRTCPublishWindowChangeState.DISPLAY_RETRY}" method="displayRetry" />
<mate:Listener type="{WebRTCPublishWindowChangeState.DISPLAY_FALLBACK}" method="displayFallback" />
<mx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import flash.external.ExternalInterface;
import mx.core.UIComponent;
import org.as3commons.logging.api.ILogger;
@ -56,11 +58,16 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.screenshare.events.ShareEvent;
import org.bigbluebutton.modules.screenshare.events.UseJavaModeCommand;
import org.bigbluebutton.modules.screenshare.events.WebRTCShareWindowEvent;
import org.bigbluebutton.modules.screenshare.events.StopSharingButtonEvent;
import org.bigbluebutton.modules.screenshare.events.WebRTCStreamEvent;
import org.bigbluebutton.modules.screenshare.events.WebRTCViewStreamEvent;
import org.bigbluebutton.modules.screenshare.events.WebRTCPublishWindowChangeState;
import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions;
import org.bigbluebutton.modules.screenshare.events.RequestToStartSharing;
import org.bigbluebutton.modules.screenshare.events.DeskshareToolbarEvent;
import org.bigbluebutton.modules.screenshare.services.red5.WebRTCConnectionEvent;
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.main.api.JSLog;
@ -92,8 +99,55 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
[Bindable] private var dsOptions:ScreenshareOptions;
private function displayInstall(e:Event):void {
setCurrentState("displayInstall");
}
private function displayRetry(e:Event):void {
setCurrentState("displayRetry");
}
private function displayFallback(e:Event):void {
setCurrentState("displayFallback");
if (ExternalInterface.available) {
var isIncognito:Function = function(args:Object):void {
incognitoLbl.visible = true;
};
var isNotIncognito:Function = function(args:Object):void {};
ExternalInterface.addCallback("isIncognito", isIncognito);
ExternalInterface.addCallback("isNotIncognito", isNotIncognito);
ExternalInterface.call("checkIfIncognito", "isIncognito", "isNotIncognito");
}
}
private function onInstallButtonClicked():void {
navigateToURL(new URLRequest(dsOptions.chromeExtensionLink), "_blank");
globalDispatcher.dispatchEvent(new WebRTCPublishWindowChangeState(WebRTCPublishWindowChangeState.DISPLAY_RETRY));
}
private function onRetryButtonClicked():void {
var onSuccess:Function = function(exists:Boolean):void {
ExternalInterface.addCallback("onSuccess", null);
if (exists) {
globalDispatcher.dispatchEvent(new RequestToStartSharing());
} else {
globalDispatcher.dispatchEvent(new WebRTCPublishWindowChangeState(WebRTCPublishWindowChangeState.DISPLAY_FALLBACK));
}
};
ExternalInterface.addCallback("onSuccess", onSuccess);
ExternalInterface.call("checkChromeExtInstalled", "onSuccess", dsOptions.chromeExtensionKey);
}
private function onFallbackButtonClicked():void {
closeWindow();
globalDispatcher.dispatchEvent(new UseJavaModeCommand());
}
private function init():void {
dsOptions = new ScreenshareOptions();
dsOptions.parseOptions();
}
private function onCreationComplete():void {
@ -170,6 +224,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
// TODO make this function private and trigger it via message
public function startVideo(rtmp:String, videoWidth:Number, videoHeight:Number):void {
setCurrentState("dispFullRegionControlBar");
var myArray :Array = rtmp.split('/');
var meetingUrl:String = rtmp.substring(0, rtmp.lastIndexOf('/'));
stream = rtmp.substring(rtmp.lastIndexOf('/')+1, rtmp.length);
@ -264,7 +319,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
video.y = videoHolder.y = (this.height - VID_HEIGHT_PAD - vidH) / 2;
videoHolder.addChild(video);
this.addChild(videoHolder);
mainContainer.addChildAt(videoHolder, 0);
ns = new NetStream(connection);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
@ -314,6 +369,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function closeWindow():void {
// LOGGER.debug("Calling stopApplet in closeWindow()");
dispatchEvent(new WebRTCShareWindowEvent(WebRTCShareWindowEvent.CLOSE));
globalDispatcher.dispatchEvent(new DeskshareToolbarEvent(DeskshareToolbarEvent.STOP));
}
/*
@ -358,9 +414,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<dspub:TabIndexer startIndex="{dsOptions.baseTabIndex + 1}"
tabIndices="{[minimizeBtn, maximizeRestoreBtn, closeBtn, btnClosePublish]}"/>
<dspub:states>
<dspub:states>
<mx:State name="dispFullRegionControlBar">
<mx:AddChild>
<mx:AddChild relativeTo="mainElement" position="after">
<mx:ControlBar id="fullRegionBottomBar">
<mx:VBox width="100%" height="100%" horizontalAlign="center">
<mx:HBox horizontalAlign="center">
@ -375,6 +432,61 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
</mx:ControlBar>
</mx:AddChild>
</mx:State>
<mx:State name="displayInstall">
<mx:AddChild relativeTo="mainElement" position="after">
<mx:VBox width="100%" height="100%" horizontalAlign="center">
<mx:HBox width="100%" horizontalAlign="center">
<mx:Text width="100%" textAlign="center" styleName="" text="You're using a recent version of Chrome but don't have the screen sharing extension installed"/>
</mx:HBox>
<mx:HBox width="100%" horizontalAlign="center">
<mx:LinkButton id="btnInstallExtension"
label="Click here to install"
visible="true"
enabled="true"
styleName="quickWindowLinkStyle"
click="onInstallButtonClicked()" />
</mx:HBox>
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="displayRetry">
<mx:AddChild relativeTo="mainElement" position="after">
<mx:VBox width="100%" height="100%" horizontalAlign="center">
<mx:LinkButton id="btnInstallExtension2"
label="Click here to install"
visible="true"
enabled="true"
styleName="quickWindowLinkStyle"
click="onInstallButtonClicked()" />
<mx:Label width="70%" textAlign="center" styleName="" text="After you have installed the screen sharing extention, click 'Retry' below"/>
<mx:Button id="btnRetry" label="Retry" visible="true" enabled="true" click="onRetryButtonClicked()" />
</mx:VBox>
</mx:AddChild>
</mx:State>
<mx:State name="displayFallback">
<mx:AddChild relativeTo="mainElement" position="after">
<mx:VBox width="100%" height="100%" horizontalAlign="center">
<mx:HBox width="100%" height="100%" horizontalAlign="center">
<mx:Text width="100%" textAlign="center" styleName="" text="Unable to detect screen sharing extension. Click here to try installing again, or select 'Use Java Screen Sharing'" />
</mx:HBox>
<mx:HBox width="100%" height="100%" horizontalAlign="center">
<mx:Text id="incognitoLbl" width="100%" visible="false" text="It seems you may be Incognito or using private browsing. Make sure under your extension settings you allow the extension in incognito mode" />
</mx:HBox>
<mx:HBox width="100%" height="100%" horizontalAlign="center">
<mx:Button id="btnFallback" label="Use Java Screen Sharing" visible="true" enabled="true" click="onFallbackButtonClicked()" />
</mx:HBox>
</mx:VBox>
</mx:AddChild>
</mx:State>
</dspub:states>
</dspub:CustomMdiWindow>
<mx:VBox id="mainContainer" width="100%" height="100%" paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5">
<mx:HBox width="100%" id="mainElement">
</mx:HBox>
</mx:VBox>
</dspub:CustomMdiWindow>