初始化 360 全景影片播放器專案並完成 NAS 部署設定
摘要: 將本機開發的 360° 全景影片播放器納入版控,同時把執行環境從 Windows 切換到 Synology NAS,改以 Docker 部署。 根本原因: 專案原本只在有 NVIDIA 顯卡的 Windows 機器上跑,config.json 寫死了 Windows 磁碟機路徑 W:/photo/Badminton,NAS 上無法直接啟動。 另外 DSM 內建的 ffmpeg 拿掉了 VAAPI 編碼器,裸跑只能走 libx264, Celeron J4025 雙核轉 4K 360 影片的速度無法接受。 影響: - 在 NAS 上 npm start 會因為找不到影片資料夾而列不出任何影片 - 即使把路徑改對,轉檔仍只能用 CPU,82 分鐘的 4K 360 影片要跑十幾小時 修法: - config.json 的 videoDir 改為 NAS 實際路徑 /volume1/photo/Badminton - docker-compose.yml 啟用 devices: /dev/dri,讓容器取得 Intel UHD 600 的 render node;容器內 Alpine 版 ffmpeg 保有完整 VAAPI 支援,啟動時 會自動偵測成 vaapi 模式,並保留 libx264 當備援 - .env(不進版控)提供 VIDEO_DIR / CACHE_DIR 等 NAS 路徑給 compose 使用 驗證: 容器啟動 log 顯示「轉檔引擎:VAAPI 硬體編碼(Intel/AMD,/dev/dri)」, /api/config 回傳 modes: ["vaapi","cpu"],/api/videos 正確辨識來源影片為 3840x1920 equirectangular。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
:root {
|
||||
--bg: #0b0d10;
|
||||
--bar: #14181d;
|
||||
--fg: #e8ebef;
|
||||
--muted: #8a939e;
|
||||
--line: #252b33;
|
||||
--accent: #4cc2ff;
|
||||
--accent-2: #ffb347;
|
||||
--danger: #ff6b6b;
|
||||
--ok: #5ddc8a;
|
||||
--radius: 8px;
|
||||
font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); overflow: hidden; }
|
||||
button, select, input { font: inherit; color: inherit; }
|
||||
button { cursor: pointer; }
|
||||
h2, h3 { margin: 0; font-weight: 600; }
|
||||
|
||||
#app { height: 100%; display: grid; grid-template-rows: auto 1fr; }
|
||||
|
||||
/* ---------- top bar ---------- */
|
||||
#topbar {
|
||||
display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
|
||||
padding: 8px 12px; background: var(--bar); border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.brand { font-weight: 800; letter-spacing: .5px; font-size: 18px; color: var(--accent); }
|
||||
.brand span { color: var(--fg); font-weight: 300; margin-left: 4px; }
|
||||
.field { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
||||
.field-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
|
||||
select {
|
||||
background: #1d232a; border: 1px solid var(--line); border-radius: var(--radius);
|
||||
padding: 6px 28px 6px 10px; max-width: 46vw; text-overflow: ellipsis;
|
||||
appearance: none; -webkit-appearance: none;
|
||||
background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
|
||||
background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
|
||||
background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
|
||||
}
|
||||
select:focus { outline: 1px solid var(--accent); }
|
||||
.icon-btn {
|
||||
background: transparent; border: 1px solid var(--line); border-radius: var(--radius);
|
||||
width: 32px; height: 32px; color: var(--muted);
|
||||
}
|
||||
.icon-btn:hover { color: var(--fg); border-color: var(--muted); }
|
||||
.pill {
|
||||
background: #1d232a; border: 1px solid var(--line); border-radius: 999px;
|
||||
padding: 5px 12px; color: var(--fg); position: relative;
|
||||
}
|
||||
.pill:hover { border-color: var(--muted); }
|
||||
.pill.active { background: var(--accent); color: #06202e; border-color: var(--accent); font-weight: 600; }
|
||||
.badge {
|
||||
display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
|
||||
background: var(--accent-2); color: #2b1a00; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 18px;
|
||||
}
|
||||
.badge[hidden] { display: none; }
|
||||
.info { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.info b { color: var(--fg); font-weight: 600; }
|
||||
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; background: #27313b; color: var(--fg); font-size: 11px; margin-left: 6px; }
|
||||
.tag.sph { background: #123a4c; color: var(--accent); }
|
||||
|
||||
/* ---------- stage ---------- */
|
||||
#stage { position: relative; background: #000; overflow: hidden; outline: none; user-select: none; -webkit-user-select: none; }
|
||||
#gl, #video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
|
||||
#gl { touch-action: none; cursor: grab; }
|
||||
#gl.dragging { cursor: grabbing; }
|
||||
#video { object-fit: contain; background: #000; }
|
||||
#stage.flat #gl { display: none; }
|
||||
#stage:not(.flat) #video { opacity: 0; pointer-events: none; width: 1px; height: 1px; }
|
||||
|
||||
.hint {
|
||||
position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
|
||||
background: rgba(0,0,0,.55); color: #ddd; font-size: 12px; padding: 6px 12px; border-radius: 999px;
|
||||
pointer-events: none; transition: opacity .4s; backdrop-filter: blur(4px);
|
||||
}
|
||||
.spinner {
|
||||
position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
|
||||
border: 3px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%;
|
||||
animation: spin .8s linear infinite; pointer-events: none;
|
||||
}
|
||||
.spinner[hidden] { display: none; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
.big-play {
|
||||
position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
|
||||
width: 84px; height: 84px; border-radius: 50%; border: 0;
|
||||
background: rgba(20,24,29,.75); color: #fff; font-size: 34px; padding-left: 8px;
|
||||
box-shadow: 0 6px 30px rgba(0,0,0,.5); backdrop-filter: blur(6px);
|
||||
}
|
||||
.big-play:hover { background: var(--accent); color: #06202e; }
|
||||
.big-play[hidden] { display: none; }
|
||||
|
||||
.toast {
|
||||
position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%);
|
||||
background: #1d232a; border: 1px solid var(--line); color: var(--fg);
|
||||
padding: 10px 14px; border-radius: var(--radius); font-size: 14px; max-width: min(90vw, 520px);
|
||||
display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.5); z-index: 5;
|
||||
}
|
||||
.toast[hidden] { display: none; }
|
||||
.toast.error { border-color: var(--danger); }
|
||||
.toast button { background: var(--accent); color: #06202e; border: 0; border-radius: 6px; padding: 4px 10px; font-weight: 600; white-space: nowrap; }
|
||||
|
||||
/* ---------- player controls ---------- */
|
||||
.controls {
|
||||
position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 14px 10px;
|
||||
background: linear-gradient(to top, rgba(0,0,0,.8), rgba(0,0,0,0));
|
||||
transition: opacity .25s; z-index: 3;
|
||||
}
|
||||
#stage.idle .controls, #stage.idle .hint { opacity: 0; pointer-events: none; }
|
||||
#stage.idle #gl { cursor: none; }
|
||||
.row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
|
||||
.spacer { flex: 1; }
|
||||
.ctl { background: transparent; border: 0; color: #fff; font-size: 18px; width: 36px; height: 36px; border-radius: 6px; }
|
||||
.ctl:hover { background: rgba(255,255,255,.12); }
|
||||
.time { font-variant-numeric: tabular-nums; font-size: 13px; color: #ddd; }
|
||||
.ctl-select { background: rgba(255,255,255,.1); border: 0; border-radius: 6px; padding: 4px 22px 4px 8px; font-size: 13px; }
|
||||
.vol { width: 90px; accent-color: var(--accent); }
|
||||
|
||||
#seek {
|
||||
--played: 0%; --buffered: 0%;
|
||||
width: 100%; height: 6px; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; margin: 0;
|
||||
}
|
||||
#seek::-webkit-slider-runnable-track {
|
||||
height: 6px; border-radius: 3px;
|
||||
background: linear-gradient(to right, var(--accent) var(--played), rgba(255,255,255,.45) var(--played), rgba(255,255,255,.45) var(--buffered), rgba(255,255,255,.18) var(--buffered));
|
||||
}
|
||||
#seek::-webkit-slider-thumb {
|
||||
-webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; margin-top: -4px;
|
||||
box-shadow: 0 0 0 2px rgba(0,0,0,.3);
|
||||
}
|
||||
#seek::-moz-range-track {
|
||||
height: 6px; border-radius: 3px;
|
||||
background: linear-gradient(to right, var(--accent) var(--played), rgba(255,255,255,.45) var(--played), rgba(255,255,255,.45) var(--buffered), rgba(255,255,255,.18) var(--buffered));
|
||||
}
|
||||
#seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
|
||||
|
||||
/* ---------- side panel ---------- */
|
||||
.panel {
|
||||
position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw);
|
||||
background: var(--bar); border-left: 1px solid var(--line); z-index: 20;
|
||||
display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.5);
|
||||
}
|
||||
.panel[hidden] { display: none; }
|
||||
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
|
||||
.panel-body { padding: 14px 16px; overflow: auto; flex: 1; }
|
||||
.panel-body h3 { font-size: 14px; margin: 10px 0 8px; word-break: break-all; }
|
||||
.panel-section-head { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; }
|
||||
.muted { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
|
||||
.link-btn { background: none; border: 0; color: var(--accent); font-size: 12px; padding: 0; }
|
||||
.link-btn:hover { text-decoration: underline; }
|
||||
|
||||
.variant, .job {
|
||||
border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; background: #10141a;
|
||||
}
|
||||
.variant .top, .job .top { display: flex; align-items: center; gap: 8px; }
|
||||
.variant .name, .job .name { font-weight: 600; }
|
||||
.variant .meta, .job .meta { color: var(--muted); font-size: 12px; margin-top: 3px; word-break: break-all; }
|
||||
.variant .actions, .job .actions { margin-left: auto; display: flex; gap: 6px; }
|
||||
.btn {
|
||||
background: #1d232a; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 13px;
|
||||
}
|
||||
.btn:hover { border-color: var(--muted); }
|
||||
.btn.primary { background: var(--accent); color: #06202e; border-color: var(--accent); font-weight: 600; }
|
||||
.btn.danger { color: var(--danger); }
|
||||
.btn.sm { padding: 2px 8px; font-size: 12px; }
|
||||
.status { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: #27313b; white-space: nowrap; }
|
||||
.status.ready, .status.done { background: #153f2a; color: var(--ok); }
|
||||
.status.running { background: #123a4c; color: var(--accent); }
|
||||
.status.queued { background: #3d3117; color: var(--accent-2); }
|
||||
.status.error { background: #4a1d1d; color: var(--danger); }
|
||||
.bar { height: 6px; background: #232a33; border-radius: 3px; margin-top: 8px; overflow: hidden; }
|
||||
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
|
||||
.job .err { color: var(--danger); font-size: 12px; margin-top: 4px; word-break: break-all; }
|
||||
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
|
||||
|
||||
@media (max-width: 760px) {
|
||||
#topbar { gap: 8px; padding: 6px 8px; }
|
||||
.brand, .info, .field-label, .hint, .vol, #resetBtn { display: none; }
|
||||
select { max-width: 40vw; }
|
||||
}
|
||||
Reference in New Issue
Block a user