Skip to content

Instantly share code, notes, and snippets.

@kencoba
Created June 2, 2017 03:54
Show Gist options
  • Save kencoba/4bc54aeb046fab3c2153816b185de6ef to your computer and use it in GitHub Desktop.
Save kencoba/4bc54aeb046fab3c2153816b185de6ef to your computer and use it in GitHub Desktop.
video tag sample.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
.button {
width: 40%;
text-align: left;
}
</style>
</head>
<body>
<script type="text/javascript">
function toSec(hms) {
var regexp = /(\d\d):(\d\d):(\d\d)/;
var matched = hms.match(regexp);
var hour = Number(matched[1]);
var minute = Number(matched[2]);
var seconds = Number(matched[3]);
return (hour*60*60) + (minute*60) + seconds;
}
function playAt(id,hms) {
document.getElementById(id).currentTime = toSec(hms);
}
</script>
<h2>Gauche programming</h2>
<h2>Part1 Chapter1 Introduction</h2>
<p>
<video id="chapter01" width="640" height="360" controls>
<source src="Gauche_chapter01.mp4"/>
</video>
<br/>
<input type="button" class="button" value="1.1 Try REPL" onClick="playAt('chapter01','00:00:00')"/><br/>
<input type="button" class="button" value="1.2 History of Lisp" onClick="playAt('chapter01','00:32:29')"/><br/>
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment