mirror of https://github.com/jitsi/jitsi-meet
parent
896650d005
commit
0f33e59e4d
@ -0,0 +1,51 @@ |
|||||||
|
/* global APP, config */ |
||||||
|
import Controller from "./Controller"; |
||||||
|
import Receiver from "./Receiver"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Implements the remote control functionality. |
||||||
|
*/ |
||||||
|
class RemoteControl { |
||||||
|
/** |
||||||
|
* Constructs new instance. Creates controller and receiver properties. |
||||||
|
* @constructor |
||||||
|
*/ |
||||||
|
constructor() { |
||||||
|
this.controller = new Controller(); |
||||||
|
this.receiver = new Receiver(); |
||||||
|
this.enabled = false; |
||||||
|
this.initialized = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Initializes the remote control - checks if the remote control should be |
||||||
|
* enabled or not, initializes the API module. |
||||||
|
*/ |
||||||
|
init() { |
||||||
|
if(config.disableRemoteControl || this.initialized) { |
||||||
|
return; |
||||||
|
} |
||||||
|
this.initialized = true; |
||||||
|
APP.API.init({ |
||||||
|
forceEnable: true, |
||||||
|
}); |
||||||
|
this.controller.enable(true); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Handles API event for support for executing remote control events into |
||||||
|
* the wrapper application. |
||||||
|
* @param {boolean} isSupported true if the receiver side is supported by |
||||||
|
* the wrapper application. |
||||||
|
*/ |
||||||
|
onRemoteControlSupported(isSupported) { |
||||||
|
if(isSupported && !config.disableRemoteControl) { |
||||||
|
this.enabled = true; |
||||||
|
if(this.initialized) { |
||||||
|
this.receiver.enable(true); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default new RemoteControl(); |
@ -0,0 +1,23 @@ |
|||||||
|
/** |
||||||
|
* The value for the "var" attribute of feature tag in disco-info packets. |
||||||
|
*/ |
||||||
|
export const DISCO_REMOTE_CONTROL_FEATURE |
||||||
|
= "http://jitsi.org/meet/remotecontrol"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Types of remote-control-event events. |
||||||
|
*/ |
||||||
|
export const EVENT_TYPES = { |
||||||
|
mousemove: "mousemove", |
||||||
|
mousedown: "mousedown", |
||||||
|
mouseup: "mouseup", |
||||||
|
mousedblclick: "mousedblclick", |
||||||
|
mousescroll: "mousescroll", |
||||||
|
keydown: "keydown", |
||||||
|
keyup: "keyup" |
||||||
|
}; |
||||||
|
|
||||||
|
/** |
||||||
|
* The type of remote control events sent trough the API module. |
||||||
|
*/ |
||||||
|
export const API_EVENT_TYPE = "remote-control-event"; |
Loading…
Reference in new issue