Giter VIP home page Giter VIP logo

videojs-playlists's Introduction

#videojs-playlists

Sexy Playlists for VideoJS.

##Installation

###Bower

bower install videojs-playlists

###Manual Download

##Usage

Initialize playList

In order to initialize playList you need to pass an array of videos with this structure:

videos = [
  {
    src : [
      'http://stream.flowplayer.org/bauhaus/624x260.webm',
      'http://stream.flowplayer.org/bauhaus/624x260.mp4',
      'http://stream.flowplayer.org/bauhaus/624x260.ogv'
    ],
    poster : '',
    title : 'Whales'
  },
  {
    src : [
      'http://vjs.zencdn.net/v/oceans.mp4',
      'http://vjs.zencdn.net/v/oceans.webm'
    ],
    poster : 'http://www.videojs.com/img/poster.jpg',
    title : 'Ocean'
  }
];

Now, when videos plays they automatically jump to the next one. You also gain a couple of methods

Jump to video

Use player.playList(index) to jump to a video into the playlist.

next

VideoJS receives a next() function which put in place the next video.

prev

VideoJS receives a prev() function which put in place the previous video.

Events

NameDescription
nextFired when you use the `next()` function or when one video finish and the next starts.
prevFired when you use the `prev()` function.
lastVideoEndedFired when the playlist has finished.

A demo is now available to showcase what you can create with this plugin.

##Pending

Pass video parameter to next and prev events. That should need to rewrite the trigger function from videojs since doesn't allow passing events.

As a workaround, the player.pl.current is updated with the actual index and player.pl.currentVideo contains the video object.

##Development

###Requirements

  • node and npm
  • bower npm install -g bower
  • grunt npm install -g grunt-cli

###Setup

  • npm install
  • bower install

###Run

grunt dev

or for just running tests on file changes:

grunt ci

###Tests

grunt mocha

videojs-playlists's People

Contributors

antonio-laguna avatar jgallen23 avatar

Watchers

 avatar  avatar

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.