odyssey-spatial-comms
Version:
Drop-in replacement for Dolby/Voxeet SDK using Odyssey Spatial Audio Service
85 lines • 3.38 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
const api_client_1 = require("./api-client");
const conference_1 = require("./conference");
const session_1 = require("./session");
const audio_1 = require("./audio");
const video_1 = require("./video");
const notification_1 = require("./notification");
const media_device_1 = require("./media-device");
__exportStar(require("./types"), exports);
class SpatialCommsSDK {
static configure(config) {
this.apiClient = new api_client_1.ApiClient(config);
this._conference = new conference_1.ConferenceAPI(this.apiClient);
this._session = new session_1.SessionAPI(this.apiClient);
this._audio = new audio_1.AudioAPI(this.apiClient);
this._video = new video_1.VideoAPI(this.apiClient);
this._notification = new notification_1.NotificationAPI(this.apiClient);
this._mediaDevice = new media_device_1.MediaDeviceAPI(this.apiClient);
// Inject session API into conference API for participant info access
this._conference.setSessionAPI(this._session);
}
static initialize(accessToken, refreshCallback) {
if (!this.apiClient) {
this.configure({
serviceUrl: 'https://spatial-audio.tenant-newgameproduction-ctrlpln.ord1.ingress.coreweave.cloud'
});
}
this.apiClient.setAccessToken(accessToken);
this.refreshTokenCallback = refreshCallback || null;
}
static get conference() {
if (!this._conference) {
throw new Error('SDK not initialized. Call initialize() first.');
}
return this._conference;
}
static get session() {
if (!this._session) {
throw new Error('SDK not initialized. Call initialize() first.');
}
return this._session;
}
static get audio() {
if (!this._audio) {
throw new Error('SDK not initialized. Call initialize() first.');
}
return this._audio;
}
static get video() {
if (!this._video) {
throw new Error('SDK not initialized. Call initialize() first.');
}
return this._video;
}
static get notifications() {
if (!this._notification) {
throw new Error('SDK not initialized. Call initialize() first.');
}
return this._notification;
}
static get mediaDevice() {
if (!this._mediaDevice) {
throw new Error('SDK not initialized. Call initialize() first.');
}
return this._mediaDevice;
}
}
SpatialCommsSDK.refreshTokenCallback = null;
exports.default = SpatialCommsSDK;
//# sourceMappingURL=odyssey-sdk.js.map