YouTube Playback Technology
for Video.js ![Build Status](https://camo.githubusercontent.com/60a9ad7fec22c2a3f5b9278804f326dd54261f8566d42550f4a4536ce26d7eda/68747470733a2f2f7472617669732d63692e6f72672f65586f6e2f766964656f6a732d796f75747562652e7376673f6272616e63683d6d6173746572)
YouTube playback technology for the Video.js player.
You can use bower (bower install videojs-youtube
), npm (npm install videojs-youtube
) or the source and build it using grunt
. Then, the only file you need is dist/vjs.youtube.js.
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="https://vjs.zencdn.net/4.12/video-js.css" />
<script src="https://vjs.zencdn.net/4.12/video.js"></script>
<script src="vjs.youtube.js"></script>
</head>
<body>
<video id="vid1" src="" class="video-js vjs-default-skin" controls preload="auto" width="640" height="360" data-setup='{ "techOrder": ["youtube"], "src": "https://www.youtube.com/watch?v=xjS6SftYQaQ" }'>
</video>
</body>
</html>
See the examples folder for more
Including the script vjs.youtube.js will add the YouTube as a tech. You just have to add it to your techOrder option. Then, you add the option src with your YouTube URL.
It supports:
- youtube.com as well as youtu.be
- Regular URLs: https://www.youtube.com/watch?v=xjS6SftYQaQ
- Embeded URLs: https://www.youtube.com/embed/xjS6SftYQaQ
- Playlist URLs: https://www.youtube.com/playlist?list=PLA60DCEB33156E51F OR https://www.youtube.com/watch?v=xjS6SftYQaQ&list=SPA60DCEB33156E51F
This plugin exposes the following additional player options:
ytcontrols
(Boolean): Display the YouTube player controls instead of the Video.js player controls. (defaultfalse
)quality
(String): Set the default video quality. Should be one of1080p
,720p
,480p
,360p
,240p
,144p
.playsInline
(Boolean): Sets theplaysinline
YouTube player parameter to enable inline playback on iOSforceHTML5
(Boolean): Forces loading the YouTube HTML5 player (defaulttrue
)forceSSL
(Boolean): Forces loading the YouTube API over https (defaulttrue
)
##Special Thank You Thanks to Steve Heffernan for the amazing Video.js and to John Hurliman for the original version of the YouTube tech