-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathindex.html
213 lines (203 loc) · 10.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Online Video Thumbnail Generator</title>
<meta name="description" content="Online tool to create snapshots of videos (local file or online by URL)">
<link rel="stylesheet" href="css/style.css?20240517">
<style>
</style>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-RKLKKLZFDQ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-RKLKKLZFDQ');
</script>
<link href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet">
<script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script>
function showInput(id, opt) {
console.log(opt)
document.getElementById('select-file').style.display = 'none';
document.getElementById('select-url').style.display = 'none';
document.getElementById(id).style.display = '';
}
function loadPage() {
var textFields = document.querySelectorAll('.mdc-text-field');
for (let index = 0; index < textFields.length; index++) {
var element = textFields[index];
new mdc.textField.MDCTextField(element);
}
}
window.addEventListener("load", loadPage);
</script>
</head>
<body>
<header class="mdc-top-app-bar">
<div class="mdc-top-app-bar__row">
<section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-start">
<!--<button class="material-icons mdc-top-app-bar__navigation-icon mdc-icon-button" aria-label="Open navigation menu">menu</button>-->
<span class="mdc-top-app-bar__title">Online Video Thumbnail Generator</span>
</section>
<!-- <section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-end" role="toolbar">
<a class="toolbar-menu" target="_blank" href="https://forms.gle/AkvW2rRQsTfobxFE8"
title="Feedback and feature requests">Feedback</a>
<button onclick="document.location='https://github.com/fraigo/online-video-thumbnail-generator'"
class="material-icons mdc-top-app-bar__action-item mdc-icon-button" aria-label="Options">
<img src="https://github.com/fluidicon.png" width="48"></button>
</section> -->
</div>
</header>
<main class="mdc-top-app-bar--fixed-adjust">
<div class="video_data">
<div class="mdc-card mdc-card--outlined">
<div>
<div class="mdc-form-field">
<div class="mdc-radio">
<input class="mdc-radio__native-control" type="radio" onclick="showInput('select-url', this)"
id="video_url" name="video_source" >
<div class="mdc-radio__background">
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label for="video_url">Video from URL</label>
</div>
<div class="mdc-form-field">
<div class="mdc-radio">
<input class="mdc-radio__native-control" type="radio" onclick="showInput('select-file', this)"
id="video_file" checked name="video_source">
<div class="mdc-radio__background">
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
<label for="video_file">Video from file</label>
</div>
</div>
<div class="instructions mdc-form-field">(Currently, youtube/vimeo video URLS are not supported, only URLs
pointing to a video resource)</div>
</div>
<br />
<div class="mdc-card mdc-card--outlined select-source">
<div id="select-file">
<input type="file" class="mdc-text-field__input" id="videofile" accept=".mp4" onchange="loadVideoFile()">
</div>
<div id="select-url" style="display:none">
<label class="mdc-text-field mdc-text-field--filled">
<span class="mdc-text-field__ripple"></span>
<span class="mdc-floating-label" id="url-label">Video URL</span>
<input id="videourl" size="100" class="mdc-text-field__input" type="text" placeholder="https://"
aria-labelledby="url-label">
<span class="mdc-line-ripple"></span>
</label>
<div class="mdc-touch-target-wrapper">
<button class="mdc-button mdc-button--raised"
onclick="loadVideoURL(document.getElementById('videourl').value)">
<span class="mdc-button__ripple"></span>
<span class="mdc-button__touch"></span>
<span class="mdc-button__label">Load video</span>
</button>
</div>
<div class="instructions mdc-form-field">
For youtube URLs, you can use a service to convert Youtube videos to MP4 files (Google for "Youtube mp4").
<ul>
<li>Use the provided "Download link" URL here, or </li>
<li>Download the file to your device and select "Video from file"</li>
</ul>
</div>
</div>
</div>
<div class="mdc-card mdc-card--outlined video-preview">
<video id="video" controls width="640" crossorigin="anonymous">
<source src="blank.mp4" type="video/mp4">
</video>
<div id="videoInfo" class="mdc-card">
</div>
<div>Select the frame to capture using video controls.</div>
<div id="videoControls" class="video-controls" style="display:none">
<div>
<input id="slider" oninput="goToTime(video,this.value)" onmouseover="this.title=this.value+'seg'"
type="range" min="0" max="100" value="0" name="position">
</div>
<div class="button-container">
<button category="controls" onclick="goToTime(video,0)">⏮<br><span> </span></button>
<button category="controls" onclick="goToTime(video,video.currentTime-60)">⏪<br><span>-1m</span></button>
<button category="controls" onclick="goToTime(video,video.currentTime-5)">⏪<br><span>-5s</span></button>
<button category="controls" onclick="goToTime(video,video.currentTime-1)">⏪<br><span>-1s</span></button>
<button category="controls" onclick="goToTime(video,video.currentTime-1/25)">⏪<br><span>-1fr</span></button>
<button category="controls"
onclick="video.paused?video.play():video.pause()">⏯<br><span> </span></button>
<button category="controls" onclick="goToTime(video,video.currentTime+1/25)">⏩<br><span>+1fr</span></button>
<button category="controls" onclick="goToTime(video,video.currentTime+1)">⏩<br><span>+1s</span></button>
<button category="controls" onclick="goToTime(video,video.currentTime+5)">⏩<br><span>+5s</span></button>
<button category="controls" onclick="goToTime(video,video.currentTime+60)">⏩<br><span>+1m</span></button>
<button category="controls" onclick="goToTime(video,video.duration)">⏭<br><span> </span></button>
</div>
</div>
</div>
</div>
<div class="video_output">
<div class="mdc-card mdc-card--outlined select-source">
<div>
<label class="mdc-text-field mdc-text-field--filled" id="videowidth" style="margin-bottom: 1rem;">
<span class="mdc-text-field__ripple"></span>
<span class="mdc-floating-label" id="size-label">Image width</span>
<input id="videow" type=number size="5" onchange="resize()" value="640" class="mdc-text-field__input"
type="text" placeholder="" aria-labelledby="size-label" readonly>
<span class="mdc-line-ripple"></span>
</label>
<div style="display: flex; gap: 1rem; flex-wrap: wrap;">
<button id="snap" class="mdc-button mdc-button--raised" onclick="snapPicture()" disabled>
<span class="mdc-button__ripple"></span>
<span class="mdc-button__touch"></span>
<span class="mdc-button__label">Snap photo</span>
</button>
<button id="snap2" class="snap2 mdc-button mdc-button--raised" onclick="autoSnapPictureAfterSelection()" disabled>
<span class="mdc-button__ripple"></span>
<span class="mdc-button__touch"></span>
<span class="mdc-button__label">Auto snap each</span>
</button>
<select id="snap_each">
<option value="2%">2%</option>
<option value="5%">5%</option>
<option value="10%">10%</option>
<option value="0.0166666m">1 sec</option>
<option value="0.0833333m">5 sec</option>
<option value="0.166666m">10 sec</option>
<option value="0.5m">30 sec</option>
<option value="1m">1 minute</option>
</select>
</div>
</div>
<div class="canvas-container">
<canvas id="canvas" width="640" height="480" style="display: none"></canvas>
<img id="preview" src="blank.png"
style="display: none; margin-bottom: 1rem; width: 100%; height: auto; max-height: 320px; object-fit: contain;">
<div id="outputs">
</div>
</div>
<div>
<button id="save" class="mdc-button mdc-button--raised save_btn" onclick="savePicture(this)" disabled>
<span class="mdc-button__ripple"></span>
<span class="mdc-button__touch"></span>
<span class="mdc-button__label save_txt">Save Image</span>
</button>
<span id="snapsize"></span>
</div>
<a href="" id="imagelink" style="display:none">Image link</a>
</div>
</div>
</main>
<!-- start the script ... within that declare variables as follows... -->
<script src="js/app.js?20240517"></script>
</body>
</html>