Init commit

This commit is contained in:
ShreejitPanchal
2026-05-19 19:56:02 +08:00
commit 6601501eff
4047 changed files with 2185372 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import { CONFIG } from '@server/initializers/config.js'
function buildRtspUrl (endpoint: string | undefined, urlPattern: string | undefined, targetCamera: string) {
const normalizedEndpoint = (endpoint || 'rtsp://localhost:8554').trim().replace(/\/+$/, '')
const normalizedPattern = (urlPattern || '/{targetCamera}/live')
.replace('{targetCamera}', encodeURIComponent(targetCamera))
if (normalizedPattern.startsWith('/')) return normalizedEndpoint + normalizedPattern
return normalizedEndpoint + '/' + normalizedPattern
}
export function buildRtspSourceUrlForTargetCamera (targetCamera: string) {
return buildRtspUrl(CONFIG.LIVE.RTSP_SOURCE.ENDPOINT, CONFIG.LIVE.RTSP_SOURCE.URL_PATTERN, targetCamera)
}
export function buildRtspSinkUrlForTargetCamera (targetCamera: string) {
return buildRtspUrl(CONFIG.LIVE.RTSP_SINK.ENDPOINT, CONFIG.LIVE.RTSP_SINK.URL_PATTERN, targetCamera)
}