Last active
December 11, 2015 21:08
-
-
Save rectalogic/4659889 to your computer and use it in GitHub Desktop.
This file contains 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
<html> | |
<head> | |
<script type="text/javascript"> | |
function init() { | |
var video = document.getElementById("video"); | |
video.addEventListener('pause', stopLogging, false); | |
video.addEventListener('playing', startLogging, false); | |
console.log("READY"); | |
} | |
function stopLogging() { | |
window.removeEventListener('devicemotion', logMotion, false); | |
console.log("STOP"); | |
} | |
function startLogging() { | |
console.log("START"); | |
window.addEventListener('devicemotion', logMotion, false); | |
} | |
function logMotion(event) { | |
console.log(event.accelerationIncludingGravity.x); | |
} | |
</script> | |
</head> | |
<body onload="init();"> | |
<video id="video" width="848" height="352" autoplay src="http://movies.apple.com/media/us/html5/showcase/2011/demos/apple-html5-demo-tron-us_848x352.m4v"></video> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment