diff --git a/rowers/templates/embedded_video.html b/rowers/templates/embedded_video.html index 4bce15f5..d144fe0a 100644 --- a/rowers/templates/embedded_video.html +++ b/rowers/templates/embedded_video.html @@ -121,6 +121,7 @@ var player; var playing = false; var dataplaying = false; + var videotime = 0; var data = JSON.parse('{{ data|safe }}'); {% for id, metric in metrics.items %} @@ -229,6 +230,7 @@ } else { if (!dataplaying) { output.value = Math.round(datatime)-Math.round(videotime); + document.getElementById("time").innerHTML = Math.round(videotime); } } @@ -237,15 +239,16 @@ function stopVideo() { player.pauseVideo(); playing = false; - dataplay.value = String.fromCharCode(9658); } // call this function when player state changes function onPlayerStateChange(event) { - if (event.data == YT.PlayerState.PLAYING) { - - } else { - + if (event.data == YT.PlayerState.PLAYING && lock.checked) { + var dataplay = document.getElementById("dataplay").childNodes[0]; + dataplay.value = String.fromCharCode(10074,10074); + } else if (lock.checked) { + var dataplay = document.getElementById("dataplay").childNodes[0]; + dataplay.value = String.fromCharCode(9658); } } @@ -557,7 +560,11 @@ function clock() { if (lock.checked) { player.seekTo(c+parseInt(output.value)); + } else { + delay = Math.round(slider.value)-Math.round(player.getCurrentTime()); + output.value = Math.round(slider.value)-Math.round(player.getCurrentTime()); } + if (c == latitude.length) { clearInterval(timer); c = 0;