Socket
Socket
Sign inDemoInstall

@tritondigitaldev/omny-player-sdk-js

Package Overview
Dependencies
0
Maintainers
29
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @tritondigitaldev/omny-player-sdk-js

The Omny Player SDK for JavaScript is a package that provides: - a HTML-compatible audio player with [consumption analytics](https://help.omnystudio.com/en/articles/1721-consumption-analytics-explained) built-in - abstractions to handle playing individual


Version published
Weekly downloads
11
increased by37.5%
Maintainers
29
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 08 Aug 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc