@ray-js/ipc-player-integration 0.0.21 → 0.0.23
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/ctx/ctx.js +14 -3
- package/lib/ui/constant.d.ts +1 -0
- package/lib/ui/constant.js +1 -0
- package/lib/ui/ui.js +14 -2
- package/lib/widgets/recordVideo/recordVideo.js +9 -2
- package/lib/widgets/screenshot/screenshot.js +10 -2
- package/lib/widgets/voiceIntercom/voiceIntercom.js +14 -4
- package/package.json +2 -2
package/lib/ctx/ctx.js
CHANGED
|
@@ -7,6 +7,7 @@ import { getSystemInfoSync, showModal, openAppSystemSettingPage } from '@ray-js/
|
|
|
7
7
|
import Strings from '../i18n';
|
|
8
8
|
import { useAtom, updateAtom, getDefaultStore, useStore } from './store';
|
|
9
9
|
import { PlayState, IntercomMode } from '../interface';
|
|
10
|
+
import { changeIgnoreHideStopPreview } from '../ui/constant';
|
|
10
11
|
import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
11
12
|
import { getEventInstance } from './event';
|
|
12
13
|
const SAVE_TO_ALBUM = 1;
|
|
@@ -237,23 +238,28 @@ export const createUseCtx = _ref => {
|
|
|
237
238
|
const store = getDefaultStore();
|
|
238
239
|
const _intercom = store.get(intercom);
|
|
239
240
|
if (target && target === _intercom) {
|
|
241
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
240
242
|
console.log('Cannot intercom during video _intercom');
|
|
241
243
|
return false;
|
|
242
244
|
}
|
|
243
|
-
if (!target && target === _intercom)
|
|
245
|
+
if (!target && target === _intercom) {
|
|
246
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
244
249
|
return new Promise((resolve, reject) => {
|
|
245
250
|
if (target) {
|
|
246
251
|
ty.authorizeStatus({
|
|
247
252
|
// 麦克风权限
|
|
248
253
|
scope: 'scope.record',
|
|
249
|
-
success:
|
|
250
|
-
|
|
254
|
+
success: () => {
|
|
255
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
251
256
|
IPCPlayerInstance.current.startTalk({
|
|
252
257
|
success: () => {
|
|
253
258
|
updateAtom(intercom, true);
|
|
254
259
|
resolve(true);
|
|
255
260
|
},
|
|
256
261
|
fail: err => {
|
|
262
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
257
263
|
const errObj = err.innerError || err || {};
|
|
258
264
|
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_intercom');
|
|
259
265
|
toast({
|
|
@@ -264,10 +270,12 @@ export const createUseCtx = _ref => {
|
|
|
264
270
|
});
|
|
265
271
|
},
|
|
266
272
|
fail: () => {
|
|
273
|
+
console.log('authorizeStatus失败回调');
|
|
267
274
|
ty.authorize({
|
|
268
275
|
// 麦克风权限
|
|
269
276
|
scope: 'scope.record',
|
|
270
277
|
success: () => {
|
|
278
|
+
console.log('authorize成功回调');
|
|
271
279
|
IPCPlayerInstance.current.startTalk({
|
|
272
280
|
success: () => {
|
|
273
281
|
updateAtom(intercom, true);
|
|
@@ -339,6 +347,7 @@ export const createUseCtx = _ref => {
|
|
|
339
347
|
toast({
|
|
340
348
|
title: Strings.getLang('ipc_player_recording_now_tip')
|
|
341
349
|
});
|
|
350
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
342
351
|
return false;
|
|
343
352
|
}
|
|
344
353
|
return new Promise((resolve, reject) => {
|
|
@@ -347,6 +356,7 @@ export const createUseCtx = _ref => {
|
|
|
347
356
|
ty.authorizeStatus({
|
|
348
357
|
scope: 'scope.writePhotosAlbum',
|
|
349
358
|
success: () => {
|
|
359
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
350
360
|
IPCPlayerInstance.current.startRecord({
|
|
351
361
|
saveToAlbum,
|
|
352
362
|
success: () => {
|
|
@@ -354,6 +364,7 @@ export const createUseCtx = _ref => {
|
|
|
354
364
|
resolve(true);
|
|
355
365
|
},
|
|
356
366
|
fail: err => {
|
|
367
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
357
368
|
reject(err);
|
|
358
369
|
}
|
|
359
370
|
});
|
package/lib/ui/constant.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const ptzControlTipId = "ptzControlTipId";
|
|
|
11
11
|
export declare const fullResolutionId = "fullResolutionId";
|
|
12
12
|
export declare const batteryId = "Battery";
|
|
13
13
|
export declare const fullSmallIntercomId = "FullSmallIntercom";
|
|
14
|
+
export declare const changeIgnoreHideStopPreview = "changeIgnoreHideStopPreview";
|
|
14
15
|
export declare const decodeClarityDic: {
|
|
15
16
|
SS: string;
|
|
16
17
|
SD: string;
|
package/lib/ui/constant.js
CHANGED
|
@@ -11,6 +11,7 @@ export const ptzControlTipId = 'ptzControlTipId';
|
|
|
11
11
|
export const fullResolutionId = 'fullResolutionId';
|
|
12
12
|
export const batteryId = 'Battery';
|
|
13
13
|
export const fullSmallIntercomId = 'FullSmallIntercom';
|
|
14
|
+
export const changeIgnoreHideStopPreview = 'changeIgnoreHideStopPreview';
|
|
14
15
|
export const decodeClarityDic = {
|
|
15
16
|
SS: 'ss',
|
|
16
17
|
// 省流量
|
package/lib/ui/ui.js
CHANGED
|
@@ -11,7 +11,7 @@ import { PlayState, PlayerStreamStatus } from '../interface';
|
|
|
11
11
|
import { useCtx } from '../ctx/ctx.composition';
|
|
12
12
|
import { useStore } from '../ctx/store';
|
|
13
13
|
import { UIEventContext } from './context';
|
|
14
|
-
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic } from './constant';
|
|
14
|
+
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic, changeIgnoreHideStopPreview } from './constant';
|
|
15
15
|
import BottomLeftContent from './bottomLeftContent';
|
|
16
16
|
import BottomRightContent from './bottomRightContent';
|
|
17
17
|
import TopLeftContent from './topLeftContent';
|
|
@@ -94,10 +94,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
94
94
|
const [scaleMultiple, setScaleMultiple] = useState(playerFit === 'contain' ? 1 : -2);
|
|
95
95
|
const [currentZoomLevel, setCurrentZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
|
|
96
96
|
const [createCtx, setCreateCtx] = useState(false);
|
|
97
|
+
// 是否需要忽略进入后台停止预览
|
|
98
|
+
const [ignoreStopOnHide, setIgnoreStopOnHide] = useState(ignoreHideStopPreview);
|
|
97
99
|
const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
|
|
98
100
|
// const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
|
|
99
101
|
// const [verticalZoomLevel, setVerticalZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
|
|
100
102
|
|
|
103
|
+
// 外部传入的ignoreHideStopPreview变化时,同步更新
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
setIgnoreStopOnHide(ignoreHideStopPreview);
|
|
106
|
+
}, [ignoreHideStopPreview]);
|
|
101
107
|
const handleOrientationChange = useMemoizedFn(data => {
|
|
102
108
|
console.log(data, 'data=============');
|
|
103
109
|
const {
|
|
@@ -466,6 +472,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
466
472
|
const listenShowEvent = useMemoizedFn(() => {
|
|
467
473
|
setComponentHideState(false);
|
|
468
474
|
});
|
|
475
|
+
const onChangeIgnoreHideStopPreview = state => {
|
|
476
|
+
setIgnoreStopOnHide(state);
|
|
477
|
+
};
|
|
469
478
|
useEffect(() => {
|
|
470
479
|
eventRef.current.on(startTimeToHideAllComponent, listenStart);
|
|
471
480
|
eventRef.current.on(pauseTimeToHideAllComponent, listenPause);
|
|
@@ -473,6 +482,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
473
482
|
eventRef.current.on(hideAllComponent, listenHideEvent);
|
|
474
483
|
eventRef.current.on('disablePlayerTap', handDisablePlayerTap);
|
|
475
484
|
eventRef.current.on('refreshBottomLeft', refreshBottomLeft);
|
|
485
|
+
eventRef.current.on(changeIgnoreHideStopPreview, onChangeIgnoreHideStopPreview);
|
|
476
486
|
return () => {
|
|
477
487
|
eventRef.current.off(startTimeToHideAllComponent, listenStart);
|
|
478
488
|
eventRef.current.off(pauseTimeToHideAllComponent, listenPause);
|
|
@@ -480,6 +490,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
480
490
|
eventRef.current.off(hideAllComponent, listenHideEvent);
|
|
481
491
|
eventRef.current.off('disablePlayerTap', handDisablePlayerTap);
|
|
482
492
|
eventRef.current.off('refreshBottomLeft', refreshBottomLeft);
|
|
493
|
+
eventRef.current.off(changeIgnoreHideStopPreview, onChangeIgnoreHideStopPreview);
|
|
483
494
|
if (reGetOrientationTimer.current) {
|
|
484
495
|
clearTimeout(reGetOrientationTimer.current);
|
|
485
496
|
reGetOrientationTimer.current = null;
|
|
@@ -550,7 +561,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
550
561
|
devId: devId,
|
|
551
562
|
onlineStatus: deviceOnline,
|
|
552
563
|
isShare: isShare,
|
|
553
|
-
ignoreHideStopPreview:
|
|
564
|
+
ignoreHideStopPreview: ignoreStopOnHide,
|
|
565
|
+
onChangeIgnoreHideStopPreview: onChangeIgnoreHideStopPreview,
|
|
554
566
|
ipcPlayerContext: instance.IPCPlayerInstance,
|
|
555
567
|
onChangeStreamStatus: onChangeStreamStatus,
|
|
556
568
|
onCtx: res => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, useContext } from 'react';
|
|
2
|
-
import { View, Text, Image } from '@ray-js/ray';
|
|
2
|
+
import { View, Text, Image, getSystemInfoSync } from '@ray-js/ray';
|
|
3
3
|
import { useSetState, useUpdateEffect } from 'ahooks';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
|
|
6
6
|
import Strings from '../../i18n';
|
|
7
7
|
import { PlayState } from '../../interface';
|
|
8
8
|
import { UIEventContext } from '../../ui/context';
|
|
9
|
-
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
9
|
+
import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview } from '../../ui/constant';
|
|
10
10
|
import { useStore, getDefaultStore } from '../../ctx/store';
|
|
11
11
|
import './recordVideo.less';
|
|
12
12
|
const CLOSE_TIME = 5000;
|
|
@@ -242,6 +242,13 @@ export function RecordVideo(props) {
|
|
|
242
242
|
showShot: false
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
+
// 发送忽略进入后台停止预览的标记
|
|
246
|
+
const {
|
|
247
|
+
platform
|
|
248
|
+
} = getSystemInfoSync();
|
|
249
|
+
if (platform === 'ios') {
|
|
250
|
+
props.event ? props === null || props === void 0 ? void 0 : props.event.emit(changeIgnoreHideStopPreview, true) : event === null || event === void 0 ? void 0 : event.emit(changeIgnoreHideStopPreview, true);
|
|
251
|
+
}
|
|
245
252
|
try {
|
|
246
253
|
const recordInfo = await setRecording(target);
|
|
247
254
|
if (target) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useContext, useRef } from 'react';
|
|
2
|
-
import { View, Image, Text, showModal, openAppSystemSettingPage } from '@ray-js/ray';
|
|
2
|
+
import { View, Image, Text, showModal, openAppSystemSettingPage, getSystemInfoSync } from '@ray-js/ray';
|
|
3
3
|
import { useSetState, useUpdateEffect, useMemoizedFn } from 'ahooks';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
|
|
6
6
|
import Strings from '../../i18n';
|
|
7
7
|
import { useStore } from '../../ctx/store';
|
|
8
8
|
import { UIEventContext } from '../../ui/context';
|
|
9
|
-
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
9
|
+
import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview } from '../../ui/constant';
|
|
10
10
|
import './screenshot.less';
|
|
11
11
|
const CLOSE_TIME = 5000;
|
|
12
12
|
export function Screenshot(props) {
|
|
@@ -106,11 +106,18 @@ export function Screenshot(props) {
|
|
|
106
106
|
setState({
|
|
107
107
|
showShot: false
|
|
108
108
|
});
|
|
109
|
+
const {
|
|
110
|
+
platform
|
|
111
|
+
} = getSystemInfoSync();
|
|
112
|
+
if (platform === 'ios') {
|
|
113
|
+
props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, true);
|
|
114
|
+
}
|
|
109
115
|
event.emit(pauseTimeToHideAllComponent);
|
|
110
116
|
ty.authorizeStatus({
|
|
111
117
|
// 相册写入权限
|
|
112
118
|
scope: 'scope.writePhotosAlbum',
|
|
113
119
|
success: () => {
|
|
120
|
+
props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, false);
|
|
114
121
|
IPCPlayerContext.snapshot({
|
|
115
122
|
saveToAlbum,
|
|
116
123
|
// 保存到 IPC 相册
|
|
@@ -122,6 +129,7 @@ export function Screenshot(props) {
|
|
|
122
129
|
});
|
|
123
130
|
},
|
|
124
131
|
fail: err => {
|
|
132
|
+
props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, false);
|
|
125
133
|
console.log(err, 'err');
|
|
126
134
|
const errObj = err.innerError || err || {};
|
|
127
135
|
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import React, { useRef, useContext, useState, useEffect } from 'react';
|
|
3
|
-
import { View } from '@ray-js/ray';
|
|
3
|
+
import { View, getSystemInfoSync } from '@ray-js/ray';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import Svg from '@ray-js/svg';
|
|
6
6
|
import { useStore, getDefaultStore, updateAtom } from '../../ctx/store';
|
|
@@ -8,7 +8,7 @@ import './voiceIntercom.less';
|
|
|
8
8
|
import { PlayerStreamStatus, IntercomMode, PlayState } from '../../interface';
|
|
9
9
|
import { UIEventContext } from '../../ui/context';
|
|
10
10
|
import { radialGradient } from '../../utils';
|
|
11
|
-
import { startTimeToHideAllComponent, pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
11
|
+
import { startTimeToHideAllComponent, pauseTimeToHideAllComponent, changeIgnoreHideStopPreview } from '../../ui/constant';
|
|
12
12
|
const NILL = () => null;
|
|
13
13
|
export const VoiceIntercom = props => {
|
|
14
14
|
const {
|
|
@@ -33,7 +33,6 @@ export const VoiceIntercom = props => {
|
|
|
33
33
|
const [frame, setFrame] = useState(0);
|
|
34
34
|
const talkingInterval = useRef(null);
|
|
35
35
|
// 每帧间隔(ms)
|
|
36
|
-
|
|
37
36
|
const {
|
|
38
37
|
event
|
|
39
38
|
} = useContext(UIEventContext);
|
|
@@ -60,9 +59,20 @@ export const VoiceIntercom = props => {
|
|
|
60
59
|
console.log('PlayerStreamStatus not 1002');
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
62
|
+
// 发送忽略进入后台停止预览的标记
|
|
63
|
+
const {
|
|
64
|
+
platform
|
|
65
|
+
} = getSystemInfoSync();
|
|
66
|
+
if (platform === 'ios') {
|
|
67
|
+
props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, true);
|
|
68
|
+
}
|
|
63
69
|
console.log('==== 开始对讲 =====');
|
|
64
70
|
originMuteStatusBeforeVoice.current = _mute;
|
|
65
|
-
|
|
71
|
+
try {
|
|
72
|
+
await setIntercom(true);
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.error('setIntercom failed:', e);
|
|
75
|
+
}
|
|
66
76
|
// 确定对讲有成功回调后,单向对讲判断开始对讲前需要静音
|
|
67
77
|
// 确定对讲有成功回调后, 双路对讲开始对讲前需要打开拾音器
|
|
68
78
|
const muteTarget = intercomMode === IntercomMode.OneWay;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/ipc-player-integration",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "IPC 融合播放器",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@ray-js/ipc-ptz-zoom": "^0.0.2",
|
|
39
39
|
"@ray-js/panel-sdk": "^1.13.1",
|
|
40
40
|
"@ray-js/direction-control": "^0.0.8",
|
|
41
|
-
"@ray-js/ray-ipc-player": "^2.0.
|
|
41
|
+
"@ray-js/ray-ipc-player": "^2.0.27",
|
|
42
42
|
"@ray-js/ray-ipc-utils": "^1.1.10",
|
|
43
43
|
"@ray-js/svg": "0.2.0",
|
|
44
44
|
"clsx": "^1.2.1",
|