Giter Site home page Giter Site logo

spivegin / videojs-background Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matthojo/videojs-background

0.0 1.0 0.0 27 KB

Allows for videos to be displayed as a full background to any element.

License: MIT License

JavaScript 78.48% HTML 21.52%

videojs-background's Introduction

Video.js Background

Full background video for video.js

Getting Started

Once you've added the plugin script to your page, you can use it with any video:

<style>
  .videojs-background-wrap {
    overflow:hidden;
    position:absolute;
    height:100%;
    width:100%;
    top:0;
    left:0;
    z-index: -998;
  }
</style>
<script src="video.js"></script>
<script src="videojs-background.js"></script>
<script>
  videojs('bg-video').Background();
</script>

There's also a working example of the plugin you can check out if you're having trouble.

Documentation

Plugin Options

You may pass in an options object to the plugin upon initialization. This object may contain any of the following properties:

container

Type: String Default: 'body'

This specifies the target element for your background video. It defualts to the body for a full background video.

autoPlay

Type: Boolean Default: true

This auto-plays the background video. If this is set to false you have to manually trigger the video start.

volume

Type: Double Default: 0

This sets the default volume level. The range is 0 - 1.

mediaAspect

Type: Double Default: 16 / 9 (1.777777778)

This sets the default video aspect ratio. If using HTML5 media type this will be retrieved automatically.

mediaType

Type: String Default: 'html5'

If you are using a custom media type; such as 'youtube'. You will need to set this so the video can be targetted correctly.

Notes

On some mobile devices (such as iOS), auto playing videos is not allowed. In the event of this the videos 'poster' will be displayed as the full background.

Installation

You can simply take the JS from /lib/videojs-background.js and use as per the exmaple.html. Alternatively, you can use the below package managers;

Bower

bower install videojs-background

Release History

  • 1.0.0: Production ready
  • 0.1.0: Initial release

Credits

  • Matthew Harrison-Jones: @matt_hojo
  • A massive hat tip goes to BigVideo.js for some of the algorithms for calculating fullscreen.

videojs-background's People

Contributors

matthojo avatar fivepapertigers avatar maximilianos avatar nkhine avatar thoma127 avatar buptsb avatar

Watchers

James Cloos 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.