Merge pull request #779 from jitsi/fix_ss_from_popup

Implements extension external installation for popup windows
This commit is contained in:
bgrozev 2016-08-10 15:25:35 -05:00 committed by GitHub
commit e59ad67055
4 changed files with 80 additions and 4 deletions

View File

@ -32,6 +32,11 @@ let room, connection, localAudio, localVideo, roomLocker;
*/
let connectionIsInterrupted = false;
/**
* Indicates whether extension external installation is in progress or not.
*/
let DSExternalInstallationInProgress = false;
import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
/**
@ -269,7 +274,9 @@ function createLocalTracks (options, checkForPermissionPrompt) {
? APP.settings.getMicDeviceId()
: options.micDeviceId,
// adds any ff fake device settings if any
firefox_fake_device: config.firefox_fake_device
firefox_fake_device: config.firefox_fake_device,
desktopSharingExtensionExternalInstallation:
options.desktopSharingExtensionExternalInstallation
}, checkForPermissionPrompt)
.catch(function (err) {
console.error(
@ -877,9 +884,27 @@ export default {
}
this.videoSwitchInProgress = true;
let externalInstallation = false;
if (shareScreen) {
createLocalTracks({ devices: ['desktop'] }).then(([stream]) => {
createLocalTracks({
devices: ['desktop'],
desktopSharingExtensionExternalInstallation: {
interval: 500,
checkAgain: () => {
return DSExternalInstallationInProgress;
},
listener: (url) => {
DSExternalInstallationInProgress = true;
externalInstallation = true;
APP.UI.showExtensionExternalInstallationDialog(url);
}
}
}).then(([stream]) => {
DSExternalInstallationInProgress = false;
// close external installation dialog on success.
if(externalInstallation)
$.prompt.close();
stream.on(
TrackEvents.LOCAL_TRACK_STOPPED,
() => {
@ -1135,6 +1160,17 @@ export default {
APP.UI.updateDTMFSupport(isDTMFSupported);
});
APP.UI.addListener(UIEvents.EXTERNAL_INSTALLATION_CANCELED, () => {
// Wait a little bit more just to be sure that we won't miss the
// extension installation
setTimeout(() => DSExternalInstallationInProgress = false, 500);
});
APP.UI.addListener(UIEvents.OPEN_EXTENSION_STORE, (url) => {
window.open(
url, "extension_store_window",
"resizable,scrollbars=yes,status=1");
});
APP.UI.addListener(UIEvents.ROOM_LOCK_CLICKED, () => {
if (room.isModerator()) {
let promise = roomLocker.isLocked

View File

@ -263,7 +263,10 @@
"micUnknownError": "Cannot use microphone for a unknown reason.",
"micPermissionDeniedError": "You have not granted permission to use your microphone. You can still join the conference but others won't hear you. Use the camera button in the address bar to fix this.",
"micNotFoundError": "Requested microphone was not found.",
"micConstraintFailedError": "Yor microphone does not satisfy some of required constraints."
"micConstraintFailedError": "Yor microphone does not satisfy some of required constraints.",
"goToStore": "Go to the webstore",
"externalInstallationTitle": "Extension required",
"externalInstallationMsg": "You need to install our desktop sharing extension."
},
"email":
{

View File

@ -1213,6 +1213,33 @@ UI.showExtensionRequiredDialog = function (url) {
"dialog.firefoxExtensionPrompt", {url: url}));
};
/**
* Shows "Please go to chrome webstore to install the desktop sharing extension"
* 2 button dialog with buttons - cancel and go to web store.
* @param url {string} the url of the extension.
*/
UI.showExtensionExternalInstallationDialog = function (url) {
messageHandler.openTwoButtonDialog(
"dialog.externalInstallationTitle",
null,
"dialog.externalInstallationMsg",
null,
true,
"dialog.goToStore",
function(e,v,m,f){
if (v) {
e.preventDefault();
eventEmitter.emit(UIEvents.OPEN_EXTENSION_STORE, url);
}
},
function () {},
function () {
eventEmitter.emit(UIEvents.EXTERNAL_INSTALLATION_CANCELED);
}
);
};
/**
* Shows dialog with combined information about camera and microphone errors.
* @param {JitsiTrackError} micError

View File

@ -83,5 +83,15 @@ export default {
LOCAL_FLIPX_CHANGED: "UI.local_flipx_changed",
// An event which indicates that the resolution of a remote video has
// changed.
RESOLUTION_CHANGED: "UI.resolution_changed"
RESOLUTION_CHANGED: "UI.resolution_changed",
/**
* Notifies that the button "Go to webstore" is pressed on the dialog for
* external extension installation.
*/
OPEN_EXTENSION_STORE: "UI.open_extension_store",
/**
* Notifies that the button "Cancel" is pressed on the dialog for
* external extension installation.
*/
EXTERNAL_INSTALLATION_CANCELED: "UI.external_installation_canceled"
};