1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Set a deviceId for VoIP example and use const/let (#2090)

This commit is contained in:
Šimon Brandner
2021-12-23 14:37:55 +01:00
committed by GitHub
parent 48dbed8001
commit 99451698a4

View File

@ -1,16 +1,17 @@
console.log("Loading browser sdk"); console.log("Loading browser sdk");
var BASE_URL = "https://matrix.org"; const BASE_URL = "https://matrix.org";
var TOKEN = "accesstokengoeshere"; const TOKEN = "accesstokengoeshere";
var USER_ID = "@username:localhost"; const USER_ID = "@username:localhost";
var ROOM_ID = "!room:id"; const ROOM_ID = "!room:id";
const DEVICE_ID = "some_device_id";
const client = matrixcs.createClient({
var client = matrixcs.createClient({
baseUrl: BASE_URL, baseUrl: BASE_URL,
accessToken: TOKEN, accessToken: TOKEN,
userId: USER_ID userId: USER_ID,
deviceId: DEVICE_ID
}); });
var call; let call;
function disableButtons(place, answer, hangup) { function disableButtons(place, answer, hangup) {
document.getElementById("hangup").disabled = hangup; document.getElementById("hangup").disabled = hangup;
@ -19,7 +20,7 @@ function disableButtons(place, answer, hangup) {
} }
function addListeners(call) { function addListeners(call) {
var lastError = ""; let lastError = "";
call.on("hangup", function() { call.on("hangup", function() {
disableButtons(false, true, true); disableButtons(false, true, true);
document.getElementById("result").innerHTML = ( document.getElementById("result").innerHTML = (