浏览代码

Project HPS, first pass

j8
Saúl Ibarra Corretgé 5 年前
父节点
当前提交
eef0f5ed97
共有 1 个文件被更改,包括 32 次插入0 次删除
  1. 32
    0
      conference.js

+ 32
- 0
conference.js 查看文件

470
      */
470
      */
471
     localVideo: null,
471
     localVideo: null,
472
 
472
 
473
+    /**
474
+     * The key used for End-To-End Encryption.
475
+     */
476
+    e2eeKey: undefined,
477
+
473
     /**
478
     /**
474
      * Creates local media tracks and connects to a room. Will show error
479
      * Creates local media tracks and connects to a room. Will show error
475
      * dialogs in case accessing the local microphone and/or camera failed. Will
480
      * dialogs in case accessing the local microphone and/or camera failed. Will
645
     init(options) {
650
     init(options) {
646
         this.roomName = options.roomName;
651
         this.roomName = options.roomName;
647
 
652
 
653
+        window.addEventListener('hashchange', this.onHashChange.bind(this), false);
654
+
648
         return (
655
         return (
649
 
656
 
650
             // Initialize the device list first. This way, when creating tracks
657
             // Initialize the device list first. This way, when creating tracks
1177
         }));
1184
         }));
1178
     },
1185
     },
1179
 
1186
 
1187
+    /**
1188
+     * Handled location hash change events.
1189
+     */
1190
+    onHashChange() {
1191
+        const items = {};
1192
+        const parts = window.location.hash.substr(1).split('&');
1193
+
1194
+        for (const part of parts) {
1195
+            const param = part.split('=');
1196
+            const key = param[0];
1197
+
1198
+            if (!key) {
1199
+                continue; // eslint-disable-line no-continue
1200
+            }
1201
+
1202
+            items[key] = param[1];
1203
+        }
1204
+
1205
+        this.e2eeKey = items.e2eekey;
1206
+
1207
+        logger.debug(`New E2EE key: ${this.e2eeKey}`);
1208
+
1209
+        this._room.setE2EEKey(this.e2eeKey);
1210
+    },
1211
+
1180
     /**
1212
     /**
1181
      * Exposes a Command(s) API on this instance. It is necessitated by (1) the
1213
      * Exposes a Command(s) API on this instance. It is necessitated by (1) the
1182
      * desire to keep room private to this instance and (2) the need of other
1214
      * desire to keep room private to this instance and (2) the need of other

正在加载...
取消
保存