Code Monkey home page Code Monkey logo

videojs-urlparams's Introduction

Video.js URL Params

This plugin reads the containing page's URL to determine what time to seek to at the start and whether to automatically beging playing.

Using the Plugin

The plugin registers itself when you include video.urlparams.js in your page:

<script src='videojs.urlparams.js'></script>

Once you have your video object, you can activate the URL Params plugin.

video.urlParams();

The plugin takes an optional options object. If an options object is provided with a url property, that value will be treated as the URL for extracting the time to which to seek. The default is to use the value of window.location.href;

video.urlParams({
  url: "http://some.url/goes/here#t=2h16m32s"
});

The URL is inspected for two parameters:

  • the t parameter is used for the time to which to seek, and
  • the presence of the autoplay parameter indicates that the player should begin playing immediately (if possible).

The value for the t parameter should consist of some amount of time in hours, minutes and/or seconds. For example, all of the following are valid values:

  • t=2h
  • t=2h16m
  • t=16m
  • t=16m32s
  • t=32s

The parameters may appear virtually anywhere in the URL, on either side of the # mark if present.

The autoplay parameter does not need a value (e.g. autoplay=1). The simple presence of the string autoplay is all that is required.

videojs-urlparams's People

Contributors

bcjwilson avatar dmlap avatar jimbojw avatar jrw95 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.