@uniai-fe/uds-templates 0.6.26 → 0.6.27
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 +1 -1
- package/src/cctv/apis/client.ts +56 -2
- package/src/cctv/components/Provider.tsx +66 -8
- package/src/cctv/components/cam-list/Item.tsx +6 -0
- package/src/cctv/components/pagination/list/Item.tsx +20 -0
- package/src/cctv/components/video/Template.tsx +3 -0
- package/src/cctv/components/viewer/desktop/Video.tsx +1 -0
- package/src/cctv/hooks/streamScheduler.ts +276 -0
- package/src/cctv/hooks/useRtcStream.ts +218 -18
- package/src/cctv/types/context.ts +21 -0
- package/src/cctv/types/hook.ts +24 -0
- package/src/cctv/types/props.ts +12 -1
- package/src/cctv/types/video-state.ts +18 -3
- package/src/cctv/utils/video-state.ts +3 -0
package/src/cctv/types/props.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CctvCompanyCameraData, CctvCompanyCameraList } from "./list";
|
|
2
|
-
import type { CctvRtcReconnectTrigger } from "./hook";
|
|
2
|
+
import type { CctvRtcReconnectTrigger, CctvRtcStreamStage } from "./hook";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* CCTV; custom overlay render context
|
|
@@ -9,6 +9,7 @@ import type { CctvRtcReconnectTrigger } from "./hook";
|
|
|
9
9
|
* @property {boolean | undefined} [isError] 영상 에러 상태 여부
|
|
10
10
|
* @property {boolean | undefined} [isLive] 영상 live 상태 여부
|
|
11
11
|
* @property {React.ReactNode} [overlayMessage] 기본 안내/에러 메시지 콘텐츠
|
|
12
|
+
* @property {CctvRtcStreamStage | undefined} [streamStage] stream 표시 단계
|
|
12
13
|
* @property {boolean | undefined} [canReconnect] UDS 내부 허용 사유와 grace/stagger를 통과해 재연결 호출이 가능한지 여부
|
|
13
14
|
* @property {CctvRtcReconnectTrigger | undefined} [reconnectStream] 재연결 trigger 함수
|
|
14
15
|
*/
|
|
@@ -37,6 +38,10 @@ export interface CctvVideoRenderOverlayContext {
|
|
|
37
38
|
* 기본 안내/에러 메시지 콘텐츠
|
|
38
39
|
*/
|
|
39
40
|
overlayMessage?: React.ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* stream 표시 단계
|
|
43
|
+
*/
|
|
44
|
+
streamStage?: CctvRtcStreamStage;
|
|
40
45
|
/**
|
|
41
46
|
* UDS 내부 허용 사유와 grace/stagger를 통과해 재연결 호출이 가능한지 여부
|
|
42
47
|
* @desc
|
|
@@ -130,6 +135,7 @@ export interface CctvVideoOverlayFooterProps {
|
|
|
130
135
|
* @property {boolean} [isError] 에러 상태 여부
|
|
131
136
|
* @property {boolean} [isLive] 영상이 정상적으로 재생 중인지 여부
|
|
132
137
|
* @property {React.ReactNode} [overlayMessage] 에러/안내 메시지 콘텐츠
|
|
138
|
+
* @property {CctvRtcStreamStage} [streamStage] stream 표시 단계
|
|
133
139
|
* @property {boolean} [canReconnect] UDS 내부 허용 사유와 grace/stagger를 통과해 재연결 호출이 가능한지 여부
|
|
134
140
|
* @property {CctvRtcReconnectTrigger} [reconnectStream] 재연결 trigger 함수
|
|
135
141
|
*/
|
|
@@ -146,6 +152,10 @@ export interface CctvVideoStateProps {
|
|
|
146
152
|
* 오버레이 메시지 콘텐츠
|
|
147
153
|
*/
|
|
148
154
|
overlayMessage?: React.ReactNode;
|
|
155
|
+
/**
|
|
156
|
+
* stream 표시 단계
|
|
157
|
+
*/
|
|
158
|
+
streamStage?: CctvRtcStreamStage;
|
|
149
159
|
/**
|
|
150
160
|
* UDS 내부 허용 사유와 grace/stagger를 통과해 재연결 호출이 가능한지 여부
|
|
151
161
|
*/
|
|
@@ -164,6 +174,7 @@ export interface CctvVideoStateProps {
|
|
|
164
174
|
* @property {boolean} [isError] 에러 상태 여부
|
|
165
175
|
* @property {boolean} [isLive] 영상이 정상적으로 재생 중인지 여부
|
|
166
176
|
* @property {React.ReactNode} [overlayMessage] 에러/안내 메시지 콘텐츠
|
|
177
|
+
* @property {CctvRtcStreamStage} [streamStage] stream 표시 단계
|
|
167
178
|
* @property {CctvVideoRenderOverlay} [renderOverlay] custom overlay 렌더 함수
|
|
168
179
|
*/
|
|
169
180
|
export interface CctvVideoTemplateProps extends CctvVideoStateProps {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { CctvCompanyCameraData } from "./list";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
CctvRtcStreamStage,
|
|
4
|
+
UseCctvRtcStreamError,
|
|
5
|
+
UseCctvRtcStreamState,
|
|
6
|
+
} from "./hook";
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* CCTV; getOverlayMessage() params
|
|
@@ -11,10 +15,14 @@ import type { UseCctvRtcStreamError, UseCctvRtcStreamState } from "./hook";
|
|
|
11
15
|
* @property {boolean} isTokenLoading UI 표시 기준 토큰 발급 요청 진행 여부
|
|
12
16
|
* @property {boolean} isTokenError 토큰 발급 실패 여부
|
|
13
17
|
* @property {string | null} streamError 스트림 오류 메시지
|
|
18
|
+
* @property {CctvRtcStreamStage} [streamStage] stream 표시 단계
|
|
14
19
|
* @property {boolean} [canReconnect] UDS 내부 허용 사유와 grace/stagger를 통과해 재연결 호출이 가능한지 여부.
|
|
15
20
|
* 오류 스타일 판정에는 직접 사용하지 않는다.
|
|
16
21
|
*/
|
|
17
|
-
export interface CctvVideoOverlayMessageParams extends
|
|
22
|
+
export interface CctvVideoOverlayMessageParams extends Omit<
|
|
23
|
+
UseCctvRtcStreamState,
|
|
24
|
+
"streamStage"
|
|
25
|
+
> {
|
|
18
26
|
/**
|
|
19
27
|
* 카메라 데이터
|
|
20
28
|
*/
|
|
@@ -27,6 +35,10 @@ export interface CctvVideoOverlayMessageParams extends UseCctvRtcStreamState {
|
|
|
27
35
|
* 서버에서 cam 리스트를 가져오는 중인지 여부
|
|
28
36
|
*/
|
|
29
37
|
isFetching?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* stream 표시 단계
|
|
40
|
+
*/
|
|
41
|
+
streamStage?: CctvRtcStreamStage;
|
|
30
42
|
/**
|
|
31
43
|
* UDS 내부 허용 사유와 grace/stagger를 통과해 재연결 호출이 가능한지 여부
|
|
32
44
|
* @desc
|
|
@@ -44,7 +56,10 @@ export interface CctvVideoOverlayMessageParams extends UseCctvRtcStreamState {
|
|
|
44
56
|
* @property {boolean} isTokenError 토큰 발급 실패 여부
|
|
45
57
|
* @property {string | null} streamError 스트림 오류 메시지
|
|
46
58
|
*/
|
|
47
|
-
export interface CctvVideoLiveParams extends
|
|
59
|
+
export interface CctvVideoLiveParams extends Omit<
|
|
60
|
+
UseCctvRtcStreamState,
|
|
61
|
+
"streamStage"
|
|
62
|
+
> {
|
|
48
63
|
/**
|
|
49
64
|
* 카메라 데이터
|
|
50
65
|
*/
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
export const CCTV_MESSAGE = {
|
|
8
8
|
selectCam: "카메라를 선택하세요.",
|
|
9
9
|
fetching: "CCTV 데이터를 불러오는 중입니다.",
|
|
10
|
+
queued: "CCTV 연결 순서를 기다리고 있습니다.",
|
|
10
11
|
preparing: "CCTV 영상을 연결하고 있습니다.",
|
|
11
12
|
sessionEnded:
|
|
12
13
|
"장시간 미사용으로 연결이 종료되었습니다. 계속 확인하시려면 다시 연결해 주세요.",
|
|
@@ -47,6 +48,7 @@ export function getOverlayMessage({
|
|
|
47
48
|
isTokenLoading,
|
|
48
49
|
isTokenError,
|
|
49
50
|
isStreaming,
|
|
51
|
+
streamStage,
|
|
50
52
|
streamError,
|
|
51
53
|
}: CctvVideoOverlayMessageParams): string | null {
|
|
52
54
|
if (!cam) {
|
|
@@ -62,6 +64,7 @@ export function getOverlayMessage({
|
|
|
62
64
|
if (canReconnect && RTC_SESSION_ENDED_RECONNECT_STATES.has(connectionState)) {
|
|
63
65
|
return CCTV_MESSAGE.sessionEnded;
|
|
64
66
|
}
|
|
67
|
+
if (streamStage === "queued") return CCTV_MESSAGE.queued;
|
|
65
68
|
// raw disconnected는 useCctvRtcStream에서 post-connected connected로 smoothing한다.
|
|
66
69
|
if (isTokenLoading || isStreaming) return CCTV_MESSAGE.preparing;
|
|
67
70
|
if (RTC_PREPARING_STATES.has(connectionState)) return CCTV_MESSAGE.preparing;
|