@ray-js/ipc-player-integration 0.0.38-beta.2 → 0.0.39-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/ctx/ctx.js +10 -7
- package/lib/ctx/multiCameraCtx.d.ts +4 -0
- package/lib/ctx/multiCameraCtx.js +8 -1
- package/package.json +1 -1
package/lib/ctx/ctx.js
CHANGED
|
@@ -11,7 +11,7 @@ import { PlayState, IntercomMode } from '../interface';
|
|
|
11
11
|
import { changeIgnoreHideStopPreview } from '../ui/constant';
|
|
12
12
|
import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
13
13
|
import { getEventInstance } from './event';
|
|
14
|
-
import { useMultiCameraCtx } from './multiCameraCtx';
|
|
14
|
+
import { isMultiCameraTileSupported, useMultiCameraCtx } from './multiCameraCtx';
|
|
15
15
|
const SAVE_TO_ALBUM = 1;
|
|
16
16
|
export const createUseCtx = _ref => {
|
|
17
17
|
let {
|
|
@@ -42,9 +42,16 @@ export const createUseCtx = _ref => {
|
|
|
42
42
|
const streamStatus = useRef();
|
|
43
43
|
// 全屏、竖屏
|
|
44
44
|
const [screenType, setScreenType] = useAtom('vertical');
|
|
45
|
+
const IPCPlayerInstance = useRef();
|
|
46
|
+
if (!IPCPlayerInstance.current) {
|
|
47
|
+
IPCPlayerInstance.current = createPlayContext(devId);
|
|
48
|
+
}
|
|
45
49
|
|
|
46
|
-
//
|
|
47
|
-
|
|
50
|
+
// 是否处于竖屏填充布局。
|
|
51
|
+
// 多目平铺设备首帧即按竖屏填充渲染:screenMode 初始就是 full(multiCameraCtx),
|
|
52
|
+
// 若此处初始为 false,首帧会以 16:9 短屏渲染、effect 后才切全高,
|
|
53
|
+
// 原生层在该尺寸跳变窗口内可能丢失 viewPos 更新,残留短屏尺寸。
|
|
54
|
+
const [isVerticalFullLayout, setIsVerticalFullLayout] = useAtom(isMultiCameraTileSupported(videoSplitProtocol, IPCPlayerInstance.current));
|
|
48
55
|
|
|
49
56
|
// 录像中
|
|
50
57
|
const [recording] = useAtom(false);
|
|
@@ -184,10 +191,6 @@ export const createUseCtx = _ref => {
|
|
|
184
191
|
|
|
185
192
|
// 判断是否已经有了对应id的content
|
|
186
193
|
|
|
187
|
-
const IPCPlayerInstance = useRef();
|
|
188
|
-
if (!IPCPlayerInstance.current) {
|
|
189
|
-
IPCPlayerInstance.current = createPlayContext(devId);
|
|
190
|
-
}
|
|
191
194
|
const _setMute = async function (target) {
|
|
192
195
|
let onlyUpdateAtom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
193
196
|
if (onlyUpdateAtom) {
|
|
@@ -16,6 +16,10 @@ interface Props {
|
|
|
16
16
|
IPCPlayerInstance: IpcContext;
|
|
17
17
|
videoSplitProtocol?: VideoSplitProtocol;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* 是否支持多目平铺布局(协议 + 基础库能力),首次渲染即可同步判定
|
|
21
|
+
*/
|
|
22
|
+
export declare const isMultiCameraTileSupported: (videoSplitProtocol?: VideoSplitProtocol, IPCPlayerInstance?: IpcContext) => boolean;
|
|
19
23
|
/**
|
|
20
24
|
* 多目摄像头相关状态、方法维护
|
|
21
25
|
*/
|
|
@@ -25,6 +25,13 @@ const DEFAULT_SELECTED_LEN_INFO = {
|
|
|
25
25
|
supportLocalizer: false,
|
|
26
26
|
supportZoom: false
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* 是否支持多目平铺布局(协议 + 基础库能力),首次渲染即可同步判定
|
|
30
|
+
*/
|
|
31
|
+
export const isMultiCameraTileSupported = (videoSplitProtocol, IPCPlayerInstance) => {
|
|
32
|
+
return (videoSplitProtocol === null || videoSplitProtocol === void 0 ? void 0 : videoSplitProtocol.total_split_num) > 1 && (videoSplitProtocol === null || videoSplitProtocol === void 0 ? void 0 : videoSplitProtocol.p_v) >= 3 && typeof (IPCPlayerInstance === null || IPCPlayerInstance === void 0 ? void 0 : IPCPlayerInstance.switchLayoutStyle) === 'function';
|
|
33
|
+
};
|
|
34
|
+
|
|
28
35
|
/**
|
|
29
36
|
* 多目摄像头相关状态、方法维护
|
|
30
37
|
*/
|
|
@@ -35,7 +42,7 @@ export const useMultiCameraCtx = props => {
|
|
|
35
42
|
videoSplitProtocol = DEFAULT_VIDEO_SPLIT_PROTOCOL
|
|
36
43
|
} = props;
|
|
37
44
|
const isSupport = useMemo(() => {
|
|
38
|
-
return (videoSplitProtocol
|
|
45
|
+
return isMultiCameraTileSupported(videoSplitProtocol, IPCPlayerInstance);
|
|
39
46
|
}, [IPCPlayerInstance, videoSplitProtocol]);
|
|
40
47
|
const dpSupportMap = useDpSupport({
|
|
41
48
|
devId,
|