UNPKG

odyssey-spatial-comms

Version:

Drop-in replacement for Dolby/Voxeet SDK using Odyssey Spatial Audio Service

44 lines 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VideoAPI = void 0; const events_1 = require("events"); class VideoAPI extends events_1.EventEmitter { constructor(apiClient) { super(); this.apiClient = apiClient; } get local() { return { start: async (participantId) => { try { const payload = { video: true }; // participantId must be in URL params, not body const endpoint = participantId ? `/api/conferences/current/media?participantId=${encodeURIComponent(participantId)}` : '/api/conferences/current/media'; await this.apiClient.post(endpoint, payload); this.emit('videoStarted'); } catch (error) { throw new Error(`Video start failed: ${error.message}`); } }, stop: async (participantId) => { try { const payload = { video: false }; // participantId must be in URL params, not body const endpoint = participantId ? `/api/conferences/current/media?participantId=${encodeURIComponent(participantId)}` : '/api/conferences/current/media'; await this.apiClient.post(endpoint, payload); this.emit('videoStopped'); } catch (error) { throw new Error(`Video stop failed: ${error.message}`); } } }; } } exports.VideoAPI = VideoAPI; //# sourceMappingURL=video.js.map