Selaa lähdekoodia

ref(remotecontrol): Pass the largeVideoWrapper as parameter to remote control module

j8
hristoterezov 8 vuotta sitten
vanhempi
commit
0453346cf4

+ 2
- 1
modules/UI/videolayout/RemoteVideo.js Näytä tiedosto

@@ -233,7 +233,8 @@ RemoteVideo.prototype.setRemoteControlSupport = function(isSupported = false) {
233 233
  * Requests permissions for remote control session.
234 234
  */
235 235
 RemoteVideo.prototype._requestRemoteControlPermissions = function () {
236
-    APP.remoteControl.controller.requestPermissions(this.id).then(result => {
236
+    APP.remoteControl.controller.requestPermissions(
237
+        this.id, this.VideoLayout.getLargeVideoWrapper()).then(result => {
237 238
         if(result === null) {
238 239
             return;
239 240
         }

+ 8
- 0
modules/UI/videolayout/VideoLayout.js Näytä tiedosto

@@ -1188,6 +1188,14 @@ var VideoLayout = {
1188 1188
     _setRemoteControlProperties (user, remoteVideo) {
1189 1189
         APP.remoteControl.checkUserRemoteControlSupport(user).then(result =>
1190 1190
             remoteVideo.setRemoteControlSupport(result));
1191
+    },
1192
+
1193
+    /**
1194
+     * Returns the wrapper jquery selector for the largeVideo
1195
+     * @returns {JQuerySelector} the wrapper jquery selector for the largeVideo
1196
+     */
1197
+    getLargeVideoWrapper() {
1198
+        return this.getCurrentlyOnLargeContainer().$wrapper;
1191 1199
     }
1192 1200
 };
1193 1201
 

+ 8
- 2
modules/remotecontrol/Controller.js Näytä tiedosto

@@ -68,15 +68,18 @@ export default class Controller extends RemoteControlParticipant {
68 68
      * Requests permissions from the remote control receiver side.
69 69
      * @param {string} userId the user id of the participant that will be
70 70
      * requested.
71
+     * @param {JQuerySelector} eventCaptureArea the area that is going to be
72
+     * used mouse and keyboard event capture.
71 73
      * @returns {Promise<boolean>} - resolve values:
72 74
      * true - accept
73 75
      * false - deny
74 76
      * null - the participant has left.
75 77
      */
76
-    requestPermissions(userId) {
78
+    requestPermissions(userId, eventCaptureArea) {
77 79
         if(!this.enabled) {
78 80
             return Promise.reject(new Error("Remote control is disabled!"));
79 81
         }
82
+        this.area = eventCaptureArea;// $("#largeVideoWrapper")
80 83
         logger.debug("Requsting remote control permissions from: " + userId);
81 84
         return new Promise((resolve, reject) => {
82 85
             const clearRequest = () => {
@@ -134,6 +137,9 @@ export default class Controller extends RemoteControlParticipant {
134 137
         if(this.enabled && event.type === REMOTE_CONTROL_EVENT_TYPE
135 138
             && remoteControlEvent.type === EVENT_TYPES.permissions
136 139
             && userId === this.requestedParticipant) {
140
+            if(remoteControlEvent.action !== PERMISSIONS_ACTIONS.grant) {
141
+                this.area = null;
142
+            }
137 143
             switch(remoteControlEvent.action) {
138 144
                 case PERMISSIONS_ACTIONS.grant: {
139 145
                     this.controlledParticipant = userId;
@@ -202,7 +208,6 @@ export default class Controller extends RemoteControlParticipant {
202 208
         logger.log("Resuming remote control controller.");
203 209
         this.isCollectingEvents = true;
204 210
         APP.keyboardshortcut.enable(false);
205
-        this.area = $("#largeVideoWrapper");
206 211
         this.area.mousemove(event => {
207 212
             const position = this.area.position();
208 213
             this._sendRemoteControlEvent(this.controlledParticipant, {
@@ -249,6 +254,7 @@ export default class Controller extends RemoteControlParticipant {
249 254
             this._userLeftListener);
250 255
         this.controlledParticipant = null;
251 256
         this.pause();
257
+        this.area = null;
252 258
         APP.UI.messageHandler.openMessageDialog(
253 259
             "dialog.remoteControlTitle",
254 260
             "dialog.remoteControlStopMessage"

Loading…
Peruuta
Tallenna