浏览代码

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

j8
hristoterezov 8 年前
父节点
当前提交
0453346cf4
共有 3 个文件被更改,包括 18 次插入3 次删除
  1. 2
    1
      modules/UI/videolayout/RemoteVideo.js
  2. 8
    0
      modules/UI/videolayout/VideoLayout.js
  3. 8
    2
      modules/remotecontrol/Controller.js

+ 2
- 1
modules/UI/videolayout/RemoteVideo.js 查看文件

233
  * Requests permissions for remote control session.
233
  * Requests permissions for remote control session.
234
  */
234
  */
235
 RemoteVideo.prototype._requestRemoteControlPermissions = function () {
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
         if(result === null) {
238
         if(result === null) {
238
             return;
239
             return;
239
         }
240
         }

+ 8
- 0
modules/UI/videolayout/VideoLayout.js 查看文件

1188
     _setRemoteControlProperties (user, remoteVideo) {
1188
     _setRemoteControlProperties (user, remoteVideo) {
1189
         APP.remoteControl.checkUserRemoteControlSupport(user).then(result =>
1189
         APP.remoteControl.checkUserRemoteControlSupport(user).then(result =>
1190
             remoteVideo.setRemoteControlSupport(result));
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 查看文件

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

正在加载...
取消
保存