@ray-js/ipc-player-integration 0.0.29-beta.21 → 0.0.29-beta.22

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.
@@ -5,6 +5,223 @@
5
5
  "css_prefix_text": "icon-panel-",
6
6
  "description": "IPC 小程序公版",
7
7
  "glyphs": [
8
+ {
9
+ "icon_id": "46981006",
10
+ "name": "tip-right-arrow",
11
+ "font_class": "tip-right-arrow",
12
+ "unicode": "e697",
13
+ "unicode_decimal": 59031
14
+ },
15
+ {
16
+ "icon_id": "46981005",
17
+ "name": "tip-circle",
18
+ "font_class": "tip-circle",
19
+ "unicode": "e698",
20
+ "unicode_decimal": 59032
21
+ },
22
+ {
23
+ "icon_id": "46872593",
24
+ "name": "night-light",
25
+ "font_class": "night-light",
26
+ "unicode": "e60e",
27
+ "unicode_decimal": 58894
28
+ },
29
+ {
30
+ "icon_id": "46869725",
31
+ "name": "feed-reminder",
32
+ "font_class": "feed-reminder",
33
+ "unicode": "e60c",
34
+ "unicode_decimal": 58892
35
+ },
36
+ {
37
+ "icon_id": "46869723",
38
+ "name": "baby-core",
39
+ "font_class": "baby-core",
40
+ "unicode": "e611",
41
+ "unicode_decimal": 58897
42
+ },
43
+ {
44
+ "icon_id": "46763588",
45
+ "name": "door-close-small",
46
+ "font_class": "door-close-small",
47
+ "unicode": "e6671",
48
+ "unicode_decimal": 943729
49
+ },
50
+ {
51
+ "icon_id": "46763563",
52
+ "name": "door-close-large",
53
+ "font_class": "door-close-large",
54
+ "unicode": "e6672",
55
+ "unicode_decimal": 943730
56
+ },
57
+ {
58
+ "icon_id": "46763122",
59
+ "name": "door-open-small",
60
+ "font_class": "door-open-small",
61
+ "unicode": "e6673",
62
+ "unicode_decimal": 943731
63
+ },
64
+ {
65
+ "icon_id": "46763015",
66
+ "name": "door-open-large",
67
+ "font_class": "door-open-large",
68
+ "unicode": "e6674",
69
+ "unicode_decimal": 943732
70
+ },
71
+ {
72
+ "icon_id": "46747422",
73
+ "name": "common-error",
74
+ "font_class": "common-error",
75
+ "unicode": "e696",
76
+ "unicode_decimal": 59030
77
+ },
78
+ {
79
+ "icon_id": "46747207",
80
+ "name": "traffic-top-up",
81
+ "font_class": "traffic-top-up",
82
+ "unicode": "e693",
83
+ "unicode_decimal": 59027
84
+ },
85
+ {
86
+ "icon_id": "46744274",
87
+ "name": "elevator-up",
88
+ "font_class": "elevator-up",
89
+ "unicode": "e6666",
90
+ "unicode_decimal": 943718
91
+ },
92
+ {
93
+ "icon_id": "46744267",
94
+ "name": "elevator-down",
95
+ "font_class": "elevator-down",
96
+ "unicode": "e6667",
97
+ "unicode_decimal": 943719
98
+ },
99
+ {
100
+ "icon_id": "46744283",
101
+ "name": "access-elevator",
102
+ "font_class": "access-elevator",
103
+ "unicode": "e6668",
104
+ "unicode_decimal": 943720
105
+ },
106
+ {
107
+ "icon_id": "46744282",
108
+ "name": "elevator-updown",
109
+ "font_class": "elevator-updown",
110
+ "unicode": "e6669",
111
+ "unicode_decimal": 943721
112
+ },
113
+ {
114
+ "icon_id": "46692674",
115
+ "name": "traffic-unauthorized",
116
+ "font_class": "traffic-unauthorized",
117
+ "unicode": "e692",
118
+ "unicode_decimal": 59026
119
+ },
120
+ {
121
+ "icon_id": "46692640",
122
+ "name": "traffic-low-data",
123
+ "font_class": "traffic-low-data",
124
+ "unicode": "e691",
125
+ "unicode_decimal": 59025
126
+ },
127
+ {
128
+ "icon_id": "46692641",
129
+ "name": "traffic-not-obtain",
130
+ "font_class": "traffic-not-obtain",
131
+ "unicode": "e690",
132
+ "unicode_decimal": 59024
133
+ },
134
+ {
135
+ "icon_id": "46518513",
136
+ "name": "swimming-anomaly",
137
+ "font_class": "swimming-anomaly",
138
+ "unicode": "e67a",
139
+ "unicode_decimal": 59002
140
+ },
141
+ {
142
+ "icon_id": "46518507",
143
+ "name": "feed-fish",
144
+ "font_class": "feed-fish",
145
+ "unicode": "e67b",
146
+ "unicode_decimal": 59003
147
+ },
148
+ {
149
+ "icon_id": "46518512",
150
+ "name": "water-temp",
151
+ "font_class": "water-temp",
152
+ "unicode": "e67c",
153
+ "unicode_decimal": 59004
154
+ },
155
+ {
156
+ "icon_id": "46518508",
157
+ "name": "fun-fish-TV",
158
+ "font_class": "fun-fish-TV",
159
+ "unicode": "e67d",
160
+ "unicode_decimal": 59005
161
+ },
162
+ {
163
+ "icon_id": "46518510",
164
+ "name": "fish-care-expert",
165
+ "font_class": "fish-care-expert",
166
+ "unicode": "e67e",
167
+ "unicode_decimal": 59006
168
+ },
169
+ {
170
+ "icon_id": "46518511",
171
+ "name": "water-quality",
172
+ "font_class": "water-quality",
173
+ "unicode": "e68b",
174
+ "unicode_decimal": 59019
175
+ },
176
+ {
177
+ "icon_id": "46518509",
178
+ "name": "swimming-issue",
179
+ "font_class": "swimming-issue",
180
+ "unicode": "e68d",
181
+ "unicode_decimal": 59021
182
+ },
183
+ {
184
+ "icon_id": "46518506",
185
+ "name": "fish-anomaly",
186
+ "font_class": "fish-anomaly",
187
+ "unicode": "e68e",
188
+ "unicode_decimal": 59022
189
+ },
190
+ {
191
+ "icon_id": "46518505",
192
+ "name": "AI-fish-health-check",
193
+ "font_class": "a-AI-fish-healthcheck",
194
+ "unicode": "e68f",
195
+ "unicode_decimal": 59023
196
+ },
197
+ {
198
+ "icon_id": "46514652",
199
+ "name": "favorites",
200
+ "font_class": "favorites1",
201
+ "unicode": "e69f",
202
+ "unicode_decimal": 59039
203
+ },
204
+ {
205
+ "icon_id": "46514654",
206
+ "name": "belly-up",
207
+ "font_class": "belly-up1",
208
+ "unicode": "e6a0",
209
+ "unicode_decimal": 59040
210
+ },
211
+ {
212
+ "icon_id": "46514664",
213
+ "name": "favorite",
214
+ "font_class": "favorite1",
215
+ "unicode": "e694",
216
+ "unicode_decimal": 59028
217
+ },
218
+ {
219
+ "icon_id": "46514661",
220
+ "name": "replay",
221
+ "font_class": "replay1",
222
+ "unicode": "e695",
223
+ "unicode_decimal": 59029
224
+ },
8
225
  {
9
226
  "icon_id": "45928176",
10
227
  "name": "gun-ball",
@@ -12,13 +229,6 @@
12
229
  "unicode": "e68c",
13
230
  "unicode_decimal": 59020
14
231
  },
15
- {
16
- "icon_id": "45928027",
17
- "name": "gun-ball-2",
18
- "font_class": "gun-ball-2",
19
- "unicode": "e68b",
20
- "unicode_decimal": 59019
21
- },
22
232
  {
23
233
  "icon_id": "45739939",
24
234
  "name": "thumbnail",
Binary file
Binary file
Binary file
@@ -8,6 +8,7 @@ export declare const fullTravelRouteControlId = "fullTravelRouteControl";
8
8
  export declare const verticalScreenId = "verticalScreenId";
9
9
  export declare const ptzControlId = "ptzControlId";
10
10
  export declare const ptzControlTipId = "ptzControlTipId";
11
+ export declare const showFlowLowTipId = "showFlowLowTipId";
11
12
  export declare const fullResolutionId = "fullResolutionId";
12
13
  export declare const batteryId = "Battery";
13
14
  export declare const fullSmallIntercomId = "FullSmallIntercom";
@@ -8,6 +8,7 @@ export const fullTravelRouteControlId = 'fullTravelRouteControl';
8
8
  export const verticalScreenId = 'verticalScreenId';
9
9
  export const ptzControlId = 'ptzControlId';
10
10
  export const ptzControlTipId = 'ptzControlTipId';
11
+ export const showFlowLowTipId = 'showFlowLowTipId';
11
12
  export const fullResolutionId = 'fullResolutionId';
12
13
  export const batteryId = 'Battery';
13
14
  export const fullSmallIntercomId = 'FullSmallIntercom';
package/lib/ui/ui.d.ts CHANGED
@@ -34,6 +34,7 @@ type Props = {
34
34
  onPlayerTap?: (data: any) => void;
35
35
  defaultAutoPlay?: boolean;
36
36
  limitFlow?: boolean;
37
+ showFlowLowTip?: boolean;
37
38
  extend?: Record<string, any>;
38
39
  };
39
40
  export declare const IPCPlayerIntegration: React.MemoExoticComponent<(props: Props) => React.JSX.Element>;
package/lib/ui/ui.js CHANGED
@@ -11,11 +11,12 @@ import { PlayState, PlayerStreamStatus, MultiCameraScreenMode } from '../interfa
11
11
  import { useCtx } from '../ctx/ctx.composition';
12
12
  import { useStore, updateAtom } from '../ctx/store';
13
13
  import { UIEventContext } from './context';
14
- import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic, changeIgnoreHideStopPreview, moveablePtzControlId, tileActionsId, tileTipId, landscapeTipId, multiPtzId, ptzMoveableTipId } from './constant';
14
+ import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic, changeIgnoreHideStopPreview, moveablePtzControlId, tileActionsId, tileTipId, landscapeTipId, multiPtzId, ptzMoveableTipId, showFlowLowTipId } from './constant';
15
15
  import BottomLeftContent from './bottomLeftContent';
