Giter VIP home page Giter VIP logo

bright's Introduction

bright

This facade wraps the brightcove smart player api with an easy to use interface.

Installation

npm install edenspiekermann-bright --save

Usage

The source files are built by webpack to the UMD format. This means you can require dist/bright.js via webpack, browserify or require.js. Although it’s not recommended you can also include dist/bright.min.js in your html. This creates a global variable called Bright.

Common.js (webpack, browserify…)

var Bright = require('bright'); // installed via npm
var Bright = require('./path_to/bright.js'); // use the one in the dist folder

var player = Bright(options);

Require.js

require(['Bright'], function(Bright) {
  var player = Bright(options);
});

Global Variable

<script src="//admin.brightcove.com/js/BrightcoveExperiences.js"></script>
<script src="bright.min.js"></script>
<script src="your_scripts.js">
// main.js
var player = Bright(options);

Note: //admin.brightcove.com/js/BrightcoveExperiences.js has to be loaded before bright.js. Use your favorite script loader or simply add a script tag before your main js file.

API

Example HTML:

<div id="player"></div>

The brightcove player will be appended as a child to this element.

var player = Bright({
  element: domElement, // [required] parent dom element of the video player
  video: videoId,      // [required] reference id ('ref:XXXXX') or video id (number)
  player: playerKey    // [required] playerKey of the brightcove player

  // append other brightcove options here (optional)
});

player.on('end', function(player) {
  player.load(videoId);
});

Possible options for brightcove can be found at this page from the official documentation.

Currently supported events:

  • load
  • play
  • pause
  • end

These event methods are copied from maxhoffmann/emitter:

  • on(event, fn)
  • once(event, fn)
  • off(event, fn)

Testing

Video and player id for testing are taken from brightcove’s example page. You may have to update them if they change.

Development

  1. Clone the repository
  2. npm install
  3. npm start to watch for file changes in src/bright.js
  4. make changes
  5. npm test starts a local server & opens your default browser with http://localhost:8000/tests
  6. npm run build if all tests pass
  7. push to develop, merge into master

bright's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.