CCTV 실시간 영상: - CCTVPlayer 컴포넌트 (hls.js 기반 HLS/MJPEG/MP4 재생) - 백엔드 HLS 프록시 엔드포인트 (CORS 우회, m3u8 URL 재작성) - KHOA 15개 + KBS 6개 실제 해안 CCTV 연동 - Vite dev proxy, 스트림 타입 자동 감지 유틸리티 HNS 분석: - HNS 시나리오 저장/불러오기/재계산 기능 - 물질 DB 검색 및 상세 정보 연동 - 좌표/파라미터 입력 UI 개선 - Python 확산 모델 스크립트 (hns_dispersion.py) 공통: - 3D 지도 토글, 보고서 생성 개선 - useSubMenu 훅, mapUtils 확장 - ESLint set-state-in-effect 수정 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
/**
|
|
* CCTV 스트림 타입 감지 유틸리티
|
|
*/
|
|
|
|
export type StreamType = 'hls' | 'mjpeg' | 'iframe' | 'mp4' | 'unknown';
|
|
|
|
/** URL 패턴으로 스트림 타입을 자동 감지한다. */
|
|
export function detectStreamType(url: string): StreamType {
|
|
const lower = url.toLowerCase();
|
|
|
|
// KHOA 공식 팝업 페이지 (내장 video.js — videoUrl 파라미터에 .m3u8이 포함되므로 HLS보다 먼저 체크)
|
|
if (lower.includes('khoa.go.kr') && lower.includes('popup.do')) {
|
|
return 'iframe';
|
|
}
|
|
|
|
if (lower.includes('.m3u8') || lower.includes('/hls/')) {
|
|
return 'hls';
|
|
}
|
|
|
|
if (
|
|
lower.includes('mjpeg') ||
|
|
lower.includes('mjpg') ||
|
|
lower.includes('/video/mjpg') ||
|
|
lower.includes('action=stream')
|
|
) {
|
|
return 'mjpeg';
|
|
}
|
|
|
|
if (
|
|
lower.includes('youtube.com/embed') ||
|
|
lower.includes('player.') ||
|
|
lower.includes('/embed/')
|
|
) {
|
|
return 'iframe';
|
|
}
|
|
|
|
if (lower.endsWith('.mp4') || lower.endsWith('.webm') || lower.endsWith('.ogg')) {
|
|
return 'mp4';
|
|
}
|
|
|
|
return 'unknown';
|
|
}
|