-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
46 lines (36 loc) · 964 Bytes
/
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>App</title>
</head>
<body>
<h1>Video Info</h1>
<form>
<div>
<label for="file-input">Select a video</label><br/>
<input id="file-input" type="file" accept="video/*"/>
</div>
<button type="submit">GET INFO</button>
</form>
<h1 id="duration-result"></h1>
<script>
const electron = require('electron');
const { ipcRenderer } = electron;
document.querySelector('form').addEventListener('submit', (event) => {
event.preventDefault();
console.log('Form Submitted');
const file = document.querySelector('input').files[0];
if (file != null) {
const { path } = file;
ipcRenderer.send('fileSubmit', path);
}
});
ipcRenderer.on('fileMetadata', (event, value) => {
console.log(value);
const element = document.querySelector('#duration-result');
element.innerHTML = `Video is ${value} seconds`;
});
</script>
</body>
</html>