mirror of
https://github.com/videojs/video.js.git
synced 2024-12-27 02:43:45 +02:00
2.3 KiB
2.3 KiB
layout | title | description | body_id | body_class |
---|---|---|---|---|
docs | Setup | Setup | setup | docs subpage |
Setup
Video.js is pretty easy to set up. It can take a matter of seconds to get the player up and working on your web page.
Step 1: Include the Video.js Javascript and CSS files in the head of your page.
You can download the Video.js source and host it on your own servers, or use the free CDN hosted version (thanks to Zencoder). It's often recommended now to put JavaScript before the end </body> tag instead of the head but Video.js includes an 'HTML5 Shiv', which needs to be in the <head> for older IE versions.
{% highlight html %}
{% endhighlight %}
Step 2: Add an HTML5 video tag to your page.
Use the video tag as normal, with a few extra pieces for Video.js:
- The 'data-setup' Atrribute tells Video.js to automatically set up the video when the page is ready, and read any options (in JSON format) from the attribute (see 'options').
- The 'id' Attribute: Should be used and unique for every video on the same page.
- The 'class' attribute contains two classes: - 'video-js' applies styles that are required for Video.js functionality, like fullscreen and subtitles. - 'vjs-default-skin' applies the default skin to the HTML controls, and can be removed or overridden to create your own controls design.
Otherwise include/exclude attributes, settings, sources, and tracks exactly as you would for HTML5 video (see 'video-tag').
{% highlight html %}
{% endhighlight %}