npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

oddworks-jwplayer-provider

v2.2.0

Published

An Oddworks provider plugin for JWPlayer APIs

Downloads

11

Readme

Oddworks JWPlayer Provider

pipeline status

An JWPlayer provider plugin for the Oddworks content server.

Installation

Install the npm package as a Node.js library:

npm install --save oddworks-jwplayer-provider

For full JWPlayer API documentation see https://developer.jwplayer.com/jw-platform/reference/v1/.

Oddworks Server Integration

The Oddworks JWPlayer provider is designed to be integrated with an Oddworks server catalog, specifically as a provider. To initialize the plugin in your server:

const jwplayerProvider = require('oddworks-jwplayer-provider');

// See https://github.com/oddnetworks/oddworks/tree/master/lib/services/catalog#patterns
// for more information regarding an Oddcast Bus.
const bus = createMyOddcastBus();

const options = {
    bus: bus,
    apiKey: process.env.JWPLAYER_API_KEY,
    secretKey: process.env.JWPLAYER_SECRET_KEY
};

jwplayerProvider.initialize(options).then(provider => {
    console.log('Initialized provider "%s"', provider.name);
}).catch(err => {
    console.error(err.stack || err.message || err);
});

JW API credentials can also be passed in on the oddworks Channel object in the secrets: {} hash like so

{
    type: 'channel',
    id: 'cartoon-network',
    secrets: {
        jwApiKey: '',
        jwSecretKey: ''
    }
}

The initialization process will attach Oddcast listeners for the following queries:

  • bus.query({role: 'provider', cmd: 'get', source: 'jwplayer-playlist-provider'})
  • bus.query({role: 'provider', cmd: 'get', source: 'jwplayer-video-provider'})

To use them you send Oddcast commands to save a specification object:

// To create a collection based on a JWPlayer playlist:
bus.sendCommand({role: 'catalog', cmd: 'setItemSpec'}, {
    channel: 'abc',
    type: 'collectionSpec',
    source: 'jwplayer-playlist-provider',
    playlist: {key: '123456'}
});

// To create a video based on a JWPlayer video:
bus.sendCommand({role: 'catalog', cmd: 'setItemSpec'}, {
    channel: 'abc',
    type: 'videoSpec',
    source: 'jwplayer-video-provider',
    video: {key: '123456'}
});

JWPlayer API Client

You can create a stand-alone API client outside of the Oddworks provider:

const jwplayerProvider = require('oddworks-jwplayer-provider');

const client = jwplayerProvider.createClient({
    bus: bus,
    apiKey: process.env.jwplayer_API_KEY,
    secretKey: process.env.jwplayer_SECRET_KEY
});

Client Methods

All methods return a Promise.

  • client.getPlaylists()
  • client.getPlaylist({playlistId})
  • client.getVideosByPlaylist({playlistId})
  • client.getVideo({videoId})

License

Apache 2.0 © Odd Networks