|
@@ -20,12 +20,12 @@ $(() => {
|
|
|
var urlParams = new URL(location.href).searchParams;
|
|
|
options.appid = urlParams.get("appid");
|
|
|
options.channel = urlParams.get("channel");
|
|
|
- options.token = urlParams.get("token");
|
|
|
+ options?.token = urlParams.get("token");
|
|
|
options.uid = urlParams.get("uid");
|
|
|
if (options.appid && options.channel) {
|
|
|
$("#uid").val(options.uid);
|
|
|
$("#appid").val(options.appid);
|
|
|
- $("#token").val(options.token);
|
|
|
+ $("#token").val(options?.token);
|
|
|
$("#channel").val(options.channel);
|
|
|
$("#join-form").submit();
|
|
|
}
|
|
@@ -36,14 +36,14 @@ $("#join-form").submit(async function (e) {
|
|
|
$("#join").attr("disabled", true);
|
|
|
try {
|
|
|
options.appid = $("#appid").val();
|
|
|
- options.token = $("#token").val();
|
|
|
+ options?.token = $("#token").val();
|
|
|
options.channel = $("#channel").val();
|
|
|
options.uid = Number($("#uid").val());
|
|
|
await join();
|
|
|
- if (options.token) {
|
|
|
+ if (options?.token) {
|
|
|
$("#success-alert-with-token").css("display", "block");
|
|
|
} else {
|
|
|
- $("#success-alert a").attr("href", `index.html?appid=${options.appid}&channel=${options.channel}&token=${options.token}`);
|
|
|
+ $("#success-alert a").attr("href", `index.html?appid=${options.appid}&channel=${options.channel}&token=${options?.token}`);
|
|
|
$("#success-alert").css("display", "block");
|
|
|
}
|
|
|
} catch (error) {
|
|
@@ -67,7 +67,7 @@ async function join() {
|
|
|
// join a channel and create local tracks, we can use Promise.all to run them concurrently
|
|
|
[options.uid, localTracks.audioTrack, screenTrack] = await Promise.all([
|
|
|
// join the channel
|
|
|
- client.join(options.appid, options.channel, options.token || null, options.uid || null),
|
|
|
+ client.join(options.appid, options.channel, options?.token || null, options.uid || null),
|
|
|
// ** create local tracks, using microphone and screen
|
|
|
AgoraRTC.createMicrophoneAudioTrack(),
|
|
|
AgoraRTC.createScreenVideoTrack({
|