16
16
  import BottomRightContent from './bottomRightContent';
17
17
  import TopLeftContent from './topLeftContent';
18
18
  import TopRightContent from './topRightContent';
19
+ import { FlowLowTip } from '../widgets';
19
20
  import { useMemoizedFn } from '../hooks';
20
21
  import { Storage } from '../utils/storage';
21
22
  import './ui.less';
@@ -64,6 +65,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
64
65
  playerRoute = 'pages/home/index',
65
66
  defaultAutoPlay = true,
66
67
  limitFlow = false,
68
+ showFlowLowTip = false,
67
69
  extend = {}
68
70
  } = props;
69
71
  const {
@@ -422,6 +424,25 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
422
424
  event.current.emit(playerTap);
423
425
  };
424
426
 
427
+ /** 标记流量不足提示是否已添加过,只允许 addContent 一次 */
428
+ const flowLowTipAddedRef = useRef(false);
429
+
430
+ /**
431
+ * 监听显示流量不足200MB的提示
432
+ */
433
+ useEffect(() => {
434
+ if (playState !== PlayState.PLAYING || !showFlowLowTip || flowLowTipAddedRef.current) return;
435
+ if (!instance.hasContent('absolute', showFlowLowTipId)) {
436
+ instance.addContent('absolute', {
437
+ id: showFlowLowTipId,
438
+ content: props => /*#__PURE__*/React.createElement(FlowLowTip, props),
439
+ absoluteContentClassName: 'ipc-player-plugin-flow-low-tip-wrap',
440
+ initProps: _objectSpread({}, props)
441
+ });
442
+ flowLowTipAddedRef.current = true;
443
+ }
444
+ }, [instance, playState, showFlowLowTip]);
445
+
425
446
  /**
426
447
  * 监听播放器实例创建完成
427
448
  */
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ComponentConfigProps } from '../../interface';
3
+ import './flowLowTip.less';
4
+ type Props = ComponentConfigProps & {
5
+ className?: string;
6
+ };
7
+ export declare const FlowLowTip: (props: Props) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,62 @@
1
+ import { View, Text } from '@ray-js/ray';
2
+ import clsx from 'clsx';
3
+ import React, { useEffect, useRef, useState } from 'react';
4
+ import { getServiceUrl } from '@ray-js/ray-ipc-utils';
5
+ import { useMemoizedFn } from 'ahooks';
6
+ import Strings from '../../i18n';
7
+ import { useStore } from '../../ctx/store';
8
+ import { showFlowLowTipId } from '../../ui/constant';
9
+ import './flowLowTip.less';
10
+ // 5秒后自动隐藏
11
+ const AUTO_HIDE_MS = 5000;
12
+ export const FlowLowTip = props => {
13
+ const {
14
+ screenType: screenTypeAtom,
15
+ hideContent,
16
+ className,
17
+ brandColor: brandColorProp,
18
+ devId
19
+ } = props;
20
+ const {
21
+ screenType,
22
+ brandColor
23
+ } = useStore({
24
+ screenType: screenTypeAtom,
25
+ brandColor: brandColorProp
26
+ });
27
+ const [hideFlowLowTip, setHideFlowLowTip] = useState(false);
28
+ const timerRef = useRef(null);
29
+ const handleClose = useMemoizedFn(async function () {
30
+ let jump = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
31
+ setHideFlowLowTip(true);
32
+ if (jump) {
33
+ await getServiceUrl(devId, 'traffic_service', {}, true);
34
+ }
35
+ hideContent('absolute', showFlowLowTipId);
36
+ });
37
+ useEffect(() => {
38
+ timerRef.current = setTimeout(handleClose, AUTO_HIDE_MS);
39
+ return () => {
40
+ if (timerRef.current) {
41
+ clearTimeout(timerRef.current);
42
+ timerRef.current = null;
43
+ }
44
+ };
45
+ }, [handleClose]);
46
+ return /*#__PURE__*/React.createElement(View, {
47
+ className: clsx(className, 'ipc-player-plugin-flow-low-tip-content', {
48
+ 'ipc-player-plugin-full-screen-ptz-control-hide': hideFlowLowTip
49
+ }),
50
+ onClick: () => handleClose(true)
51
+ }, /*#__PURE__*/React.createElement(View, {
52
+ className: "ipc-player-plugin-flow-low-tip-text-wrap"
53
+ }, /*#__PURE__*/React.createElement(Text, {
54
+ className: clsx('icon-panel', 'icon-panel-tip-circle', 'ipc-player-plugin-flow-low-tip-icon')
55
+ }), /*#__PURE__*/React.createElement(Text, {
56
+ className: "ipc-player-plugin-flow-low-tip-text"
57
+ }, Strings.getLang('ipc_player_flow_low_tip'))), /*#__PURE__*/React.createElement(View, {
58
+ className: "ipc-player-plugin-flow-low-tip-button-wrap"
59
+ }, /*#__PURE__*/React.createElement(Text, {
60
+ className: clsx('icon-panel', 'icon-panel-tip-right-arrow', 'ipc-player-plugin-flow-low-tip-button-icon')
61
+ })));
62
+ };
@@ -0,0 +1,73 @@
1
+ @animation-time: 0.3s;
2
+
3
+ .ipc-player-plugin-flow-low-tip-wrap {
4
+ position: absolute;
5
+ top: calc(10px * var(--ipc-player-size-scale, 1));
6
+ left: calc(16px * var(--ipc-player-size-scale, 1));
7
+ right: calc(16px * var(--ipc-player-size-scale, 1));
8
+ background-color: #262626;
9
+ z-index: 350;
10
+ border-radius: calc(8px * var(--ipc-player-size-scale, 1));
11
+ overflow: hidden;
12
+ padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
13
+ font-size: calc(12px * var(--ipc-player-size-scale, 1));
14
+ color: #ffffff;
15
+ transform: translate(0, 0);
16
+ transition: @animation-time ease-in;
17
+ animation: ipc-player-plugin-flow-low-tip-move-in @animation-time ease-in-out forwards;
18
+ &.ipc-player-plugin-flow-low-tip-hide {
19
+ animation: ipc-player-plugin-flow-low-tip-move-out @animation-time ease-in-out forwards;
20
+ }
21
+ }
22
+
23
+ .ipc-player-plugin-flow-low-tip-content {
24
+ display: flex;
25
+ flex-direction: row;
26
+ align-items: center;
27
+ }
28
+
29
+ .ipc-player-plugin-flow-low-tip-text-wrap {
30
+ flex: 1;
31
+ min-width: 0;
32
+ display: flex;
33
+ flex-direction: row;
34
+ align-items: center;
35
+ }
36
+
37
+ .ipc-player-plugin-flow-low-tip-icon {
38
+ color: #ffa000;
39
+ }
40
+
41
+ .ipc-player-plugin-flow-low-tip-text {
42
+ flex: 1;
43
+ min-width: 0;
44
+ padding: 0 calc(4px * var(--ipc-player-size-scale, 1));
45
+ word-wrap: break-word;
46
+ overflow-wrap: break-word;
47
+ white-space: normal;
48
+ }
49
+
50
+ .ipc-player-plugin-flow-low-tip-button-wrap {
51
+ width: calc(32px * var(--ipc-player-size-scale, 1));
52
+ display: flex;
53
+ justify-content: flex-end;
54
+ align-items: center;
55
+ }
56
+
57
+ @keyframes ipc-player-plugin-flow-low-tip-move-in {
58
+ 0% {
59
+ transform: translate(0, -100vh); /* 从上方滑入 */
60
+ }
61
+ 100% {
62
+ transform: translate(0, 0); /* 移动到目标位置 */
63
+ }
64
+ }
65
+
66
+ @keyframes ipc-player-plugin-flow-low-tip-move-out {
67
+ 0% {
68
+ transform: translate(0, 0); /* 从当前位置开始 */
69
+ }
70
+ 100% {
71
+ transform: translate(0, -100vh); /* 向上滑出,隐藏 */
72
+ }
73
+ }
@@ -0,0 +1 @@
1
+ export * from './flowLowTip';
@@ -0,0 +1 @@
1
+ export * from './flowLowTip';
@@ -17,3 +17,4 @@ export * from './ptzControlTip';
17
17
  export * from './multiCamera';
18
18
  export * from './smallIntercom';
19
19
  export * from './toggleVerticalFull';
20
+ export * from './flowLowTip';
@@ -16,4 +16,5 @@ export * from './moveInteractiveControl';
16
16
  export * from './ptzControlTip';
17
17
  export * from './multiCamera';
18
18
  export * from './smallIntercom';
19
- export * from './toggleVerticalFull';
19
+ export * from './toggleVerticalFull';
20
+ export * from './flowLowTip';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.29-beta.21",
3
+ "version": "0.0.29-beta.22",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [