aboutsummaryrefslogtreecommitdiff
path: root/assets/netcut/assets/script.js
diff options
context:
space:
mode:
authorAndreas Hubel2020-06-07 21:41:40 +0200
committerAndreas Hubel2020-06-07 21:41:40 +0200
commita66c79184091efdac09ee31a3778c6fc850dbbda (patch)
treed0c8f474548d8699411b7e33ee3fde62029c13da /assets/netcut/assets/script.js
parentd0a9d8b2b0d28dbef209c7cbcbfd56eaeac24d9b (diff)
add netcut assets to repo
submodules are propably to complicated for deployment.... :-)
Diffstat (limited to 'assets/netcut/assets/script.js')
m---------assets/netcut0
-rw-r--r--assets/netcut/assets/script.js70
2 files changed, 70 insertions, 0 deletions
diff --git a/assets/netcut b/assets/netcut
deleted file mode 160000
-Subproject 3dcf07d83e57191c79654d97310cbeb494ea52b
diff --git a/assets/netcut/assets/script.js b/assets/netcut/assets/script.js
new file mode 100644
index 0000000..7d84af9
--- /dev/null
+++ b/assets/netcut/assets/script.js
@@ -0,0 +1,70 @@
+videojs.log.level('debug');
+
+
+var player = videojs('video');
+player.ready(function() {
+ this.markers({
+ onTimeUpdateAfterMarkerUpdate: function() {
+ prevTime = player.currentTime();
+ },
+ onMarkerReached: function() {
+ player.pause();
+ },
+ markers: [
+ {time: (INFRAME / 25), text: 'inframe', class: 'inframe'},
+ {time: (OUTFRAME / 25), text: 'outframe', class: 'outframe'},
+ ]
+ });
+
+ if(INFRAME != -1) this.currentTime(INFRAME / 25);
+
+ this.hotkeys({
+ volumeStep: 0.1,
+ seekStep: 5,
+ enableModifiersForNumbers: false,
+ });
+});
+
+var inframe = document.getElementById('inframe');
+var outframe = document.getElementById('outframe');
+
+if(INFRAME != -1) {
+ inframe.innerHTML = "inframe: " + (INFRAME / 25) + " seconds (frame " + INFRAME + ")\n";
+}
+
+if(OUTFRAME != -1) {
+ outframe.innerHTML = "outframe: " + (OUTFRAME / 25) + " seconds (frame " + OUTFRAME + ")\n";
+}
+
+function fnord(e) {
+ var time = player.currentTime();
+ var frame = Math.round(player.currentTime() / (1/VIDEO_FPS));
+
+ if(e['key'] == 'i') {
+ player.markers.getMarkers().forEach(function(x, i){
+ if(x.text == 'inframe') player.markers.remove([i]);
+ });
+ player.markers.add([{time: time, text: 'inframe', class: 'inframe'}]);
+ inframe.innerHTML = "inframe: " + time + " seconds (frame " + frame + ")\n";
+ } else if(e['key'] == 'o') {
+ player.markers.getMarkers().forEach(function(x, i){
+ if(x.text == 'outframe') player.markers.remove([i]);
+ });
+ player.markers.add([{time: time, text: 'outframe', class: 'outframe'}]);
+ outframe.innerHTML = "outframe: " + time + " seconds (frame " + frame + ")\n";
+ } else if(e['key'] == 'I') {
+ player.markers.getMarkers().forEach(function(x, i){
+ if(x.text == 'inframe') player.currentTime(x.time);
+ });
+ } else if(e['key'] == 'O') {
+ player.markers.getMarkers().forEach(function(x, i){
+ if(x.text == 'outframe') player.currentTime(x.time);
+ });
+ } else {
+ return true;
+ }
+}
+
+var playerdiv = document.getElementById('webcut');
+playerdiv.addEventListener("keydown", fnord);
+player.focus();