/
main.js
37 lines (34 loc) · 977 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const signalingUrl = "wss://ayame-labo.shiguredo.app/signaling";
let roomId = "ayame-web-sdk-sample";
let clientId = null;
let videoCodec = null;
let audioCodec = null;
let signalingKey = null;
function onChangeVideoCodec() {
videoCodec = document.getElementById("video-codec").value;
if (videoCodec == "none") {
videoCodec = null;
}
}
// query string から roomId, clientId を取得するヘルパー
function parseQueryString() {
const qs = window.Qs;
if (window.location.search.length > 0) {
var params = qs.parse(window.location.search.substr(1));
if (params.roomId) {
roomId = params.roomId;
}
if (params.clientId) {
clientId = params.clientId;
}
if (params.signalingKey) {
signalingKey = params.signalingKey;
}
}
}
parseQueryString();
const roomIdInput = document.getElementById("roomIdInput");
roomIdInput.addEventListener("change", (event) => {
console.log(event);
roomId = event.target.value;
});