3 # [Video.js - HTML5 Video Player][vjs]
5 [![Build Status][travis-icon]][travis-link]
6 [![Coverage Status][coveralls-icon]][coveralls-link]
7 [![Slack Status][slack-icon]][slack-link]
9 [![NPM][npm-icon]][npm-link]
11 > Video.js is a web video player built from the ground up for an HTML5 world. It supports HTML5 and Flash video, as well as YouTube and Vimeo (through [plugins][plugins]). It supports video playback on desktops and mobile devices. This project was started mid 2010, and the player is now used on over ~~50,000~~ ~~100,000~~ ~~200,000~~ [400,000 websites][builtwith].
15 Thanks to the awesome folks over at [Fastly][fastly], there's a free, CDN hosted version of Video.js that anyone can use. Add these tags to your document's `<head>`:
18 <link href="//vjs.zencdn.net/5.11/video-js.min.css" rel="stylesheet">
19 <script src="//vjs.zencdn.net/5.11/video.min.js"></script>
22 > For the latest URLs, check out the [Getting Started][getting-started] page on our website.
24 Next, using Video.js is as simple as creating a `<video>` element, but with an additional `data-setup` attribute. At a minimum, this attribute must have a value of `'{}'`, but it can include any Video.js [options][options] - just make sure it contains valid JSON!
32 poster="//vjs.zencdn.net/v/oceans.png"
34 <source src="//vjs.zencdn.net/v/oceans.mp4" type="video/mp4"></source>
35 <source src="//vjs.zencdn.net/v/oceans.webm" type="video/webm"></source>
36 <source src="//vjs.zencdn.net/v/oceans.ogv" type="video/ogg"></source>
38 To view this video please enable JavaScript, and consider upgrading to a
40 <a href="http://videojs.com/html5-video-support/" target="_blank">
47 When the page loads, Video.js will find this element and automatically setup a player in its place.
49 If you don't want to use automatic setup, you can leave off the `data-setup` attribute and initialize a `<video>` element manually using the `videojs` function:
52 var player = videojs('my-player');
55 The `videojs` function also accepts an `options` object and a callback to be invoked
56 when the player is ready:
61 var player = videojs('my-player', options, function onPlayerReady() {
62 videojs.log('Your player is ready!');
64 // In this context, `this` is the player that was created by Video.js.
67 // How about an event listener?
68 this.on('ended', function() {
69 videojs.log('Awww...over so soon?!');
74 If you're ready to dive in, the [Getting Started][getting-started] page and [documentation][docs] are the best places to go for more information. If you get stuck, head over to our [Slack channel][slack-link]!
78 Video.js is a free and open source library, and we appreciate any help you're willing to give - whether it's fixing bugs, improving documentation, or suggesting new features. Check out the [contributing guide][contributing] for more!
80 _Video.js uses [BrowserStack][browserstack] for compatibility testing._
84 Video.js is [licensed][license] under the Apache License, Version 2.0.
86 [browserstack]: https://browserstack.com
88 [builtwith]: https://trends.builtwith.com/media/VideoJS
90 [contributing]: CONTRIBUTING.md
92 [coveralls-icon]: https://coveralls.io/repos/github/videojs/video.js/badge.svg?branch=master
94 [coveralls-link]: https://coveralls.io/github/videojs/video.js?branch=master
96 [docs]: http://docs.videojs.com
98 [fastly]: http://www.fastly.com/
100 [getting-started]: http://videojs.com/getting-started/
104 [logo]: http://videojs.com/img/logo.png
106 [npm-icon]: https://nodei.co/npm/video.js.png?downloads=true&downloadRank=true
108 [npm-link]: https://nodei.co/npm/video.js/
110 [options]: docs/guides/options.md
112 [plugins]: http://videojs.com/plugins/
114 [slack-icon]: http://slack.videojs.com/badge.svg
116 [slack-link]: http://slack.videojs.com
118 [travis-icon]: https://travis-ci.org/videojs/video.js.svg?branch=master
120 [travis-link]: https://travis-ci.org/videojs/video.js
122 [vjs]: http://videojs.com