|
@@ -3,7 +3,18 @@
|
|
|
<div v-if="state.open" class="video-monitor-backdrop">
|
|
<div v-if="state.open" class="video-monitor-backdrop">
|
|
|
<section class="video-monitor" role="dialog" aria-modal="true" aria-labelledby="video-monitor-title" data-video-monitor>
|
|
<section class="video-monitor" role="dialog" aria-modal="true" aria-labelledby="video-monitor-title" data-video-monitor>
|
|
|
<header>
|
|
<header>
|
|
|
- <div><h2 id="video-monitor-title">{{ state.device?.deviceName || '视频监控设备' }}</h2><p>{{ state.device?.deviceCode }}</p></div>
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <h2 id="video-monitor-title">{{ state.device?.deviceName || '视频监控设备' }}</h2>
|
|
|
|
|
+ <!-- The six fields the operator checks on a monitor device (维护者 2026-11-18). -->
|
|
|
|
|
+ <dl class="video-monitor__meta" data-video-meta>
|
|
|
|
|
+ <div><dt>设备名称</dt><dd data-video-meta-field="deviceName">{{ state.device?.deviceName || '—' }}</dd></div>
|
|
|
|
|
+ <div><dt>业务设备编码</dt><dd data-video-meta-field="businessCode">{{ state.device?.businessCode || state.device?.deviceCode || '—' }}</dd></div>
|
|
|
|
|
+ <div><dt>接入方式</dt><dd data-video-meta-field="accessType">{{ accessTypeText }}</dd></div>
|
|
|
|
|
+ <div><dt>国标设备 / 通道</dt><dd data-video-meta-field="gb">{{ gbText }}</dd></div>
|
|
|
|
|
+ <div><dt>安装位置</dt><dd data-video-meta-field="location">{{ state.device?.location || '—' }}</dd></div>
|
|
|
|
|
+ <div><dt>厂商</dt><dd data-video-meta-field="manufacturer">{{ state.device?.manufacturer || '—' }}</dd></div>
|
|
|
|
|
+ </dl>
|
|
|
|
|
+ </div>
|
|
|
<button type="button" aria-label="关闭监控" @click="video.close">关闭</button>
|
|
<button type="button" aria-label="关闭监控" @click="video.close">关闭</button>
|
|
|
</header>
|
|
</header>
|
|
|
<div class="video-monitor__tabs">
|
|
<div class="video-monitor__tabs">
|
|
@@ -26,6 +37,16 @@
|
|
|
<button type="button" @click="playRecord(record)">播放</button>
|
|
<button type="button" @click="playRecord(record)">播放</button>
|
|
|
</li>
|
|
</li>
|
|
|
</ul>
|
|
</ul>
|
|
|
|
|
+ <!-- Volume and fullscreen are not device capabilities, so they stay usable here;
|
|
|
|
|
+ the native bar was removed only to stop pause/seek bypassing the grey gate. -->
|
|
|
|
|
+ <div v-if="state.playbackMedia" class="video-monitor__playback-controls" data-playback-surface>
|
|
|
|
|
+ <button type="button" data-playback-mute :aria-pressed="playbackMuted"
|
|
|
|
|
+ @click="togglePlaybackMute">{{ playbackMuted ? '取消静音' : '静音' }}</button>
|
|
|
|
|
+ <button type="button" data-playback-fullscreen @click="enterPlaybackFullscreen">全屏</button>
|
|
|
|
|
+ <label v-if="state.playbackControls?.seek" class="video-monitor__seek">
|
|
|
|
|
+ 跳到 <input v-model="playbackPosition" type="number" min="0" step="1" data-playback-position /> 秒
|
|
|
|
|
+ </label>
|
|
|
|
|
+ </div>
|
|
|
<!-- Unconfirmed playback controls stay visible but grey, each stating why. -->
|
|
<!-- Unconfirmed playback controls stay visible but grey, each stating why. -->
|
|
|
<div v-if="state.playbackMedia" class="video-monitor__playback-controls">
|
|
<div v-if="state.playbackMedia" class="video-monitor__playback-controls">
|
|
|
<button v-for="control in playbackControls" :key="control.key" type="button" data-playback-control
|
|
<button v-for="control in playbackControls" :key="control.key" type="button" data-playback-control
|
|
@@ -36,12 +57,27 @@
|
|
|
<p class="video-monitor__status" role="status">{{ labels[state.phase] || '未播放' }}</p>
|
|
<p class="video-monitor__status" role="status">{{ labels[state.phase] || '未播放' }}</p>
|
|
|
<p v-if="retryNote" class="video-monitor__status" role="status">{{ retryNote }}</p>
|
|
<p v-if="retryNote" class="video-monitor__status" role="status">{{ retryNote }}</p>
|
|
|
<div class="video-monitor__body">
|
|
<div class="video-monitor__body">
|
|
|
- <aside><h3>云台控制</h3><button type="button" disabled title="停止保障尚未验证,不提供物理控制">方向/变倍</button><p>能力尚未开放</p></aside>
|
|
|
|
|
|
|
+ <aside data-ptz-panel>
|
|
|
|
|
+ <h3>云台控制</h3>
|
|
|
|
|
+ <!-- Buttons always exist; an absent capability or permission only greys them (维护者 2026-11-18). -->
|
|
|
|
|
+ <div class="video-monitor__ptz" role="group" aria-label="云台控制">
|
|
|
|
|
+ <button v-for="key in PTZ_DIRECTIONS" :key="key" type="button" :data-ptz-direction="key"
|
|
|
|
|
+ :disabled="!ptzEnabled" :title="ptzEnabled ? '' : ptzReason">{{ ptzLabel(key) }}</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="video-monitor__ptz" role="group" aria-label="云台变倍">
|
|
|
|
|
+ <button type="button" data-ptz-zoom="in" :disabled="!ptzEnabled" :title="ptzEnabled ? '' : ptzReason">放大</button>
|
|
|
|
|
+ <button type="button" data-ptz-zoom="out" :disabled="!ptzEnabled" :title="ptzEnabled ? '' : ptzReason">缩小</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <button type="button" data-ptz-stop :disabled="!ptzEnabled" :title="ptzEnabled ? '' : ptzReason">停止</button>
|
|
|
|
|
+ <p v-if="!ptzEnabled" data-ptz-hint>{{ ptzReason }}</p>
|
|
|
|
|
+ </aside>
|
|
|
<div class="video-monitor__screen">
|
|
<div class="video-monitor__screen">
|
|
|
<VideoPlayer v-if="state.media" :media="state.media" :options="playerOptions" @ready="video.ready" @error="video.fail" />
|
|
<VideoPlayer v-if="state.media" :media="state.media" :options="playerOptions" @ready="video.ready" @error="video.fail" />
|
|
|
- <video v-else-if="state.playbackMedia" :src="state.playbackMedia.url" controls autoplay muted playsinline
|
|
|
|
|
- controlslist="nodownload noremoteplayback noplaybackrate" disablepictureinpicture disableremoteplayback
|
|
|
|
|
- aria-label="历史录像画面" @contextmenu.prevent />
|
|
|
|
|
|
|
+ <!-- A GB28181 playback publishes WebRTC signalling, so it uses the same player
|
|
|
|
|
+ as live video; native controls would also bypass the grey gate. -->
|
|
|
|
|
+ <VideoPlayer v-else-if="state.playbackMedia" :media="state.playbackMedia" :options="playerOptions"
|
|
|
|
|
+ label="历史录像画面" :controls="false"
|
|
|
|
|
+ @ready="video.readyPlayback" @error="video.failPlayback" />
|
|
|
<p v-else-if="state.phase === 'retrying'">等待自动重连…</p>
|
|
<p v-else-if="state.phase === 'retrying'">等待自动重连…</p>
|
|
|
<p v-else>{{ state.error || '等待视频连接' }}</p>
|
|
<p v-else>{{ state.error || '等待视频连接' }}</p>
|
|
|
</div>
|
|
</div>
|
|
@@ -71,6 +107,26 @@ const labels = { idle: '未播放', starting: '正在建立视频会话', connec
|
|
|
// Switching tabs ends the current stream but must keep the monitor open.
|
|
// Switching tabs ends the current stream but must keep the monitor open.
|
|
|
const mode = ref('live')
|
|
const mode = ref('live')
|
|
|
const range = reactive(video.historyWindow())
|
|
const range = reactive(video.historyWindow())
|
|
|
|
|
+// PTZ panel: the buttons are always present; only capability/permission greys them out.
|
|
|
|
|
+const PTZ_DIRECTIONS = ['up', 'down', 'left', 'right', 'up-left', 'up-right', 'down-left', 'down-right']
|
|
|
|
|
+const PTZ_LABELS = { up: '上', down: '下', left: '左', right: '右', 'up-left': '左上', 'up-right': '右上', 'down-left': '左下', 'down-right': '右下' }
|
|
|
|
|
+const ptzLabel = (key) => PTZ_LABELS[key]
|
|
|
|
|
+// Real device PTZ control is ticket 06; until the device confirms it, the buttons stay grey with a reason.
|
|
|
|
|
+const PTZ_UNCONFIRMED = '设备未确认云台能力或当前无控制权限'
|
|
|
|
|
+const ptzEnabled = computed(() => {
|
|
|
|
|
+ const device = state.value.device
|
|
|
|
|
+ return Boolean(device?.capabilities?.ptz) && !state.value.cleanupError
|
|
|
|
|
+})
|
|
|
|
|
+const ptzReason = computed(() => state.value.cleanupError ? '会话释放未确认,暂停控制' : PTZ_UNCONFIRMED)
|
|
|
|
|
+// Access mode and GB identifiers come straight from the binding; blanks show as a dash.
|
|
|
|
|
+const ACCESS_TEXT = { GB28181: '国标接入', MANUAL: '手工接入' }
|
|
|
|
|
+const accessTypeText = computed(() => ACCESS_TEXT[state.value.device?.accessType] || state.value.device?.accessType || '—')
|
|
|
|
|
+const gbText = computed(() => {
|
|
|
|
|
+ const device = state.value.device
|
|
|
|
|
+ return device?.gbDeviceId || device?.gbChannelId
|
|
|
|
|
+ ? `${device.gbDeviceId || '—'} / ${device.gbChannelId || '—'}`
|
|
|
|
|
+ : '—'
|
|
|
|
|
+})
|
|
|
const switchMode = async (next) => {
|
|
const switchMode = async (next) => {
|
|
|
if (next === mode.value) return
|
|
if (next === mode.value) return
|
|
|
if (next === 'history') {
|
|
if (next === 'history') {
|
|
@@ -95,8 +151,29 @@ const playbackControls = computed(() => {
|
|
|
control('speed-0.5', '0.5×', 'speed'), control('speed-1', '1×', 'speed'), control('speed-2', '2×', 'speed'),
|
|
control('speed-0.5', '0.5×', 'speed'), control('speed-1', '1×', 'speed'), control('speed-2', '2×', 'speed'),
|
|
|
control('speed-4', '4×', 'speed'), control('seek', '跳转')]
|
|
control('speed-4', '4×', 'speed'), control('seek', '跳转')]
|
|
|
})
|
|
})
|
|
|
|
|
+// A seek needs a position inside the chosen recording; the panel asks for one instead of guessing.
|
|
|
|
|
+const playbackPosition = ref('')
|
|
|
// A disabled control must not reach the server even when activated programmatically.
|
|
// A disabled control must not reach the server even when activated programmatically.
|
|
|
-const runControl = (control) => { if (control.enabled) void video.controlPlayback(control.key) }
|
|
|
|
|
|
|
+const runControl = (control) => {
|
|
|
|
|
+ if (!control.enabled) return
|
|
|
|
|
+ if (control.key === 'seek') {
|
|
|
|
|
+ const seconds = Number(playbackPosition.value)
|
|
|
|
|
+ if (!Number.isFinite(seconds)) return
|
|
|
|
|
+ void video.controlPlayback('seek', seconds)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ void video.controlPlayback(control.key)
|
|
|
|
|
+}
|
|
|
|
|
+// Local presentation only: the player starts muted, and neither action is a device capability.
|
|
|
|
|
+const playbackMuted = ref(true)
|
|
|
|
|
+const playbackVideo = () => document.querySelector('[data-video-monitor] video[aria-label="历史录像画面"]')
|
|
|
|
|
+const togglePlaybackMute = () => {
|
|
|
|
|
+ const element = playbackVideo()
|
|
|
|
|
+ if (!element) return
|
|
|
|
|
+ playbackMuted.value = !playbackMuted.value
|
|
|
|
|
+ element.muted = playbackMuted.value
|
|
|
|
|
+}
|
|
|
|
|
+const enterPlaybackFullscreen = () => { void playbackVideo()?.requestFullscreen?.() }
|
|
|
const retryNote = computed(() => state.value.phase !== 'retrying' || !state.value.retryAttempt
|
|
const retryNote = computed(() => state.value.phase !== 'retrying' || !state.value.retryAttempt
|
|
|
? ''
|
|
? ''
|
|
|
: `第 ${state.value.retryAttempt} 次自动重试,等待 ${Math.round((state.value.retryDelayMs || 0) / 1000)} 秒(剩余 ${state.value.retriesLeft ?? 0} 次)`)
|
|
: `第 ${state.value.retryAttempt} 次自动重试,等待 ${Math.round((state.value.retryDelayMs || 0) / 1000)} 秒(剩余 ${state.value.retriesLeft ?? 0} 次)`)
|
|
@@ -136,6 +213,11 @@ onBeforeUnmount(() => { document.removeEventListener('visibilitychange', hidden)
|
|
|
.video-monitor header p { margin: 0; color: #9dbbc8; overflow-wrap: anywhere; }
|
|
.video-monitor header p { margin: 0; color: #9dbbc8; overflow-wrap: anywhere; }
|
|
|
.video-monitor button { padding: 7px 18px; color: #d8f8ff; background: #14556b; border: 1px solid #448ba0; border-radius: 4px; cursor: pointer; }
|
|
.video-monitor button { padding: 7px 18px; color: #d8f8ff; background: #14556b; border: 1px solid #448ba0; border-radius: 4px; cursor: pointer; }
|
|
|
.video-monitor button:disabled { color: #8399a3; background: #263c46; border-color: #49616b; cursor: not-allowed; }
|
|
.video-monitor button:disabled { color: #8399a3; background: #263c46; border-color: #49616b; cursor: not-allowed; }
|
|
|
|
|
+.video-monitor__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 18px; margin: 8px 0 0; }
|
|
|
|
|
+.video-monitor__meta div { display: flex; gap: 8px; font-size: 13px; color: #b6d4e0; }
|
|
|
|
|
+.video-monitor__meta dt { color: #8fb4c2; margin: 0; white-space: nowrap; }
|
|
|
|
|
+.video-monitor__meta dd { margin: 0; overflow-wrap: anywhere; }
|
|
|
|
|
+.video-monitor__ptz { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
|
|
|
.video-monitor__tabs { display: flex; gap: 20px; align-items: center; margin-top: 18px; }
|
|
.video-monitor__tabs { display: flex; gap: 20px; align-items: center; margin-top: 18px; }
|
|
|
.video-monitor__status { color: #a3d5e3; }
|
|
.video-monitor__status { color: #a3d5e3; }
|
|
|
.video-monitor__body { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; }
|
|
.video-monitor__body { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; }
|