This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* some helpers */ | |
Array.prototype.insert = function(index, item) { | |
this.splice(index, 0, item); | |
}; | |
Number.prototype.clamp = function(min, max) { | |
return max > min ? | |
Math.min(Math.max(this, min), max) : | |
Math.min(Math.max(this, max), min); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var subtitles = ["Hello!", "I'm a cat!", "Goodbye!"]; | |
var currentSubtitle = 0; | |
var subtitleInterval = 10; | |
var $subtitles = $('#subtitles'); | |
var backgroundColors = ["blue", "red", "pink"]; | |
var currentBackground = 0; | |
var backgroundInterval = 3; | |
var $body = $('body'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>HTML5 Video Example</title> | |
<meta charset="utf-8" /> | |
<link href="style.css" type="text/css" rel="stylesheet"/> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
</head> | |
<body> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family:Helvetica, sans-serif; | |
line-height: 1.45; | |
} | |
#subtitles { | |
font-size:22px; | |
padding:.25em; | |
margin:.25em 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tag = document.createElement('script'); | |
tag.src = "http://www.youtube.com/iframe_api"; | |
var firstTagScript = document.getElementsByTagName('script')[0]; | |
firstTagScript.parentNode.insertBefore(tag, firstTagScript); | |
var subtitles = ["Hello!", "I'm a cat!", "Goodbye!"]; | |
var currentSubtitle = 0; | |
var subtitleInterval = 10; | |
var $subtitles = $('#subtitles'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>HTML5 Video Example</title> | |
<meta charset="utf-8" /> | |
<link href="style.css" type="text/css" rel="stylesheet"/> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
</head> | |
<body> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var player = document.querySelector('audio'); | |
var playBtn = document.querySelector('#play-btn'); | |
var progress = document.querySelector('#progress'); | |
var progressTotal = document.querySelector('#progress-bar').offsetWidth; | |
var volume = document.querySelector('#volume'); | |
var speed = document.querySelector('#speed'); | |
playBtn.addEventListener('click', function() { | |
if ( player.paused ) { | |
player.play(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family:monospace; | |
margin:0; | |
line-height:1.45; | |
} | |
* { | |
box-sizing:border-box; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<link href="style.css" rel="stylesheet" type="text/css" /> | |
<title>HTML5 Audio Player</title> | |
</head> | |
<body> | |
<div id="container"> | |
<h1>Audio Player</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background-color: lightblue; | |
font-family: Helvetica, Arial, sans-serif; | |
font-size: 18px; | |
} | |
h1 { color: #ffddff; } | |
p { color: white; } |
NewerOlder