Update app.py
Browse files
app.py
CHANGED
|
@@ -945,12 +945,22 @@ function stop_recording() {
|
|
| 945 |
}
|
| 946 |
window.stop_recording = stop_recording;
|
| 947 |
|
| 948 |
-
function seek() {
|
| 949 |
videoDome.videoTexture.video.pause();
|
| 950 |
video.pause();
|
| 951 |
-
|
| 952 |
-
videoDome.videoTexture.video.currentTime
|
| 953 |
-
video.currentTime
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 954 |
}
|
| 955 |
window.seek = seek;
|
| 956 |
|
|
@@ -1286,7 +1296,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
| 1286 |
<a href='#' onclick='snapshot();'>Screenshot</a>
|
| 1287 |
<a href='#' onclick='record_video();'>Record</a>
|
| 1288 |
<a href='#' onclick='stop_recording();'>Stop rec.</a>
|
| 1289 |
-
<a href='#' onclick='seek();'>
|
| 1290 |
<a href='#' onclick='play();'>Play</a><br/>
|
| 1291 |
<img src='' id='img_out' onload='var ctxt = document.getElementById(\"cnv_out\").getContext(\"2d\");ctxt.drawImage(this, 0, 0);'/><br/>
|
| 1292 |
<canvas id='cnv_out'></canvas>
|
|
|
|
| 945 |
}
|
| 946 |
window.stop_recording = stop_recording;
|
| 947 |
|
| 948 |
+
function seek(t) {
|
| 949 |
videoDome.videoTexture.video.pause();
|
| 950 |
video.pause();
|
| 951 |
+
|
| 952 |
+
videoDome.videoTexture.video.currentTime += t;
|
| 953 |
+
if (videoDome.videoTexture.video.currentTime > videoDome.videoTexture.video.duration) {
|
| 954 |
+
videoDome.videoTexture.video.currentTime = videoDome.videoTexture.video.duration;
|
| 955 |
+
} else if (videoDome.videoTexture.video.currentTime < 0) {
|
| 956 |
+
videoDome.videoTexture.video.currentTime = 0;
|
| 957 |
+
}
|
| 958 |
+
video.currentTime += t;
|
| 959 |
+
if (video.currentTime > video.duration) {
|
| 960 |
+
video.currentTime = video.duration;
|
| 961 |
+
} else if (video.currentTime < 0) {
|
| 962 |
+
video.currentTime = 0;
|
| 963 |
+
}
|
| 964 |
}
|
| 965 |
window.seek = seek;
|
| 966 |
|
|
|
|
| 1296 |
<a href='#' onclick='snapshot();'>Screenshot</a>
|
| 1297 |
<a href='#' onclick='record_video();'>Record</a>
|
| 1298 |
<a href='#' onclick='stop_recording();'>Stop rec.</a>
|
| 1299 |
+
<a href='#' onclick='seek(-1);'>Back</a> <a href='#' onclick='seek(1);'>Fwd</a>
|
| 1300 |
<a href='#' onclick='play();'>Play</a><br/>
|
| 1301 |
<img src='' id='img_out' onload='var ctxt = document.getElementById(\"cnv_out\").getContext(\"2d\");ctxt.drawImage(this, 0, 0);'/><br/>
|
| 1302 |
<canvas id='cnv_out'></canvas>
|