Project HPS, first pass

This commit is contained in:
Saúl Ibarra Corretgé 2020-04-07 14:14:47 +02:00
parent 1751fc7635
commit eef0f5ed97
1 changed files with 32 additions and 0 deletions

View File

@ -470,6 +470,11 @@ export default {
*/
localVideo: null,
/**
* The key used for End-To-End Encryption.
*/
e2eeKey: undefined,
/**
* Creates local media tracks and connects to a room. Will show error
* dialogs in case accessing the local microphone and/or camera failed. Will
@ -645,6 +650,8 @@ export default {
init(options) {
this.roomName = options.roomName;
window.addEventListener('hashchange', this.onHashChange.bind(this), false);
return (
// Initialize the device list first. This way, when creating tracks
@ -1177,6 +1184,31 @@ export default {
}));
},
/**
* Handled location hash change events.
*/
onHashChange() {
const items = {};
const parts = window.location.hash.substr(1).split('&');
for (const part of parts) {
const param = part.split('=');
const key = param[0];
if (!key) {
continue; // eslint-disable-line no-continue
}
items[key] = param[1];
}
this.e2eeKey = items.e2eekey;
logger.debug(`New E2EE key: ${this.e2eeKey}`);
this._room.setE2EEKey(this.e2eeKey);
},
/**
* Exposes a Command(s) API on this instance. It is necessitated by (1) the
* desire to keep room private to this instance and (2) the need of other