-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmpv.html
More file actions
58 lines (50 loc) · 1.31 KB
/
mpv.html
File metadata and controls
58 lines (50 loc) · 1.31 KB
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
<html>
<head>
<meta charset="UTF-8">
<style>
body {
overflow: hidden;
margin: 0;
}
</style>
<script src="dist/mpv.bundle.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const video = document.querySelector('x-video')
const input = document.querySelector('input')
video.addEventListener('open-file', async (e) => {
e.preventDefault();
input.click()
})
video.addEventListener('prop-change', (e) => {
console.log(e.detail.name, e.detail.value)
})
input.addEventListener('change', (e) => {
const files = []
for (const f of input.files) {
files.push(f.path)
}
// reset value so next change will trigger
input.value = ''
if (files.length) {
video.load(files)
}
})
})
</script>
<title>mpv player</title></head>
<body>
<x-video
control
enable-crop
enable-key
ai-switch="pedestrian,vehicle,face_detail,face,pedestrian_detail,car_detail"
screenshot-format="jpeg"
video-sync="audio"
locale="zh-cn"
screenshot-directory="D:\"
hwaccel="auto">
</x-video>
<input type="file" ref="openFileEl" style="opacity: 0; position: absolute; top: -100px;" accept="video/*,.ps,.mkv" multiple>
</body>
</html>