v1.7.8/release
- Video Listener Optimizations - Auto Leave Fix - Edge support - Admin Dashboard Update - Vimeo & Dailymotion
This commit is contained in:
+48
-40
@@ -9,14 +9,14 @@ ALL CONTENT ON WATCH PARTY'S WEBSITE OR IN WATCH PARTY'S CHROME EXTENSION APP, U
|
||||
CITED ARE THE SOLE INTELLECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
|
||||
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
|
||||
************************************************************************/
|
||||
import VoxeetSDK from '@voxeet/voxeet-web-sdk';
|
||||
import VoxeetSDK from "@voxeet/voxeet-web-sdk";
|
||||
import {
|
||||
GetVoxeetTokenApi,
|
||||
GetRefreshedVoxeetTokenApi,
|
||||
LocalData,
|
||||
UpdateVoxeetApi,
|
||||
updateLocalData,
|
||||
} from './Api';
|
||||
} from "./Api";
|
||||
|
||||
export default class CallManager {
|
||||
constructor(listener, notify) {
|
||||
@@ -38,7 +38,7 @@ export default class CallManager {
|
||||
if (onCall === true) this.leaveCall();
|
||||
else this.boot(conference, useVideo);
|
||||
} catch (e) {
|
||||
this.notify('Uh oh something went wrong, try rejoining the call.');
|
||||
this.notify("Uh oh something went wrong, try rejoining the call.");
|
||||
}
|
||||
}
|
||||
toggleMute(muted) {
|
||||
@@ -48,9 +48,11 @@ export default class CallManager {
|
||||
}
|
||||
toggleVideo(useVideo) {
|
||||
if (useVideo === true) {
|
||||
VoxeetSDK.conference.startVideo(VoxeetSDK.session.participant).then(() => {
|
||||
this.listener({ usingVideo: useVideo });
|
||||
});
|
||||
VoxeetSDK.conference
|
||||
.startVideo(VoxeetSDK.session.participant)
|
||||
.then(() => {
|
||||
this.listener({ usingVideo: useVideo });
|
||||
});
|
||||
} else {
|
||||
VoxeetSDK.conference.stopVideo(VoxeetSDK.session.participant).then(() => {
|
||||
this.listener({ usingVideo: useVideo });
|
||||
@@ -65,14 +67,14 @@ export default class CallManager {
|
||||
.fetch(conference._id)
|
||||
.then((c) => this.joinCall(c, useVideo))
|
||||
.catch((err) => {
|
||||
console.error('Failed to fetch conference', err);
|
||||
console.error("Failed to fetch conference", err);
|
||||
this.startCall(useVideo);
|
||||
});
|
||||
} else if (opened && !conference) {
|
||||
this.startCall(useVideo);
|
||||
} else {
|
||||
this.listener({ onCall: false, muted: false, callActionPending: false });
|
||||
console.error('Unable to open Voxeet Session');
|
||||
console.error("Unable to open Voxeet Session");
|
||||
}
|
||||
}
|
||||
async startCall(useVideo) {
|
||||
@@ -103,7 +105,7 @@ export default class CallManager {
|
||||
callActionPending: false,
|
||||
usingVideo: false,
|
||||
});
|
||||
console.error('Update Voxeet API Error', err);
|
||||
console.error("Update Voxeet API Error", err);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -116,11 +118,11 @@ export default class CallManager {
|
||||
callActionPending: false,
|
||||
usingVideo: false,
|
||||
});
|
||||
console.error('Failed to update party Voxeet');
|
||||
console.error("Failed to update party Voxeet");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.notify('Ask your party admin to start the call.');
|
||||
this.notify("Ask your party admin to start the call.");
|
||||
this.leaveCall();
|
||||
}
|
||||
}
|
||||
@@ -135,8 +137,8 @@ export default class CallManager {
|
||||
callActionPending: false,
|
||||
usingVideo: false,
|
||||
});
|
||||
this.notify('Unable to join call. Try again in a moment.');
|
||||
console.error('Error joining call', e);
|
||||
this.notify("Unable to join call. Try again in a moment.");
|
||||
console.error("Error joining call", e);
|
||||
return false;
|
||||
});
|
||||
if (joined === true) {
|
||||
@@ -168,19 +170,23 @@ export default class CallManager {
|
||||
});
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Error Opening Voxeet Session', error);
|
||||
console.error("Error Opening Voxeet Session", error);
|
||||
}
|
||||
console.error('Session not initialized');
|
||||
console.error("Session not initialized");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async initialize() {
|
||||
VoxeetSDK.conference.on('joined', () => {
|
||||
this.listener({ onCall: true, callActionPending: false, usingVideo: this.__useVideo });
|
||||
VoxeetSDK.conference.on("joined", () => {
|
||||
this.listener({
|
||||
onCall: true,
|
||||
callActionPending: false,
|
||||
usingVideo: this.__useVideo,
|
||||
});
|
||||
});
|
||||
|
||||
VoxeetSDK.conference.on('left', () => {
|
||||
VoxeetSDK.conference.on("left", () => {
|
||||
this.listener({
|
||||
onCall: false,
|
||||
callActionPending: false,
|
||||
@@ -189,34 +195,34 @@ export default class CallManager {
|
||||
});
|
||||
});
|
||||
|
||||
VoxeetSDK.conference.on('streamAdded', (participant, stream) => {
|
||||
VoxeetSDK.conference.on("streamAdded", (participant, stream) => {
|
||||
this.listener({ callActionPending: true });
|
||||
const vid = 'video#' + CSS.escape(participant.id);
|
||||
const vid = "video#" + CSS.escape(participant.id);
|
||||
if (!document.querySelector(vid)) {
|
||||
const vidNode = document.createElement('video');
|
||||
const vidNode = document.createElement("video");
|
||||
vidNode.id = participant.id;
|
||||
vidNode.muted = true;
|
||||
vidNode.srcObject = stream;
|
||||
vidNode.onloadedmetadata = vidNode.play;
|
||||
|
||||
const vidContainerNode = document.createElement('div');
|
||||
vidContainerNode.classList.add('vxt-video');
|
||||
vidContainerNode.setAttribute('data-id', participant.id);
|
||||
vidContainerNode.setAttribute('data-name', participant.info.name || '');
|
||||
const vidContainerNode = document.createElement("div");
|
||||
vidContainerNode.classList.add("vxt-video");
|
||||
vidContainerNode.setAttribute("data-id", participant.id);
|
||||
vidContainerNode.setAttribute("data-name", participant.info.name || "");
|
||||
vidContainerNode.appendChild(vidNode);
|
||||
|
||||
if (participant.info.externalId !== LocalData().userUid) {
|
||||
const volSliderNode = document.createElement('input');
|
||||
volSliderNode.setAttribute('type', 'range');
|
||||
volSliderNode.min = '0';
|
||||
volSliderNode.max = '1';
|
||||
volSliderNode.value = '1';
|
||||
volSliderNode.step = '0.1';
|
||||
volSliderNode.id = 'vxt-slider-' + participant.id;
|
||||
volSliderNode.classList.add('vxt-slider');
|
||||
const volSliderNode = document.createElement("input");
|
||||
volSliderNode.setAttribute("type", "range");
|
||||
volSliderNode.min = "0";
|
||||
volSliderNode.max = "1";
|
||||
volSliderNode.value = "1";
|
||||
volSliderNode.step = "0.1";
|
||||
volSliderNode.id = "vxt-slider-" + participant.id;
|
||||
volSliderNode.classList.add("vxt-slider");
|
||||
volSliderNode.onchange = (e) => {
|
||||
const v = e.target.value;
|
||||
const audioOuts = document.querySelectorAll('audio.vxt-audio');
|
||||
const audioOuts = document.querySelectorAll("audio.vxt-audio");
|
||||
if (audioOuts.length > 0) {
|
||||
audioOuts.forEach((el) => {
|
||||
if (el.id === `audio-${participant.id}`) {
|
||||
@@ -228,14 +234,16 @@ export default class CallManager {
|
||||
vidContainerNode.appendChild(volSliderNode);
|
||||
}
|
||||
|
||||
document.querySelector('.vxt-video-container').appendChild(vidContainerNode);
|
||||
document
|
||||
.querySelector(".vxt-video-container")
|
||||
.appendChild(vidContainerNode);
|
||||
}
|
||||
this.listener({ callActionPending: false });
|
||||
});
|
||||
|
||||
VoxeetSDK.conference.on('streamRemoved', (participant, stream) => {
|
||||
VoxeetSDK.conference.on("streamRemoved", (participant, stream) => {
|
||||
const vcid = ".vxt-video[data-id='" + CSS.escape(participant.id) + "']";
|
||||
const vid = 'video#' + CSS.escape(participant.id);
|
||||
const vid = "video#" + CSS.escape(participant.id);
|
||||
if (document.querySelector(vcid)) {
|
||||
document
|
||||
.querySelector(vid)
|
||||
@@ -262,11 +270,11 @@ export default class CallManager {
|
||||
this.updateTokens(access_token, refresh_token);
|
||||
await VoxeetSDK.initializeToken(access_token, refresh_token);
|
||||
} else {
|
||||
console.error('Get Voxeet Token API Result Error', tokenResult);
|
||||
console.error("Get Voxeet Token API Result Error", tokenResult);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Get Voxeet Token API error', err);
|
||||
console.error("Get Voxeet Token API error", err);
|
||||
});
|
||||
} else {
|
||||
await VoxeetSDK.initializeToken(this.__accessToken, this.__refreshToken);
|
||||
@@ -282,7 +290,7 @@ export default class CallManager {
|
||||
resolve(access_token);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Get Voxeet Token API error', err);
|
||||
console.error("Get Voxeet Token API error", err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user