Skip to content

Commit

Permalink
Merge with VJS5 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
eXon committed Oct 16, 2015
2 parents 9616161 + 9062066 commit 8d8d37c
Show file tree
Hide file tree
Showing 33 changed files with 838 additions and 1,766 deletions.
25 changes: 0 additions & 25 deletions .editorconfig

This file was deleted.

11 changes: 1 addition & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
.DS_Store
.idea
*.sublime-project
*.sublime-workspace
dist

node_modules
bower_components
npm-debug.log

mongoose*.exe

*.orig

*.log
dist
2 changes: 2 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
25 changes: 5 additions & 20 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,11 @@
"node" : false,
"sub" : true,
"quotmark" : "single",
"browser" : true,
"jasmine" : true,
"node" : true,
"predef": [
// standard
"document",
"window",
"console",
"alert",
"setTimeout",
"toString",
"isNaN",

// mocha
"describe",
"it",
"before",
"beforeEach",
"after",
"afterEach",

// video.js
"videojs"
"videojs",
"YT"
]
}

12 changes: 8 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Exclude everything but the contents of the src and dist directory.
**/*
!dist/**
!src/**
.DS_Store
.npmignore
.gitignore
.jshintrc
.jshintignore
src
tests
karma.conf.js
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

77 changes: 0 additions & 77 deletions Gruntfile.js

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

84 changes: 66 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,95 @@
# YouTube Playback Technology<br />for [Video.js](https://github.com/videojs/video.js) [![Build Status](https://travis-ci.org/eXon/videojs-youtube.svg?branch=master)](https://travis-ci.org/eXon/videojs-youtube)
[![Selenium Test Status](https://saucelabs.com/browser-matrix/videojs-youtube.svg)](https://saucelabs.com/u/videojs-youtube)
<br /><br />
YouTube playback technology for the [Video.js player](https://github.com/videojs/video.js/).
# YouTube Playback Technology<br />for [Video.js](https://github.com/videojs/video.js)

## Install
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.
You can use bower (`bower install videojs-youtube`), npm (`npm install videojs-youtube`) or the source and build it using `npm run build`. Then, the only file you need is dist/Youtube.min.js.

## Example
```html
<!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>
<link type="text/css" rel="stylesheet" href="../node_modules/video.js/dist/video-js.min.css" />
</head>
<body>
<video id="vid1" src="" class="video-js vjs-default-skin" controls preload="auto" width="640" height="360" data-setup='{ "techOrder": ["youtube"], "src": "http://www.youtube.com/watch?v=xjS6SftYQaQ" }'>
<video
id="vid1"
class="video-js vjs-default-skin"
controls
autoplay
width="640" height="264"
data-setup='{ "techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "https://www.youtube.com/watch?v=xjS6SftYQaQ"}] }'
>
</video>

<script src="../node_modules/video.js/dist/video.min.js"></script>
<script src="../dist/Youtube.min.js"></script>
</body>
</html>
```


See the examples folder for more

## How does it work?
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.
Including the script Youtube.min.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: http://www.youtube.com/watch?v=xjS6SftYQaQ
- Embeded URLs: http://www.youtube.com/embed/xjS6SftYQaQ
- Playlist URLs: http://www.youtube.com/playlist?list=PLA60DCEB33156E51F OR http://www.youtube.com/watch?v=xjS6SftYQaQ&list=SPA60DCEB33156E51F

## Additional Options
This plugin exposes the following additional [player options](https://github.com/videojs/video.js/blob/master/docs/guides/options.md):
## Options
It supports every regular Video.js options. Additionally, you can change any [YouTube parameter](https://developers.google.com/youtube/player_parameters?hl=en#Parameters). Here is an example of setting the `iv_load_policy` parameter to `1`.

- `ytcontrols` (Boolean): Display the YouTube player controls instead of the Video.js player controls. (default `false`)
- `ytFullScreenControls` (Boolean): Show the fullscreen controls on the default youtube player controls. Also enables double click to fullscreen. (default `true`)
- `quality` (String): Set the default video quality. Should be one of `1080p`, `720p`, `480p`, `360p`, `240p`, `144p`.
- `playsInline` (Boolean): Sets the [`playsinline`](https://developers.google.com/youtube/player_parameters?playerVersion=HTML5#playsinline) YouTube player parameter to enable inline playback on iOS
- `forceHTML5` (Boolean): Forces loading the YouTube HTML5 player (default `true`)
```html
<video
id="vid1"
class="video-js vjs-default-skin"
controls
autoplay
width="640" height="264"
data-setup='{ "techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "https://www.youtube.com/watch?v=xjS6SftYQaQ"}], "Youtube": { "iv_load_policy": 1 } }'
>
</video>
```

### YouTube controls
Because `controls` is already a Video.js option, to use the YouTube controls, you must set the `ytControls` parameter.

```html
<video
id="vid1"
class="video-js vjs-default-skin"
controls
autoplay
width="640" height="264"
data-setup='{ "techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "https://www.youtube.com/watch?v=xjS6SftYQaQ"}], "Youtube": { "ytControls": 2 } }'
>
</video>
```

##Special Thank You
Thanks to Steve Heffernan for the amazing Video.js and to John Hurliman for the original version of the YouTube tech

## License
The MIT License (MIT)

Copyright (c) 2014-2015 Benoit Tremblay <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
33 changes: 21 additions & 12 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
{
"name": "videojs-youtube",
"version": "2.0.0",
"homepage": "https://github.com/eXon/videojs-youtube",
"authors": [
"Benoit Tremblay <[email protected]>"
],
"description": "YouTube playback technology for Video.js",
"version": "1.2.13",
"main": ["dist/vjs.youtube.js"],
"main": "dist/Youtube.min.js",
"license": "MIT",
"keywords": [
"video",
"videojs",
"video.js",
"vjs",
"YouTube",
"tech"
],
"ignore": [
"examples",
"sandbox",
"test",
".editorconfig",
".npmignore",
".gitignore",
".jshintrc",
".travis.yml",
"bower.json",
"Gruntfile.js",
"package.json",
"README.md"
".jshintignore",
"src",
"tests",
"karma.conf.js"
],
"dependencies": {
"video.js": "^4.11"
"video.js": "^5.0.0"
}
}
Binary file added examples/.DS_Store
Binary file not shown.
12 changes: 0 additions & 12 deletions examples/autoplay.html

This file was deleted.

Loading

0 comments on commit 8d8d37c

Please sign in to comment.