v1.3.0-beta/pin for create and join
This commit is contained in:
+21
-8
@@ -6,6 +6,7 @@ class CallManager {
|
||||
this.listener = listener;
|
||||
this.__refreshToken = null;
|
||||
this.__accessToken = null;
|
||||
this.__sessionInitialized = false;
|
||||
}
|
||||
toggleCall(onCall, conferenceRoomId) {
|
||||
if (onCall === true) this.leaveCall();
|
||||
@@ -13,25 +14,37 @@ class CallManager {
|
||||
}
|
||||
async boot(conferenceRoomId) {
|
||||
if (
|
||||
this.__accessToken !== undefined &&
|
||||
this.__refreshToken !== undefined &&
|
||||
this.__accessToken !== null &&
|
||||
this.__accessToken !== undefined ||
|
||||
this.__refreshToken !== undefined ||
|
||||
this.__accessToken !== null ||
|
||||
this.__refreshToken !== null
|
||||
) {
|
||||
)
|
||||
await this.initialize();
|
||||
const opened = await this.openSession();
|
||||
if (opened && conferenceRoomId) this.joinCall(conferenceRoomId);
|
||||
else if (opened && !conferenceRoomId) this.startCall(conferenceRoomId);
|
||||
else console.log('Unable to open Voxeet Session');
|
||||
}
|
||||
async startCall(conferenceRoomId) {
|
||||
VoxeetSDK.conference.create({ alias: window.localStorage.getItem('watchPartyRoomId') });
|
||||
}
|
||||
async joinCall(conferenceRoomId) {}
|
||||
async leaveCall() {}
|
||||
async openSession() {
|
||||
if (!this.__sessionInitialized) {
|
||||
try {
|
||||
await VoxeetSDK.session.open({
|
||||
externalId: window.localStorage.getItem('watchPartyUserUid'),
|
||||
name: window.localStorage.getItem('watchPartyUserName'),
|
||||
});
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Error Opening Voxeet Session', error);
|
||||
}
|
||||
} else {
|
||||
this.initialize();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
async leaveCall() {}
|
||||
async openSession() {}
|
||||
async initialize() {
|
||||
GetVoxeetTokenApi()
|
||||
.then((res) => res.json())
|
||||
|
||||
Reference in New Issue
Block a user