@ray-js/ipc-player-integration 0.0.12 → 0.0.13-beta-2
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 +12 -2
- package/lib/interface.d.ts +2 -2
- package/lib/ui/ui.js +48 -8
- package/lib/widgets/battery/battery.composition.d.ts +4 -4
- package/package.json +2 -2
package/lib/ctx/ctx.js
CHANGED
|
@@ -225,7 +225,12 @@ export const createUseCtx = _ref => {
|
|
|
225
225
|
setPtzControlTipDisabled,
|
|
226
226
|
setBrandColor,
|
|
227
227
|
setVerticalMic,
|
|
228
|
-
setIntercom: async target
|
|
228
|
+
setIntercom: async function (target) {
|
|
229
|
+
let onlyUpdateAtom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
230
|
+
if (onlyUpdateAtom) {
|
|
231
|
+
updateAtom(intercom, target);
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
229
234
|
const store = getDefaultStore();
|
|
230
235
|
const _intercom = store.get(intercom);
|
|
231
236
|
if (target && target === _intercom) {
|
|
@@ -319,7 +324,12 @@ export const createUseCtx = _ref => {
|
|
|
319
324
|
setMute: _setMute,
|
|
320
325
|
setResolution: _setResolution,
|
|
321
326
|
setResolutionList,
|
|
322
|
-
setRecording: async target
|
|
327
|
+
setRecording: async function (target) {
|
|
328
|
+
let onlyUpdateAtom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
329
|
+
if (onlyUpdateAtom) {
|
|
330
|
+
updateAtom(recording, target);
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
323
333
|
const store = getDefaultStore();
|
|
324
334
|
const _recording = store.get(recording);
|
|
325
335
|
if (target && target === _recording) {
|
package/lib/interface.d.ts
CHANGED
|
@@ -73,8 +73,8 @@ export type UseCtx = (options: {
|
|
|
73
73
|
setRecordingDisabled: (type: boolean) => void;
|
|
74
74
|
setResolution: (type: string) => void;
|
|
75
75
|
setResolutionList: (type: string[]) => void;
|
|
76
|
-
setRecording: (value: boolean) => Promise<RecordInfoData>;
|
|
77
|
-
setIntercom: (value: boolean) => Promise<boolean>;
|
|
76
|
+
setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<RecordInfoData>;
|
|
77
|
+
setIntercom: (value: boolean, onlyUpdateAtom?: boolean) => Promise<boolean>;
|
|
78
78
|
setMute: (value: boolean) => Promise<boolean>;
|
|
79
79
|
changeStreamStatus: (value: PlayerStreamStatus) => void;
|
|
80
80
|
getStreamStatus: () => PlayerStreamStatus;
|
package/lib/ui/ui.js
CHANGED
|
@@ -6,6 +6,7 @@ import React, { useContext, useState, useRef, useMemo, useEffect, useImperativeH
|
|
|
6
6
|
import { View, CoverView, getSystemInfoSync, usePageEvent, setNavigationBarBack, setPageOrientation } from '@ray-js/ray';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import IPCPlayer from '@ray-js/ray-ipc-player';
|
|
9
|
+
import { ipcTTTOperatorLog } from '@ray-js/ray-ipc-utils';
|
|
9
10
|
import { PlayState, PlayerStreamStatus } from '../interface';
|
|
10
11
|
import { useCtx } from '../ctx/ctx.composition';
|
|
11
12
|
import { useStore } from '../ctx/store';
|
|
@@ -19,8 +20,8 @@ import { useMemoizedFn } from '../hooks';
|
|
|
19
20
|
import './ui.less';
|
|
20
21
|
function getCtxInstance(instance, devId) {
|
|
21
22
|
if (instance) return instance;
|
|
23
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
22
24
|
return useCtx({
|
|
23
|
-
// eslint-disable-line
|
|
24
25
|
devId
|
|
25
26
|
});
|
|
26
27
|
}
|
|
@@ -67,7 +68,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
67
68
|
setPlayState,
|
|
68
69
|
setScreenType,
|
|
69
70
|
setBrandColor,
|
|
70
|
-
setVerticalMic
|
|
71
|
+
setVerticalMic,
|
|
72
|
+
setIntercom
|
|
71
73
|
} = instance;
|
|
72
74
|
const prevTriggerEvent = useRef();
|
|
73
75
|
/*
|
|
@@ -86,15 +88,17 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
86
88
|
const timer = useRef();
|
|
87
89
|
const [scaleMultiple, setScaleMultiple] = useState(playerFit === 'contain' ? 1 : -2);
|
|
88
90
|
const [currentZoomLevel, setCurrentZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
|
|
91
|
+
const [createCtx, setCreateCtx] = useState(false);
|
|
89
92
|
const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
|
|
90
93
|
// const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
|
|
91
94
|
// const [verticalZoomLevel, setVerticalZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
|
|
92
95
|
|
|
93
96
|
useEffect(() => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
if (createCtx) {
|
|
98
|
+
setScaleMultiple(playerFit === 'contain' ? 1 : -2);
|
|
99
|
+
setCurrentZoomLevel(playerFit === 'contain' ? 1 : -2);
|
|
100
|
+
}
|
|
101
|
+
}, [playerFit, createCtx]);
|
|
98
102
|
useEffect(() => {
|
|
99
103
|
setBrandColor(brandColor);
|
|
100
104
|
setVerticalMic(verticalMic);
|
|
@@ -105,6 +109,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
105
109
|
event.current.emit(playerTap);
|
|
106
110
|
};
|
|
107
111
|
|
|
112
|
+
/**
|
|
113
|
+
* 监听播放器实例创建完成
|
|
114
|
+
*/
|
|
115
|
+
|
|
108
116
|
/**
|
|
109
117
|
* 监听屏幕布局变化
|
|
110
118
|
*/
|
|
@@ -160,6 +168,34 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
160
168
|
console.log(err, 'err');
|
|
161
169
|
}
|
|
162
170
|
}));
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 监听退出此player
|
|
174
|
+
*/
|
|
175
|
+
usePageEvent('onHide', () => {
|
|
176
|
+
console.log(instance === null || instance === void 0 ? void 0 : instance.IPCPlayerInstance, 'instance?.IPCPlayerInstance ===');
|
|
177
|
+
ipcTTTOperatorLog('hide: 调用停止录制方法');
|
|
178
|
+
setRecording(false, true);
|
|
179
|
+
setIntercom(false, true);
|
|
180
|
+
instance === null || instance === void 0 || instance.IPCPlayerInstance.stopRecord({
|
|
181
|
+
saveToAlbum: 1,
|
|
182
|
+
success: () => {
|
|
183
|
+
ipcTTTOperatorLog('hide: 调用停止录制方法成功');
|
|
184
|
+
},
|
|
185
|
+
fail: () => {
|
|
186
|
+
ipcTTTOperatorLog('hide: 调用停止录制方法失败');
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
ipcTTTOperatorLog('hide: 调用停止对讲方法');
|
|
190
|
+
instance === null || instance === void 0 || instance.IPCPlayerInstance.stopTalk({
|
|
191
|
+
success: () => {
|
|
192
|
+
ipcTTTOperatorLog('hide: 调用停止对讲成功');
|
|
193
|
+
},
|
|
194
|
+
fail: () => {
|
|
195
|
+
ipcTTTOperatorLog('hide: 调用停止对讲失败');
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
});
|
|
163
199
|
const systemInfo = useRef(null);
|
|
164
200
|
if (!systemInfo.current) {
|
|
165
201
|
systemInfo.current = getSystemInfoSync();
|
|
@@ -438,8 +474,12 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
438
474
|
isShare: isShare,
|
|
439
475
|
ignoreHideStopPreview: ignoreHideStopPreview,
|
|
440
476
|
ipcPlayerContext: instance.IPCPlayerInstance,
|
|
441
|
-
onChangeStreamStatus: onChangeStreamStatus
|
|
442
|
-
|
|
477
|
+
onChangeStreamStatus: onChangeStreamStatus,
|
|
478
|
+
onCtx: res => {
|
|
479
|
+
if (res) {
|
|
480
|
+
setCreateCtx(true);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
443
483
|
// onPlayerTap={handlePlayerClick}
|
|
444
484
|
,
|
|
445
485
|
onCameraNotifyWeakNetwork: data => {
|
|
@@ -30,8 +30,8 @@ export declare const Battery: import("react").FunctionComponent<{
|
|
|
30
30
|
setRecordingDisabled: (type: boolean) => void;
|
|
31
31
|
setResolution: (type: string) => void;
|
|
32
32
|
setResolutionList: (type: string[]) => void;
|
|
33
|
-
setRecording: (value: boolean) => Promise<import("../..").RecordInfoData>;
|
|
34
|
-
setIntercom: (value: boolean) => Promise<boolean>;
|
|
33
|
+
setRecording: (value: boolean, onlyUpdateAtom?: boolean | undefined) => Promise<import("../..").RecordInfoData>;
|
|
34
|
+
setIntercom: (value: boolean, onlyUpdateAtom?: boolean | undefined) => Promise<boolean>;
|
|
35
35
|
setMute: (value: boolean) => Promise<boolean>;
|
|
36
36
|
changeStreamStatus: (value: import("../..").PlayerStreamStatus) => void;
|
|
37
37
|
getStreamStatus: () => import("../..").PlayerStreamStatus;
|
|
@@ -77,8 +77,8 @@ export declare const BatteryFull: import("react").FunctionComponent<{
|
|
|
77
77
|
setRecordingDisabled: (type: boolean) => void;
|
|
78
78
|
setResolution: (type: string) => void;
|
|
79
79
|
setResolutionList: (type: string[]) => void;
|
|
80
|
-
setRecording: (value: boolean) => Promise<import("../..").RecordInfoData>;
|
|
81
|
-
setIntercom: (value: boolean) => Promise<boolean>;
|
|
80
|
+
setRecording: (value: boolean, onlyUpdateAtom?: boolean | undefined) => Promise<import("../..").RecordInfoData>;
|
|
81
|
+
setIntercom: (value: boolean, onlyUpdateAtom?: boolean | undefined) => Promise<boolean>;
|
|
82
82
|
setMute: (value: boolean) => Promise<boolean>;
|
|
83
83
|
changeStreamStatus: (value: import("../..").PlayerStreamStatus) => void;
|
|
84
84
|
getStreamStatus: () => import("../..").PlayerStreamStatus;
|
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.13-beta-2",
|
|
4
4
|
"description": "IPC 融合播放器",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@ray-js/panel-sdk": "^1.13.1",
|
|
40
40
|
"@ray-js/direction-control": "^0.0.8",
|
|
41
41
|
"@ray-js/ray-ipc-player": "2.0.23",
|
|
42
|
-
"@ray-js/ray-ipc-utils": "1.1.
|
|
42
|
+
"@ray-js/ray-ipc-utils": "^1.1.10",
|
|
43
43
|
"@ray-js/svg": "0.2.0",
|
|
44
44
|
"clsx": "^1.2.1",
|
|
45
45
|
"jotai": "^2.10.2"
|