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

videojs-ooyala

v0.3.2

Published

Video.js plugin to fetch videos from Ooyala

Downloads

4

Readme

videojs.ooyala.js

Video.js plugin to fetch videos from Ooyala. By supplying an Ooyala EmbedCode, the plugin will call the Ooyala API and fetch the video source of that EmbedCode.

Demo

Run grunt on the project folder will serve up a server at localhost:3000/demo which provides a demo page.

Usage

Include ./dist/videojs.ooyala.js after video.js.

Enable the plugin once your player has been initialised:

player.ooyala({
    playerBrandingId: (String), // Ooyala Player Branding ID (Required)
    pcode: (String),             // Ooyala Provider ID (Required)
    enableHls: (Boolean),        // Tweak force returning m3u8 from Ooyala if available (Optional)
    mobileProfile: (String)     // SAS profile to narrow down streams for mobile devices (Optional)
});

Set an Ooyala video to the player:

If you want to set an Ooyala video to the player and prepare it for playback:

player.ooyala.setSource(embedCode, callback);
// embedCode: (String) The Ooyala video EmbedCode (Required)
// callback: (Function) Returns the results of getVideoSource(), see below (Optional).

Get video source from Ooyala

If you need to get the video source from ooyala for other use:

player.ooyala.getVideoSource(embedCodes, callback);
// embedCodes: (String/Array) The Ooyala video EmbedCodes. Can be multiple videos. (Required)
// callback: (Function) Callback function once data is fetched. (Required)

Callback function will have err and res as argument, here is an example of callback results:

{
    apiResponse: 'the complete response from the Ooyala API as a JSON object'
    videoUrls: {
        embedCode1: {
                authorized: 'true',         // If we are authorised to use this video
                src: 'Video URL',           // If authorised is true, this is defined.
                type: 'Video Type'          // If authorised is true, this is defined.
        },
        embedCode2: {
                authorized: 'false',
                message: 'Error Message',   // If authorised is false, this is defined.
                code: 'Error Code'          // If authorised is false, this is defined.
        }
    }
}

src and type are only set if authorized is true. You can then set these to the player, for example:

player.ooyala.getVideoSource('myEmbedCode1, myEmbedCode2', function(err, res) {
    var videoResult = res && res['myEmbedCode1'];

    if (videoResult.authorized) {
      player.src({
          type: videoResult.type,
          src: videoResult.src
      });
    }
})

Get the meta data of an Ooyala video

Ooyala videos have meta data that we can extract based on the embedCode.

player.ooyala.getMetadata(embedCode, callback)
// embedCodes: (String/Array) The Ooyala video EmbedCodes. Can be multiple videos. (Required)
// callback: (Function) Callback function once metadata is fetched (Required)

Example:

player.ooyala.getMetadata(embedCode, function(err, res) {
    console.log('metadata', embedCode, res);
})

Player support

This plugin has been tested with:

  • Video.Js 4.12.15
  • Brightcove Perform Player v1.24.22

IE Browser compatibility

This plugin uses the following functions so if you need support for a particular version of IE, you will need to implement a polyfill within your application.

| Function | IE Version Supported | |------------- |---------------------- | | Object.keys | IE9+ | | window.atob | IE10+ |

Contributing

Bug fixes are always welcome, though for new functionality it's best to raise an issue first. We appreciate that all contribution follow our style guide set in our JSHint and JSCS using Grunt.

History

v0.3.0

  • Retry XHR calls on timeout
  • Add video.js error messages on failed XHR calls

v0.2.0

  • Add enableHls and mobileProfile option.
  • Add prepareSettingSource() to allow developer to prepare video source before setting to video player.

v0.1.0

  • First release