fix(remotecontrol): Fixing issues after peer review.

This commit is contained in:
hristoterezov 2017-01-17 18:16:18 -06:00
parent 5d22061c0a
commit 0efca9a9a8
7 changed files with 38 additions and 12 deletions

View File

@ -1838,9 +1838,9 @@ export default {
/**
* Sends a message via the data channel.
* @param to {string} the id of the endpoint that should receive the
* message. If "" the message will be sent to all participants.
* @param payload {object} the payload of the message.
* @param {string} to the id of the endpoint that should receive the
* message. If "" - the message will be sent to all participants.
* @param {object} payload the payload of the message.
* @throws NetworkError or InvalidStateError or Error if the operation
* fails.
*/

View File

@ -218,7 +218,18 @@ class API {
/**
* Sends remote control event.
* @param {object} event the event.
* @param {object} event the remote control event. The remote control event
* has one mandatory property - type which is string from EVENT_TYPES enum
* defined in /service/remotecontrol/constants. Depending on the event type
* the event can have other properties or not.
* mousemove - will also have {int} properties x and y
* mousedown, mouseup and mousedblclick - will have {int} property button
* with values - 1(left), 2(middle) or 3 (right)
* mousescroll - will have {int} property y
* keydown and keyup - will have {string} property key and array of strings
* property modifiers.
* stop - won't have any other properties
* permissions - will have {PERMISSIONS_ACTIONS} property action.
*/
sendRemoteControlEvent(event) {
sendMessage({method: "remote-control-event", params: event});

View File

@ -1,5 +1,6 @@
/**
* Enumerates the supported keys.
* NOTE: The maps represents actual keys on the keyboard not chars.
*/
export const KEYS = {
BACKSPACE: "backspace" ,

View File

@ -170,9 +170,6 @@ export default class Controller extends RemoteControlParticipant {
* listeners. Disables keyboard events.
*/
_start() {
if(!this.enabled) {
return;
}
APP.UI.addListener(UIEvents.LARGE_VIDEO_ID_CHANGED,
this._largeVideoChangedListener);
APP.conference.addConferenceListener(

View File

@ -86,9 +86,14 @@ export default class Receiver extends RemoteControlParticipant {
}
/**
* Sends "remote-control-event" events to to the API module.
* Listens for data channel EndpointMessage events. Handles only events of
* type remote control. Sends "remote-control-event" events to the API
* module.
* @param {JitsiParticipant} participant the controller participant
* @param {Object} event the remote control event.
* @param {Object} event EndpointMessage event from the data channels. It
* has {string} type property. The function process only events of type
* REMOTE_CONTROL_EVENT_TYPE which will have event property(the remote
* control event)
*/
_onRemoteControlEvent(participant, event) {
if(this.enabled && event.type === REMOTE_CONTROL_EVENT_TYPE) {

View File

@ -39,8 +39,16 @@ class RemoteControl {
}
/**
* Handles remote control events from the API module.
* @param {object} event the remote control event
* Handles remote control events from the API module. Currently only events
* with type = EVENT_TYPES.supported or EVENT_TYPES.permissions
* @param {object} event the remote control event. The remote control event
* has one mandatory property - type which is string from EVENT_TYPES enum
* defined in /service/remotecontrol/constants. If the event type is
* "supported" it won't have any other properties. If the event type is
* "permissions" the method will expect also the following properties:
* {string} userId - the user id of the participant that made the request
* for permissions
* {PERMISSIONS_ACTIONS} action the action related to the event.
*/
onRemoteControlAPIEvent(event) {
switch(event.type) {

View File

@ -23,7 +23,11 @@ export function init() {
APP.keyboardshortcut = KeyboardShortcut;
APP.tokenData = getTokenData();
APP.API.init(APP.tokenData.jwt ? {forceEnable: true} : undefined);
// Force enable the API if jwt token is passed because most probably
// jitsi meet is displayed inside of wrapper that will need to communicate
// with jitsi meet.
APP.API.init(APP.tokenData.jwt ? { forceEnable: true } : undefined);
APP.translation.init(settings.getLanguage());
}