cleanup desktopsharing events

This commit is contained in:
isymchych 2015-12-30 15:28:56 +02:00
parent c36001f861
commit 335cc6ca6f
6 changed files with 19 additions and 25 deletions

12
app.js
View File

@ -17,6 +17,7 @@ import URLProcessor from "./modules/config/URLProcessor";
import RoomnameGenerator from './modules/util/RoomnameGenerator';
import CQEvents from './service/connectionquality/CQEvents';
import UIEvents from './service/UI/UIEvents';
import DSEvents from './service/desktopsharing/DesktopSharingEventTypes';
import UI from "./modules/UI/UI";
import statistics from "./modules/statistics/statistics";
@ -27,9 +28,6 @@ import AuthHandler from './modules/AuthHandler';
import createRoomLocker from './modules/RoomLocker';
const DesktopSharingEventTypes =
require("./service/desktopsharing/DesktopSharingEventTypes");
const ConnectionEvents = JitsiMeetJS.events.connection;
const ConnectionErrors = JitsiMeetJS.errors.connection;
@ -511,8 +509,14 @@ function initConference(localTracks, connection) {
APP.UI.updateDTMFSupport(isDTMFSupported);
});
APP.UI.addListener(UIEvents.TOGGLE_SCREENSHARING, function () {
APP.desktopsharing.toggleScreenSharing();
});
APP.UI.addListener(DSEvents.SWITCHING_DONE, function (isSharingScreen) {
APP.UI.updateDesktopSharingButtons(isSharingScreen);
});
APP.desktopsharing.addListener(
DesktopSharingEventTypes.NEW_STREAM_CREATED,
DSEvents.NEW_STREAM_CREATED,
(track, callback) => {
const localCallback = (newTrack) => {
if (newTrack.isLocal() && newTrack === localVideo) {

View File

@ -11,6 +11,7 @@ import Avatar from "./avatar/Avatar";
import PanelToggler from "./side_pannels/SidePanelToggler";
import UIUtil from "./util/UIUtil";
import UIEvents from "../../service/UI/UIEvents";
import CQEvents from '../../service/connectionquality/CQEvents';
import PreziManager from './prezi/Prezi';
import EtherpadManager from './etherpad/Etherpad';
@ -22,9 +23,6 @@ var EventEmitter = require("events");
UI.messageHandler = require("./util/MessageHandler");
var messageHandler = UI.messageHandler;
var JitsiPopover = require("./util/JitsiPopover");
var CQEvents = require("../../service/connectionquality/CQEvents");
var DesktopSharingEventTypes
= require("../../service/desktopsharing/DesktopSharingEventTypes");
var Feedback = require("./Feedback");
var eventEmitter = new EventEmitter();
@ -599,8 +597,8 @@ UI.setAudioLevel = function (id, lvl) {
VideoLayout.setAudioLevel(id, lvl);
};
UI.updateDesktopSharingButtons = function () {
Toolbar.changeDesktopSharingButtonState();
UI.updateDesktopSharingButtons = function (isSharingScreen) {
Toolbar.changeDesktopSharingButtonState(isSharingScreen);
};
UI.hideStats = function () {

View File

@ -136,7 +136,7 @@ const buttonHandlers = {
} else {
AnalyticsAdapter.sendEvent('toolbar.screen.enabled');
}
APP.desktopsharing.toggleScreenSharing();
emitter.emit(UIEvents.TOGGLE_SCREENSHARING);
},
"toolbar_button_fullScreen": function() {
AnalyticsAdapter.sendEvent('toolbar.fullscreen.enabled');
@ -309,9 +309,8 @@ const Toolbar = {
// checks whether desktop sharing is enabled and whether
// we have params to start automatically sharing
checkAutoEnableDesktopSharing () {
if (UIUtil.isButtonEnabled('desktop')
&& config.autoEnableDesktopSharing) {
APP.desktopsharing.toggleScreenSharing();
if (UIUtil.isButtonEnabled('desktop') && config.autoEnableDesktopSharing) {
emitter.emit(UIEvents.TOGGLE_SCREENSHARING);
}
},

View File

@ -1,7 +1,6 @@
/* global APP, JitsiMeetJS, config */
var EventEmitter = require("events");
var DesktopSharingEventTypes
= require("../../service/desktopsharing/DesktopSharingEventTypes");
import DSEvents from '../../service/desktopsharing/DesktopSharingEventTypes';
const TrackEvents = JitsiMeetJS.events.track;
@ -27,14 +26,11 @@ var eventEmitter = new EventEmitter();
function streamSwitchDone() {
switchInProgress = false;
eventEmitter.emit(
DesktopSharingEventTypes.SWITCHING_DONE,
isUsingScreenStream);
eventEmitter.emit(DSEvents.SWITCHING_DONE, isUsingScreenStream);
}
function newStreamCreated(track) {
eventEmitter.emit(DesktopSharingEventTypes.NEW_STREAM_CREATED,
track, streamSwitchDone);
eventEmitter.emit(DSEvents.NEW_STREAM_CREATED, track, streamSwitchDone);
}
function getVideoStreamFailed() {

View File

@ -34,6 +34,7 @@ export default {
TOGGLE_SETTINGS: "UI.toggle_settings",
TOGGLE_CONTACT_LIST: "UI.toggle_contact_list",
TOGGLE_FILM_STRIP: "UI.toggle_film_strip",
TOGGLE_SCREENSHARING: "UI.toggle_screensharing",
CONTACT_CLICKED: "UI.contact_clicked",
HANGUP: "UI.hangup",
LOGOUT: "UI.logout",

View File

@ -1,6 +1,4 @@
var DesktopSharingEventTypes = {
INIT: "ds.init",
export default {
SWITCHING_DONE: "ds.switching_done",
NEW_STREAM_CREATED: "ds.new_stream_created",
@ -11,5 +9,3 @@ var DesktopSharingEventTypes = {
*/
FIREFOX_EXTENSION_NEEDED: "ds.firefox_extension_needed"
};
module.exports = DesktopSharingEventTypes;