47 lines
1.8 KiB
JavaScript
47 lines
1.8 KiB
JavaScript
const labels = {
|
|
loading: '正在连接',
|
|
waiting: '等待视频',
|
|
ready: '播放正常',
|
|
authentication_failed: '摄像头认证失败',
|
|
stream_not_found: '未找到视频流',
|
|
service_unavailable: '视频服务不可用',
|
|
timeout: '连接超时',
|
|
expired: '播放会话已过期',
|
|
offline: '视频已断开',
|
|
stopped: '视频已停止'
|
|
}
|
|
|
|
const details = {
|
|
loading: '正在建立短期播放会话,请稍候。',
|
|
waiting: '播放器已连接,正在等待摄像头开始传输画面。',
|
|
ready: '摄像头视频正在传输。',
|
|
authentication_failed: '请到“设备管理”更新摄像头账号或密码,再重新验证视频接入。',
|
|
stream_not_found: '请到“视频服务”执行对账,确认媒体路径已经恢复。',
|
|
service_unavailable: '请到“视频服务”检查 MediaMTX 进程和端口配置。',
|
|
timeout: '20 秒内未收到画面,请检查摄像头网络后重新连接。',
|
|
expired: '短期播放会话已失效,请重新连接。',
|
|
offline: '无法取得最新播放状态,请检查网络后重新连接。',
|
|
stopped: '该视频路径已停止,请先到“视频服务”恢复。'
|
|
}
|
|
|
|
export function playbackStatusLabel(value) {
|
|
return labels[value] || '暂时无法播放'
|
|
}
|
|
|
|
export function playbackStatusDetail(value, detail) {
|
|
return detail || details[value] || details.offline
|
|
}
|
|
|
|
export function playbackStatusType(value) {
|
|
if (value === 'ready') return 'success'
|
|
if (value === 'loading' || value === 'waiting') return 'warning'
|
|
if (value === 'stopped') return 'info'
|
|
return 'danger'
|
|
}
|
|
|
|
export function routeStatus(value) {
|
|
if (value === 'ready') return { label: '可观看', type: 'success' }
|
|
if (value === 'waiting') return { label: '等待观看', type: 'warning' }
|
|
return { label: '需要处理', type: 'danger' }
|
|
}
|