@tritondigitaldev/omny-player-sdk-js
The Omny Player SDK for JavaScript is a package that provides:
- a HTML-compatible audio player with consumption analytics built-in
- abstractions to handle playing individual clips, or multiple clips in a playlist
- a simple and type-safe way of accessing the consumer API to fetch metadata about programs, playlists and clips
Installation
TODO
Usage example
import {
OmnyPlayer,
OmnyConsumerApi,
} from "@tritondigitaldev/omny-player-sdk-js";
const player = new OmnyPlayer({ consumptionSource: 'Web' });
const api = new OmnyConsumerApi({ organizationId: '<organization-id-here>' });
async function load() {
const clipResponse = await api.getClipById({
clipId: "<clip-id-here>",
});
if (!clipResponse.success) {
console.error("Error loading clip");
return;
}
const { payload: clip } = clipResponse;
const clipPlayer = player.createClipPlayerByData(clip);
clipPlayer.play();
}