-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
49 lines (42 loc) · 1.51 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Video Info</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
Chromium <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
<br/>
<br/>
<form>
<div>
<label>Select a video</label>
<input type="file" accept="video/*" />
</div>
<button type="submit">Get Info</button>
</form>
<h1 id="videoDuration">Please select video and submit</h1>
<script>
const electron = require('electron');
const { ipcRenderer } = electron;
//send data from this page into electron
document.querySelector('form').addEventListener('submit', (event) => {
event.preventDefault();
// const file = document.querySelector('input').files[0];
const { path } = document.querySelector('input').files[0];
ipcRenderer.send('video:submit', path);
console.log(path);
});
// retrieve data from electeon into this page
ipcRenderer.on('video:metadata', (event, videoDuration) => {
document.querySelector('#videoDuration').innerHTML = `Video duration is ${videoDuration} second(s)`;
});
// You can also require other files to run in this process
require('./renderer.js')
</script>
</body>
</html>