@ray-js/ray-ipc-player 2.0.31 → 2.1.0-beta.1
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/components/ErrorOverlay.d.ts +28 -0
- package/lib/components/ErrorOverlay.js +293 -0
- package/lib/components/FullScreenBackButton.d.ts +8 -0
- package/lib/components/FullScreenBackButton.js +16 -0
- package/lib/components/LoadingOverlay.d.ts +9 -0
- package/lib/components/LoadingOverlay.js +27 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +3 -0
- package/lib/hooks/index.d.ts +2 -1
- package/lib/hooks/index.js +3 -1
- package/lib/hooks/usePlayerConnection.d.ts +40 -0
- package/lib/hooks/usePlayerConnection.js +319 -0
- package/lib/hooks/usePlayerProps.d.ts +4 -0
- package/lib/hooks/usePlayerProps.js +108 -0
- package/lib/i18n/index.d.ts +16 -0
- package/lib/i18n/strings.d.ts +8 -0
- package/lib/i18n/strings.js +10 -2
- package/lib/index.js +208 -590
- package/lib/index.less +45 -3
- package/lib/svg/flowLimit.svg +1 -0
- package/lib/svg/rightArrow.svg +1 -0
- package/lib/svg/sleep.svg +1 -0
- package/lib/typings/index.d.ts +13 -1
- package/lib/utils.js +3 -2
- package/package.json +4 -3
package/lib/index.js
CHANGED
|
@@ -1,75 +1,68 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
3
|
import "core-js/modules/es.json.stringify.js";
|
|
3
4
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
4
5
|
/* eslint-disable no-unneeded-ternary */
|
|
5
6
|
import React, { useState, useEffect, useRef } from 'react';
|
|
6
7
|
import { useImmer } from 'use-immer';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { setPageOrientation, usePageEvent, useAppEvent, getNetworkType, offNetworkStatusChange, onNetworkStatusChange, publishDps, showToast, getSystemInfoSync, onMqttMessageReceived, registerMQTTProtocolListener, offMqttMessageReceived, unregisterMQTTProtocolListener, registerDeviceListListener, onDpDataChange, onDeviceOnlineStatusUpdate, performanceEvent, getCurrentPages } from '@ray-js/ray';
|
|
11
|
-
import clsx from 'clsx';
|
|
8
|
+
import { IpcPlayer, View } from '@ray-js/components';
|
|
9
|
+
import { useMemoizedFn } from 'ahooks';
|
|
10
|
+
import { setPageOrientation, usePageEvent, useAppEvent, getNetworkType, offNetworkStatusChange, onNetworkStatusChange, publishDps, showToast, getSystemInfoSync, onMqttMessageReceived, registerMQTTProtocolListener, offMqttMessageReceived, unregisterMQTTProtocolListener, registerDeviceListListener, onDpDataChange, onDeviceOnlineStatusUpdate } from '@ray-js/ray';
|
|
12
11
|
import Strings from './i18n';
|
|
13
12
|
import { IpcFailCode } from './constant';
|
|
14
|
-
import { useWakeUpDevice } from './hooks';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { deviceFreezeReasonStore, miniIdLabs } from './config';
|
|
13
|
+
import { useWakeUpDevice, usePlayerProps, usePlayerConnection } from './hooks';
|
|
14
|
+
import { getDpIdByDpCode, ipcTTTOperatorLog } from './utils';
|
|
15
|
+
import { LoadingOverlay, ErrorOverlay, FullScreenBackButton } from './components';
|
|
18
16
|
import './index.less';
|
|
19
17
|
const CSS_PREFIX = 'ray-ipc-player';
|
|
20
18
|
|
|
21
19
|
// 生成带前缀的类名
|
|
22
20
|
const getClassName = className => "".concat(CSS_PREFIX, "-").concat(className);
|
|
23
21
|
const Player = props => {
|
|
22
|
+
// 使用自定义 hook 处理 props 解构
|
|
24
23
|
const {
|
|
25
|
-
updateLayout
|
|
26
|
-
devId
|
|
27
|
-
objectFit
|
|
24
|
+
updateLayout,
|
|
25
|
+
devId,
|
|
26
|
+
objectFit,
|
|
28
27
|
onChangeStreamStatus,
|
|
29
28
|
onPlayerTap,
|
|
30
29
|
onZoomChange,
|
|
31
30
|
onCameraPreviewFailure,
|
|
32
31
|
onCameraNotifyWeakNetwork,
|
|
33
32
|
onInitPreview,
|
|
34
|
-
defaultMute
|
|
35
|
-
onlineStatus
|
|
36
|
-
loadText
|
|
37
|
-
rotateZ
|
|
38
|
-
scalable
|
|
39
|
-
scaleMultiple
|
|
40
|
-
ptzControllable
|
|
41
|
-
clarity
|
|
33
|
+
defaultMute,
|
|
34
|
+
onlineStatus,
|
|
35
|
+
loadText,
|
|
36
|
+
rotateZ,
|
|
37
|
+
scalable,
|
|
38
|
+
scaleMultiple,
|
|
39
|
+
ptzControllable,
|
|
40
|
+
clarity,
|
|
42
41
|
ipcPlayerContext,
|
|
43
42
|
onCtx,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
borderStyle: 'solid',
|
|
48
|
-
borderColor: '',
|
|
49
|
-
borderWidth: 0
|
|
50
|
-
},
|
|
51
|
-
privateState = false,
|
|
52
|
-
extend = {},
|
|
53
|
-
brandColor = '#FF592A',
|
|
43
|
+
privateState,
|
|
44
|
+
extend,
|
|
45
|
+
brandColor,
|
|
54
46
|
renderErrIcon,
|
|
55
|
-
isShare
|
|
47
|
+
isShare,
|
|
56
48
|
onPlayerContainerTap,
|
|
57
|
-
reConnect
|
|
58
|
-
awakeStatus
|
|
59
|
-
ignoreHideStopPreview
|
|
49
|
+
reConnect,
|
|
50
|
+
awakeStatus,
|
|
51
|
+
ignoreHideStopPreview,
|
|
60
52
|
onChangeIgnoreHideStopPreview,
|
|
61
|
-
hideSuggestedText
|
|
62
|
-
hideHelpButton
|
|
63
|
-
hideFeedBackButton
|
|
64
|
-
playerRoute
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
hideSuggestedText,
|
|
54
|
+
hideHelpButton,
|
|
55
|
+
hideFeedBackButton,
|
|
56
|
+
playerRoute,
|
|
57
|
+
defaultAutoPlay,
|
|
58
|
+
limitFlow,
|
|
67
59
|
borderRadius,
|
|
68
60
|
bgColor,
|
|
69
61
|
borderStyle,
|
|
70
62
|
borderColor,
|
|
71
|
-
borderWidth
|
|
72
|
-
|
|
63
|
+
borderWidth,
|
|
64
|
+
isLowPowerDevice
|
|
65
|
+
} = usePlayerProps(props);
|
|
73
66
|
const [playState, setPlayState] = useImmer({
|
|
74
67
|
connectState: false,
|
|
75
68
|
// 连接状态
|
|
@@ -101,10 +94,12 @@ const Player = props => {
|
|
|
101
94
|
const privateLowPowerDeviceTimeOutRef = useRef(null);
|
|
102
95
|
const privateWakeOutTimeRef = useRef(null);
|
|
103
96
|
const privateDeviceWakeNeedPublishTimeRef = useRef(null);
|
|
97
|
+
// 内部维护首次组件渲染时,自动播放状态,一旦调用重试,触发拉流后,将其状态设为true
|
|
98
|
+
const [autoPlay, setAutoPlay] = useState(defaultAutoPlay);
|
|
99
|
+
|
|
104
100
|
// connectChangeRef
|
|
105
101
|
useRef(null);
|
|
106
102
|
const firstPreviewTimeRef = useRef(false);
|
|
107
|
-
const [isLowPowerDevice] = useState(awakeStatus !== undefined);
|
|
108
103
|
|
|
109
104
|
// 自定义计时老低功耗方案设备在线状态, 用于短暂时间报上下线的UI展示兼容 待实现
|
|
110
105
|
const [lowPowerDeviceOnlineState, setLowPowerDeviceOnlineState] = useState(onlineStatus);
|
|
@@ -114,8 +109,6 @@ const Player = props => {
|
|
|
114
109
|
const [device4GIsFreeze, setDevice4GIsFreeze] = useState(false);
|
|
115
110
|
// 4G设备冻结原因, 待实现
|
|
116
111
|
const [deviceFreezeReason, setDeviceFreezeReason] = useState(1);
|
|
117
|
-
// 4G设备流量是否不足
|
|
118
|
-
const [trafficLessOrEqualZero, setTrafficLessOrEqualZero] = useState(false);
|
|
119
112
|
// 手机连接网络状态
|
|
120
113
|
const [phoneNetworkConnect, setPhoneNetworkConnect] = useState(true);
|
|
121
114
|
const ipcCtx = useRef(null); // ipc实例
|
|
@@ -127,6 +120,54 @@ const Player = props => {
|
|
|
127
120
|
const retryCount = useRef(0); // 重试次数
|
|
128
121
|
const muteRef = useRef(defaultMute); // 静音
|
|
129
122
|
|
|
123
|
+
/**
|
|
124
|
+
* 设置声音
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
// 使用连接相关的 hook
|
|
128
|
+
const {
|
|
129
|
+
_retry,
|
|
130
|
+
_reConnect,
|
|
131
|
+
stopPreview,
|
|
132
|
+
disconnect,
|
|
133
|
+
handleReWakeCamera,
|
|
134
|
+
handleReWakeCameraLowPowerDevice,
|
|
135
|
+
getPlayerRoute
|
|
136
|
+
} = usePlayerConnection({
|
|
137
|
+
devId,
|
|
138
|
+
ipcCtx,
|
|
139
|
+
playState,
|
|
140
|
+
setPlayState,
|
|
141
|
+
setVideoErrCode,
|
|
142
|
+
onChangeStreamStatus,
|
|
143
|
+
onInitPreview,
|
|
144
|
+
playerRoute,
|
|
145
|
+
privateState,
|
|
146
|
+
isLowPowerDevice,
|
|
147
|
+
awakeStatus,
|
|
148
|
+
wirelessFlag,
|
|
149
|
+
setEnableWakeUpInterval,
|
|
150
|
+
setLowPrivateOutTimeFlag,
|
|
151
|
+
setMqttPrivateFlag,
|
|
152
|
+
privateLowPowerDeviceTimeOutRef,
|
|
153
|
+
privateWakeOutTimeRef,
|
|
154
|
+
firstPreviewTimeRef,
|
|
155
|
+
retryCount,
|
|
156
|
+
muteRef,
|
|
157
|
+
setMuted: val => {
|
|
158
|
+
var _ipcCtx$current;
|
|
159
|
+
ipcTTTOperatorLog("VID: begin_to_set_mute");
|
|
160
|
+
(_ipcCtx$current = ipcCtx.current) === null || _ipcCtx$current === void 0 || _ipcCtx$current.setMuted({
|
|
161
|
+
mute: val,
|
|
162
|
+
success: () => {
|
|
163
|
+
ipcTTTOperatorLog("VID: set_mute_success: ".concat(val));
|
|
164
|
+
},
|
|
165
|
+
fail: () => {
|
|
166
|
+
ipcTTTOperatorLog("VID: set_mute_failure: ".concat(val));
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
130
171
|
usePageEvent('onShow', useMemoizedFn(async () => {
|
|
131
172
|
getNetworkType({
|
|
132
173
|
success: res => {
|
|
@@ -143,7 +184,7 @@ const Player = props => {
|
|
|
143
184
|
return;
|
|
144
185
|
}
|
|
145
186
|
// 视图准备就绪
|
|
146
|
-
if (phoneNetworkConnect && playState.initLy && ipcCtx.current && onlineStatus && !privateState) {
|
|
187
|
+
if (phoneNetworkConnect && playState.initLy && ipcCtx.current && onlineStatus && !privateState && !limitFlow && autoPlay) {
|
|
147
188
|
ipcTTTOperatorLog('VID: onShow_event_to_retry');
|
|
148
189
|
retry();
|
|
149
190
|
}
|
|
@@ -162,6 +203,24 @@ const Player = props => {
|
|
|
162
203
|
setScreenType(type);
|
|
163
204
|
}
|
|
164
205
|
});
|
|
206
|
+
|
|
207
|
+
// 针对limitFlow
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
if (limitFlow || !autoPlay) {
|
|
210
|
+
setPlayState(d => {
|
|
211
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
212
|
+
loadingState: false,
|
|
213
|
+
errorState: true,
|
|
214
|
+
errorMessage: ''
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
ipcTTTOperatorLog("limitFlow ~~~~ ".concat(limitFlow, " autoPlay ~~~ ").concat(autoPlay));
|
|
218
|
+
if (playState.initLy && ipcCtx.current) {
|
|
219
|
+
stopPreview();
|
|
220
|
+
disconnect();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}, [limitFlow, autoPlay, playState.initLy, ipcCtx.current]);
|
|
165
224
|
useEffect(() => {
|
|
166
225
|
registerDeviceListListener({
|
|
167
226
|
deviceIdList: [devId],
|
|
@@ -192,6 +251,7 @@ const Player = props => {
|
|
|
192
251
|
onDpDataChange(handleDpDataChange);
|
|
193
252
|
}, []);
|
|
194
253
|
usePageEvent('onHide', useMemoizedFn(async () => {
|
|
254
|
+
ipcTTTOperatorLog('VID: onHide event will go to stopPreview');
|
|
195
255
|
if (ignoreHideStopPreview) {
|
|
196
256
|
return;
|
|
197
257
|
}
|
|
@@ -208,22 +268,6 @@ const Player = props => {
|
|
|
208
268
|
stopPreview();
|
|
209
269
|
disconnect();
|
|
210
270
|
}));
|
|
211
|
-
useMount(() => {
|
|
212
|
-
onNetworkStatusChange(res => {
|
|
213
|
-
setPhoneNetworkConnect(res.isConnected);
|
|
214
|
-
if (!res.isConnected) {
|
|
215
|
-
// 断网,需要主动调用断流以及断开P2P
|
|
216
|
-
ipcTTTOperatorLog('VID: network is not connected, need stop preview and disconnect');
|
|
217
|
-
stopPreview();
|
|
218
|
-
disconnect();
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
useUnmount(() => {
|
|
223
|
-
offNetworkStatusChange(res => {
|
|
224
|
-
console.log(res);
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
271
|
const handleDpDataChange = useMemoizedFn(res => {
|
|
228
272
|
if (res.deviceId === devId) {
|
|
229
273
|
const dpsInfo = res.dps;
|
|
@@ -277,7 +321,8 @@ const Player = props => {
|
|
|
277
321
|
});
|
|
278
322
|
|
|
279
323
|
/**
|
|
280
|
-
* 监听mqtt
|
|
324
|
+
* 监听mqtt协议消息
|
|
325
|
+
* 主要用于低功耗设备的唤醒状态监听
|
|
281
326
|
*/
|
|
282
327
|
useEffect(() => {
|
|
283
328
|
registerMQTTProtocolListener({
|
|
@@ -299,6 +344,31 @@ const Player = props => {
|
|
|
299
344
|
};
|
|
300
345
|
}, []);
|
|
301
346
|
|
|
347
|
+
/**
|
|
348
|
+
* 监听网络状态变化
|
|
349
|
+
* 组件挂载时开始监听,网络断开时主动停流和断开连接
|
|
350
|
+
* 组件卸载时移除监听器
|
|
351
|
+
*/
|
|
352
|
+
useEffect(() => {
|
|
353
|
+
const handleNetworkStatusChange = res => {
|
|
354
|
+
setPhoneNetworkConnect(res.isConnected);
|
|
355
|
+
if (!res.isConnected) {
|
|
356
|
+
// 断网,需要主动调用断流以及断开P2P
|
|
357
|
+
ipcTTTOperatorLog('VID: network is not connected, need stop preview and disconnect');
|
|
358
|
+
stopPreview();
|
|
359
|
+
disconnect();
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
// 开始监听网络状态变化
|
|
364
|
+
onNetworkStatusChange(handleNetworkStatusChange);
|
|
365
|
+
|
|
366
|
+
// 清理函数:组件卸载时移除网络状态监听器
|
|
367
|
+
return () => {
|
|
368
|
+
offNetworkStatusChange(handleNetworkStatusChange);
|
|
369
|
+
};
|
|
370
|
+
}, [stopPreview, disconnect]);
|
|
371
|
+
|
|
302
372
|
/**
|
|
303
373
|
* 唤醒设备TTT能力
|
|
304
374
|
*/
|
|
@@ -307,13 +377,23 @@ const Player = props => {
|
|
|
307
377
|
enabled: enableWakeUpInterval,
|
|
308
378
|
intervalTime: 300
|
|
309
379
|
});
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* 监听设备休眠状态变化
|
|
383
|
+
* 当检测到设备上报休眠后,触发重新连接
|
|
384
|
+
*/
|
|
310
385
|
useEffect(() => {
|
|
311
386
|
if (wirelessFlag) {
|
|
312
387
|
// 进入面板后,若监听到设备上报休眠后, 需进行重新连接
|
|
313
388
|
setWirelessFlag(false);
|
|
314
389
|
_reConnect();
|
|
315
390
|
}
|
|
316
|
-
}, [wirelessFlag]);
|
|
391
|
+
}, [wirelessFlag, _reConnect]);
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* 初始化获取网络类型
|
|
395
|
+
* 组件挂载时主动获取一次当前网络状态
|
|
396
|
+
*/
|
|
317
397
|
useEffect(() => {
|
|
318
398
|
getNetworkType({
|
|
319
399
|
success: res => {
|
|
@@ -326,18 +406,29 @@ const Player = props => {
|
|
|
326
406
|
}
|
|
327
407
|
});
|
|
328
408
|
}, []);
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* IPC实例生命周期管理
|
|
412
|
+
* 当设备在线且devId变化时创建IPC实例
|
|
413
|
+
* 组件卸载时断开连接并清理实例
|
|
414
|
+
*/
|
|
329
415
|
useEffect(() => {
|
|
330
416
|
onlineStatus && createIpcCtx();
|
|
331
417
|
return () => {
|
|
332
418
|
disconnect();
|
|
333
419
|
ipcCtx.current = null;
|
|
334
420
|
};
|
|
335
|
-
}, [devId, onlineStatus]);
|
|
421
|
+
}, [devId, onlineStatus, disconnect]);
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* 外部重连指令处理
|
|
425
|
+
* 当接收到外部重连指令且设备在线时,触发重新连接
|
|
426
|
+
*/
|
|
336
427
|
useEffect(() => {
|
|
337
428
|
if (reConnect && devId && onlineStatus) {
|
|
338
429
|
_reConnect();
|
|
339
430
|
}
|
|
340
|
-
}, [reConnect]);
|
|
431
|
+
}, [reConnect, devId, onlineStatus, _reConnect]);
|
|
341
432
|
useEffect(() => {
|
|
342
433
|
muteRef.current = defaultMute;
|
|
343
434
|
}, [defaultMute]);
|
|
@@ -361,10 +452,19 @@ const Player = props => {
|
|
|
361
452
|
console.log('监听到设备离线');
|
|
362
453
|
setPlayState(d => {
|
|
363
454
|
d.errorState = true;
|
|
364
|
-
d.errorMsg = Strings.getLang('ipc_player_device_offline');
|
|
455
|
+
d.errorMsg = limitFlow ? Strings.getLang('ipc_player_traffic_load_offline_limit_tip') : Strings.getLang('ipc_player_device_offline');
|
|
456
|
+
});
|
|
457
|
+
} else if (!autoPlay) {
|
|
458
|
+
setPlayState(d => {
|
|
459
|
+
d.errorState = true;
|
|
460
|
+
d.errorMsg = '设备处于休眠中';
|
|
461
|
+
});
|
|
462
|
+
} else if (limitFlow) {
|
|
463
|
+
setPlayState(d => {
|
|
464
|
+
d.errorState = true;
|
|
465
|
+
d.errorMsg = Strings.getLang('ipc_player_traffic_load_online_zero_tip');
|
|
365
466
|
});
|
|
366
467
|
} else if (playState.initLy && !privateState) {
|
|
367
|
-
console.log('sdhjsahdjshajdh');
|
|
368
468
|
ipcTTTOperatorLog("VID: privateState_status_change: ".concat(privateState));
|
|
369
469
|
retry();
|
|
370
470
|
} else if (playState.initLy && privateState) {
|
|
@@ -373,139 +473,10 @@ const Player = props => {
|
|
|
373
473
|
onChangeStreamStatus && onChangeStreamStatus(-1001);
|
|
374
474
|
}
|
|
375
475
|
}
|
|
376
|
-
}, [phoneNetworkConnect, onlineStatus, playState.initLy, privateState]);
|
|
377
|
-
|
|
378
|
-
// 重试
|
|
379
|
-
const _retry = async () => {
|
|
380
|
-
console.log('调用了重试');
|
|
381
|
-
const connectState = await getIsConnected(ipcCtx.current);
|
|
382
|
-
console.log('调用了重试--connectState');
|
|
383
|
-
const isOnPreview = await getIsOnPreview(ipcCtx.current);
|
|
384
|
-
console.log('调用了重试--isOnPreview');
|
|
385
|
-
setPlayState(d => {
|
|
386
|
-
d.connectState = connectState ? true : false;
|
|
387
|
-
d.errorMsg = '';
|
|
388
|
-
d.errorState = false;
|
|
389
|
-
d.loadingState = isOnPreview ? false : true;
|
|
390
|
-
});
|
|
391
|
-
setVideoErrCode('');
|
|
392
|
-
// !prePlayRef.current && connectState && (await disconnect());
|
|
393
|
-
// console.log(connectState, isOnPreview, '当前链接状态和预览状态');
|
|
394
|
-
ipcTTTOperatorLog("VID: start_create_p2p_connect");
|
|
395
|
-
ipcCtx.current && createConnect();
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
// 无需关心连接状态直接发起重新连接
|
|
399
|
-
const _reConnect = () => {
|
|
400
|
-
console.log('不在播放器路由内, 不进行标记');
|
|
401
|
-
// 排除默认值为"",不等于播放器路由时, 不进行连接操作
|
|
402
|
-
if (playerRoute !== '' && playerRoute !== getPlayerRoute()) {
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
setPlayState(d => {
|
|
406
|
-
d.connectState = true;
|
|
407
|
-
d.loadingText = Strings.getLang('ipc_player_get_video_stream');
|
|
408
|
-
d.errorMsg = '';
|
|
409
|
-
d.errorState = false;
|
|
410
|
-
d.loadingState = true;
|
|
411
|
-
});
|
|
412
|
-
setVideoErrCode('');
|
|
413
|
-
// !prePlayRef.current && connectState && (await disconnect());
|
|
414
|
-
// console.log(connectState, isOnPreview, '当前链接状态和预览状态');
|
|
415
|
-
ipcTTTOperatorLog("VID: start_create_p2p_connect");
|
|
416
|
-
ipcCtx.current && createConnect();
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* 关闭隐私模式,重新拉流
|
|
421
|
-
*/
|
|
422
|
-
const handleReWakeCamera = async () => {
|
|
423
|
-
setPlayState(d => {
|
|
424
|
-
d.connectState = true;
|
|
425
|
-
d.errorMsg = '';
|
|
426
|
-
d.loadingText = Strings.getLang('ipc_player_private_open_stream');
|
|
427
|
-
d.errorState = false;
|
|
428
|
-
d.loadingState = true;
|
|
429
|
-
});
|
|
430
|
-
setVideoErrCode('');
|
|
431
|
-
const sendDpId = await getDpIdByDpCode(devId, 'basic_private');
|
|
432
|
-
if (sendDpId === -1) {
|
|
433
|
-
showToast(Strings.getLang('ipc_player_basic_private_not_exist'));
|
|
434
|
-
} else {
|
|
435
|
-
publishDps({
|
|
436
|
-
deviceId: devId,
|
|
437
|
-
dps: {
|
|
438
|
-
[sendDpId]: false
|
|
439
|
-
},
|
|
440
|
-
mode: 1,
|
|
441
|
-
pipelines: [0, 1, 2, 3, 4, 5, 6],
|
|
442
|
-
options: {},
|
|
443
|
-
success: () => {
|
|
444
|
-
console.log('下发隐私模式成功');
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
*
|
|
452
|
-
* 低功耗设备关闭隐私模式,先判断设备是否唤醒,唤醒后才可下发隐私模式DP
|
|
453
|
-
*/
|
|
454
|
-
|
|
455
|
-
const handleReWakeCameraLowPowerDevice = useMemoizedFn(() => {
|
|
456
|
-
setVideoErrCode('');
|
|
457
|
-
setLowPrivateOutTimeFlag(false);
|
|
458
|
-
if (awakeStatus) {
|
|
459
|
-
setPlayState(d => {
|
|
460
|
-
d.connectState = true;
|
|
461
|
-
d.errorMsg = '';
|
|
462
|
-
d.loadingText = Strings.getLang('ipc_player_private_open_stream');
|
|
463
|
-
d.errorState = false;
|
|
464
|
-
d.loadingState = true;
|
|
465
|
-
});
|
|
466
|
-
// 如果值为true, 表示设备为唤醒状态,直接下发隐私模式DP
|
|
467
|
-
handleReWakeCamera();
|
|
468
|
-
} else {
|
|
469
|
-
setPlayState(d => {
|
|
470
|
-
d.connectState = true;
|
|
471
|
-
d.errorMsg = '';
|
|
472
|
-
d.loadingText = Strings.getLang('ipc_player_private_open_low_stream');
|
|
473
|
-
d.errorState = false;
|
|
474
|
-
d.loadingState = true;
|
|
475
|
-
});
|
|
476
|
-
// 如果值为false, 表示设备为睡眠状态,需要唤醒设备
|
|
477
|
-
setMqttPrivateFlag(true);
|
|
478
|
-
setEnableWakeUpInterval(true);
|
|
479
|
-
// 2秒后停止下发唤醒, 防止频繁唤醒, 此时若Mqtt监听到1协议,也会停止下发唤醒
|
|
480
|
-
privateLowPowerDeviceTimeOutRef.current = setTimeout(() => {
|
|
481
|
-
setEnableWakeUpInterval(false);
|
|
482
|
-
// 清除定时器
|
|
483
|
-
privateLowPowerDeviceTimeOutRef.current && clearTimeout(privateLowPowerDeviceTimeOutRef.current);
|
|
484
|
-
}, 2000);
|
|
485
|
-
|
|
486
|
-
// 15 秒后若设备还是未唤醒,未监听到Mqtt消息以及唤醒Dp上报, 则提示报错
|
|
487
|
-
privateWakeOutTimeRef.current = setTimeout(() => {
|
|
488
|
-
// 清除定时器
|
|
489
|
-
privateLowPowerDeviceTimeOutRef.current && clearTimeout(privateWakeOutTimeRef.current);
|
|
490
|
-
setPlayState(d => {
|
|
491
|
-
d.connectState = false;
|
|
492
|
-
d.errorMsg = Strings.getLang('ipc_player_private_open_low_stream_fail');
|
|
493
|
-
d.errorState = true;
|
|
494
|
-
d.loadingState = false;
|
|
495
|
-
});
|
|
496
|
-
setMqttPrivateFlag(false);
|
|
497
|
-
setLowPrivateOutTimeFlag(true);
|
|
498
|
-
}, 15000);
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
const getPlayerRoute = () => {
|
|
502
|
-
const pages = getCurrentPages(); // 获取当前页面栈
|
|
503
|
-
const currentPage = pages[pages.length - 1]; // 获取当前页面实例
|
|
504
|
-
return currentPage.route;
|
|
505
|
-
};
|
|
476
|
+
}, [phoneNetworkConnect, onlineStatus, playState.initLy, privateState, limitFlow, autoPlay]);
|
|
506
477
|
const retry = useMemoizedFn(() => {
|
|
507
478
|
console.log('重新拉流启动');
|
|
508
|
-
|
|
479
|
+
setAutoPlay(true);
|
|
509
480
|
// 任何重试拉流时, 将播放器状态还原为loading状态
|
|
510
481
|
setVideoErrCode('');
|
|
511
482
|
setPlayState(d => {
|
|
@@ -535,149 +506,8 @@ const Player = props => {
|
|
|
535
506
|
});
|
|
536
507
|
};
|
|
537
508
|
|
|
538
|
-
// 建立连接
|
|
539
|
-
const createConnect = useMemoizedFn(async params => {
|
|
540
|
-
var _ipcCtx$current;
|
|
541
|
-
if (playerRoute !== '' && playerRoute !== getPlayerRoute()) {
|
|
542
|
-
console.log('不在播放器路由内, 不进行连接操作');
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
// console.log('建立连接前:', devId, Date.now());
|
|
546
|
-
// 若走到连接状态,需清除低功耗15秒超时定时
|
|
547
|
-
privateLowPowerDeviceTimeOutRef.current && clearTimeout(privateWakeOutTimeRef.current);
|
|
548
|
-
setLowPrivateOutTimeFlag(false);
|
|
549
|
-
// 表示为 149 低功耗设备, 唤醒设备
|
|
550
|
-
if (isLowPowerDevice) {
|
|
551
|
-
// 下发唤醒
|
|
552
|
-
setEnableWakeUpInterval(true);
|
|
553
|
-
}
|
|
554
|
-
(_ipcCtx$current = ipcCtx.current) === null || _ipcCtx$current === void 0 || _ipcCtx$current.connect({
|
|
555
|
-
success: () => {
|
|
556
|
-
ipcTTTOperatorLog("VID: create_p2p_connect_success");
|
|
557
|
-
// 清除唤醒定时器
|
|
558
|
-
setEnableWakeUpInterval(false);
|
|
559
|
-
setPlayState(d => {
|
|
560
|
-
d.connectState = true;
|
|
561
|
-
d.loadingText = Strings.getLang('ipc_player_get_video_stream');
|
|
562
|
-
d.errorState = false;
|
|
563
|
-
d.errorMsg = '';
|
|
564
|
-
});
|
|
565
|
-
onChangeStreamStatus && onChangeStreamStatus(1001);
|
|
566
|
-
ipcTTTOperatorLog("VID: start_to_preview");
|
|
567
|
-
startPreview(params);
|
|
568
|
-
},
|
|
569
|
-
fail: () => {
|
|
570
|
-
// 清除唤醒定时器
|
|
571
|
-
setEnableWakeUpInterval(false);
|
|
572
|
-
ipcTTTOperatorLog("VID: create_p2p_connect_failure");
|
|
573
|
-
// 针对进入面板上报149状态的为true的设备直接忽略
|
|
574
|
-
if (!wirelessFlag) {
|
|
575
|
-
setPlayState(d => {
|
|
576
|
-
d.connectState = false;
|
|
577
|
-
d.errorState = true;
|
|
578
|
-
d.errorMsg = Strings.getLang('ipc_player_connect_fail');
|
|
579
|
-
d.loadingState = false;
|
|
580
|
-
});
|
|
581
|
-
onChangeStreamStatus && onChangeStreamStatus(-1001);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
|
-
});
|
|
586
|
-
|
|
587
509
|
// 视图层准备就绪,开始建立连接
|
|
588
510
|
|
|
589
|
-
/*
|
|
590
|
-
* 开启预览
|
|
591
|
-
*/
|
|
592
|
-
const startPreview = useMemoizedFn(params => {
|
|
593
|
-
var _ipcCtx$current2;
|
|
594
|
-
// console.log('开启预览前');
|
|
595
|
-
(_ipcCtx$current2 = ipcCtx.current) === null || _ipcCtx$current2 === void 0 || _ipcCtx$current2.startPreview({
|
|
596
|
-
success: () => {
|
|
597
|
-
ipcTTTOperatorLog('VID: start_preview_success');
|
|
598
|
-
if (typeof performanceEvent === 'function' && !firstPreviewTimeRef.current) {
|
|
599
|
-
performanceEvent({
|
|
600
|
-
launchData: '出流成功耗时',
|
|
601
|
-
success: () => {
|
|
602
|
-
firstPreviewTimeRef.current = true;
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
// console.log('开启预览:', devId);
|
|
608
|
-
setPlayState(d => {
|
|
609
|
-
d.loadingState = false;
|
|
610
|
-
d.errorState = false;
|
|
611
|
-
d.errorMsg = '';
|
|
612
|
-
});
|
|
613
|
-
setMuted(muteRef.current);
|
|
614
|
-
params && onInitPreview && onInitPreview(devId);
|
|
615
|
-
onChangeStreamStatus && onChangeStreamStatus(1002);
|
|
616
|
-
},
|
|
617
|
-
fail: async e => {
|
|
618
|
-
ipcTTTOperatorLog("VID: start_preview_fail: ".concat(JSON.stringify(e)));
|
|
619
|
-
const isOnPreview = await getIsOnPreview(ipcCtx.current);
|
|
620
|
-
ipcTTTOperatorLog("VID: get_is_on_preview_status_".concat(isOnPreview));
|
|
621
|
-
// console.error('开启失败:', e, devId, isOnPreview);
|
|
622
|
-
if (isOnPreview || e !== null && e !== void 0 && e.errorMsg.includes('doing preview')) {
|
|
623
|
-
// 忽略重复预览异常的报错
|
|
624
|
-
setPlayState(d => {
|
|
625
|
-
d.loadingState = false;
|
|
626
|
-
d.errorState = false;
|
|
627
|
-
d.errorMsg = '';
|
|
628
|
-
});
|
|
629
|
-
setMuted(muteRef.current);
|
|
630
|
-
onChangeStreamStatus && onChangeStreamStatus(1002);
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
|
-
// 针对进入到面板,接收到上报为设备休眠的情况直接忽略
|
|
634
|
-
if (!wirelessFlag) {
|
|
635
|
-
setPlayState(d => {
|
|
636
|
-
d.errorState = true;
|
|
637
|
-
d.loadingState = false;
|
|
638
|
-
d.errorMsg = Strings.getLang('ipc_player_preview_fail');
|
|
639
|
-
});
|
|
640
|
-
onChangeStreamStatus && onChangeStreamStatus(-1002);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* 暂停预览
|
|
648
|
-
*/
|
|
649
|
-
const stopPreview = () => {
|
|
650
|
-
var _ipcCtx$current3;
|
|
651
|
-
ipcTTTOperatorLog("VID: begin_to_stop_preview");
|
|
652
|
-
ipcTTTOperatorLog("VID: set_mute_is_true");
|
|
653
|
-
setMuted(true);
|
|
654
|
-
(_ipcCtx$current3 = ipcCtx.current) === null || _ipcCtx$current3 === void 0 || _ipcCtx$current3.stopPreview({
|
|
655
|
-
success: () => {
|
|
656
|
-
ipcTTTOperatorLog("VID: stop_preview_success");
|
|
657
|
-
},
|
|
658
|
-
fail: e => {
|
|
659
|
-
ipcTTTOperatorLog("VID: stop_preview_failure: ".concat(JSON.stringify(e)));
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
};
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* 设置声音
|
|
666
|
-
*/
|
|
667
|
-
const setMuted = val => {
|
|
668
|
-
var _ipcCtx$current4;
|
|
669
|
-
ipcTTTOperatorLog("VID: begin_to_set_mute");
|
|
670
|
-
(_ipcCtx$current4 = ipcCtx.current) === null || _ipcCtx$current4 === void 0 || _ipcCtx$current4.setMuted({
|
|
671
|
-
mute: val,
|
|
672
|
-
success: () => {
|
|
673
|
-
ipcTTTOperatorLog("VID: set_mute_success: ".concat(val));
|
|
674
|
-
},
|
|
675
|
-
fail: () => {
|
|
676
|
-
ipcTTTOperatorLog("VID: set_mute_failure: ".concat(val));
|
|
677
|
-
}
|
|
678
|
-
});
|
|
679
|
-
};
|
|
680
|
-
|
|
681
511
|
/**
|
|
682
512
|
* 获取当前是否静音
|
|
683
513
|
*/
|
|
@@ -745,29 +575,6 @@ const Player = props => {
|
|
|
745
575
|
}
|
|
746
576
|
});
|
|
747
577
|
|
|
748
|
-
// 断开连接
|
|
749
|
-
const disconnect = () => {
|
|
750
|
-
return new Promise((resolve, reject) => {
|
|
751
|
-
var _ipcCtx$current6;
|
|
752
|
-
// console.log('断开连接前');
|
|
753
|
-
(_ipcCtx$current6 = ipcCtx.current) === null || _ipcCtx$current6 === void 0 || _ipcCtx$current6.disconnect({
|
|
754
|
-
success: res => {
|
|
755
|
-
// console.log('断开连接成功:', devId);
|
|
756
|
-
resolve(res);
|
|
757
|
-
setPlayState(d => {
|
|
758
|
-
d.connectState = false;
|
|
759
|
-
});
|
|
760
|
-
onChangeStreamStatus && onChangeStreamStatus(1009);
|
|
761
|
-
},
|
|
762
|
-
fail: e => {
|
|
763
|
-
// console.error('断开连接失败:', devId);
|
|
764
|
-
reject(e);
|
|
765
|
-
onChangeStreamStatus && onChangeStreamStatus(-1009);
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
});
|
|
769
|
-
};
|
|
770
|
-
|
|
771
578
|
/**
|
|
772
579
|
* 播放器容器点击事件
|
|
773
580
|
*/
|
|
@@ -789,7 +596,7 @@ const Player = props => {
|
|
|
789
596
|
*/
|
|
790
597
|
|
|
791
598
|
const handleCameraPreviewFailure = useMemoizedFn(data => {
|
|
792
|
-
console.log(data, '
|
|
599
|
+
console.log(data, 'handleCameraPreviewFailure');
|
|
793
600
|
ipcTTTOperatorLog("cameraPreviewFailure_event_trigger_".concat(JSON.stringify(data)));
|
|
794
601
|
if (data.type === 'cameraPreviewFailure' && !privateState) {
|
|
795
602
|
// 隐私模式时不展示错误
|
|
@@ -811,181 +618,6 @@ const Player = props => {
|
|
|
811
618
|
}
|
|
812
619
|
}
|
|
813
620
|
});
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* 获取错误展示内容
|
|
817
|
-
*/
|
|
818
|
-
const getErrorContent = useMemoizedFn(() => {
|
|
819
|
-
if (!phoneNetworkConnect) {
|
|
820
|
-
return Strings.getLang('ipc_player_network_fail');
|
|
821
|
-
}
|
|
822
|
-
if (!onlineStatus) {
|
|
823
|
-
return Strings.getLang('ipc_player_device_offline');
|
|
824
|
-
}
|
|
825
|
-
if (!isLowPowerDevice && onlineStatus && privateState) {
|
|
826
|
-
return Strings.getLang('ipc_player_device_sleep');
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
// 低功耗隐私模式正常唤醒
|
|
830
|
-
if (isLowPowerDevice && lowPowerDeviceOnlineState && privateState && !lowPrivateOutTimeFlag) {
|
|
831
|
-
return Strings.getLang('ipc_player_device_sleep');
|
|
832
|
-
}
|
|
833
|
-
// 低功耗隐私模式正常唤醒,下发指令失败
|
|
834
|
-
if (isLowPowerDevice && lowPowerDeviceOnlineState && privateState && !lowPrivateOutTimeFlag) {
|
|
835
|
-
return Strings.getLang('ipc_player_private_open_low_stream_fail');
|
|
836
|
-
}
|
|
837
|
-
if (!isLowPowerDevice && device4GIsFreeze && onlineStatus && !privateState) {
|
|
838
|
-
return deviceFreezeReasonStore[deviceFreezeReason];
|
|
839
|
-
}
|
|
840
|
-
if (isLowPowerDevice && device4GIsFreeze && lowPowerDeviceOnlineState && !privateState) {
|
|
841
|
-
return deviceFreezeReasonStore[deviceFreezeReason];
|
|
842
|
-
}
|
|
843
|
-
if (onlineStatus && trafficLessOrEqualZero) {
|
|
844
|
-
return Strings.getLang('ipc_player_traffic_load_online_zero_tip');
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
// if (isLowPowerDevice && lowPowerDeviceOnlineState) {
|
|
848
|
-
// return Strings.getLang('ipc_player_traffic_load_online_zero_tip');
|
|
849
|
-
// }
|
|
850
|
-
|
|
851
|
-
if (!onlineStatus) {
|
|
852
|
-
return Strings.getLang('ipc_player_no_line');
|
|
853
|
-
}
|
|
854
|
-
if (videoErrCode !== '') {
|
|
855
|
-
if (Strings["ipc_player_error_".concat(codeCoverToInt(videoErrCode))]) {
|
|
856
|
-
return "".concat(Strings.getLang("ipc_player_error_".concat(codeCoverToInt(videoErrCode))), "(").concat(videoErrCode, ")");
|
|
857
|
-
}
|
|
858
|
-
return "".concat(Strings.getLang("ipc_player_error_common"), "(").concat(videoErrCode, ")");
|
|
859
|
-
}
|
|
860
|
-
return playState.errorMsg;
|
|
861
|
-
});
|
|
862
|
-
|
|
863
|
-
/**
|
|
864
|
-
* 根据自定义类型获取错误码展示内容
|
|
865
|
-
*/
|
|
866
|
-
|
|
867
|
-
const getErrorContentByType = useMemoizedFn((errCode, type) => {
|
|
868
|
-
const errContent = getErrCodeDetailDataByCode(String(errCode));
|
|
869
|
-
const contentEmpty = _isEmpty(errContent);
|
|
870
|
-
switch (type) {
|
|
871
|
-
// 是否展示建议文案
|
|
872
|
-
case 'suggestedFlag':
|
|
873
|
-
if (hideSuggestedText) {
|
|
874
|
-
return false;
|
|
875
|
-
}
|
|
876
|
-
if (contentEmpty) {
|
|
877
|
-
return false;
|
|
878
|
-
}
|
|
879
|
-
return errContent.suggestedText !== '';
|
|
880
|
-
|
|
881
|
-
// 建议文案
|
|
882
|
-
case 'suggestedText':
|
|
883
|
-
if (contentEmpty || privateState) {
|
|
884
|
-
return '';
|
|
885
|
-
}
|
|
886
|
-
return errContent.suggestedText;
|
|
887
|
-
// 是否展示点我重试
|
|
888
|
-
case 'retry':
|
|
889
|
-
if (!phoneNetworkConnect) {
|
|
890
|
-
return false;
|
|
891
|
-
}
|
|
892
|
-
if (!isLowPowerDevice && !onlineStatus) {
|
|
893
|
-
return false;
|
|
894
|
-
}
|
|
895
|
-
if (isLowPowerDevice && !lowPowerDeviceOnlineState) {
|
|
896
|
-
return false;
|
|
897
|
-
}
|
|
898
|
-
if (privateState && !isShare && !device4GIsFreeze) {
|
|
899
|
-
return true;
|
|
900
|
-
}
|
|
901
|
-
if (privateState && isShare) {
|
|
902
|
-
return false;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
// 设备4G冻结,冻结原因为特殊情况下,展示retry
|
|
906
|
-
if (device4GIsFreeze && onlineStatus && !privateState && deviceFreezeReason === 1) {
|
|
907
|
-
return true;
|
|
908
|
-
}
|
|
909
|
-
if (contentEmpty || privateState) {
|
|
910
|
-
return true;
|
|
911
|
-
}
|
|
912
|
-
return errContent.try;
|
|
913
|
-
// 是否展示点我重试
|
|
914
|
-
case 'retryText':
|
|
915
|
-
if (privateState) {
|
|
916
|
-
return Strings.getLang('ipc_player_re_wake_camera');
|
|
917
|
-
}
|
|
918
|
-
return Strings.getLang('ipc_player_retry');
|
|
919
|
-
case 'help':
|
|
920
|
-
if (hideHelpButton) {
|
|
921
|
-
return false;
|
|
922
|
-
}
|
|
923
|
-
if (!phoneNetworkConnect || privateState) {
|
|
924
|
-
return false;
|
|
925
|
-
}
|
|
926
|
-
if (isLowPowerDevice && lowPowerDeviceOnlineState) {
|
|
927
|
-
return false;
|
|
928
|
-
}
|
|
929
|
-
if (isLowPowerDevice && !lowPowerDeviceOnlineState) {
|
|
930
|
-
return true;
|
|
931
|
-
}
|
|
932
|
-
if (!isLowPowerDevice && !onlineStatus) {
|
|
933
|
-
return true;
|
|
934
|
-
}
|
|
935
|
-
if (privateState && isShare) {
|
|
936
|
-
return false;
|
|
937
|
-
}
|
|
938
|
-
if (contentEmpty) {
|
|
939
|
-
return false;
|
|
940
|
-
}
|
|
941
|
-
return errContent.help;
|
|
942
|
-
case 'helpNum':
|
|
943
|
-
if (privateState && isShare) {
|
|
944
|
-
return false;
|
|
945
|
-
}
|
|
946
|
-
return errContent.helpNum;
|
|
947
|
-
case 'feedBack':
|
|
948
|
-
if (hideFeedBackButton) {
|
|
949
|
-
return false;
|
|
950
|
-
}
|
|
951
|
-
if (!phoneNetworkConnect) {
|
|
952
|
-
return true;
|
|
953
|
-
}
|
|
954
|
-
if (privateState) {
|
|
955
|
-
return false;
|
|
956
|
-
}
|
|
957
|
-
if (contentEmpty) {
|
|
958
|
-
return false;
|
|
959
|
-
}
|
|
960
|
-
return errContent.feedBack;
|
|
961
|
-
default:
|
|
962
|
-
return false;
|
|
963
|
-
}
|
|
964
|
-
});
|
|
965
|
-
|
|
966
|
-
/**
|
|
967
|
-
* 跳转帮助小程序
|
|
968
|
-
*/
|
|
969
|
-
const handleGotoHelpMini = useMemoizedFn(async () => {
|
|
970
|
-
if (isLowPowerDevice && !lowPowerDeviceOnlineState || !onlineStatus) {
|
|
971
|
-
const realLanguage = await getLanguage();
|
|
972
|
-
const url = "godzilla://".concat(miniIdLabs.helpMini, "/pages/commonDetails/index?answer=/app-helpcenter/").concat(realLanguage, "/K94ow0gwu9bg2");
|
|
973
|
-
openTargetMinByShortLink(url);
|
|
974
|
-
return false;
|
|
975
|
-
}
|
|
976
|
-
const helpNum = getErrorContentByType(videoErrCode, 'helpNum');
|
|
977
|
-
const helpFeedBack = getErrorContentByType(videoErrCode, 'helpFeedBack');
|
|
978
|
-
const homeInfo = await getHomeInfo();
|
|
979
|
-
const devInfo = await getDeviceInfo(devId);
|
|
980
|
-
const url = "godzilla://".concat(miniIdLabs.ipcHelpMini, "?errCode=").concat(videoErrCode, "&deviceId=").concat(devId, "&homeId=").concat(homeInfo === null || homeInfo === void 0 ? void 0 : homeInfo.homeId, "&instanceId=").concat(devInfo === null || devInfo === void 0 ? void 0 : devInfo.uuid, "&helpNum=").concat(helpNum, "&helpFeedBack=").concat(helpFeedBack, "&themeColor=").concat(brandColor);
|
|
981
|
-
openTargetMinByShortLink(url);
|
|
982
|
-
return false;
|
|
983
|
-
});
|
|
984
|
-
|
|
985
|
-
/**
|
|
986
|
-
* 跳转反馈小程序
|
|
987
|
-
*/
|
|
988
|
-
|
|
989
621
|
return /*#__PURE__*/React.createElement(View, {
|
|
990
622
|
className: getClassName('ipc-player'),
|
|
991
623
|
onClick: () => {
|
|
@@ -1022,61 +654,47 @@ const Player = props => {
|
|
|
1022
654
|
borderColor: borderColor,
|
|
1023
655
|
borderWidth: borderWidth,
|
|
1024
656
|
backgroundColor: bgColor
|
|
1025
|
-
}, extend)), /*#__PURE__*/React.createElement(
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
className: clsx(getClassName('operator-btn'), getClassName('operator-retry')),
|
|
1059
|
-
style: {
|
|
1060
|
-
backgroundColor: "".concat(brandColor)
|
|
1061
|
-
},
|
|
1062
|
-
onClick: retry
|
|
1063
|
-
}, getErrorContentByType(videoErrCode, 'retryText')), getErrorContentByType(videoErrCode, 'help') && /*#__PURE__*/React.createElement(View, {
|
|
1064
|
-
className: clsx(getClassName('operator-btn'), getClassName('operator-help')),
|
|
1065
|
-
onClick: handleGotoHelpMini
|
|
1066
|
-
}, Strings.getLang('ipc_player_help')), getErrorContentByType(videoErrCode, 'feedBack') && /*#__PURE__*/React.createElement(View, {
|
|
1067
|
-
className: clsx(getClassName('operator-btn'), getClassName('operator-feedback')),
|
|
1068
|
-
onClick: () => {
|
|
1069
|
-
const url = "godzilla://".concat(miniIdLabs.helpMini, "/pages/v2/problemSubmit/index");
|
|
1070
|
-
openTargetMinByShortLink(url);
|
|
1071
|
-
}
|
|
1072
|
-
}, Strings.getLang('ipc_player_feedback')))), screenType === 'landscape' && (playState.loadingState || playState.errorState) && /*#__PURE__*/React.createElement(CoverView, {
|
|
1073
|
-
className: clsx(getClassName('load-full-back-container')),
|
|
1074
|
-
onClick: () => {
|
|
657
|
+
}, extend)), /*#__PURE__*/React.createElement(LoadingOverlay, {
|
|
658
|
+
isLoading: playState.loadingState,
|
|
659
|
+
loadingText: loadText || playState.loadingText,
|
|
660
|
+
borderRadius: borderRadius,
|
|
661
|
+
getClassName: getClassName
|
|
662
|
+
}), /*#__PURE__*/React.createElement(ErrorOverlay, {
|
|
663
|
+
devId: devId,
|
|
664
|
+
isError: playState.errorState,
|
|
665
|
+
videoErrCode: videoErrCode,
|
|
666
|
+
borderRadius: borderRadius,
|
|
667
|
+
brandColor: brandColor,
|
|
668
|
+
getClassName: getClassName,
|
|
669
|
+
renderErrIcon: renderErrIcon,
|
|
670
|
+
onRetry: retry,
|
|
671
|
+
phoneNetworkConnect: phoneNetworkConnect,
|
|
672
|
+
onlineStatus: onlineStatus,
|
|
673
|
+
privateState: privateState,
|
|
674
|
+
isLowPowerDevice: isLowPowerDevice,
|
|
675
|
+
lowPowerDeviceOnlineState: lowPowerDeviceOnlineState,
|
|
676
|
+
lowPrivateOutTimeFlag: lowPrivateOutTimeFlag,
|
|
677
|
+
device4GIsFreeze: device4GIsFreeze,
|
|
678
|
+
deviceFreezeReason: deviceFreezeReason,
|
|
679
|
+
playStateErrorMsg: playState.errorMsg,
|
|
680
|
+
hideSuggestedText: hideSuggestedText,
|
|
681
|
+
hideHelpButton: hideHelpButton,
|
|
682
|
+
hideFeedBackButton: hideFeedBackButton,
|
|
683
|
+
isShare: isShare,
|
|
684
|
+
limitFlow: limitFlow,
|
|
685
|
+
autoPlay: autoPlay
|
|
686
|
+
}), /*#__PURE__*/React.createElement(FullScreenBackButton, {
|
|
687
|
+
isVisible: screenType === 'landscape' && (playState.loadingState || playState.errorState),
|
|
688
|
+
getClassName: getClassName,
|
|
689
|
+
onBackFullScreen: () => {
|
|
1075
690
|
setScreenType('portrait');
|
|
1076
691
|
setPageOrientation({
|
|
1077
692
|
pageOrientation: 'portrait',
|
|
1078
693
|
success: () => {
|
|
1079
|
-
|
|
694
|
+
console.log('Landscape mode exited successfully');
|
|
695
|
+
},
|
|
696
|
+
fail: () => {
|
|
697
|
+
console.log('Failed to exit landscape mode');
|
|
1080
698
|
}
|
|
1081
699
|
});
|
|
1082
700
|
}
|