Merge pull request #524 from damencho/ds-error-handle

Improves desktop sharing error handling.
This commit is contained in:
yanas 2016-03-07 13:41:17 -06:00
commit 729ca2fbe6
2 changed files with 26 additions and 37 deletions

View File

@ -157,23 +157,6 @@ function createLocalTracks (...devices) {
}); });
} }
/**
* Create local screen sharing track.
* Shows UI notification if Firefox extension is required.
* @returns {Promise<JitsiLocalTrack[]>}
*/
function createDesktopTrack () {
return createLocalTracks('desktop').catch(function (err) {
if (err === TrackErrors.FIREFOX_EXTENSION_NEEDED) {
APP.UI.showExtensionRequiredDialog(
config.desktopSharingFirefoxExtensionURL
);
}
return Promise.reject(err);
});
}
class ConferenceConnector { class ConferenceConnector {
constructor(resolve, reject) { constructor(resolve, reject) {
this._resolve = resolve; this._resolve = resolve;
@ -610,7 +593,7 @@ export default {
this.videoSwitchInProgress = true; this.videoSwitchInProgress = true;
if (shareScreen) { if (shareScreen) {
createDesktopTrack().then(([stream]) => { createLocalTracks('desktop').then(([stream]) => {
stream.on( stream.on(
TrackEvents.LOCAL_TRACK_STOPPED, TrackEvents.LOCAL_TRACK_STOPPED,
() => { () => {
@ -630,7 +613,32 @@ export default {
}).catch((err) => { }).catch((err) => {
this.videoSwitchInProgress = false; this.videoSwitchInProgress = false;
this.toggleScreenSharing(false); this.toggleScreenSharing(false);
if(err === TrackErrors.CHROME_EXTENSION_USER_CANCELED)
return;
console.error('failed to share local desktop', err); console.error('failed to share local desktop', err);
if (err === TrackErrors.FIREFOX_EXTENSION_NEEDED) {
APP.UI.showExtensionRequiredDialog(
config.desktopSharingFirefoxExtensionURL
);
return;
}
// Handling:
// TrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR
// TrackErrors.GENERAL
// and any other
let dialogTxt = APP.translation
.generateTranslationHTML("dialog.failtoinstall");
let dialogTitle = APP.translation
.generateTranslationHTML("dialog.error");
APP.UI.messageHandler.openDialog(
dialogTitle,
dialogTxt,
false
);
}); });
} else { } else {
createLocalTracks('video').then( createLocalTracks('video').then(
@ -799,10 +807,6 @@ export default {
APP.UI.updateDTMFSupport(isDTMFSupported); APP.UI.updateDTMFSupport(isDTMFSupported);
}); });
room.on(ConferenceEvents.FIREFOX_EXTENSION_NEEDED, function (url) {
APP.UI.notifyFirefoxExtensionRequired(url);
});
APP.UI.addListener(UIEvents.ROOM_LOCK_CLICKED, () => { APP.UI.addListener(UIEvents.ROOM_LOCK_CLICKED, () => {
if (room.isModerator()) { if (room.isModerator()) {
let promise = roomLocker.isLocked let promise = roomLocker.isLocked

View File

@ -736,21 +736,6 @@ UI.notifyConnectionFailed = function (stropheErrorMsg) {
); );
}; };
/**
* Notify user that he need to install Firefox extension to share screen.
* @param {stirng} url extension url
*/
UI.notifyFirefoxExtensionRequired = function (url) {
messageHandler.openMessageDialog(
"dialog.extensionRequired",
null,
null,
APP.translation.generateTranslationHTML(
"dialog.firefoxExtensionPrompt", {url}
)
);
};
/** /**
* Notify user that he was automatically muted when joned the conference. * Notify user that he was automatically muted when joned the conference.
*/ */