From 0e662dfac5dc1322858d63859894147c74a35839 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 1 Apr 2018 12:32:19 +0530 Subject: [PATCH] use page up/down to seek --- index.html | 6 +++--- js/app.js | 51 +++++++++++++++++++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 195f552..6254db3 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ - + @@ -112,10 +112,10 @@ A web based transcribing and subtitling tool. It is used for transcribing videos
0:00:00.000
- Ctrl / Alt: Seek back / forward    seconds.
+ Ctrl / Alt: Seek back / forward    seconds.
Esc: Pause / Unpause
Insert / Tab: Insert time-code
- PageUp / PageDown: Volume Up / Down
+ Shift PageUp / Shift PageDown: Volume Up / Down
Double-click on time-code in textarea: Seek video to time-code.
diff --git a/js/app.js b/js/app.js index 105bf92..a1b7d9f 100644 --- a/js/app.js +++ b/js/app.js @@ -10,6 +10,11 @@ var videoHash = undefined; Ox.load({ UI: {theme: 'oxlight'}, }, function() { + if (navigator.platform == 'MacIntel') { + } else { + $('#seek_back').html('PageUp') + $('#seek_fwd').html('PageDown') + } Ox.$body.show(); globalUser = new User(); adjustSize(); @@ -40,19 +45,25 @@ Ox.load({ return false; } } - //Ctrl - Seek Back - if (e.keyCode == 17) { - var seekTime = parseFloat($('#seekTime').val()); - var currTime = Video.get(); - var newTime = currTime - seekTime; - Video.set(newTime); - } - //Alt - Seek Fwd. - if (e.keyCode == 18) { - var seekTime = parseFloat($('#seekTime').val()); - var currTime = Video.get(); - var newTime = currTime + seekTime; - Video.set(newTime); + if (navigator.platform == 'MacIntel') { + //Ctrl - Seek Back + if (e.keyCode == 17) { + seek(-seekTime) + } + //Alt - Seek Fwd. + if (e.keyCode == 18) { + seek(seekTime) + } + } else { + //PageUp - seek back + if (e.keyCode == 33) { + seek(-seekTime) + } + + // PageDown - seek fwd. + if (e.keyCode == 34) { + seek(seekTime) + } } //Space - togglePause if no focus on TA @@ -60,13 +71,14 @@ Ox.load({ Video.togglePause(); } - //PageUp - volume Up: - if (e.keyCode == 33) { + //Shift PageUp - volume up: + if (e.keyCode == 33 && e.shiftKey) { Video.volUp(); return false; } - if (e.keyCode == 34) { + //Shift PageDown - volume down: + if (e.keyCode == 34 && e.shiftKey) { Video.volDown(); return false; } @@ -318,6 +330,13 @@ function loadVideo(videoFile) { }); }; +function seek(delta) { + var seekTime = parseFloat($('#seekTime').val()); + var currTime = Video.get(); + var newTime = currTime + delta; + Video.set(newTime); +} + $(window).unload(function() { saveTxt(); });