hyungonryu commited on
Commit
185d32f
·
verified ·
1 Parent(s): d5fd990

Upload playback.html

Browse files
Files changed (1) hide show
  1. playback.html +257 -0
playback.html ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Video Sync with Custom UI</title>
6
+ <style>
7
+ body { font-family: sans-serif; margin: 20px; }
8
+ table { margin: 0 auto; }
9
+ td { padding: 5px; vertical-align: middle; }
10
+ .slider, .timeline-slider { }
11
+ .video-container-wrapper { position: relative; display: inline-block; }
12
+ .video-container {
13
+ position: relative;
14
+ width: 640px;
15
+ height: 480px;
16
+ background: #000;
17
+ overflow: hidden;
18
+ }
19
+ .video {
20
+ position: absolute;
21
+ top: 0;
22
+ left: 0;
23
+ width: 640px;
24
+ height: 480px;
25
+ object-fit: cover;
26
+ }
27
+ .wipe-line {
28
+ position: absolute;
29
+ top: 0;
30
+ width: 2px;
31
+ height: 100%;
32
+ background: blue;
33
+ pointer-events: none;
34
+ }
35
+ </style>
36
+ </head>
37
+ <body>
38
+ <center>
39
+ <h1>Geostationary Satellite Time Interpolation</h1>
40
+ <h4>Hyun Gon Ryu | NVIDIA AI Technology Center Korea</h4>
41
+ </center>
42
+ <table>
43
+ <tr>
44
+ <td width="700">
45
+ <font size="1">
46
+ This demo video consists of images generated at one-minute intervals from the KMA GK2A satellite's full-disk images, originally captured at ten-minute intervals, using the VFI technique. By using the wipe scrollbar, you can compare the original video (delineated by a blue line) with the enhanced version. You can adjust the zoom and playback speed, and when played at 0.3x speed, the differences between the two videos become distinctly apparent.
47
+ </font>
48
+ </td>
49
+ </tr>
50
+ </table>
51
+
52
+ <!-- Video set selection -->
53
+ <table id="videoSetTable">
54
+ <tr>
55
+ <td>
56
+ Select Video Set:
57
+ <select id="videoSetSelect">
58
+ <option value="">No</option>
59
+ <option value="0">TongA Case | 20220116 | ir105</option>
60
+ <option value="1">SouthAsia | 20240820 | ir105</option>
61
+ <option value="2">EastAsia | 20240820 | ir105</option>
62
+ <option value="3">SouthWestAsia | 20240820 | ir105</option>
63
+ </select>
64
+ </td>
65
+ </tr>
66
+ </table>
67
+
68
+ <table id="controlTable">
69
+ <!-- 1st Row: Play button, Speed, Screen Size -->
70
+ <tr>
71
+ <td>
72
+ <button id="playPauseBtn">PLAY</button>
73
+ </td>
74
+ <td>
75
+ Screen Size:
76
+ <select id="scaleSelect">
77
+ <option value="0.5">0.5</option>
78
+ <option value="1" selected>1</option>
79
+ <option value="1.5">1.5</option>
80
+ <option value="2">2</option>
81
+ </select>
82
+ </td>
83
+ <td>
84
+ Speed:
85
+ <select id="speedSelect">
86
+ <option value="0.1">0.1</option>
87
+ <option value="0.2">0.2</option>
88
+ <option value="0.3">0.3</option>
89
+ <option value="0.4">0.4</option>
90
+ <option value="0.5">0.5</option>
91
+ <option value="0.6">0.6</option>
92
+ <option value="0.7">0.7</option>
93
+ <option value="0.8">0.8</option>
94
+ <option value="0.9">0.9</option>
95
+ <option value="1" selected>1</option>
96
+ <option value="2">2</option>
97
+ <option value="4">4</option>
98
+ </select>
99
+ </td>
100
+ </tr>
101
+
102
+ <!-- 2nd Row: Wipe Slider -->
103
+ <tr>
104
+ <td colspan="3">
105
+ <input type="range" id="wipeRange" class="slider" min="0" max="1" step="0.01" value="0.5">
106
+ </td>
107
+ </tr>
108
+
109
+ <!-- 3rd Row: Timeline Slider -->
110
+ <tr>
111
+ <td colspan="3">
112
+ <input type="range" id="timelineRange" class="timeline-slider" min="0" max="100" step="0.1" value="0">
113
+ </td>
114
+ </tr>
115
+
116
+ <!-- 4th Row: Video Area -->
117
+ <tr>
118
+ <td colspan="3">
119
+ <div class="video-container-wrapper">
120
+ <div class="video-container" id="videoContainer">
121
+ <video id="video1" class="video" src="video1.mp4" preload="auto" muted></video>
122
+ <video id="video2" class="video" src="video2.mp4" preload="auto" muted></video>
123
+ <div id="wipeLine" class="wipe-line"></div>
124
+ </div>
125
+ </div>
126
+ </td>
127
+ </tr>
128
+ </table>
129
+
130
+ <script>
131
+ // Base width remains constant.
132
+ const baseWidth = 640;
133
+
134
+ // Predefined video sets.
135
+ const videoSets = [
136
+ { label: "TongA Case", area: "TongaArea", date: "20220116", sensor: "ir105" },
137
+ { label: "SouthAsia", area: "SouthAsia", date: "20240820", sensor: "ir105" },
138
+ { label: "EastAsia", area: "EastAsia", date: "20240820", sensor: "ir105" },
139
+ { label: "SouthWestAsia", area: "WestAsia", date: "20240820", sensor: "ir105" },
140
+ ];
141
+
142
+ // Get DOM elements.
143
+ const video1 = document.getElementById("video1");
144
+ const video2 = document.getElementById("video2");
145
+ const playPauseBtn = document.getElementById("playPauseBtn");
146
+ const wipeRange = document.getElementById("wipeRange");
147
+ const timelineRange = document.getElementById("timelineRange");
148
+ const scaleSelect = document.getElementById("scaleSelect");
149
+ const speedSelect = document.getElementById("speedSelect");
150
+ const videoContainer = document.getElementById("videoContainer");
151
+ const wipeLine = document.getElementById("wipeLine");
152
+ const controlTable = document.getElementById("controlTable");
153
+ const videoSetSelect = document.getElementById("videoSetSelect");
154
+
155
+ let isPlaying = false;
156
+
157
+ // Update playback speed.
158
+ function updateSpeed() {
159
+ const speedValue = parseFloat(speedSelect.value);
160
+ video1.playbackRate = speedValue;
161
+ video2.playbackRate = speedValue;
162
+ }
163
+
164
+ // Update the wipe effect.
165
+ function updateWipe() {
166
+ const wipeValue = parseFloat(wipeRange.value);
167
+ const rightPercent = (1 - wipeValue) * 100;
168
+ video2.style.clipPath = `inset(0 ${rightPercent}% 0 0)`;
169
+ // Calculate position using the base width.
170
+ const lineX = baseWidth * wipeValue - (wipeLine.clientWidth / 2);
171
+ wipeLine.style.left = `${lineX}px`;
172
+ }
173
+
174
+ // Update timeline slider based on video progress.
175
+ function updateTimeline() {
176
+ if (video1.duration) {
177
+ const percent = (video1.currentTime / video1.duration) * 100;
178
+ timelineRange.value = percent;
179
+ }
180
+ }
181
+ video1.addEventListener("timeupdate", updateTimeline);
182
+
183
+ // Toggle play/pause.
184
+ function togglePlayPause() {
185
+ if (!isPlaying) {
186
+ video1.play();
187
+ video2.play();
188
+ playPauseBtn.textContent = "Pause";
189
+ isPlaying = true;
190
+ } else {
191
+ video1.pause();
192
+ video2.pause();
193
+ playPauseBtn.textContent = "Play";
194
+ isPlaying = false;
195
+ }
196
+ }
197
+
198
+ // Seek both videos.
199
+ function seekTimeline() {
200
+ if (video1.duration) {
201
+ const percent = timelineRange.value / 100;
202
+ const newTime = video1.duration * percent;
203
+ video1.currentTime = newTime;
204
+ video2.currentTime = newTime;
205
+ }
206
+ }
207
+
208
+ // Update scale and adjust related elements.
209
+ function updateScale() {
210
+ const scaleValue = parseFloat(scaleSelect.value);
211
+ videoContainer.style.transform = `scale(${scaleValue})`;
212
+ videoContainer.style.transformOrigin = "top left";
213
+ // Update slider and table widths to the visually scaled size.
214
+ const effectiveWidth = baseWidth * scaleValue;
215
+ wipeRange.style.width = effectiveWidth + "px";
216
+ timelineRange.style.width = effectiveWidth + "px";
217
+ controlTable.style.width = effectiveWidth + "px";
218
+ updateWipe();
219
+ }
220
+
221
+ // Update video sources based on selected video set.
222
+ function updateVideoSet() {
223
+ const selectedIndex = videoSetSelect.value;
224
+ if (selectedIndex === "") {
225
+ // "No" selected, you could reset the video sources if desired.
226
+ return;
227
+ }
228
+ const videoSet = videoSets[parseInt(selectedIndex)];
229
+ const area = videoSet.area;
230
+ const date = videoSet.date;
231
+ const sensor = videoSet.sensor;
232
+ // Construct filenames.
233
+ const originalFile = `${area}/video_${area}_${sensor}um_${date}_10min_010fps.mp4`;
234
+ const enhancedFile = `${area}/video_${area}_${sensor}um_${date}_01min_100fps.mp4`;
235
+ // Update video sources.
236
+ video1.setAttribute("src", originalFile);
237
+ video2.setAttribute("src", enhancedFile);
238
+ // Reload the videos.
239
+ video1.load();
240
+ video2.load();
241
+ }
242
+
243
+ // Event listeners.
244
+ playPauseBtn.addEventListener("click", togglePlayPause);
245
+ wipeRange.addEventListener("input", updateWipe);
246
+ timelineRange.addEventListener("input", seekTimeline);
247
+ scaleSelect.addEventListener("change", updateScale);
248
+ speedSelect.addEventListener("change", updateSpeed);
249
+ videoSetSelect.addEventListener("change", updateVideoSet);
250
+
251
+ // Initial setup.
252
+ updateWipe();
253
+ updateScale();
254
+ updateSpeed();
255
+ </script>
256
+ </body>
257
+ </html>