Git Product home page Git Product logo

n-video's Introduction

Next Video Circle CI

Creates a video player and attaches analytics

Installation

$ bower install n-video --save

Usage

Create an element of the format e.g.

<div data-n-component="n-video"
    data-n-video-source="brightcove"
    data-n-video-id="4165329773001"></div>

Where

  • data-n-video-source['brightcove'] Source of the video (currently only accepts Brightcove)
  • data-n-video-id Source's ID of the video

In JS

var nVideo = require('n-video');
var opts = {
    optimumWidth: 710,
    placeholder: true,
    classes: ['video'],
    selector: '.js-video'
};
nVideo.init(opts);

Where opts is an optional object with properties

  • optimumWidth [Number] The optimum width of the video, used when there are multiple video renditions available to decide which to display (the smallest one that's at least as large as this width, if it exists)
  • placeholder [Boolean] Show just the poster image, load (and play) video on click
  • placeholderTitle [Boolean] Show just the title as an overlay on the placeholder
  • classes [Array] Classes to add to the video (and placeholder) element
  • selector [String] Selector to use to find the n-video elements. Appended with :not([data-n-video-js])[data-n-component~="n-video"]. Defaults to *.

optimumWidth, palceholder and classes can also be set in the markup with an attribute of the form data-n-video-opts-*, e.g. data-n-video-opts-optimum-width="300". These trump options supplied to the init method.

If the data is available, it can also be passed through in an attribute (e.g. data-n-video-opts-data="{ "videoStillURL": ... }") to save the browser an HTTP request

Development

$ npm install origami-build-tools
$ make install
$ make demo

And then visit http://localhost:8080/demos/local

Before committing, run

$ make pre-commit

Testing

$ make test

(Requires Firefox)

TODO

  • Add support for Vimeo(?)

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.