Implements extension external installation for popup windows

pull/779/head
hristoterezov 8 years ago
parent a50a980de4
commit f899d16a79
  1. 40
      conference.js
  2. 5
      lang/main.json
  3. 27
      modules/UI/UI.js
  4. 12
      service/UI/UIEvents.js

@ -33,6 +33,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";
/**
@ -270,7 +275,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(
@ -878,9 +885,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,
() => {
@ -1134,6 +1159,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

@ -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":
{

@ -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

@ -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"
};

Loading…
Cancel
Save