@tritondigitaldev/omny-player-sdk-js
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

@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

npm install @tritondigitaldev/omny-player-sdk-js

# or

yarn add @tritondigitaldev/omny-player-sdk-js

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>" });
let clipPlayer;

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;
    clipPlayer = player.createClipPlayer(clip);
    clipPlayer.play();
}

// If you no longer need the player instance, you can call destroy to stop the media playback and have all callbacks cleared.
clipPlayer.destroy();

If using the UMD bundle, use the Omny prefix. For example:

const player = new Omny.OmnyPlayer({ consumptionSource: "Web" });
const api = new Omny.OmnyConsumerApi({ organizationId: "<organization-id-here>" });

Readme

Keywords

none

Package Sidebar

Install

npm i @tritondigitaldev/omny-player-sdk-js

Weekly Downloads

11

Version

0.1.1

License

UNLICENSED

Unpacked Size

409 kB

Total Files

6

Last publish

Collaborators

  • stambunan-omny
  • quppa
  • maxwlczk
  • mpiche
  • jessicaomana
  • mlagree
  • hamish-omny
  • ashley.joseph
  • dannymach
  • stuartkeith
  • npmjs-bot-td
  • cloe.furlan
  • eric-omny
  • triton-platform-user
  • ktirgari
  • chryse7
  • antoine.parent
  • aybtriton
  • ppinson.triton
  • nbielza
  • cassandrepochet
  • franck.kapokokamtchang
  • renrizzolo
  • td-raystevens
  • td-lamoureux
  • td-chrispoupart
  • vn-triton
  • vincent.fuchs
  • guillaume-bedard
  • paul.lopez.triton
  • plveilleux
  • emilietritondigital
  • berneldahssi
  • nidhibandi