-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
624 lines (544 loc) · 17.1 KB
/
Copy pathindex.html
File metadata and controls
624 lines (544 loc) · 17.1 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
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Apple TV Like Video Player Demo</title>
<meta
name="description"
content="Apple TV-style custom HTML5 video player demo. A lightweight vanilla JavaScript plugin with cinematic UI and smooth controls."
/>
<link rel="stylesheet" href="./apple-video-player.css" />
<link href="https://cdn.jsdelivr.net/npm/sf-mono-webfont@1.0.0/stylesheet.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/sf-font@1.0.0/stylesheet.min.css" rel="stylesheet" />
<style>
:root {
--bg: #fafafa;
--surface: #ffffff;
--text-main: #09090b;
--text-muted: #71717a;
--border: rgba(0, 0, 0, 0.06);
--radius-lg: 32px;
--radius-md: 20px;
--font-sans: "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--font-mono: "SF Mono", "JetBrains Mono", monospace;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html,
body {
min-height: 100%;
}
body {
font-family: var(--font-sans);
background-color: var(--bg);
color: var(--text-main);
line-height: 1.5;
overflow-x: hidden;
-webkit-font-smoothing: antialiased;
}
.noise {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
pointer-events: none;
z-index: 9999;
opacity: 0.035;
background-image: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
}
.ambient-blob {
position: fixed;
width: 600px;
height: 600px;
background: radial-gradient(circle, rgba(140, 140, 140, 0.12) 0%, rgba(255, 255, 255, 0) 60%);
border-radius: 50%;
pointer-events: none;
z-index: 0;
transform: translate(-50%, -50%);
transition: width 0.3s, height 0.3s;
filter: blur(40px);
}
.container {
position: relative;
z-index: 1;
max-width: 1280px;
margin: 0 auto;
padding: 6vw 4vw;
display: flex;
flex-direction: column;
gap: 40px;
}
.hero {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
margin-bottom: 20px;
}
.badge {
display: inline-block;
padding: 6px 16px;
background: rgba(0, 0, 0, 0.04);
border: 1px solid var(--border);
border-radius: 100px;
font-size: 13px;
font-weight: 500;
letter-spacing: 0.02em;
margin-bottom: 24px;
}
.hero h1 {
font-size: clamp(2.5rem, 5vw, 4.5rem);
font-weight: 700;
letter-spacing: -0.03em;
line-height: 1.1;
margin-bottom: 0;
}
.heroLine1 {
color: var(--text-main);
}
.heroLine2 {
color: var(--text-muted);
}
.bento-grid {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 24px;
width: 100%;
}
.card {
background: var(--surface);
border-radius: var(--radius-lg);
border: 1px solid var(--border);
box-shadow: 0 4px 24px -8px rgba(0, 0, 0, 0.03);
position: relative;
overflow: hidden;
padding: 32px;
}
.card.video-card {
grid-column: span 12;
padding: 12px;
display: flex;
align-items: center;
justify-content: center;
background: #ffffff;
box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.08);
}
.card.info-card {
grid-column: span 5;
display: flex;
flex-direction: column;
justify-content: center;
}
.card.code-card {
grid-column: span 7;
display: flex;
flex-direction: column;
justify-content: center;
}
.spotlight-card::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(800px circle at var(--mouse-x, 0) var(--mouse-y, 0), rgba(0, 0, 0, 0.03), transparent 40%);
opacity: 0;
transition: opacity 0.5s;
pointer-events: none;
z-index: 1;
}
.spotlight-card:hover::before {
opacity: 1;
}
.video-wrapper {
width: 100%;
aspect-ratio: 16 / 9;
border-radius: calc(var(--radius-lg) - 8px);
overflow: hidden;
background: #000;
position: relative;
z-index: 2;
}
.video-wrapper video {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.card-label {
font-size: 12px;
text-transform: uppercase;
color: var(--text-muted);
font-weight: 600;
margin-bottom: 12px;
letter-spacing: 0.08em;
}
.card-title {
font-size: 1.5rem;
font-weight: 600;
letter-spacing: -0.02em;
margin-bottom: 16px;
color: var(--text-main);
}
.card-desc {
font-size: 1.05rem;
color: var(--text-muted);
line-height: 1.6;
}
code.inline-tag {
background: #f4f4f5;
border: 1px solid #e4e4e7;
border-radius: 6px;
padding: 2px 6px;
font-family: var(--font-mono);
font-size: 0.9em;
color: var(--text-main);
}
.code-window {
background: #09090b;
border-radius: 16px;
border: 1px solid #27272a;
overflow: hidden;
margin-bottom: 16px;
box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.3);
position: relative;
z-index: 2;
}
.code-header {
display: flex;
gap: 8px;
padding: 14px 16px;
background: rgba(255, 255, 255, 0.03);
border-bottom: 1px solid #27272a;
align-items: center;
}
.code-dot {
width: 10px;
height: 10px;
border-radius: 50%;
}
.code-dot.red {
background: #ff5f56;
}
.code-dot.yellow {
background: #ffbd2e;
}
.code-dot.green {
background: #27c93f;
}
.code-body {
padding: 20px 24px;
overflow-x: auto;
font-family: var(--font-mono);
font-size: 14px;
line-height: 1.7;
color: #a1a1aa;
}
.code-body span {
font-family: var(--font-mono);
}
.token.tag {
color: #f472b6;
}
.token.attr {
color: #38bdf8;
}
.token.string {
color: #a3e635;
}
.token.punct {
color: #71717a;
}
.hint-text {
font-size: 0.95rem;
color: var(--text-main);
display: flex;
align-items: center;
gap: 8px;
font-weight: 500;
}
.reveal-up {
opacity: 0;
transform: translateY(40px);
transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-scale {
opacity: 0;
transform: scale(0.95) translateY(20px);
transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s ease;
}
.is-revealed {
opacity: 1;
transform: translateY(0) scale(1);
}
.lang-switcher {
position: fixed;
top: 24px;
right: 24px;
z-index: 10000;
display: flex;
gap: 8px;
padding: 8px;
background: rgba(255, 255, 255, 0.72);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(0, 0, 0, 0.06);
border-radius: 999px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
.lang-btn {
border: none;
background: transparent;
color: var(--text-muted);
font-family: var(--font-sans);
font-size: 13px;
font-weight: 600;
padding: 8px 12px;
border-radius: 999px;
cursor: pointer;
transition: all 0.2s ease;
}
.lang-btn:hover {
background: rgba(0, 0, 0, 0.05);
color: var(--text-main);
}
.lang-btn.active {
background: #09090b;
color: #ffffff;
}
@media (max-width: 1024px) {
.card.info-card {
grid-column: span 12;
}
.card.code-card {
grid-column: span 12;
}
}
@media (max-width: 600px) {
.container {
padding: 24px 16px;
}
.hero h1 {
font-size: 2.2rem;
}
.card {
padding: 24px;
}
.card.video-card {
padding: 8px;
}
.code-body {
padding: 16px;
font-size: 12px;
}
.lang-switcher {
top: 16px;
right: 16px;
gap: 4px;
padding: 6px;
}
.lang-btn {
font-size: 12px;
padding: 6px 10px;
}
}
</style>
</head>
<body>
<div class="lang-switcher" aria-label="Language Switcher">
<button class="lang-btn active" data-lang-btn="zh-CN" type="button">中</button>
<button class="lang-btn" data-lang-btn="en" type="button">EN</button>
<button class="lang-btn" data-lang-btn="ja" type="button">日</button>
<button class="lang-btn" data-lang-btn="ko" type="button">한</button>
</div>
<div class="noise"></div>
<div class="ambient-blob" id="blob"></div>
<div class="container">
<header class="hero reveal-up" style="transition-delay: 0.1s;">
<div class="badge" data-i18n="badge">Component v1.0</div>
<h1>
<span data-i18n="heroLine1" class="heroLine1">Apple TV Like</span><br />
<span data-i18n="heroLine2" class="heroLine2">HTML5 Video Player.</span>
</h1>
</header>
<main class="bento-grid">
<div class="card video-card reveal-scale" style="transition-delay: 0.2s;">
<div class="video-wrapper">
<video src="./demo.mp4" preload="metadata"></video>
</div>
</div>
<div class="card info-card spotlight-card reveal-up" style="transition-delay: 0.3s;">
<div>
<div class="card-label" data-i18n="overviewLabel">Overview</div>
<h2 class="card-title" data-i18n="overviewTitle">简介</h2>
<p class="card-desc" id="overviewDesc"></p>
</div>
</div>
<div class="card code-card spotlight-card reveal-up" style="transition-delay: 0.4s;">
<div class="card-label" data-i18n="quickStartLabel">Quick Start</div>
<h2 class="card-title" style="margin-bottom: 20px;" data-i18n="usageTitle">使用方法</h2>
<div class="code-window">
<div class="code-header">
<div class="code-dot red"></div>
<div class="code-dot yellow"></div>
<div class="code-dot green"></div>
</div>
<div class="code-body">
<pre style="margin: 0;"><code><span class="token punct"><</span><span class="token tag">link</span> <span class="token attr">rel</span><span class="token punct">=</span><span class="token string">"stylesheet"</span> <span class="token attr">href</span><span class="token punct">=</span><span class="token string">"apple-video-player.css"</span><span class="token punct">></span>
<span class="token punct"><</span><span class="token tag">script</span> <span class="token attr">src</span><span class="token punct">=</span><span class="token string">"apple-video-player.js"</span><span class="token punct">></span><span class="token punct"></</span><span class="token tag">script</span><span class="token punct">></span>
<span class="token punct"><</span><span class="token tag">video</span> <span class="token attr">src</span><span class="token punct">=</span><span class="token string">"demo.mp4"</span><span class="token punct">></span><span class="token punct"></</span><span class="token tag">video</span><span class="token punct">></span></code></pre>
</div>
</div>
<div class="hint-text">
<span>✨</span>
<span data-i18n="hintText">加载后会自动增强所有视频元素。</span>
</div>
</div>
</main>
</div>
<script src="./apple-video-player.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const blob = document.getElementById('blob');
let mouseX = window.innerWidth / 2;
let mouseY = window.innerHeight / 2;
let blobX = mouseX;
let blobY = mouseY;
const translations = {
'zh-CN': {
pageTitle: 'Apple TV 风格 HTML5 视频播放器演示',
badge: '组件 v1.0',
heroLine1: 'Apple TV Like',
heroLine2: 'HTML5 Video Player.',
overviewLabel: 'Overview',
overviewTitle: '简介',
overviewDesc:
'一个轻量级原生 JS 视频播放器插件,可将普通 <code class="inline-tag"><video></code> 元素无缝增强为具有 Apple TV 风格交互美学体验的高级播放器。丝滑流畅,无需繁杂配置。',
quickStartLabel: 'Quick Start',
usageTitle: '使用方法',
hintText: '加载后会自动增强所有视频元素。'
},
en: {
pageTitle: 'Apple TV Like HTML5 Video Player Demo',
badge: 'Component v1.0',
heroLine1: 'Apple TV Like',
heroLine2: 'HTML5 Video Player.',
overviewLabel: 'Overview',
overviewTitle: 'Description',
overviewDesc:
'A lightweight vanilla JavaScript plugin that seamlessly enhances ordinary <code class="inline-tag"><video></code> elements into a premium player with an Apple TV-inspired cinematic interface. Smooth, elegant, and zero setup.',
quickStartLabel: 'Quick Start',
usageTitle: 'Usage',
hintText: 'All video elements will be enhanced automatically after loading.'
},
ja: {
pageTitle: 'Apple TV風 HTML5ビデオプレイヤー デモ',
badge: 'コンポーネント v1.0',
heroLine1: 'Apple TV Like',
heroLine2: 'HTML5 Video Player.',
overviewLabel: 'Overview',
overviewTitle: '概要',
overviewDesc:
'軽量なバニラ JavaScript 製ビデオプレイヤープラグインです。通常の <code class="inline-tag"><video></code> 要素を、Apple TV風のシネマティックで洗練された操作体験を持つ高品質プレイヤーへシームレスに強化します。なめらかで、美しく、設定もほぼ不要です。',
quickStartLabel: 'Quick Start',
usageTitle: '使い方',
hintText: '読み込み後、ページ内のすべての video 要素を自動的に強化します。'
},
ko: {
pageTitle: 'Apple TV 스타일 HTML5 비디오 플레이어 데모',
badge: '컴포넌트 v1.0',
heroLine1: 'Apple TV Like',
heroLine2: 'HTML5 Video Player.',
overviewLabel: 'Overview',
overviewTitle: '소개',
overviewDesc:
'가벼운 바닐라 JavaScript 비디오 플레이어 플러그인으로, 일반 <code class="inline-tag"><video></code> 요소를 Apple TV 스타일의 시네마틱하고 세련된 인터페이스를 갖춘 고급 플레이어로 자연스럽게 확장합니다. 부드럽고 우아하며 복잡한 설정이 필요 없습니다.',
quickStartLabel: 'Quick Start',
usageTitle: '사용 방법',
hintText: '로드 후 모든 video 요소가 자동으로 향상됩니다.'
}
};
function normalizeLang(lang) {
if (!lang) return 'en';
const lower = lang.toLowerCase();
if (lower.startsWith('zh')) return 'zh-CN';
if (lower.startsWith('ja')) return 'ja';
if (lower.startsWith('ko')) return 'ko';
return 'en';
}
function setLanguage(lang) {
const dict = translations[lang] || translations.en;
document.documentElement.lang = lang;
document.title = dict.pageTitle;
localStorage.setItem('applePlayerDemoLang', lang);
document.querySelectorAll('[data-i18n]').forEach(el => {
const key = el.getAttribute('data-i18n');
if (dict[key]) {
el.textContent = dict[key];
}
});
const overviewDesc = document.getElementById('overviewDesc');
if (overviewDesc) {
overviewDesc.innerHTML = dict.overviewDesc;
}
document.querySelectorAll('[data-lang-btn]').forEach(btn => {
btn.classList.toggle('active', btn.getAttribute('data-lang-btn') === lang);
});
}
const savedLang = localStorage.getItem('applePlayerDemoLang');
const browserLang = normalizeLang(navigator.language);
const initialLang = savedLang || browserLang || 'en';
setLanguage(initialLang);
document.querySelectorAll('[data-lang-btn]').forEach(btn => {
btn.addEventListener('click', () => {
const lang = btn.getAttribute('data-lang-btn');
setLanguage(lang);
});
});
window.addEventListener('mousemove', e => {
mouseX = e.clientX;
mouseY = e.clientY;
});
function renderBlob() {
blobX += (mouseX - blobX) * 0.05;
blobY += (mouseY - blobY) * 0.05;
blob.style.left = `${blobX}px`;
blob.style.top = `${blobY}px`;
requestAnimationFrame(renderBlob);
}
renderBlob();
const cards = document.querySelectorAll('.spotlight-card');
cards.forEach(card => {
card.addEventListener('mousemove', e => {
const rect = card.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
card.style.setProperty('--mouse-x', `${x}px`);
card.style.setProperty('--mouse-y', `${y}px`);
});
});
const observerOptions = {
root: null,
rootMargin: '0px',
threshold: 0.1
};
const observer = new IntersectionObserver((entries, observerRef) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('is-revealed');
observerRef.unobserve(entry.target);
}
});
}, observerOptions);
const revealElements = document.querySelectorAll('.reveal-up, .reveal-scale');
revealElements.forEach(el => observer.observe(el));
});
</script>
</body>
</html>