@uniai-fe/uds-templates 0.5.12 → 0.5.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniai-fe/uds-templates",
3
- "version": "0.5.12",
3
+ "version": "0.5.13",
4
4
  "description": "UNIAI Design System; UI Templates Package",
5
5
  "type": "module",
6
6
  "private": false,
@@ -12,6 +12,13 @@ export const CCTV_MESSAGE = {
12
12
  offline: "CCTV 연결 오류",
13
13
  } as const;
14
14
 
15
+ const RTC_PREPARING_STATES = new Set<RTCPeerConnectionState>([
16
+ "new",
17
+ "connecting",
18
+ "disconnected",
19
+ "closed",
20
+ ]);
21
+
15
22
  /**
16
23
  * CCTV; 스트리밍 상태에 따른 메시지 추출
17
24
  * @param {CctvVideoOverlayMessageParams} params 상태 파라미터
@@ -27,6 +34,7 @@ export const CCTV_MESSAGE = {
27
34
  */
28
35
  export function getOverlayMessage({
29
36
  cam,
37
+ connectionState,
30
38
  hasCamProp = false,
31
39
  isFetching = false,
32
40
  isTokenLoading,
@@ -44,6 +52,8 @@ export function getOverlayMessage({
44
52
  if (isTokenError) return CCTV_MESSAGE.tokenError;
45
53
  if (streamError) return streamError;
46
54
  if (isTokenLoading || isStreaming) return CCTV_MESSAGE.preparing;
55
+ if (connectionState === "failed") return CCTV_MESSAGE.offline;
56
+ if (RTC_PREPARING_STATES.has(connectionState)) return CCTV_MESSAGE.preparing;
47
57
  return null;
48
58
  }
49
59