@ray-js/ipc-player-integration 0.0.59-beta.0 → 0.0.61-beta.0
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/README.md +0 -6
- package/lib/ctx/ctx.album.test.d.ts +1 -0
- package/lib/ctx/ctx.album.test.js +197 -0
- package/lib/ctx/ctx.composition.js +19 -4
- package/lib/ctx/ctx.js +103 -55
- package/lib/ctx/ports.output.d.ts +1 -0
- package/lib/ctx/resolution.d.ts +1 -1
- package/lib/ctx/resolution.js +3 -1
- package/lib/i18n/index.d.ts +12 -0
- package/lib/i18n/strings.d.ts +6 -0
- package/lib/i18n/strings.js +6 -0
- package/lib/index.d.ts +0 -4
- package/lib/index.js +1 -3
- package/lib/interface.d.ts +19 -3
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/bottomLeftContent.js +55 -119
- package/lib/ui/bottomRightContent.js +3 -6
- package/lib/ui/ui.d.ts +2 -5
- package/lib/ui/ui.js +49 -63
- package/lib/utils/captureResult.d.ts +14 -0
- package/lib/utils/captureResult.js +70 -0
- package/lib/utils/captureResult.test.d.ts +1 -0
- package/lib/utils/captureResult.test.js +117 -0
- package/lib/utils/fullLinkTracking.d.ts +5 -0
- package/lib/utils/fullLinkTracking.js +71 -0
- package/lib/utils/navigation.d.ts +2 -1
- package/lib/utils/navigation.js +13 -3
- package/lib/utils/ttt.js +2 -8
- package/lib/widgets/battery/battery.js +1 -2
- package/lib/widgets/battery/batteryFull.js +1 -2
- package/lib/widgets/captureResult/captureResult.d.ts +16 -0
- package/lib/widgets/captureResult/captureResult.js +85 -0
- package/lib/widgets/captureResult/captureResult.less +144 -0
- package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
- package/lib/widgets/captureResult/captureResult.test.js +80 -0
- package/lib/widgets/captureResult/index.d.ts +2 -0
- package/lib/widgets/captureResult/index.js +2 -0
- package/lib/widgets/floodlight/floodlight.js +1 -2
- package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
- package/lib/widgets/fullScreen/fullScreen.js +1 -2
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +1 -2
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +2 -1
- package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +3 -12
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
- package/lib/widgets/multiCamera/landscapeTip.js +1 -2
- package/lib/widgets/multiCamera/moveablePtzControl.js +1 -1
- package/lib/widgets/multiCamera/multiPtz.js +1 -2
- package/lib/widgets/multiCamera/ptzMoveableTip.js +1 -2
- package/lib/widgets/multiCamera/switchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileMultiPtz.js +1 -2
- package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileTip.js +1 -2
- package/lib/widgets/muted/muted.js +10 -5
- package/lib/widgets/muted/muted.less +5 -1
- package/lib/widgets/muted/muted.test.d.ts +1 -0
- package/lib/widgets/muted/muted.test.js +81 -0
- package/lib/widgets/ptz/ptz.js +1 -2
- package/lib/widgets/ptz/ptzControl.js +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +3 -6
- package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
- package/lib/widgets/recordVideo/recordVideo.js +53 -53
- package/lib/widgets/recordVideo/recordVideo.less +17 -74
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
- package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
- package/lib/widgets/resolution/fullResolutionControl.js +19 -29
- package/lib/widgets/resolution/resolution.js +2 -3
- package/lib/widgets/screenshot/screenshot.js +66 -45
- package/lib/widgets/screenshot/screenshot.less +1 -40
- package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
- package/lib/widgets/screenshot/screenshot.test.js +120 -0
- package/lib/widgets/signal4G/signal4G.js +1 -4
- package/lib/widgets/siren/siren.js +1 -2
- package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
- package/lib/widgets/trialBadge/index.d.ts +2 -1
- package/lib/widgets/trialBadge/index.js +20 -17
- package/lib/widgets/trialBadge/index.less +0 -24
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +3 -2
- package/lib/widgets/trialBadge/useTrialBadge.js +13 -2
- package/lib/widgets/tryExperience/tryExperience.js +1 -3
- package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
- package/lib/widgets/voiceIntercom/voiceIntercom.js +24 -50
- package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -16
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
- package/lib/widgets/zoomTurntable/turntable/index.js +1 -2
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +1 -2
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +1 -2
- package/package.json +8 -15
- package/lib/renderer/capabilities.d.ts +0 -8
- package/lib/renderer/capabilities.js +0 -19
- package/lib/renderer/context.d.ts +0 -5
- package/lib/renderer/context.js +0 -6
- package/lib/renderer/directionControl.d.ts +0 -6
- package/lib/renderer/directionControl.js +0 -3
- package/lib/renderer/font.less +0 -5
- package/lib/renderer/glyphs.d.ts +0 -1
- package/lib/renderer/glyphs.js +0 -256
- package/lib/renderer/index.module.less +0 -48
- package/lib/renderer/ptzZoom.d.ts +0 -6
- package/lib/renderer/ptzZoom.js +0 -3
- package/lib/renderer/text.d.ts +0 -4
- package/lib/renderer/text.js +0 -32
- package/lib/renderer/text.module.less +0 -4
- package/lib/renderer/viewport.d.ts +0 -7
- package/lib/renderer/viewport.js +0 -24
- package/lib/res/lynx-signal/index.d.ts +0 -1
- package/lib/res/lynx-signal/index.js +0 -22
- package/lib/res/lynx-signal/signalFour0.png +0 -0
- package/lib/res/lynx-signal/signalFour1.png +0 -0
- package/lib/res/lynx-signal/signalFour2.png +0 -0
- package/lib/res/lynx-signal/signalFour3.png +0 -0
- package/lib/res/lynx-signal/signalFour4.png +0 -0
- package/lib/res/lynx-signal/signalThree0.png +0 -0
- package/lib/res/lynx-signal/signalThree1.png +0 -0
- package/lib/res/lynx-signal/signalThree2.png +0 -0
- package/lib/res/lynx-signal/signalThree3.png +0 -0
- package/lib/res/player-more-arrow.png +0 -0
- package/lib/ui/scrollHintArrow.d.ts +0 -23
- package/lib/ui/scrollHintArrow.js +0 -82
package/lib/i18n/strings.js
CHANGED
|
@@ -9,8 +9,11 @@ export default {
|
|
|
9
9
|
ipc_player_resolution_AUDIO: 'Audio Mode',
|
|
10
10
|
ipc_player_current_resolution_is_equal: 'Already at current clarity',
|
|
11
11
|
ipc_player_screenshot_success_tip: 'Screenshot saved to album',
|
|
12
|
+
ipc_player_screenshot_multi_success_tip: 'Screenshots saved to album',
|
|
12
13
|
ipc_player_error_screenshot_error_tip: 'Screenshot failed. Please try again later.',
|
|
13
14
|
ipc_player_record_success_tip: 'Recording saved to album',
|
|
15
|
+
ipc_player_record_multi_success_tip: 'Recordings saved to album',
|
|
16
|
+
ipc_player_multi_capture_success_count: '{0} items',
|
|
14
17
|
ipc_player_shot_success_check: 'View',
|
|
15
18
|
ipc_player_record_success_check: 'View',
|
|
16
19
|
ipc_player_recording_now_tip: 'Recording in progress...',
|
|
@@ -51,8 +54,11 @@ export default {
|
|
|
51
54
|
ipc_player_resolution_AUDIO: '音频模式',
|
|
52
55
|
ipc_player_current_resolution_is_equal: '已是当前清晰度',
|
|
53
56
|
ipc_player_screenshot_success_tip: '截图已保存在APP相册',
|
|
57
|
+
ipc_player_screenshot_multi_success_tip: '图片已保存至相册',
|
|
54
58
|
ipc_player_error_screenshot_error_tip: '截图失败了,请稍后再试',
|
|
55
59
|
ipc_player_record_success_tip: '录像已保存在APP相册',
|
|
60
|
+
ipc_player_record_multi_success_tip: '视频已保存至相册',
|
|
61
|
+
ipc_player_multi_capture_success_count: '共{0}个',
|
|
56
62
|
ipc_player_shot_success_check: '查看',
|
|
57
63
|
ipc_player_record_success_check: '查看',
|
|
58
64
|
ipc_player_recording_now_tip: '正在录像中...',
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,3 @@ import * as Widgets from './widgets';
|
|
|
5
5
|
import * as Features from './features';
|
|
6
6
|
import * as Utils from './utils';
|
|
7
7
|
export { Widgets, Features, Utils };
|
|
8
|
-
export { PlayerRenderModeContext } from './renderer/context';
|
|
9
|
-
export type { PlayerRenderMode } from './renderer/context';
|
|
10
|
-
export type { LynxPlayerAdapters } from './renderer/capabilities';
|
|
11
|
-
export { LynxPlayerAdaptersContext } from './renderer/capabilities';
|
package/lib/index.js
CHANGED
|
@@ -4,6 +4,4 @@ export * from './interface';
|
|
|
4
4
|
import * as Widgets from './widgets';
|
|
5
5
|
import * as Features from './features';
|
|
6
6
|
import * as Utils from './utils';
|
|
7
|
-
export { Widgets, Features, Utils };
|
|
8
|
-
export { PlayerRenderModeContext } from './renderer/context';
|
|
9
|
-
export { LynxPlayerAdaptersContext } from './renderer/capabilities';
|
|
7
|
+
export { Widgets, Features, Utils };
|
package/lib/interface.d.ts
CHANGED
|
@@ -41,19 +41,24 @@ export type EventInstance = {
|
|
|
41
41
|
};
|
|
42
42
|
export type UseCtx = (options: {
|
|
43
43
|
devId: string;
|
|
44
|
+
/** 宿主决定是否禁用 Auto;null 表示本次配置查询尚未完成。 */
|
|
45
|
+
autoClarityDisabled?: boolean | null;
|
|
44
46
|
initTopLeftContent?: ComponentConfig[];
|
|
45
47
|
initTopRightContent?: ComponentConfig[];
|
|
46
48
|
initBottomLeftContent?: ComponentConfig[];
|
|
47
49
|
initBottomRightContent?: ComponentConfig[];
|
|
48
50
|
initAbsoluteContent?: ComponentConfig[];
|
|
49
51
|
saveToAlbum?: 0 | 1;
|
|
52
|
+
multiLens?: boolean;
|
|
50
53
|
showPtzControlTip?: boolean;
|
|
51
54
|
videoSplitProtocol?: VideoSplitProtocol;
|
|
52
55
|
}) => {
|
|
53
56
|
devId: string;
|
|
57
|
+
trialBadgeViewedRef: React.MutableRefObject<boolean>;
|
|
54
58
|
brandColor: RetAtom<string>;
|
|
55
59
|
verticalMic: RetAtom<boolean>;
|
|
56
60
|
saveToAlbum: 0 | 1;
|
|
61
|
+
multiLens: boolean;
|
|
57
62
|
showPtzControlTip: boolean;
|
|
58
63
|
screenType: RetAtom<ScreenType>;
|
|
59
64
|
isVerticalFullLayout: RetAtom<boolean>;
|
|
@@ -89,7 +94,8 @@ export type UseCtx = (options: {
|
|
|
89
94
|
setRecordingDisabled: (type: boolean) => void;
|
|
90
95
|
setResolution: (type: string) => Promise<boolean>;
|
|
91
96
|
setResolutionList: (type: string[]) => void;
|
|
92
|
-
setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<
|
|
97
|
+
setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<CaptureResult>;
|
|
98
|
+
stopRecordingOnUnload: () => Promise<CaptureResult>;
|
|
93
99
|
setIntercom: (value: boolean, onlyUpdateAtom?: boolean) => Promise<boolean>;
|
|
94
100
|
setMute: (value: boolean) => Promise<boolean>;
|
|
95
101
|
changeStreamStatus: (value: PlayerStreamStatus) => void;
|
|
@@ -120,8 +126,12 @@ export type ComponentConfig<T = ReturnType<UseCtx> & Record<string, any>> = {
|
|
|
120
126
|
absoluteContentClassName?: string;
|
|
121
127
|
absoluteContentStyle?: React.CSSProperties;
|
|
122
128
|
absoluteNoCoverView?: boolean;
|
|
129
|
+
renderWhen?: (state: ComponentRenderState) => boolean;
|
|
123
130
|
hidden?: boolean;
|
|
124
131
|
};
|
|
132
|
+
export type ComponentRenderState = {
|
|
133
|
+
playState: PlayState;
|
|
134
|
+
};
|
|
125
135
|
export type ComponentConfigProps = {
|
|
126
136
|
IPCPlayerContext: IpcContext;
|
|
127
137
|
} & ReturnType<UseCtx>;
|
|
@@ -129,11 +139,17 @@ export type PlayStatusData = {
|
|
|
129
139
|
playState: PlayState;
|
|
130
140
|
playCode: number;
|
|
131
141
|
};
|
|
132
|
-
export type
|
|
142
|
+
export type CaptureFileInfo = {
|
|
143
|
+
index?: number;
|
|
133
144
|
tempImagePath: string;
|
|
134
145
|
filePath: string;
|
|
135
|
-
thumbPath
|
|
146
|
+
thumbPath?: string;
|
|
147
|
+
width?: number;
|
|
148
|
+
height?: number;
|
|
149
|
+
data?: string;
|
|
136
150
|
};
|
|
151
|
+
export type CaptureResult = boolean | CaptureFileInfo;
|
|
152
|
+
export type RecordInfoData = CaptureResult;
|
|
137
153
|
/**
|
|
138
154
|
* 多目屏幕模式
|
|
139
155
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
2
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
4
3
|
import "core-js/modules/esnext.iterator.every.js";
|
|
@@ -7,10 +6,8 @@ import "core-js/modules/esnext.iterator.find.js";
|
|
|
7
6
|
import "core-js/modules/esnext.iterator.map.js";
|
|
8
7
|
import "core-js/modules/esnext.iterator.reduce.js";
|
|
9
8
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
10
|
-
import { CoverView, ScrollView, View
|
|
9
|
+
import { CoverView, ScrollView, View } from '@ray-js/ray';
|
|
11
10
|
import clsx from 'clsx';
|
|
12
|
-
import { ScrollHintArrow, ScrollHintButton, usesNativeHintImage, getHintViewport } from './scrollHintArrow';
|
|
13
|
-
import { usePlayerRenderMode } from '../renderer/context';
|
|
14
11
|
import { useStore } from '../ctx/store';
|
|
15
12
|
import { useComponentHideState } from './hooks';
|
|
16
13
|
import { TrialBadge, useTrialBadge } from '../widgets/trialBadge';
|
|
@@ -26,7 +23,6 @@ const VERTICAL_FLAT_MAX = 4;
|
|
|
26
23
|
// 这段同时也是箭头的落位区 —— 箭头贴着内容压在第 5 项露出的一角上(和改动前的观感一致),
|
|
27
24
|
// 因此至少要放得下箭头本体 26 + 左右各 4 的间隙。
|
|
28
25
|
const VERTICAL_PEEK_WIDTH = 34;
|
|
29
|
-
const VERTICAL_HINT_EDGE_GAP = 4;
|
|
30
26
|
|
|
31
27
|
// 平铺档内容与右下角按钮之间的最小安全间距
|
|
32
28
|
const VERTICAL_FLAT_SAFE_GAP = 8;
|
|
@@ -83,19 +79,15 @@ const BottomLeftContent = _ref => {
|
|
|
83
79
|
const tryExp = bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.find(item => item.id === 'TryExperience');
|
|
84
80
|
return (_gRawData = tryExp === null || tryExp === void 0 || (_tryExp$initProps5 = tryExp.initProps) === null || _tryExp$initProps5 === void 0 ? void 0 : _tryExp$initProps5.gRawData) !== null && _gRawData !== void 0 ? _gRawData : false;
|
|
85
81
|
}, [bottomLeftContent]);
|
|
86
|
-
const renderMode = usePlayerRenderMode();
|
|
87
|
-
const hintPlatform = useMemo(() => {
|
|
88
|
-
var _getSystemInfoSync;
|
|
89
|
-
return renderMode === 'lynx' ? ((_getSystemInfoSync = getSystemInfoSync()) === null || _getSystemInfoSync === void 0 ? void 0 : _getSystemInfoSync.platform) || '' : '';
|
|
90
|
-
}, [renderMode]);
|
|
91
82
|
const [shouldHide] = useComponentHideState();
|
|
92
83
|
const {
|
|
93
84
|
showTrialBadge,
|
|
85
|
+
handleTrialView,
|
|
94
86
|
handleTrialSubscribe,
|
|
95
87
|
handleCountdownEnd
|
|
96
|
-
} = useTrialBadge(ctx.event, ctx.devId, trialRemainingSec);
|
|
88
|
+
} = useTrialBadge(ctx.event, ctx.devId, trialRemainingSec, ctx.trialBadgeViewedRef);
|
|
97
89
|
|
|
98
|
-
//
|
|
90
|
+
// 横向滚动状态:内容溢出且未滑到对应边缘时,显示左 / 右箭头提示
|
|
99
91
|
const idRef = useRef(++scrollClsSeq);
|
|
100
92
|
// wrap 是左下角的可用区(left:0 ~ right:reservedRight),宽度不随 ScrollView 收窄而变,
|
|
101
93
|
// 因此用它、而不是 ScrollView 自身,作为“能摆多宽”的基准,避免收窄与分档互相依赖
|
|
@@ -116,8 +108,6 @@ const BottomLeftContent = _ref => {
|
|
|
116
108
|
// 点击箭头时的受控滚动目标;仅在程序化滚动期间为数值,结束后置回 undefined,
|
|
117
109
|
// 避免持续受控导致用户手动拖动被回弹
|
|
118
110
|
const [scrollTo, setScrollTo] = useState(undefined);
|
|
119
|
-
const [lynxAtEnd, setLynxAtEnd] = useState(false);
|
|
120
|
-
const endPageTouchRef = useRef(null);
|
|
121
111
|
// 横竖屏切换后,强制 ScrollView 重新挂载并把滚动状态重置为初始值
|
|
122
112
|
const [scrollResetKey, setScrollResetKey] = useState(0);
|
|
123
113
|
// 用户在某种屏幕模式下拖动过一次之后,该模式不再展示箭头(竖屏 / 横屏各自独立记录)
|
|
@@ -140,12 +130,10 @@ const BottomLeftContent = _ref => {
|
|
|
140
130
|
const scrollEndTimerRef = useRef();
|
|
141
131
|
// 测量时需要叠加当前滚动量,用 ref 避免闭包拿到过期值
|
|
142
132
|
const scrollLeftRef = useRef(0);
|
|
143
|
-
const pageOffsetRef = useRef(0);
|
|
144
133
|
useEffect(() => {
|
|
145
134
|
setScrollResetKey(k => k + 1);
|
|
146
135
|
setScrollLeft(0);
|
|
147
136
|
setScrollTo(undefined);
|
|
148
|
-
setLynxAtEnd(false);
|
|
149
137
|
scrollLeftRef.current = 0;
|
|
150
138
|
// 清零上一屏的测量值,避免用旧 clientWidth/contentWidth 在重新测量前误判溢出导致箭头闪现
|
|
151
139
|
setClientWidth(0);
|
|
@@ -306,7 +294,7 @@ const BottomLeftContent = _ref => {
|
|
|
306
294
|
// 这样即使内容容器被撑满到可视内盒宽,也能拿到真实内容宽;哨兵不可用时回退到容器宽。
|
|
307
295
|
let tw = 0;
|
|
308
296
|
if (scrollRect && endRect && typeof endRect.left === 'number') {
|
|
309
|
-
tw = endRect.left - scrollRect.left - paddingLeftPx + scrollLeftRef.current
|
|
297
|
+
tw = endRect.left - scrollRect.left - paddingLeftPx + scrollLeftRef.current;
|
|
310
298
|
}
|
|
311
299
|
if (!(tw > 0)) {
|
|
312
300
|
tw = (contentRect === null || contentRect === void 0 ? void 0 : contentRect.width) || 0;
|
|
@@ -315,11 +303,11 @@ const BottomLeftContent = _ref => {
|
|
|
315
303
|
setContentWidth(tw);
|
|
316
304
|
}
|
|
317
305
|
attempts += 1;
|
|
318
|
-
//
|
|
319
|
-
if (attempts >=
|
|
306
|
+
// 最多轮询 15 次(约 6s)兜底,避免无限轮询
|
|
307
|
+
if (attempts >= 15) {
|
|
320
308
|
return;
|
|
321
309
|
}
|
|
322
|
-
timer = setTimeout(measure,
|
|
310
|
+
timer = setTimeout(measure, 400);
|
|
323
311
|
});
|
|
324
312
|
};
|
|
325
313
|
|
|
@@ -335,7 +323,7 @@ const BottomLeftContent = _ref => {
|
|
|
335
323
|
// playState:视频就绪后 overlay 可能重新布局,需重新测量
|
|
336
324
|
playState, bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.length, shouldHide, showBadge, wrapCls, scrollCls, contentCls, scrollResetKey, resizeSignal,
|
|
337
325
|
// 收紧后各项 padding 变小,必须重测一遍逐项宽,否则分档还在用收紧前的旧值
|
|
338
|
-
tightened
|
|
326
|
+
tightened]);
|
|
339
327
|
|
|
340
328
|
// 子元素主动上报宽度变化 → 重跑测量,及时更新横滑箭头与右边缘淡出
|
|
341
329
|
useEffect(() => {
|
|
@@ -365,37 +353,19 @@ const BottomLeftContent = _ref => {
|
|
|
365
353
|
const totalContentWidth = naturalWidth > 0 ? paddingLeftPx + naturalWidth + paddingRightPx : 0;
|
|
366
354
|
// 竖屏由“个数”决定是否溢出(平铺档恒不溢出);横屏保持原来的像素比对
|
|
367
355
|
const isOverflow = isVertical ? !isFlat : totalContentWidth > clientWidth + 1;
|
|
368
|
-
const
|
|
369
|
-
const
|
|
370
|
-
// Once the end is reached there is no hint to mask: restore the WebView layout budget.
|
|
371
|
-
|
|
372
|
-
const hintViewport = getHintViewport(renderMode, hintPlatform, isScrollMode, verticalScrollWidth, usesNativeHintImage(renderMode, hintPlatform) ? availableWidth : clientWidth, hintSize, VERTICAL_HINT_EDGE_GAP, lynxAtEnd);
|
|
373
|
-
const scrollViewWidth = hintViewport.visibleWidth;
|
|
374
|
-
const atEnd = lynxAtEnd || !isOverflow || scrollLeft + scrollViewWidth >= totalContentWidth - 2;
|
|
375
|
-
// Lynx 不响应 ScrollView 的受控 scrollLeft / scrollIntoView,点击时平移现有内容。
|
|
376
|
-
// 保留原节点;末页通过右滑返回,不增加 WebView 没有的反向箭头。
|
|
377
|
-
const pageOffset = renderMode === 'lynx' && lynxAtEnd ? Math.max(0, totalContentWidth - scrollViewWidth - scrollLeft) : 0;
|
|
378
|
-
pageOffsetRef.current = pageOffset;
|
|
356
|
+
const scrollViewWidth = verticalScrollWidth > 0 ? verticalScrollWidth : clientWidth;
|
|
357
|
+
const atEnd = !isOverflow || scrollLeft + scrollViewWidth >= totalContentWidth - 2;
|
|
379
358
|
const isDismissed = dismissed[screenType];
|
|
359
|
+
const isButtonHint = scrollHintMode === 'button';
|
|
380
360
|
// button 模式:溢出且未到末端即常显(不受 dismissed 影响);pulse 模式:保留拖动后消失的旧逻辑。
|
|
381
361
|
// compact 档(<= 4 个但摆不下)不出箭头:那点空间要留给元素本身,箭头只会遮更多
|
|
382
362
|
|
|
383
363
|
// 右侧还有未滚到头的内容时,启用右边缘淡出,把没完全露出的元素渐隐隐藏(横竖屏都生效)
|
|
384
364
|
const fadeRightEdge = isOverflow && !atEnd;
|
|
385
365
|
|
|
386
|
-
//
|
|
387
|
-
//
|
|
366
|
+
// 点击右箭头:直接滚动到最右端。
|
|
367
|
+
// 给一个足够大的目标值,交由 ScrollView 自身夹取到真实最右端,避免测量误差导致滚不到底。
|
|
388
368
|
|
|
389
|
-
const readTouch = event => {
|
|
390
|
-
var _event$touches, _event$changedTouches, _event$origin, _event$origin2, _touch$clientX, _touch$clientY;
|
|
391
|
-
const touch = (event === null || event === void 0 || (_event$touches = event.touches) === null || _event$touches === void 0 ? void 0 : _event$touches[0]) || (event === null || event === void 0 || (_event$changedTouches = event.changedTouches) === null || _event$changedTouches === void 0 ? void 0 : _event$changedTouches[0]) || (event === null || event === void 0 || (_event$origin = event.origin) === null || _event$origin === void 0 || (_event$origin = _event$origin.touches) === null || _event$origin === void 0 ? void 0 : _event$origin[0]) || (event === null || event === void 0 || (_event$origin2 = event.origin) === null || _event$origin2 === void 0 || (_event$origin2 = _event$origin2.changedTouches) === null || _event$origin2 === void 0 ? void 0 : _event$origin2[0]);
|
|
392
|
-
const x = (_touch$clientX = touch === null || touch === void 0 ? void 0 : touch.clientX) !== null && _touch$clientX !== void 0 ? _touch$clientX : touch === null || touch === void 0 ? void 0 : touch.pageX;
|
|
393
|
-
const y = (_touch$clientY = touch === null || touch === void 0 ? void 0 : touch.clientY) !== null && _touch$clientY !== void 0 ? _touch$clientY : touch === null || touch === void 0 ? void 0 : touch.pageY;
|
|
394
|
-
return typeof x === 'number' && typeof y === 'number' ? {
|
|
395
|
-
x,
|
|
396
|
-
y
|
|
397
|
-
} : null;
|
|
398
|
-
};
|
|
399
369
|
const coverHeight = screenType === 'vertical' ? shouldHide ? 49 : 48 : shouldHide ? 59 : 58;
|
|
400
370
|
const containerHeight = screenType === 'vertical' ? 48 : 58;
|
|
401
371
|
|
|
@@ -408,50 +378,44 @@ const BottomLeftContent = _ref => {
|
|
|
408
378
|
// 竖屏: 0 + 24 = 24 → bottom = 16
|
|
409
379
|
// 横屏: 25 + 16.5 = 41.5 → bottom = 33.5
|
|
410
380
|
const visibleRowHeight = containerHeight - paddingBottomPx;
|
|
411
|
-
|
|
412
381
|
// button 模式用半透明圆做点击热区,比 pulse 提示大;下移半个差值以保持图标中心不变
|
|
413
|
-
|
|
382
|
+
const hintSize = isButtonHint ? 26 : 16;
|
|
414
383
|
// 竖屏:箭头贴着可视区右缘、压在第 5 项露出的那一角上(改动前就是这个观感)。
|
|
415
384
|
// 箭头右缘距可视区右缘 4px => right = 可用宽 - 可视宽 + 4
|
|
416
385
|
// 可视宽是“前 4 项 + 34 露出区”,箭头宽 26,因此箭头左缘落在第 4 项之后 4px,碰不到它。
|
|
417
386
|
// 横屏维持原来的 6px
|
|
418
387
|
const hintRight = (() => {
|
|
419
388
|
if (!isVertical) return 6;
|
|
420
|
-
if (!(availableWidth > 0) || !(
|
|
421
|
-
return Math.max(availableWidth -
|
|
389
|
+
if (!(availableWidth > 0) || !(scrollViewWidth > 0)) return 4;
|
|
390
|
+
return Math.max(availableWidth - scrollViewWidth + 4, 4);
|
|
422
391
|
})();
|
|
423
392
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
424
393
|
className: clsx('ipc-player-bottom-left-content-wrap', wrapCls),
|
|
425
|
-
style:
|
|
394
|
+
style: {
|
|
426
395
|
right: rightCss,
|
|
427
396
|
height: showBadge ? `${coverHeight + 30}px` : `${coverHeight}px`,
|
|
428
397
|
display: 'flex',
|
|
429
398
|
flexDirection: 'column',
|
|
430
399
|
justifyContent: 'flex-start',
|
|
431
|
-
opacity: shouldHide ? 0 : 1
|
|
432
|
-
}, renderMode === 'lynx' ? {
|
|
433
|
-
transition: 'opacity 0.3s ease'
|
|
434
|
-
} : {}), {}, {
|
|
400
|
+
opacity: shouldHide ? 0 : 1,
|
|
435
401
|
pointerEvents: shouldHide ? 'none' : 'auto'
|
|
436
|
-
}
|
|
402
|
+
}
|
|
437
403
|
}, showBadge && /*#__PURE__*/React.createElement(View, {
|
|
438
404
|
style: {
|
|
439
405
|
height: '32px',
|
|
440
406
|
marginLeft: screenType === 'vertical' ? '12px' : '25px'
|
|
441
407
|
}
|
|
442
408
|
}, /*#__PURE__*/React.createElement(TrialBadge, {
|
|
409
|
+
onView: handleTrialView,
|
|
443
410
|
brandColor: brandColor,
|
|
444
411
|
trialRemainingSec: trialRemainingSec,
|
|
445
412
|
onSubscribe: handleTrialSubscribe,
|
|
446
413
|
onCountdownEnd: handleCountdownEnd
|
|
447
|
-
})), /*#__PURE__*/React.createElement(ScrollView,
|
|
414
|
+
})), /*#__PURE__*/React.createElement(ScrollView, {
|
|
448
415
|
key: scrollResetKey,
|
|
449
|
-
scrollX:
|
|
416
|
+
scrollX: true,
|
|
450
417
|
scrollLeft: scrollTo,
|
|
451
|
-
scrollWithAnimation: true
|
|
452
|
-
}, usesNativeHintImage(renderMode, hintPlatform) ? {
|
|
453
|
-
bounces: false
|
|
454
|
-
} : {}, {
|
|
418
|
+
scrollWithAnimation: true,
|
|
455
419
|
onScroll: e => {
|
|
456
420
|
var _e$detail;
|
|
457
421
|
// 滑动开始时暂停自动隐藏(仅在一次滑动会话内触发一次),滑动停止后恢复
|
|
@@ -472,13 +436,8 @@ const BottomLeftContent = _ref => {
|
|
|
472
436
|
// Ray ScrollView 在不同实现下,scrollLeft 可能直接挂在事件上,也可能在 detail 内
|
|
473
437
|
const sl = typeof (e === null || e === void 0 ? void 0 : e.scrollLeft) === 'number' ? e.scrollLeft : e === null || e === void 0 || (_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.scrollLeft;
|
|
474
438
|
if (typeof sl === 'number') {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
scrollLeftRef.current = nextScrollLeft;
|
|
478
|
-
setScrollLeft(nextScrollLeft);
|
|
479
|
-
if (usesNativeHintImage(renderMode, hintPlatform) && isScrollMode && !lynxAtEnd && nextScrollLeft > 0 && clientWidth > 0 && nextScrollLeft + clientWidth >= totalContentWidth - 2) {
|
|
480
|
-
setLynxAtEnd(true);
|
|
481
|
-
}
|
|
439
|
+
scrollLeftRef.current = sl;
|
|
440
|
+
setScrollLeft(sl);
|
|
482
441
|
// 一旦真的拖动过(>2px 阈值过滤抖动 / 重置触发的 0 值),当前屏幕模式下不再展示箭头
|
|
483
442
|
if (sl > 2 && !dismissed[screenType]) {
|
|
484
443
|
setDismissed(d => _objectSpread(_objectSpread({}, d), {}, {
|
|
@@ -495,45 +454,26 @@ const BottomLeftContent = _ref => {
|
|
|
495
454
|
// 横屏 isScrollMode 恒为 false,仍走 72px 宽渐变,行为不变。
|
|
496
455
|
'ipc-player-bottom-left-scroll-fademask--narrow': fadeRightEdge && isScrollMode
|
|
497
456
|
}),
|
|
498
|
-
style:
|
|
457
|
+
style: {
|
|
499
458
|
paddingBottom: `${paddingBottomPx}px`,
|
|
500
459
|
paddingLeft: `${paddingLeftPx}px`,
|
|
501
460
|
paddingRight: `${paddingRightPx}px`,
|
|
502
|
-
width:
|
|
503
|
-
}, usesNativeHintImage(renderMode, hintPlatform) && isScrollMode ? {
|
|
504
|
-
clipPath: 'none'
|
|
505
|
-
} : {}), {}, {
|
|
461
|
+
width: verticalScrollWidth > 0 ? `${verticalScrollWidth}px` : '100%',
|
|
506
462
|
height: `${containerHeight}px`,
|
|
507
463
|
marginTop: showBadge ? '-2px' : 0,
|
|
508
464
|
whiteSpace: 'nowrap'
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
onTouchStart: renderMode === 'lynx' ? event => {
|
|
512
|
-
endPageTouchRef.current = renderMode === 'lynx' && lynxAtEnd ? readTouch(event) : null;
|
|
513
|
-
} : undefined,
|
|
514
|
-
onTouchEnd: renderMode === 'lynx' ? event => {
|
|
515
|
-
const start = endPageTouchRef.current;
|
|
516
|
-
const end = readTouch(event);
|
|
517
|
-
endPageTouchRef.current = null;
|
|
518
|
-
if (!start || !end || renderMode !== 'lynx' || !lynxAtEnd) return;
|
|
519
|
-
const dx = end.x - start.x;
|
|
520
|
-
if (dx > 24 && dx > Math.abs(end.y - start.y)) setLynxAtEnd(false);
|
|
521
|
-
} : undefined,
|
|
522
|
-
onTouchCancel: () => {
|
|
523
|
-
endPageTouchRef.current = null;
|
|
524
|
-
},
|
|
465
|
+
}
|
|
466
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
525
467
|
className: clsx('ipc-player-bottom-left-content-container', contentCls, {
|
|
526
468
|
'ipc-player-bottom-left-content-container-tight': tightened
|
|
527
469
|
}),
|
|
528
|
-
style:
|
|
529
|
-
display:
|
|
470
|
+
style: {
|
|
471
|
+
display: 'inline-flex',
|
|
530
472
|
flexDirection: 'row',
|
|
531
473
|
height: `${visibleRowHeight}px`,
|
|
532
474
|
alignItems: 'center',
|
|
533
475
|
paddingLeft: `${contentPaddingLeftPx}px`
|
|
534
|
-
}
|
|
535
|
-
transform: `translateX(-${pageOffset}px)`
|
|
536
|
-
} : {})
|
|
476
|
+
}
|
|
537
477
|
}, children, /*#__PURE__*/React.createElement(View, {
|
|
538
478
|
className: endCls,
|
|
539
479
|
style: {
|
|
@@ -541,26 +481,11 @@ const BottomLeftContent = _ref => {
|
|
|
541
481
|
height: '1px',
|
|
542
482
|
flexShrink: 0
|
|
543
483
|
}
|
|
544
|
-
}))), isOverflow && !atEnd && !isCompact && (!isVertical || isScrollMode) && (isButtonHint || !isDismissed) && /*#__PURE__*/React.createElement(
|
|
545
|
-
renderMode: renderMode,
|
|
546
|
-
platform: hintPlatform,
|
|
547
|
-
onPress: isButtonHint ? () => {
|
|
548
|
-
if (!isOverflow) {
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
if (renderMode === 'lynx') {
|
|
552
|
-
var _ctx$event6, _ctx$event7;
|
|
553
|
-
(_ctx$event6 = ctx.event) === null || _ctx$event6 === void 0 || _ctx$event6.emit(pauseTimeToHideAllComponent);
|
|
554
|
-
setLynxAtEnd(true);
|
|
555
|
-
(_ctx$event7 = ctx.event) === null || _ctx$event7 === void 0 || _ctx$event7.emit(startTimeToHideAllComponent);
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
setScrollTo(Math.max(0, Math.ceil(totalContentWidth - scrollViewWidth)));
|
|
559
|
-
} : undefined,
|
|
484
|
+
}))), isOverflow && !atEnd && !isCompact && (!isVertical || isScrollMode) && (isButtonHint || !isDismissed) && /*#__PURE__*/React.createElement(CoverView, {
|
|
560
485
|
className: clsx('ipc-player-bottom-left-scroll-hint', {
|
|
561
486
|
'ipc-player-bottom-left-scroll-hint--button': isButtonHint
|
|
562
487
|
}),
|
|
563
|
-
style:
|
|
488
|
+
style: {
|
|
564
489
|
position: 'absolute',
|
|
565
490
|
right: `${hintRight}px`,
|
|
566
491
|
bottom: `${paddingBottomPx + visibleRowHeight / 2 - 8 - (hintSize - 16) / 2}px`,
|
|
@@ -570,15 +495,26 @@ const BottomLeftContent = _ref => {
|
|
|
570
495
|
alignItems: 'center',
|
|
571
496
|
justifyContent: 'center',
|
|
572
497
|
pointerEvents: isButtonHint ? 'auto' : 'none'
|
|
573
|
-
},
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
498
|
+
},
|
|
499
|
+
onClick: isButtonHint ? () => {
|
|
500
|
+
if (!isOverflow) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
setScrollTo(totalContentWidth + clientWidth + 9999);
|
|
504
|
+
} : undefined
|
|
505
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
506
|
+
className: clsx('ipc-player-bottom-left-scroll-hint-arrow', {
|
|
507
|
+
'ipc-player-bottom-left-scroll-hint-arrow--right': true,
|
|
508
|
+
'ipc-player-bottom-left-scroll-hint-arrow--light': isButtonHint,
|
|
509
|
+
'ipc-player-bottom-left-scroll-hint-arrow--static': isButtonHint
|
|
510
|
+
})
|
|
511
|
+
// 右向 chevron 由 top+right 描边旋转而成,视觉重心偏右;放大并整体左移使其在圆内居中
|
|
512
|
+
,
|
|
513
|
+
style: isButtonHint ? {
|
|
514
|
+
width: '9px',
|
|
515
|
+
height: '9px',
|
|
516
|
+
transform: 'translate(-1px, 0) rotate(45deg)'
|
|
517
|
+
} : undefined
|
|
582
518
|
})));
|
|
583
519
|
};
|
|
584
520
|
export default BottomLeftContent;
|
|
@@ -2,7 +2,6 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import React, { useEffect, useRef } from 'react';
|
|
3
3
|
import { CoverView, View } from '@ray-js/ray';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import { usePlayerRenderMode } from '../renderer/context';
|
|
6
5
|
import { useStore } from '../ctx/store';
|
|
7
6
|
import { useComponentHideState } from './hooks';
|
|
8
7
|
|
|
@@ -25,7 +24,6 @@ const BottomRightContent = _ref => {
|
|
|
25
24
|
bottomRightContent: ctx.bottomRightContent
|
|
26
25
|
});
|
|
27
26
|
const [shouldHide] = useComponentHideState();
|
|
28
|
-
const renderMode = usePlayerRenderMode();
|
|
29
27
|
const idRef = useRef(++rightClsSeq);
|
|
30
28
|
const wrapCls = `ipc-br-wrap-${idRef.current}`;
|
|
31
29
|
const lastWidthRef = useRef(0);
|
|
@@ -46,18 +44,17 @@ const BottomRightContent = _ref => {
|
|
|
46
44
|
onWidthChange === null || onWidthChange === void 0 || onWidthChange(w);
|
|
47
45
|
}
|
|
48
46
|
attempts += 1;
|
|
49
|
-
|
|
50
|
-
if (attempts >= (renderMode === 'lynx' ? 20 : 15)) {
|
|
47
|
+
if (attempts >= 15) {
|
|
51
48
|
return;
|
|
52
49
|
}
|
|
53
|
-
timer = setTimeout(measure,
|
|
50
|
+
timer = setTimeout(measure, 400);
|
|
54
51
|
});
|
|
55
52
|
};
|
|
56
53
|
timer = setTimeout(measure, 60);
|
|
57
54
|
return () => {
|
|
58
55
|
if (timer) clearTimeout(timer);
|
|
59
56
|
};
|
|
60
|
-
}, [screenType, playState, bottomRightContent === null || bottomRightContent === void 0 ? void 0 : bottomRightContent.length, shouldHide, wrapCls, onWidthChange
|
|
57
|
+
}, [screenType, playState, bottomRightContent === null || bottomRightContent === void 0 ? void 0 : bottomRightContent.length, shouldHide, wrapCls, onWidthChange]);
|
|
61
58
|
const containerHeight = screenType === 'vertical' ? 48 : 58;
|
|
62
59
|
|
|
63
60
|
// 将 width 统一规范成 CSS 合法值。number → "${n}px",string → 原样透传。
|
package/lib/ui/ui.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { PlayerRenderMode } from '../renderer/context';
|
|
3
|
-
import { LynxPlayerAdapters } from '../renderer/capabilities';
|
|
4
2
|
import { PlayStatusData, UseCtx, EventInstance } from '../interface';
|
|
5
3
|
import './ui.less';
|
|
6
4
|
type CtxInstance = ReturnType<UseCtx>;
|
|
@@ -16,10 +14,9 @@ type CSSVariable = {
|
|
|
16
14
|
'--fontSize': string;
|
|
17
15
|
};
|
|
18
16
|
type Props = {
|
|
19
|
-
renderMode?: PlayerRenderMode;
|
|
20
|
-
/** Required when Lynx enables widgets backed by WebView-only renderers. */
|
|
21
|
-
lynxAdapters?: LynxPlayerAdapters;
|
|
22
17
|
devId: string;
|
|
18
|
+
/** 未提供 instance 时,传给播放器内部的 useCtx。null 表示配置查询中。 */
|
|
19
|
+
autoClarityDisabled?: boolean | null;
|
|
23
20
|
isShare?: boolean;
|
|
24
21
|
ignoreHideStopPreview?: boolean;
|
|
25
22
|
instance?: CtxInstance;
|