Repository navigation
Expand file tree
/
Copy pathplayer.html
More file actions
101 lines (101 loc) · 6.17 KB
/
Copy pathplayer.html
File metadata and controls
101 lines (101 loc) · 6.17 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>playsvideo</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#111111">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="apple-touch-icon" href="/icons/icon-192.png">
<style>
:root { --bg: #fff; --fg: #111; --muted: #999; --video-bg: #000; --file-color: #111; }
@media (prefers-color-scheme: dark) {
:root { --bg: #111; --fg: #eee; --muted: #999; --video-bg: #000; --file-color: #eee; }
}
html[data-theme="light"] { --bg: #fff; --fg: #111; --muted: #999; --file-color: #111; }
html[data-theme="dark"] { --bg: #111; --fg: #eee; --muted: #999; --file-color: #eee; }
body { font-family: system-ui, sans-serif; margin: 2rem; background: var(--bg); color: var(--fg); }
video { width: 100%; max-width: 1280px; display: none; margin-top: 1rem; background: var(--video-bg); }
#status { margin-top: 0.5rem; color: var(--muted); }
input[type="file"] { font-size: 1rem; color: var(--file-color); }
.header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.theme-toggle { background: none; border: 1px solid var(--muted); color: var(--fg); border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; opacity: 0.6; flex-shrink: 0; }
.theme-toggle:hover { opacity: 1; }
.drop-target { border: 2px dashed var(--muted); border-radius: 12px; padding: 3rem 2rem; text-align: center; color: var(--muted); margin: 1rem 0; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.drop-target:hover { border-color: var(--fg); color: var(--fg); }
.drop-target.dragover { border-color: var(--fg); color: var(--fg); background: rgba(128,128,128,0.08); }
.drop-target.hidden { display: none; }
.player-actions { display: none; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.player-actions button { background: none; border: 1px solid var(--muted); color: var(--fg); padding: 0.4rem 1rem; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.player-actions button:hover { border-color: var(--fg); }
.player-actions button:disabled { opacity: 0.5; cursor: default; }
.pv-video-container { max-width: 1280px; margin-top: 1rem; background: var(--video-bg); }
.pv-video-container video { margin-top: 0; }
.pv-video-container.pv-videojs-container { width: min(100%, calc(80vh * 16 / 9)); }
.pv-video-container.pv-videojs-container .video-js { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.pv-video-container.pv-videojs-container .video-js .vjs-tech { object-fit: contain; }
.pv-video-container:fullscreen { width: 100vw !important; max-width: none !important; height: 100vh !important; margin: 0 !important; background: #000; }
.pv-video-container:fullscreen .video-js { width: 100vw !important; max-width: none !important; height: 100vh !important; max-height: none !important; aspect-ratio: auto !important; }
.video-js:fullscreen, .video-js.vjs-fullscreen { width: 100vw !important; max-width: none !important; height: 100vh !important; max-height: none !important; aspect-ratio: auto !important; background: #000; }
.video-js:fullscreen .vjs-tech, .video-js.vjs-fullscreen .vjs-tech { width: 100% !important; max-width: none !important; height: 100% !important; max-height: none !important; object-fit: contain; }
.pv-video-container:fullscreen video { width: 100%; height: 100%; object-fit: contain; }
.pv-video-container::backdrop, .video-js::backdrop { background: #000; }
#subtitle-status { margin-top: 0.5rem; color: var(--muted); font-size: 0.9rem; min-height: 1.25rem; }
</style>
<script>
(function() {
var t = localStorage.getItem('pv-theme');
if (t) document.documentElement.setAttribute('data-theme', t);
})();
</script>
</head>
<body>
<div class="header">
<a href="/" style="text-decoration:none;color:inherit">
<svg width="300" height="48" viewBox="0 0 340 48">
<polygon points="2,4 2,44 32,24" fill="currentColor"/>
<text x="44" y="38" font-family="'Inter', sans-serif" font-weight="700" font-size="38" fill="currentColor" letter-spacing="-2">plays</text>
<text x="164" y="38" font-family="'Inter', sans-serif" font-weight="300" font-size="38" fill="currentColor" letter-spacing="-2">video</text>
</svg>
</a>
<button class="theme-toggle" id="theme-toggle" aria-label="Toggle theme"></button>
</div>
<input type="file" id="file-input" class="hidden" style="display:none">
<input type="file" id="subtitle-input" accept=".srt,.vtt" class="hidden" style="display:none">
<div class="drop-target" id="drop-target">Drop a video file here, or click to browse</div>
<p id="status"></p>
<div class="pv-video-container" id="video-container">
<video id="video" controls autoplay></video>
</div>
<div class="player-actions" id="player-actions">
<button id="open-another">Open another file</button>
<button id="load-subtitles">Load subtitles</button>
<button id="clear-subtitles" disabled>Clear subtitles</button>
<button id="toggle-controls">Video.js controls</button>
</div>
<div id="subtitle-status"></div>
<script type="module" src="/src/pwa-player.ts"></script>
<script>
(function() {
var btn = document.getElementById('theme-toggle');
function isDark() {
var t = document.documentElement.getAttribute('data-theme');
if (t) return t === 'dark';
return matchMedia('(prefers-color-scheme: dark)').matches;
}
function update() { btn.textContent = isDark() ? '\u2600' : '\u263E'; }
btn.addEventListener('click', function() {
var next = isDark() ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', next);
localStorage.setItem('pv-theme', next);
update();
});
update();
matchMedia('(prefers-color-scheme: dark)').addEventListener('change', update);
})();
</script>
</body>
</html>