Added support for multiple instances

This commit is contained in:
Sam Potts 2015-02-16 23:51:33 +11:00
parent 4499bf39ef
commit 383fdf0af4
9 changed files with 675 additions and 659 deletions

View File

@ -4,14 +4,9 @@
/*global simpleMedia, templates */ /*global simpleMedia, templates */
// Register a callback // Setup the player
simpleMedia.on("setup", function() {
//console.log(this);
});
//execute shout
simpleMedia.setup({ simpleMedia.setup({
//debug: true, debug: true,
title: "Video demo", title: "Video demo",
html: templates.controls.render({}) html: templates.controls.render({})
}); });

File diff suppressed because it is too large Load Diff

View File

@ -35,14 +35,14 @@ html {
} }
body { body {
font-family: "Avenir", "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Avenir", "Helvetica Neue", Helvetica, Arial, sans-serif;
.font-size(18);
color: #6D797F;
line-height: 1.5;
background: #fff; background: #fff;
.font-size(16);
line-height: 1.5;
text-align: center; text-align: center;
color: #6D797F;
} }
h1 { h1,
.font-size(48); h2 {
letter-spacing: -.025em; letter-spacing: -.025em;
color: #2E3C44; color: #2E3C44;
margin: 0 0 10px; margin: 0 0 10px;
@ -50,16 +50,27 @@ h1 {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
h1 {
.font-size(48);
}
h2 {
.font-size(32);
margin: 0 0 20px;
}
p { p {
margin: 0 0 20px; margin: 0 0 20px;
} }
header { header {
margin: 40px 0; margin: 40px 0;
p {
.font-size(18);
}
} }
.example-audio .player, .example-audio .player,
.example-video .player { .example-video .player {
margin: 0 auto; margin: 0 auto 40px;
&:fullscreen { &:fullscreen {
max-width: none; max-width: none;

2
dist/css/docs.css vendored
View File

@ -1 +1 @@
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:0 0}a:focus{outline:dotted thin}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}hr{box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@font-face{font-family:Avenir;src:url(../../assets/fonts/AvenirLTStd-Medium.woff2) format("woff2"),url(../../assets/fonts/AvenirLTStd-Medium.woff) format("woff"),url(../../assets/fonts/AvenirLTStd-Medium.ttf) format("truetype");font-style:normal;font-weight:400}@font-face{font-family:Avenir;src:url(../../assets/fonts/AvenirLTStd-Heavy.woff2) format("woff2"),url(../../assets/fonts/AvenirLTStd-Heavy.woff) format("woff"),url(../../assets/fonts/AvenirLTStd-Heavy.ttf) format("truetype");font-style:normal;font-weight:600}*,::after,::before{box-sizing:border-box}html{font-size:62.5%}body{font-family:Avenir,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:18px;font-size:1.8rem;color:#6D797F;line-height:1.5;background:#fff;text-align:center}h1{font-size:48px;font-size:4.8rem;letter-spacing:-.025em;color:#2E3C44;margin:0 0 10px;line-height:1.2;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}p{margin:0 0 20px}header{margin:40px 0}.example-audio .player,.example-video .player{margin:0 auto}.example-audio .player:-webkit-full-screen,.example-video .player:-webkit-full-screen{max-width:none}.example-audio .player:-moz-full-screen,.example-video .player:-moz-full-screen{max-width:none}.example-audio .player:-ms-fullscreen,.example-video .player:-ms-fullscreen{max-width:none}.example-audio .player:fullscreen,.example-video .player:fullscreen{max-width:none}.example-audio .player{max-width:480px}.example-video .player{max-width:1200px} /*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:0 0}a:focus{outline:dotted thin}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}hr{box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@font-face{font-family:Avenir;src:url(../../assets/fonts/AvenirLTStd-Medium.woff2) format("woff2"),url(../../assets/fonts/AvenirLTStd-Medium.woff) format("woff"),url(../../assets/fonts/AvenirLTStd-Medium.ttf) format("truetype");font-style:normal;font-weight:400}@font-face{font-family:Avenir;src:url(../../assets/fonts/AvenirLTStd-Heavy.woff2) format("woff2"),url(../../assets/fonts/AvenirLTStd-Heavy.woff) format("woff"),url(../../assets/fonts/AvenirLTStd-Heavy.ttf) format("truetype");font-style:normal;font-weight:600}*,::after,::before{box-sizing:border-box}html{font-size:62.5%}body{font-family:Avenir,"Helvetica Neue",Helvetica,Arial,sans-serif;background:#fff;font-size:16px;font-size:1.6rem;line-height:1.5;text-align:center;color:#6D797F}h1,h2{letter-spacing:-.025em;color:#2E3C44;margin:0 0 10px;line-height:1.2;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}h1{font-size:48px;font-size:4.8rem}h2{font-size:32px;font-size:3.2rem;margin:0 0 20px}p{margin:0 0 20px}header{margin:40px 0}header p{font-size:18px;font-size:1.8rem}.example-audio .player,.example-video .player{margin:0 auto 40px}.example-audio .player:-webkit-full-screen,.example-video .player:-webkit-full-screen{max-width:none}.example-audio .player:-moz-full-screen,.example-video .player:-moz-full-screen{max-width:none}.example-audio .player:-ms-fullscreen,.example-video .player:-ms-fullscreen{max-width:none}.example-audio .player:fullscreen,.example-video .player:fullscreen{max-width:none}.example-audio .player{max-width:480px}.example-video .player{max-width:1200px}

2
dist/js/docs.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,41 +0,0 @@
<!doctype html>
<html lang="en" class="example-audio">
<head>
<meta charset="utf-8" />
<title>Simple Media</title>
<meta name="description" content="Custom HTML5 video 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/css/simple-media.css">
<link rel="stylesheet" href="../dist/css/docs.css">
</head>
<body>
<header>
<h1>Simple Media</h1>
<p>A simple HTML5 media player</p>
</header>
<div class="player">
<audio controls>
<!-- Audio files -->
<source src="../media/Covox_-_Switchblade_Squadron.mp3" type="audio/mp3">
<!-- Fallback for browsers that don't support the <audio> element -->
<div>
<a href="../media/Covox_-_Switchblade_Squadron.mp3">Download it</a>
</div>
</video>
</div>
<!-- Load SVG defs -->
<script>(function(d,p){var a=new XMLHttpRequest(),b=d.body; a.open("GET",p,!0);a.send();a.onload=function(){var c=d.createElement("div");c.style.display="none";c.innerHTML=a.responseText;b.insertBefore(c,b.childNodes[0])}})(document,"../dist/svg/sprite.svg");</script>
<!-- Core player -->
<script src="../dist/js/simple-media.js"></script>
<!-- Docs setup -->
<script src="../dist/js/docs.js"></script>
</body>
</html>

67
docs/index.html Normal file
View File

@ -0,0 +1,67 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Simple Media</title>
<meta name="description" content="Custom HTML5 video 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/css/simple-media.css">
<link rel="stylesheet" href="../dist/css/docs.css">
</head>
<body>
<header>
<h1>Simple Media</h1>
<p>A simple HTML5 media player</p>
</header>
<section class="example-video">
<h2>Video</h2>
<p>Using the native &lt;video&gt; element.</p>
<div class="player">
<video poster="../media/poster_PayPal_Austin2.jpg" controls>
<!-- Video files -->
<source src="https://www.paypalobjects.com/webstatic/mktg/videos/PayPal_AustinSMB_baseline.mp4" type="video/mp4">
<source src="https://www.paypalobjects.com/webstatic/mktg/videos/PayPal_AustinSMB_baseline.webm" type="video/webm">
<!-- Text track file -->
<track kind="captions" label="English captions" src="../media/captions_PayPal_Austin_en.vtt" srclang="en" default>
<!-- Fallback for browsers that don't support the <video> element -->
<div>
<a href="https://www.paypalobjects.com/webstatic/mktg/videos/PayPal_AustinSMB_baseline.mp4">
<img src="../media/poster_PayPal_Austin2.jpg" width="640" height="360" alt="download video">
</a>
</div>
</video>
</div>
</section>
<section class="example-audio">
<h2>Audio</h2>
<p>Yep, it does &lt;audio&gt; too.</p>
<div class="player">
<audio controls>
<!-- Audio files -->
<source src="../media/Covox_-_Switchblade_Squadron.mp3" type="audio/mp3">
<!-- Fallback for browsers that don't support the <audio> element -->
<div>
<a href="../media/Covox_-_Switchblade_Squadron.mp3">Download it</a>
</div>
</audio>
</div>
</section>
<!-- Load SVG defs -->
<script>(function(d,p){var a=new XMLHttpRequest(),b=d.body; a.open("GET",p,!0);a.send();a.onload=function(){var c=d.createElement("div");c.style.display="none";c.innerHTML=a.responseText;b.insertBefore(c,b.childNodes[0])}})(document,"../dist/svg/sprite.svg");</script>
<!-- Core player -->
<script src="../dist/js/simple-media.js"></script>
<!-- Docs setup -->
<script src="../dist/js/docs.js"></script>
</body>
</html>

View File

@ -1,47 +0,0 @@
<!doctype html>
<html lang="en" class="example-video">
<head>
<meta charset="utf-8" />
<title>Simple Media</title>
<meta name="description" content="Custom HTML5 video 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/css/simple-media.css">
<link rel="stylesheet" href="../dist/css/docs.css">
</head>
<body>
<header>
<h1>Simple Media</h1>
<p>A simple HTML5 media player</p>
</header>
<div class="player">
<video poster="../media/poster_PayPal_Austin2.jpg" controls>
<!-- Video files -->
<source src="https://www.paypalobjects.com/webstatic/mktg/videos/PayPal_AustinSMB_baseline.mp4" type="video/mp4">
<source src="https://www.paypalobjects.com/webstatic/mktg/videos/PayPal_AustinSMB_baseline.webm" type="video/webm">
<!-- Text track file -->
<track kind="captions" label="English captions" src="../media/captions_PayPal_Austin_en.vtt" srclang="en" default>
<!-- Fallback for browsers that don't support the <video> element -->
<div>
<a href="https://www.paypalobjects.com/webstatic/mktg/videos/PayPal_AustinSMB_baseline.mp4">
<img src="../media/poster_PayPal_Austin2.jpg" width="640" height="360" alt="download video">
</a>
</div>
</video>
</div>
<!-- Load SVG defs -->
<script>(function(d,p){var a=new XMLHttpRequest(),b=d.body; a.open("GET",p,!0);a.send();a.onload=function(){var c=d.createElement("div");c.style.display="none";c.innerHTML=a.responseText;b.insertBefore(c,b.childNodes[0])}})(document,"../dist/svg/sprite.svg");</script>
<!-- Core player -->
<script src="../dist/js/simple-media.js"></script>
<!-- Docs setup -->
<script src="../dist/js/docs.js"></script>
</body>
</html>