Commit 90e2e0f3 by Ernie Park

make video player use one play/pause button that toggles

parent 85a29648
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
<section> <section>
<ul class="vcr"> <ul class="vcr">
<li><a class="play" onclick="play();">Play</a></li> <li><a id="video_control" class="pause">Pause</a></li>
<li><a class="pause" onclick="pause();">Pause</a></li>
</ul> </ul>
<div id="vidtime">0:00/0:00</div> <div id="vidtime">0:00/0:00</div>
......
...@@ -34,7 +34,7 @@ loadNewVideo(streams["1.0"], ${ position }); ...@@ -34,7 +34,7 @@ loadNewVideo(streams["1.0"], ${ position });
function add_speed(key, stream) { function add_speed(key, stream) {
var id = 'speed_' + stream; var id = 'speed_' + stream;
$("#video_speeds").append(' <span id="'+id+'">'+key+'X</span>'); $("#video_speeds").append(' <span id="'+id+'">'+key+'x</span>');
$("#"+id).click(function(){ $("#"+id).click(function(){
change_video_speed(key, stream); change_video_speed(key, stream);
}); });
...@@ -57,3 +57,16 @@ l.sort(sort_by_value); ...@@ -57,3 +57,16 @@ l.sort(sort_by_value);
for(var i=0; i<l.length; i++) { for(var i=0; i<l.length; i++) {
add_speed(l[i], streams[l[i]]) add_speed(l[i], streams[l[i]])
} }
//toggle video play/pause. the HTML assumes video is always autoplayed
//initially since it starts with class "pause". may want to set that in
//javascript
$("#video_control").click(function(){
if ($(this).hasClass("play")){
play();
$(this).removeClass().addClass("pause");
} else {
pause();
$(this).removeClass().addClass("play");
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment