Merge branch 'master' into develop
# Conflicts: # dist/plyr.css # dist/plyr.js # docs/dist/docs.css # docs/dist/docs.js # docs/index.html # docs/src/js/docs.js # docs/src/less/components/icons.less # docs/src/less/components/type.less # docs/src/less/docs.less # gulpfile.js # package.json # src/js/plyr.js
This commit is contained in:
commit
ee2cdb2c9b
@ -30,7 +30,7 @@ Note: `{seektime}` will be replaced with your configured seek time or the defaul
|
||||
|
||||
## Using custom HTML
|
||||
|
||||
The example on [plyr.io](http://plyr.io) setup uses a Hogan template. Check out `controls.html` in `/src/templates` to get an idea of how the default html is structured.
|
||||
You can specify the HTML for the controls using the `html` option.
|
||||
|
||||
The classes and data attributes used in your template should match the `selectors` option.
|
||||
|
||||
|
2
dist/plyr.css
vendored
2
dist/plyr.css
vendored
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Docs styles -->
|
||||
<link rel="stylesheet" href="//cdn.plyr.io/1.3.5/docs.css">
|
||||
<link rel="stylesheet" href="//cdn.plyr.io/1.3.7/docs.css">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
|
@ -8,10 +8,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.5/plyr.css">
|
||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.7/plyr.css">
|
||||
|
||||
<!-- Docs styles -->
|
||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.5/docs.css">
|
||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.7/docs.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
@ -21,12 +21,12 @@
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://github.com/selz/plyr" target="_blank" class="btn btn-primary" data-shr-network="github">
|
||||
<svg class="icon"><use xlink:href="#icon-github"/></svg>Download on GitHub
|
||||
<svg class="icon"><use xlink:href="#shr-github"/></svg>Download on GitHub
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/intent/tweet?text=A+simple+HTML5+media+player+with+custom+controls+and+WebVTT+captions.&url=http%3A%2F%2Fplyr.io&via=Sam_Potts" target="_blank" class="btn btn-twitter" data-shr-network="twitter">
|
||||
<svg class="icon"><use xlink:href="#icon-twitter"/></svg>Tweet
|
||||
<svg class="icon"><use xlink:href="#shr-twitter"/></svg>Tweet
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -57,9 +57,11 @@
|
||||
<source src="https://cdn.selz.com/plyr/1.0/movie.mp4" type="video/mp4">
|
||||
<source src="https://cdn.selz.com/plyr/1.0/movie.webm" type="video/webm">
|
||||
|
||||
|
||||
<!-- Text track file -->
|
||||
<track kind="captions" label="English" srclang="en" src="https://cdn.selz.com/plyr/1.0/example_captions_en.vtt" default>
|
||||
|
||||
|
||||
<!-- Fallback for browsers that don't support the <video> element -->
|
||||
<a href="https://cdn.selz.com/plyr/1.0/movie.mp4">Download</a>
|
||||
</video>
|
||||
@ -77,22 +79,39 @@
|
||||
<!-- Load SVG defs -->
|
||||
<!-- You should bundle all SVG/Icons into one file using a build tool such as gulp and svg store -->
|
||||
<script>
|
||||
function loadSprite(d, u) {
|
||||
var a = new XMLHttpRequest(),
|
||||
b = document.body;
|
||||
(function() {
|
||||
[
|
||||
"https://cdn.shr.one/0.1.9/sprite.svg",
|
||||
"https://cdn.plyr.io/1.3.7/sprite.svg"
|
||||
]
|
||||
.forEach(function(u) {
|
||||
var x = new XMLHttpRequest(),
|
||||
b = document.body;
|
||||
|
||||
// If proper CORS supported
|
||||
if("withCredentials" in a) {
|
||||
a.open("GET", u, true);
|
||||
a.send();
|
||||
a.onload = function(){
|
||||
// Check for CORS support
|
||||
// If you're loading from same domain, you can remove the if statement
|
||||
// XHR for Chrome/Firefox/Opera/Safari
|
||||
if ("withCredentials" in x) {
|
||||
x.open("GET", u, true);
|
||||
}
|
||||
// XDomainRequest for older IE
|
||||
else if (typeof XDomainRequest != "undefined") {
|
||||
x = new XDomainRequest();
|
||||
x.open("GET", u);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
x.send();
|
||||
x.onload = function() {
|
||||
var c = document.createElement("div");
|
||||
c.setAttribute("hidden", "");
|
||||
c.innerHTML = a.responseText;
|
||||
c.innerHTML = x.responseText;
|
||||
b.insertBefore(c, b.childNodes[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
// Load the plyr sprite
|
||||
loadSprite(document, "../dist/sprite.svg");
|
||||
|
||||
@ -101,12 +120,12 @@
|
||||
</script>
|
||||
|
||||
<!-- Plyr core script -->
|
||||
<script src="https://cdn.plyr.io/1.3.5/plyr.js"></script>
|
||||
<script src="https://cdn.plyr.io/1.3.7/plyr.js"></script>
|
||||
|
||||
<!-- Shr core script -->
|
||||
<script src="https://cdn.shr.one/0.1.7/shr.js"></script>
|
||||
<script src="https://cdn.shr.one/0.1.9/shr.js"></script>
|
||||
|
||||
<!-- Docs script -->
|
||||
<script src="https://cdn.plyr.io/1.3.5/docs.js"></script>
|
||||
<script src="https://cdn.plyr.io/1.3.7/docs.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
130
docs/index.master.html
Normal file
130
docs/index.master.html
Normal file
@ -0,0 +1,130 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Plyr - A simple HTML5 media player</title>
|
||||
<meta name="description" content="A simple HTML5 media player with custom controls and WebVTT captions.">
|
||||
<meta name="author" content="Sam Potts">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="../dist/plyr.css">
|
||||
|
||||
<!-- Docs styles -->
|
||||
<link rel="stylesheet" href="dist/docs.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Plyr</h1>
|
||||
<p>A simple HTML5 media player with custom controls and WebVTT captions by <a href="https://twitter.com/sam_potts" target="_blank">@sam_potts</a> from <a href="https://twitter.com/selz" target="_blank">@selz</a></p>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://github.com/selz/plyr" target="_blank" class="btn btn-primary" data-shr-network="github">
|
||||
<svg class="icon"><use xlink:href="#shr-github"/></svg>Download on GitHub
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/intent/tweet?text=A+simple+HTML5+media+player+with+custom+controls+and+WebVTT+captions.&url=http%3A%2F%2Fplyr.io&via=Sam_Potts" target="_blank" class="btn btn-twitter" data-shr-network="twitter">
|
||||
<svg class="icon"><use xlink:href="#shr-twitter"/></svg>Tweet
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main role="main" id="main">
|
||||
<nav class="btn-bar nav-panel">
|
||||
<ul>
|
||||
<li><a href="#video" class="btn active btn-small">Video</a></li>
|
||||
<li><a href="#youtube" class="btn btn-small">YouTube</a></li>
|
||||
<li><a href="#audio" class="btn btn-small">Audio</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="panels">
|
||||
<section class="panel example-video active" id="video">
|
||||
<div class="player">
|
||||
<video poster="poster.jpg" controls crossorigin>
|
||||
<!-- Video files -->
|
||||
<source src="https://cdn.selz.com/plyr/1.0/movie.mp4" type="video/mp4">
|
||||
<source src="https://cdn.selz.com/plyr/1.0/movie.webm" type="video/webm">
|
||||
|
||||
<!-- Text track file -->
|
||||
<track kind="captions" label="English" srclang="en" src="https://cdn.selz.com/plyr/1.0/example_captions_en.vtt" default>
|
||||
|
||||
<!-- Fallback for browsers that don't support the <video> element -->
|
||||
<a href="https://cdn.selz.com/plyr/1.0/movie.mp4">Download</a>
|
||||
</video>
|
||||
</div>
|
||||
<small>Big Buck Bunny. More info can be found at <a href="https://peach.blender.org" target="_blank">peach.blender.org</a>.</small>
|
||||
</section>
|
||||
<section class="panel example-video" id="youtube">
|
||||
<div class="player">
|
||||
<div data-video-id="Au87oAJ2jeE" data-type="youtube"></div>
|
||||
</div>
|
||||
<small>Envato's "Made By" interview of <a href="https://www.youtube.com/watch?v=Au87oAJ2jeE" target="_blank">Dan Cederholm</a> from <a href="https://dribbble.com" target="_blank">Dribbble</a>.</small>
|
||||
</section>
|
||||
<section class="panel example-audio" id="audio">
|
||||
<div class="player">
|
||||
<audio controls>
|
||||
<!-- Audio files -->
|
||||
<source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3" type="audio/mp3">
|
||||
<source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.ogg" type="audio/ogg">
|
||||
|
||||
<!-- Fallback for browsers that don't support the <audio> element -->
|
||||
<a href="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3">Download</a>
|
||||
</audio>
|
||||
</div>
|
||||
<small>"96" by Logistics, which can be purchased from <a href="https://www.hospitalrecords.com/shop/artist/logistics" target="_blank">Hospital Records</a>.</small>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Load SVG defs -->
|
||||
<!-- You should bundle all SVG/Icons into one file using a build tool such as gulp and svg store -->
|
||||
<script>
|
||||
(function() {
|
||||
[
|
||||
"https://cdn.shr.one/0.1.9/sprite.svg",
|
||||
"../dist/sprite.svg"
|
||||
]
|
||||
.forEach(function(u) {
|
||||
var x = new XMLHttpRequest(),
|
||||
b = document.body;
|
||||
|
||||
// Check for CORS support
|
||||
// If you're loading from same domain, you can remove the if statement
|
||||
// XHR for Chrome/Firefox/Opera/Safari
|
||||
if ("withCredentials" in x) {
|
||||
x.open("GET", u, true);
|
||||
}
|
||||
// XDomainRequest for older IE
|
||||
else if (typeof XDomainRequest != "undefined") {
|
||||
x = new XDomainRequest();
|
||||
x.open("GET", u);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
x.send();
|
||||
x.onload = function() {
|
||||
var c = document.createElement("div");
|
||||
c.setAttribute("hidden", "");
|
||||
c.innerHTML = x.responseText;
|
||||
b.insertBefore(c, b.childNodes[0]);
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- Plyr core script -->
|
||||
<script src="../src/js/plyr.js"></script>
|
||||
|
||||
<!-- Shr core script -->
|
||||
<script src="https://cdn.shr.one/0.1.9/shr.js"></script>
|
||||
|
||||
<!-- Docs script -->
|
||||
<script src="dist/docs.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -2,7 +2,7 @@
|
||||
// Docs example
|
||||
// ==========================================================================
|
||||
|
||||
/*global plyr, shr */
|
||||
/*global plyr, shr*/
|
||||
|
||||
// Setup the player
|
||||
plyr.setup({
|
||||
|
22
gulpfile.js
22
gulpfile.js
@ -41,8 +41,7 @@ paths = {
|
||||
// Source paths
|
||||
src: {
|
||||
less: path.join(root, "docs/src/less/**/*"),
|
||||
js: path.join(root, "docs/src/js/**/*"),
|
||||
sprite: path.join(root, "docs/src/sprite/*.svg")
|
||||
js: path.join(root, "docs/src/js/**/*")
|
||||
},
|
||||
// Output paths
|
||||
output: path.join(root, "docs/dist/"),
|
||||
@ -130,16 +129,16 @@ var build = {
|
||||
},
|
||||
sprite: function(bundle) {
|
||||
// Process Icons
|
||||
gulp.task("sprite-" + bundle, function () {
|
||||
gulp.task("sprite", function () {
|
||||
return gulp
|
||||
.src(paths[bundle].src.sprite)
|
||||
.src(paths.plyr.src.sprite)
|
||||
.pipe(svgmin({
|
||||
plugins: [{
|
||||
removeDesc: true
|
||||
}]
|
||||
}))
|
||||
.pipe(svgstore())
|
||||
.pipe(gulp.dest(paths[bundle].output));
|
||||
.pipe(gulp.dest(paths.plyr.output));
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -148,12 +147,16 @@ var build = {
|
||||
build.js(bundles.plyr.js, "plyr");
|
||||
build.less(bundles.plyr.less, "plyr");
|
||||
build.sass(bundles.plyr.sass, "plyr");
|
||||
build.sprite("plyr");
|
||||
build.sprite();
|
||||
|
||||
// Docs files
|
||||
build.less(bundles.docs.less, "docs");
|
||||
build.js(bundles.docs.js, "docs");
|
||||
build.sprite("docs");
|
||||
|
||||
// Build all JS
|
||||
gulp.task("js", function(){
|
||||
run(tasks.js);
|
||||
});
|
||||
|
||||
// Build SASS (for testing, default is LESS)
|
||||
gulp.task("sass", function(){
|
||||
@ -170,12 +173,11 @@ gulp.task("watch", function () {
|
||||
// Docs
|
||||
gulp.watch(paths.docs.src.js, tasks.js);
|
||||
gulp.watch(paths.docs.src.less, tasks.less);
|
||||
gulp.watch(paths.docs.src.sprite, ["sprite-docs"]);
|
||||
});
|
||||
|
||||
// Default gulp task
|
||||
gulp.task("default", function(){
|
||||
run(tasks.js, tasks.less, "sprite-plyr", "sprite-docs", "watch");
|
||||
run(tasks.js, tasks.less, "sprite", "watch");
|
||||
});
|
||||
|
||||
// Publish a version to CDN and docs
|
||||
@ -261,5 +263,5 @@ gulp.task("open", function () {
|
||||
|
||||
// Do everything
|
||||
gulp.task("publish", function () {
|
||||
run(tasks.js, tasks.less, "sprite-plyr", "sprite-docs", "cdn", "docs");
|
||||
run(tasks.js, tasks.less, "sprite", "cdn", "docs");
|
||||
});
|
14
package.json
14
package.json
@ -1,28 +1,28 @@
|
||||
{
|
||||
"name": "plyr",
|
||||
"version": "1.3.5",
|
||||
"version": "1.4.0",
|
||||
"description": "A simple HTML5 media player using custom controls",
|
||||
"homepage": "http://plyr.io",
|
||||
"main": "gulpfile.js",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-autoprefixer": "^3.0.2",
|
||||
"gulp-autoprefixer": "^3.1.0",
|
||||
"gulp-concat": "^2.3.3",
|
||||
"gulp-gzip": "^1.0.0",
|
||||
"gulp-less": "^3.0.3",
|
||||
"gulp-less": "^3.0.5",
|
||||
"gulp-minify-css": "^1.2.1",
|
||||
"gulp-open": "^1.0.0",
|
||||
"gulp-rename": "^1.2.0",
|
||||
"gulp-replace": "^0.5.3",
|
||||
"gulp-s3": "^0.3.0",
|
||||
"gulp-sass": "^2.0.4",
|
||||
"gulp-sass": "^2.1.0",
|
||||
"gulp-size": "^2.0.0",
|
||||
"gulp-svgmin": "^1.0.0",
|
||||
"gulp-svgstore": "^5.0.0",
|
||||
"gulp-uglify": "^1.4.1",
|
||||
"gulp-util": "^3.0.6",
|
||||
"run-sequence": "^1.1.4"
|
||||
"gulp-uglify": "^1.5.1",
|
||||
"gulp-util": "^3.0.7",
|
||||
"run-sequence": "^1.1.5"
|
||||
},
|
||||
"scripts": {
|
||||
"preinstall": "npm install -g gulp"
|
||||
|
18
readme.md
18
readme.md
@ -1,7 +1,7 @@
|
||||
# Plyr
|
||||
A simple, accessible HTML5 media player.
|
||||
|
||||
[Checkout the demo](http://plyr.io)
|
||||
Checkout the [demo](http://plyr.io).
|
||||
|
||||
[](http://plyr.io)
|
||||
|
||||
@ -24,9 +24,9 @@ We wanted a lightweight, accessible and customisable media player that just supp
|
||||
Oh and yes, it works with Bootstrap.
|
||||
|
||||
## Changelog
|
||||
Check out [the changelog](changelog.md)
|
||||
Check out the [changelog](changelog.md).
|
||||
|
||||
## Planned development
|
||||
## Planned Development
|
||||
- Vimeo support
|
||||
- Playback speed
|
||||
- Playlists
|
||||
@ -34,13 +34,13 @@ Check out [the changelog](changelog.md)
|
||||
- Audio captions
|
||||
... and whatever else has been raised in [issues](https://github.com/Selz/plyr/issues)
|
||||
|
||||
If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/Selz/plyr/issues/new) or of course, forking and sending a pull request.
|
||||
If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/Selz/plyr/issues/new) or, of course, forking and sending a pull request.
|
||||
|
||||
## Implementation
|
||||
|
||||
Check `docs/index.html` and `docs/dist/docs.js` for an example setup.
|
||||
|
||||
**Heads up**, the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.3.5/plyr.js` to `https://cdn.plyr.io/1.3.5/plyr.js`
|
||||
**Heads up:** the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.3.7/plyr.js` to `https://cdn.plyr.io/1.3.7/plyr.js`
|
||||
|
||||
### Bower
|
||||
If bower is your thang, you can grab Plyr using:
|
||||
@ -60,14 +60,14 @@ More info is on [npm](https://www.npmjs.com/package/ember-cli-plyr) and [GitHub]
|
||||
If you want to use our CDN, you can use the following:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.5/plyr.css">
|
||||
<script src="https://cdn.plyr.io/1.3.5/plyr.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.3.7/plyr.css">
|
||||
<script src="https://cdn.plyr.io/1.3.7/plyr.js"></script>
|
||||
```
|
||||
|
||||
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.3.5/sprite.svg`.
|
||||
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.3.7/sprite.svg`.
|
||||
|
||||
### CSS
|
||||
If you want to use the default css, add the `plyr.css` file from /dist into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request.
|
||||
If you want to use the default css, add the `plyr.css` file from `/dist` into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request.
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="dist/plyr.css">
|
||||
|
Loading…
x
Reference in New Issue
Block a user