@ray-js/ray-ipc-player 2.0.21-beta-1 → 2.0.21-beta-3
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/lib/index.js +28 -19
- package/lib/typings/index.d.ts +56 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -51,7 +51,8 @@ const Player = props => {
|
|
|
51
51
|
isShare = false,
|
|
52
52
|
onPlayerContainerTap,
|
|
53
53
|
reConnect = false,
|
|
54
|
-
awakeStatus = undefined
|
|
54
|
+
awakeStatus = undefined,
|
|
55
|
+
ignoreHideStopPreview = false
|
|
55
56
|
} = props;
|
|
56
57
|
const {
|
|
57
58
|
borderRadius,
|
|
@@ -170,30 +171,19 @@ const Player = props => {
|
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
});
|
|
173
|
-
onDpDataChange(
|
|
174
|
-
if (res.deviceId === devId) {
|
|
175
|
-
const dpsInfo = res.dps;
|
|
176
|
-
const arr = Object.keys(dpsInfo);
|
|
177
|
-
if (arr.length === 1) {
|
|
178
|
-
const dpId = +arr[0];
|
|
179
|
-
const dpValue = dpsInfo[arr[0]];
|
|
180
|
-
// 这里的 149 为固定 dpId, 无需进行根据 code 获取
|
|
181
|
-
if (dpId === 149 && !dpValue) {
|
|
182
|
-
// 进入到面板中,低功耗产品上报休眠, 进行标记
|
|
183
|
-
setWirelessFlag(true);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
});
|
|
174
|
+
onDpDataChange(handleDpDataChange);
|
|
188
175
|
}, []);
|
|
189
|
-
usePageEvent('onHide', async () => {
|
|
176
|
+
usePageEvent('onHide', useMemoizedFn(async () => {
|
|
190
177
|
setPlayState(d => {
|
|
191
178
|
d.loadingState = true;
|
|
192
179
|
});
|
|
180
|
+
if (ignoreHideStopPreview) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
193
183
|
// 先停流
|
|
194
184
|
stopPreview();
|
|
195
185
|
// await getCurMute();
|
|
196
|
-
});
|
|
186
|
+
}));
|
|
197
187
|
useMount(() => {
|
|
198
188
|
onNetworkStatusChange(res => {
|
|
199
189
|
setPhoneNetworkConnect(res.isConnected);
|
|
@@ -204,6 +194,22 @@ const Player = props => {
|
|
|
204
194
|
console.log(res);
|
|
205
195
|
});
|
|
206
196
|
});
|
|
197
|
+
const handleDpDataChange = useMemoizedFn(res => {
|
|
198
|
+
if (res.deviceId === devId) {
|
|
199
|
+
const dpsInfo = res.dps;
|
|
200
|
+
const arr = Object.keys(dpsInfo);
|
|
201
|
+
if (arr.length === 1) {
|
|
202
|
+
const dpId = +arr[0];
|
|
203
|
+
const dpValue = dpsInfo[arr[0]];
|
|
204
|
+
console.log(privateState, 'privateState');
|
|
205
|
+
// 这里的 149 为固定 dpId, 无需进行根据 code 获取
|
|
206
|
+
if (dpId === 149 && !dpValue && !privateState) {
|
|
207
|
+
// 进入到面板中,低功耗产品上报休眠, 进行标记
|
|
208
|
+
setWirelessFlag(true);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
207
213
|
const handleMqttMessage = useMemoizedFn(event => {
|
|
208
214
|
var _event$messageData;
|
|
209
215
|
if ((event === null || event === void 0 ? void 0 : event.protocol) === 1 && event !== null && event !== void 0 && (_event$messageData = event.messageData) !== null && _event$messageData !== void 0 && _event$messageData.online) {
|
|
@@ -318,6 +324,9 @@ const Player = props => {
|
|
|
318
324
|
} else if (playState.initLy && !privateState) {
|
|
319
325
|
ipcTTTOperatorLog("VID: privateState_status_change: ".concat(privateState));
|
|
320
326
|
retry();
|
|
327
|
+
} else if (playState.initLy && privateState) {
|
|
328
|
+
// 如果隐私模式为true, 主动推一波流变化的状态码,适配ios不触发connectChange的情况
|
|
329
|
+
onChangeStreamStatus && onChangeStreamStatus(-1001);
|
|
321
330
|
}
|
|
322
331
|
}
|
|
323
332
|
}, [phoneNetworkConnect, onlineStatus, playState.initLy, privateState]);
|
|
@@ -713,7 +722,7 @@ const Player = props => {
|
|
|
713
722
|
errCode,
|
|
714
723
|
errorCode
|
|
715
724
|
} = data === null || data === void 0 ? void 0 : data.detail;
|
|
716
|
-
const codeValue = errCode
|
|
725
|
+
const codeValue = errCode !== undefined ? errCode : errorCode;
|
|
717
726
|
if (deviceId) {
|
|
718
727
|
if (deviceId === devId) {
|
|
719
728
|
setVideoErrCode(codeValue);
|
package/lib/typings/index.d.ts
CHANGED
|
@@ -18,6 +18,24 @@ export type IProps = {
|
|
|
18
18
|
* @default true
|
|
19
19
|
*/
|
|
20
20
|
onlineStatus: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @description.en brandColor
|
|
23
|
+
* @description.zh 品牌色
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
brandColor: string;
|
|
27
|
+
/**
|
|
28
|
+
* @description.en renderErrIcon
|
|
29
|
+
* @description.zh 自定义渲染错误图标
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
renderErrIcon?: () => React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* @description.en isShare
|
|
35
|
+
* @description.zh 是否为分享设备
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
isShare: string;
|
|
21
39
|
/**
|
|
22
40
|
* @description.en privateState
|
|
23
41
|
* @description.zh 隐私模式
|
|
@@ -32,10 +50,16 @@ export type IProps = {
|
|
|
32
50
|
defaultMute?: boolean;
|
|
33
51
|
/**
|
|
34
52
|
* @description.en clarity
|
|
35
|
-
* @description.zh 清晰度 normal:标清,hd:高清
|
|
53
|
+
* @description.zh 清晰度 normal:标清,hd:高清 ss: 省流 ud: 超清 ssp: 超高清 auto: 自动 audio: 音频
|
|
54
|
+
* @default "normal"
|
|
55
|
+
*/
|
|
56
|
+
clarity?: 'normal' | 'hd' | 'ss' | 'ud' | 'ssp' | 'auto' | 'audio';
|
|
57
|
+
/**
|
|
58
|
+
* @description.en ipcPlayerContext
|
|
59
|
+
* @description.zh 播放器上下文
|
|
36
60
|
* @default "normal"
|
|
37
61
|
*/
|
|
38
|
-
|
|
62
|
+
ipcPlayerContext?: any;
|
|
39
63
|
/**
|
|
40
64
|
* @description.en updateLayout
|
|
41
65
|
* @description.zh 外层父节点样式变化,播放器监听不到,需要主动触发播放器视图更新,每次需要设置不同的字符串值
|
|
@@ -48,6 +72,30 @@ export type IProps = {
|
|
|
48
72
|
* @default (data) => void
|
|
49
73
|
*/
|
|
50
74
|
onChangeStreamStatus?: (data) => void;
|
|
75
|
+
/**
|
|
76
|
+
* @description.en onPlayerContainerTap
|
|
77
|
+
* @description.zh 点击视频播放器区域
|
|
78
|
+
* @default (data) => void
|
|
79
|
+
*/
|
|
80
|
+
onPlayerContainerTap?: (data) => void;
|
|
81
|
+
/**
|
|
82
|
+
* @description.en onZoomChange
|
|
83
|
+
* @description.zh 视频播放器比例变化
|
|
84
|
+
* @default (data) => void
|
|
85
|
+
*/
|
|
86
|
+
onZoomChange?: (data) => void;
|
|
87
|
+
/**
|
|
88
|
+
* @description.en onCameraPreviewFailure
|
|
89
|
+
* @description.zh 视频错误码回调
|
|
90
|
+
* @default (data) => void
|
|
91
|
+
*/
|
|
92
|
+
onCameraPreviewFailure?: (data) => void;
|
|
93
|
+
/**
|
|
94
|
+
* @description.en onCameraNotifyWeakNetwork
|
|
95
|
+
* @description.zh 弱网检测回调
|
|
96
|
+
* @default (data) => void
|
|
97
|
+
*/
|
|
98
|
+
onCameraNotifyWeakNetwork?: (data) => void;
|
|
51
99
|
/**
|
|
52
100
|
* @description.en onCtx
|
|
53
101
|
* @description.zh 获取ipcPlayer实例ctx以及重试方法retry
|
|
@@ -132,4 +180,10 @@ export type IProps = {
|
|
|
132
180
|
* @default {}
|
|
133
181
|
*/
|
|
134
182
|
awakeStatus?: boolean | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* @description.en needReconnect
|
|
185
|
+
* @description.zh 是否需要唤醒
|
|
186
|
+
* @default {}
|
|
187
|
+
*/
|
|
188
|
+
ignoreHideStopPreview: boolean;
|
|
135
189
|
};
|