Referencing recorded video to see if it is playing or not (JS)
http://stackoverflow.com/questions/41354400/referencing-recorded-video-to-see-if-it-is-playing-or-not-js
HTML
<h1></h1>
<video controls muted style="width:20%;"></video>
<script>
var video = document.querySelector('video');
var h1 = document.querySelector('h1');
video.onloadedmetadata = function() {
if(lastTime) return;
checkForTimeChange();
};
var lastTime;
function checkForTimeChange() {
if(!lastTime) {
lastTime = video.currentTime;
}
if(lastTime == video.currentTime) {
h1.innerHTML = 'paused';
}
else {
h1.innerHTML = 'playing';
}
lastTime = video.currentTime;
setTimeout(checkForTimeChange, 500);
}
</script>
<script>
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
navigator.getUserMedia({video: true}, function(stream) {
video.src = URL.createObjectURL(stream);
video.play();
}, function() {});
</script>