@ray-js/ipc-player-integration 0.0.58-beta.2 → 0.0.59-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.
Files changed (119) hide show
  1. package/README.md +6 -0
  2. package/lib/ctx/ctx.composition.js +4 -19
  3. package/lib/ctx/ctx.js +55 -100
  4. package/lib/ctx/ports.output.d.ts +0 -1
  5. package/lib/ctx/resolution.d.ts +1 -1
  6. package/lib/ctx/resolution.js +1 -3
  7. package/lib/i18n/index.d.ts +0 -12
  8. package/lib/i18n/strings.d.ts +0 -6
  9. package/lib/i18n/strings.js +0 -6
  10. package/lib/index.d.ts +4 -0
  11. package/lib/index.js +3 -1
  12. package/lib/interface.d.ts +3 -18
  13. package/lib/renderer/capabilities.d.ts +8 -0
  14. package/lib/renderer/capabilities.js +19 -0
  15. package/lib/renderer/context.d.ts +5 -0
  16. package/lib/renderer/context.js +6 -0
  17. package/lib/renderer/directionControl.d.ts +6 -0
  18. package/lib/renderer/directionControl.js +3 -0
  19. package/lib/renderer/font.less +5 -0
  20. package/lib/renderer/glyphs.d.ts +1 -0
  21. package/lib/renderer/glyphs.js +256 -0
  22. package/lib/renderer/index.module.less +48 -0
  23. package/lib/renderer/ptzZoom.d.ts +6 -0
  24. package/lib/renderer/ptzZoom.js +3 -0
  25. package/lib/renderer/text.d.ts +4 -0
  26. package/lib/renderer/text.js +32 -0
  27. package/lib/renderer/text.module.less +4 -0
  28. package/lib/renderer/viewport.d.ts +7 -0
  29. package/lib/renderer/viewport.js +24 -0
  30. package/lib/res/lynx-signal/index.d.ts +1 -0
  31. package/lib/res/lynx-signal/index.js +22 -0
  32. package/lib/res/lynx-signal/signalFour0.png +0 -0
  33. package/lib/res/lynx-signal/signalFour1.png +0 -0
  34. package/lib/res/lynx-signal/signalFour2.png +0 -0
  35. package/lib/res/lynx-signal/signalFour3.png +0 -0
  36. package/lib/res/lynx-signal/signalFour4.png +0 -0
  37. package/lib/res/lynx-signal/signalThree0.png +0 -0
  38. package/lib/res/lynx-signal/signalThree1.png +0 -0
  39. package/lib/res/lynx-signal/signalThree2.png +0 -0
  40. package/lib/res/lynx-signal/signalThree3.png +0 -0
  41. package/lib/res/player-more-arrow.png +0 -0
  42. package/lib/ui/bottomLeftContent.js +118 -52
  43. package/lib/ui/bottomRightContent.js +6 -3
  44. package/lib/ui/scrollHintArrow.d.ts +23 -0
  45. package/lib/ui/scrollHintArrow.js +82 -0
  46. package/lib/ui/ui.d.ts +5 -2
  47. package/lib/ui/ui.js +63 -49
  48. package/lib/utils/ttt.js +8 -2
  49. package/lib/widgets/battery/battery.js +2 -1
  50. package/lib/widgets/battery/batteryFull.js +2 -1
  51. package/lib/widgets/floodlight/floodlight.js +2 -1
  52. package/lib/widgets/flowLowTip/flowLowTip.js +2 -1
  53. package/lib/widgets/fullScreen/fullScreen.js +2 -1
  54. package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
  55. package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
  56. package/lib/widgets/fullScreen/verticalScreen.js +2 -1
  57. package/lib/widgets/index.d.ts +0 -1
  58. package/lib/widgets/index.js +1 -2
  59. package/lib/widgets/moveInteractiveControl/controlButton.js +2 -1
  60. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +12 -3
  61. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +24 -4
  62. package/lib/widgets/multiCamera/landscapeTip.js +2 -1
  63. package/lib/widgets/multiCamera/moveablePtzControl.js +1 -1
  64. package/lib/widgets/multiCamera/multiPtz.js +2 -1
  65. package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -1
  66. package/lib/widgets/multiCamera/switchLayout.js +2 -1
  67. package/lib/widgets/multiCamera/tileMultiPtz.js +2 -1
  68. package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
  69. package/lib/widgets/multiCamera/tileTip.js +2 -1
  70. package/lib/widgets/muted/muted.js +5 -10
  71. package/lib/widgets/muted/muted.less +1 -5
  72. package/lib/widgets/ptz/ptz.js +2 -1
  73. package/lib/widgets/ptz/ptzControl.js +1 -1
  74. package/lib/widgets/ptzControlTip/ptzControlTip.js +6 -3
  75. package/lib/widgets/ptzControlTip/ptzControlTip.less +6 -0
  76. package/lib/widgets/realTimeMagnification/realTimeMagnification.js +2 -1
  77. package/lib/widgets/recordVideo/recordVideo.js +53 -53
  78. package/lib/widgets/recordVideo/recordVideo.less +74 -17
  79. package/lib/widgets/recordVideo/recordVideo.test.js +0 -1
  80. package/lib/widgets/resolution/fullResolutionControl.js +29 -19
  81. package/lib/widgets/resolution/resolution.js +3 -2
  82. package/lib/widgets/screenshot/screenshot.js +45 -66
  83. package/lib/widgets/screenshot/screenshot.less +40 -1
  84. package/lib/widgets/signal4G/signal4G.js +4 -1
  85. package/lib/widgets/siren/siren.js +2 -1
  86. package/lib/widgets/tempHumidity/tempHumidity.js +2 -1
  87. package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +2 -1
  88. package/lib/widgets/trialBadge/index.js +8 -3
  89. package/lib/widgets/trialBadge/index.less +24 -0
  90. package/lib/widgets/tryExperience/tryExperience.js +3 -1
  91. package/lib/widgets/videoBitKBP/videoBitKBP.js +2 -1
  92. package/lib/widgets/voiceIntercom/voiceIntercom.js +50 -24
  93. package/lib/widgets/voiceIntercom/voiceIntercom.less +16 -0
  94. package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
  95. package/lib/widgets/zoomTurntable/turntable/index.js +2 -1
  96. package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +2 -1
  97. package/lib/widgets/zoomTurntable/zoomTurntableTip.js +2 -1
  98. package/package.json +15 -8
  99. package/lib/ctx/ctx.album.test.d.ts +0 -1
  100. package/lib/ctx/ctx.album.test.js +0 -197
  101. package/lib/ui/absoluteContent.d.ts +0 -2
  102. package/lib/ui/absoluteContent.js +0 -3
  103. package/lib/utils/captureResult.d.ts +0 -14
  104. package/lib/utils/captureResult.js +0 -70
  105. package/lib/utils/captureResult.test.d.ts +0 -1
  106. package/lib/utils/captureResult.test.js +0 -117
  107. package/lib/widgets/captureResult/captureResult.d.ts +0 -16
  108. package/lib/widgets/captureResult/captureResult.js +0 -85
  109. package/lib/widgets/captureResult/captureResult.less +0 -144
  110. package/lib/widgets/captureResult/captureResult.test.d.ts +0 -1
  111. package/lib/widgets/captureResult/captureResult.test.js +0 -80
  112. package/lib/widgets/captureResult/index.d.ts +0 -2
  113. package/lib/widgets/captureResult/index.js +0 -2
  114. package/lib/widgets/muted/muted.test.d.ts +0 -1
  115. package/lib/widgets/muted/muted.test.js +0 -81
  116. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +0 -1
  117. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +0 -106
  118. package/lib/widgets/screenshot/screenshot.test.d.ts +0 -1
  119. package/lib/widgets/screenshot/screenshot.test.js +0 -120
package/README.md CHANGED
@@ -359,3 +359,9 @@ yarn build
359
359
  ```
360
360
 
361
361
  Other available scripts: `start:wechat`, `start:web`, `start:native`, `build:tuya`, `build:wechat`, `build:web`, `build:native`.
362
+
363
+ ## Lynx integration
364
+
365
+ This branch includes master `3fadcb8` (`0.0.55`) updates for automatic clarity, offline notifications and album permissions. Set `renderMode="lynx"` explicitly; the default remains `webview`.
366
+
367
+ Use **`@ray-js/ray-ipc-player: 2.1.6-beta.0`** exactly and **`@ray-js/ray-ipc-utils: ^1.1.18`** (currently locked to `1.1.18`). Pin **`@ray-js/direction-control: 0.0.13-beta.0`** and **`@ray-js/ipc-ptz-zoom: 0.0.5-beta.0`** as the published Lynx versions. PTZ, direction and turntable widgets require compatible `lynxAdapters`. See [Lynx integration notes](./README-LYNX.md) for adapter requirements, verification and remaining runtime limitations.
@@ -6,7 +6,6 @@ import { IntercomMode, MuteMode, ClarityType } from '@ray-js/ray-ipc-utils/lib/i
6
6
  import { createUseCtx } from './ctx';
7
7
  import { FullSmallIntercom, VerticalSmallIntercom, BatteryFull, Battery, Screenshot, TempHumidity, Signal4G, RecordVideo, FullScreen, VideoBitKBP, Muted, Floodlight, Siren, TryExperience, Resolution, Ptz, MultiPtz, TileTip, PtzMoveableTip, LandscapeTip, TileActions, MoveablePtzControl, SwitchLayout, ToggleVerticalFull, RealTimeMagnification, ZoomTurntableEntry } from '../widgets';
8
8
  import { authorizeStatus } from '../utils/authorize';
9
- import { PlayState } from '../interface';
10
9
  import { landscapeTipId, moveablePtzControlId, multiPtzId, ptzMoveableTipId, tileActionsId, tileTipId } from '../ui/constant';
11
10
  import { multiPrefix } from '../widgets/multiCamera/constants';
12
11
  const createPlayContext = ty.createIpcPlayerContext;
@@ -88,29 +87,20 @@ export const defaultBottomRightContent = [{
88
87
  content: FullScreen
89
88
  }];
90
89
  const absoluteContent = [];
91
- const renderWhenPlaying = _ref => {
92
- let {
93
- playState
94
- } = _ref;
95
- return playState === PlayState.PLAYING;
96
- };
97
90
  export const multiCameraAbsoluteContent = [{
98
91
  id: tileTipId,
99
92
  content: TileTip,
100
93
  absoluteContentClassName: `${multiPrefix}-tile-tip-wrap`,
101
- renderWhen: renderWhenPlaying,
102
94
  hidden: true
103
95
  }, {
104
96
  id: ptzMoveableTipId,
105
97
  content: PtzMoveableTip,
106
98
  absoluteContentClassName: `${multiPrefix}-tile-tip-wrap`,
107
- renderWhen: renderWhenPlaying,
108
99
  hidden: true
109
100
  }, {
110
101
  id: landscapeTipId,
111
102
  content: LandscapeTip,
112
103
  absoluteContentClassName: `${multiPrefix}-tile-tip-wrap`,
113
- renderWhen: renderWhenPlaying,
114
104
  hidden: true
115
105
  }, {
116
106
  id: tileActionsId,
@@ -122,12 +112,12 @@ export const multiCameraAbsoluteContent = [{
122
112
  absoluteNoCoverView: true,
123
113
  hidden: true
124
114
  }];
125
- const toast = _ref2 => {
115
+ const toast = _ref => {
126
116
  let {
127
117
  title,
128
118
  duration
129
- } = _ref2,
130
- config = _objectWithoutProperties(_ref2, _excluded);
119
+ } = _ref,
120
+ config = _objectWithoutProperties(_ref, _excluded);
131
121
  ty.showToast(_objectSpread({
132
122
  title,
133
123
  duration,
@@ -139,7 +129,6 @@ const getMemoryState = devId => {
139
129
  mute: true,
140
130
  intercomMode: IntercomMode.TwoWay,
141
131
  resolution: ClarityType.HD,
142
- defaultResolution: ClarityType.HD,
143
132
  resolutionList: [ClarityType.HD, ClarityType.SD],
144
133
  isIntercomSupported: false,
145
134
  maxZoomSettings: 6
@@ -151,16 +140,12 @@ const getMemoryState = devId => {
151
140
  return resolve(defaultValue);
152
141
  }
153
142
  const muteValue = res.data.microphoneSettings.cachedMuteMode === MuteMode.OFF;
154
- const {
155
- availableResolutions
156
- } = res.data.videoResolution;
157
143
  return resolve({
158
144
  mute: muteValue,
159
145
  intercomMode: res.data.intercomInfo.cachedIntercomMode,
160
146
  isIntercomSupported: res.data.intercomInfo.isIntercomSupported,
161
147
  resolution: res.data.videoResolution.cachedResolution,
162
- defaultResolution: res.data.videoResolution.defaultResolution,
163
- resolutionList: Array.isArray(availableResolutions) && availableResolutions.length > 0 ? availableResolutions : defaultValue.resolutionList,
148
+ resolutionList: res.data.videoResolution.availableResolutions,
164
149
  maxZoomSettings: (_res$data$maxZoomSett = res.data.maxZoomSettings) !== null && _res$data$maxZoomSett !== void 0 ? _res$data$maxZoomSett : 6
165
150
  });
166
151
  }).catch(err => {
package/lib/ctx/ctx.js CHANGED
@@ -3,14 +3,13 @@ import "core-js/modules/esnext.iterator.constructor.js";
3
3
  import "core-js/modules/esnext.iterator.filter.js";
4
4
  import "core-js/modules/esnext.iterator.find.js";
5
5
  import "core-js/modules/esnext.iterator.map.js";
6
- import { useRef, useCallback, useEffect, useState } from 'react';
6
+ import { useRef, useCallback, useEffect } from 'react';
7
7
  import { getSystemInfoSync, showModal, openAppSystemSettingPage } from '@ray-js/ray';
8
8
  import Strings from '../i18n';
9
9
  import { ensureAlbumPermission } from '../utils/authorize/album';
10
10
  import { useAtom, updateAtom, getDefaultStore, useStore } from './store';
11
11
  import { PlayState, IntercomMode } from '../interface';
12
12
  import { changeIgnoreHideStopPreview } from '../ui/constant';
13
- import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
14
13
  import { getEventInstance } from './event';
15
14
  import { isMultiCameraTileSupported, useMultiCameraCtx } from './multiCameraCtx';
16
15
  import { toNativeClarity, withAutoClarity } from './resolution';
@@ -33,14 +32,12 @@ export const createUseCtx = _ref => {
33
32
  return _ref2 => {
34
33
  let {
35
34
  devId,
36
- autoClarityDisabled,
37
35
  initTopLeftContent,
38
36
  initTopRightContent,
39
37
  initBottomLeftContent,
40
38
  initBottomRightContent,
41
39
  initAbsoluteContent,
42
40
  saveToAlbum = SAVE_TO_ALBUM,
43
- multiLens = false,
44
41
  showPtzControlTip = false,
45
42
  videoSplitProtocol
46
43
  } = _ref2;
@@ -60,7 +57,6 @@ export const createUseCtx = _ref => {
60
57
 
61
58
  // 录像中
62
59
  const [recording] = useAtom(false);
63
- const recordingMultiLensRef = useRef(false);
64
60
 
65
61
  // 录像是否不可点击
66
62
  const [recordingDisabled, setRecordingDisabled] = useAtom(false);
@@ -78,8 +74,6 @@ export const createUseCtx = _ref => {
78
74
  const [resolution] = useAtom('HD');
79
75
  // resolution 清晰度列表
80
76
  const [resolutionList, setResolutionList] = useAtom([]);
81
- const [memoryState, setMemoryState] = useState(null);
82
- const autoFallbackPendingRef = useRef(null);
83
77
  // 自动模式下宿主上报的实际清晰度,供横竖屏码率区域共用
84
78
  const [autoClarity] = useAtom(null);
85
79
 
@@ -130,73 +124,40 @@ export const createUseCtx = _ref => {
130
124
  if (!eventRef.current) {
131
125
  eventRef.current = getEventInstance();
132
126
  }
133
- const syncMemoryState = res => {
134
- var _res$maxZoomSettings;
135
- setMemoryState({
136
- devId,
137
- data: res
138
- });
139
- // 历史 Auto 等宿主配置确定后再恢复,避免先显示 Auto 再回退。
140
- if (res.resolution !== ClarityType.AUTO) {
141
- restoreResolution(res.resolution, res.resolutionList, _setResolution);
142
- }
143
- _setMute(res.mute, true);
144
- setIntercomMode(res.intercomMode);
145
- setIntercomSupported(res.isIntercomSupported);
146
- setMaxZoomSettings((_res$maxZoomSettings = res.maxZoomSettings) !== null && _res$maxZoomSettings !== void 0 ? _res$maxZoomSettings : 6);
147
- };
148
- useEffect(() => {
149
- autoFallbackPendingRef.current = null;
150
- }, [devId]);
151
127
  useEffect(() => {
152
128
  // 初始化获取缓存值
153
- let active = true;
129
+
154
130
  (async () => {
155
131
  if (!devId) return;
156
132
  try {
133
+ var _res$maxZoomSettings;
157
134
  const res = await getMemoryState(devId);
158
- if (!active) return;
159
- syncMemoryState(res);
135
+ setResolutionList(withAutoClarity(res.resolutionList));
136
+ restoreResolution(res.resolution, res.resolutionList, _setResolution);
137
+ _setMute(res.mute, true);
138
+ setIntercomMode(res.intercomMode);
139
+ setIntercomSupported(res.isIntercomSupported);
140
+ setMaxZoomSettings((_res$maxZoomSettings = res.maxZoomSettings) !== null && _res$maxZoomSettings !== void 0 ? _res$maxZoomSettings : 6);
160
141
  } catch (error) {
161
142
  console.error('获取 getMemoryState 失败:', error);
162
143
  }
163
144
  })();
164
- return () => {
165
- active = false;
166
- };
167
145
  }, [devId]);
168
146
  useEffect(() => {
169
- let active = true;
170
147
  if (devId && _playState === PlayState.PLAYING) {
171
148
  // 获取缓存的值且同步
172
149
  getMemoryState(devId).then(res => {
173
- if (!active) return;
174
- syncMemoryState(res);
150
+ var _res$maxZoomSettings2;
151
+ setResolutionList(withAutoClarity(res.resolutionList));
152
+ // 传true表示值即可,会取播放器的值
153
+ restoreResolution(res.resolution, res.resolutionList, _setResolution);
154
+ _setMute(res.mute, true);
155
+ setIntercomMode(res.intercomMode);
156
+ setIntercomSupported(res.isIntercomSupported);
157
+ setMaxZoomSettings((_res$maxZoomSettings2 = res.maxZoomSettings) !== null && _res$maxZoomSettings2 !== void 0 ? _res$maxZoomSettings2 : 6);
175
158
  });
176
159
  }
177
- return () => {
178
- active = false;
179
- };
180
160
  }, [devId, _playState]);
181
- useEffect(() => {
182
- // 普通档位或宿主配置变化时,决定是否追加 Auto。
183
- const list = (memoryState === null || memoryState === void 0 ? void 0 : memoryState.devId) === devId ? memoryState.data.resolutionList : [];
184
- if (autoClarityDisabled === null) {
185
- setResolutionList(list.filter(clarity => clarity !== ClarityType.AUTO));
186
- return;
187
- }
188
- setResolutionList(withAutoClarity(list, autoClarityDisabled));
189
- if ((memoryState === null || memoryState === void 0 ? void 0 : memoryState.devId) !== devId || memoryState.data.resolution !== ClarityType.AUTO) return;
190
- if (autoClarityDisabled && autoFallbackPendingRef.current !== devId) {
191
- autoFallbackPendingRef.current = devId;
192
- _setResolution(memoryState.data.defaultResolution).catch(error => {
193
- autoFallbackPendingRef.current = null;
194
- console.warn('恢复默认清晰度失败:', error);
195
- });
196
- } else if (!autoClarityDisabled) {
197
- restoreResolution(memoryState.data.resolution, list, _setResolution);
198
- }
199
- }, [devId, memoryState, currentResolution, autoClarityDisabled]);
200
161
  useEffect(() => {
201
162
  refreshAfterPlayback(_playState, currentResolution);
202
163
  }, [devId, _playState, currentResolution]);
@@ -313,30 +274,6 @@ export const createUseCtx = _ref => {
313
274
  });
314
275
  });
315
276
  };
316
- const stopRecording = showError => {
317
- return new Promise((resolve, reject) => {
318
- IPCPlayerInstance.current.stopRecord({
319
- saveToAlbum,
320
- success: res => {
321
- recordingMultiLensRef.current = false;
322
- updateAtom(recording, false);
323
- resolve(res);
324
- },
325
- fail: err => {
326
- recordingMultiLensRef.current = false;
327
- updateAtom(recording, false);
328
- reject(err);
329
- if (showError) {
330
- const errObj = err.innerError || err || {};
331
- const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_stop_recording_err');
332
- toast({
333
- title: errMsg
334
- });
335
- }
336
- }
337
- });
338
- });
339
- };
340
277
  const multiCameraCtx = useMultiCameraCtx({
341
278
  devId,
342
279
  IPCPlayerInstance: IPCPlayerInstance.current,
@@ -347,7 +284,6 @@ export const createUseCtx = _ref => {
347
284
  brandColor,
348
285
  verticalMic,
349
286
  saveToAlbum,
350
- multiLens,
351
287
  screenType,
352
288
  isVerticalFullLayout,
353
289
  setIsVerticalFullLayout,
@@ -393,7 +329,7 @@ export const createUseCtx = _ref => {
393
329
  ty.authorizeStatus({
394
330
  // 麦克风权限
395
331
  scope: 'scope.record',
396
- success: success => {
332
+ success: () => {
397
333
  eventRef.current.emit(changeIgnoreHideStopPreview, false);
398
334
  IPCPlayerInstance.current.startTalk({
399
335
  success: () => {
@@ -411,12 +347,12 @@ export const createUseCtx = _ref => {
411
347
  }
412
348
  });
413
349
  },
414
- fail: err => {
350
+ fail: () => {
415
351
  console.log('authorizeStatus失败回调');
416
352
  ty.authorize({
417
353
  // 麦克风权限
418
354
  scope: 'scope.record',
419
- success: success => {
355
+ success: () => {
420
356
  console.log('authorize成功回调');
421
357
  IPCPlayerInstance.current.startTalk({
422
358
  success: () => {
@@ -492,25 +428,44 @@ export const createUseCtx = _ref => {
492
428
  eventRef.current.emit(changeIgnoreHideStopPreview, false);
493
429
  return false;
494
430
  }
495
- if (!target) return stopRecording(true);
496
- const granted = await ensureAlbumPermission();
497
- eventRef.current.emit(changeIgnoreHideStopPreview, false);
498
- if (!granted) return false;
431
+ if (target) {
432
+ const granted = await ensureAlbumPermission();
433
+ eventRef.current.emit(changeIgnoreHideStopPreview, false);
434
+ if (!granted) return false;
435
+ }
499
436
  return new Promise((resolve, reject) => {
500
- IPCPlayerInstance.current.startRecord({
501
- saveToAlbum,
502
- success: () => {
503
- updateAtom(recording, true);
504
- resolve(true);
505
- },
506
- fail: err => {
507
- eventRef.current.emit(changeIgnoreHideStopPreview, false);
508
- reject(err);
509
- }
510
- });
437
+ if (target) {
438
+ IPCPlayerInstance.current.startRecord({
439
+ saveToAlbum,
440
+ success: () => {
441
+ updateAtom(recording, true);
442
+ resolve(true);
443
+ },
444
+ fail: err => {
445
+ eventRef.current.emit(changeIgnoreHideStopPreview, false);
446
+ reject(err);
447
+ }
448
+ });
449
+ } else {
450
+ IPCPlayerInstance.current.stopRecord({
451
+ saveToAlbum,
452
+ success: res => {
453
+ updateAtom(recording, false);
454
+ resolve(res);
455
+ },
456
+ fail: err => {
457
+ updateAtom(recording, false);
458
+ reject(err);
459
+ const errObj = err.innerError || err || {};
460
+ const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_stop_recording_err');
461
+ toast({
462
+ title: errMsg
463
+ });
464
+ }
465
+ });
466
+ }
511
467
  });
512
468
  },
513
- stopRecordingOnUnload: () => stopRecording(false),
514
469
  setRecordingDisabled,
515
470
  setScreenType,
516
471
  topLeftContent,
@@ -8,7 +8,6 @@ export type GetMemoryState = (devId: string) => Promise<{
8
8
  intercomMode: IntercomMode;
9
9
  isIntercomSupported: boolean;
10
10
  resolution: ClarityType;
11
- defaultResolution: ClarityType;
12
11
  resolutionList: [ClarityType.HD, ClarityType.SD];
13
12
  maxZoomSettings?: number;
14
13
  }>;
@@ -3,6 +3,6 @@ type NativeClarity = Parameters<IpcContext['setClarity']>[0]['clarity'];
3
3
  export declare const toNativeClarity: (clarity: ClarityType) => NativeClarity;
4
4
  /** 宿主支持自动清晰度,且返回至少两个档位时才展示 AUTO。 */
5
5
  export declare const canShowAutoClarity: (list?: ClarityType[]) => boolean;
6
- export declare const withAutoClarity: (list?: ClarityType[], autoClarityDisabled?: boolean) => ClarityType[];
6
+ export declare const withAutoClarity: (list?: ClarityType[]) => ClarityType[];
7
7
  export declare const normalizeResolution: (resolution: ClarityType, list: ClarityType[]) => ClarityType;
8
8
  export {};
@@ -21,10 +21,8 @@ export const canShowAutoClarity = function () {
21
21
  };
22
22
  export const withAutoClarity = function () {
23
23
  let list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
24
- let autoClarityDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
25
24
  const withoutAuto = list.filter(clarity => clarity !== ClarityType.AUTO);
26
- const showAuto = !autoClarityDisabled && canShowAutoClarity(withoutAuto);
27
- return showAuto ? [...withoutAuto, ClarityType.AUTO] : withoutAuto;
25
+ return canShowAutoClarity(list) ? [...withoutAuto, ClarityType.AUTO] : withoutAuto;
28
26
  };
29
27
  export const normalizeResolution = (resolution, list) => {
30
28
  if (resolution !== ClarityType.AUTO || canShowAutoClarity(list)) return resolution;
@@ -10,11 +10,8 @@ declare const Strings: kit.I18N<{
10
10
  ipc_player_resolution_AUDIO: string;
11
11
  ipc_player_current_resolution_is_equal: string;
12
12
  ipc_player_screenshot_success_tip: string;
13
- ipc_player_screenshot_multi_success_tip: string;
14
13
  ipc_player_error_screenshot_error_tip: string;
15
14
  ipc_player_record_success_tip: string;
16
- ipc_player_record_multi_success_tip: string;
17
- ipc_player_multi_capture_success_count: string;
18
15
  ipc_player_shot_success_check: string;
19
16
  ipc_player_record_success_check: string;
20
17
  ipc_player_recording_now_tip: string;
@@ -55,11 +52,8 @@ declare const Strings: kit.I18N<{
55
52
  ipc_player_resolution_AUDIO: string;
56
53
  ipc_player_current_resolution_is_equal: string;
57
54
  ipc_player_screenshot_success_tip: string;
58
- ipc_player_screenshot_multi_success_tip: string;
59
55
  ipc_player_error_screenshot_error_tip: string;
60
56
  ipc_player_record_success_tip: string;
61
- ipc_player_record_multi_success_tip: string;
62
- ipc_player_multi_capture_success_count: string;
63
57
  ipc_player_shot_success_check: string;
64
58
  ipc_player_record_success_check: string;
65
59
  ipc_player_recording_now_tip: string;
@@ -100,11 +94,8 @@ declare const Strings: kit.I18N<{
100
94
  ipc_player_resolution_AUDIO: string;
101
95
  ipc_player_current_resolution_is_equal: string;
102
96
  ipc_player_screenshot_success_tip: string;
103
- ipc_player_screenshot_multi_success_tip: string;
104
97
  ipc_player_error_screenshot_error_tip: string;
105
98
  ipc_player_record_success_tip: string;
106
- ipc_player_record_multi_success_tip: string;
107
- ipc_player_multi_capture_success_count: string;
108
99
  ipc_player_shot_success_check: string;
109
100
  ipc_player_record_success_check: string;
110
101
  ipc_player_recording_now_tip: string;
@@ -144,11 +135,8 @@ declare const Strings: kit.I18N<{
144
135
  ipc_player_resolution_AUDIO: string;
145
136
  ipc_player_current_resolution_is_equal: string;
146
137
  ipc_player_screenshot_success_tip: string;
147
- ipc_player_screenshot_multi_success_tip: string;
148
138
  ipc_player_error_screenshot_error_tip: string;
149
139
  ipc_player_record_success_tip: string;
150
- ipc_player_record_multi_success_tip: string;
151
- ipc_player_multi_capture_success_count: string;
152
140
  ipc_player_shot_success_check: string;
153
141
  ipc_player_record_success_check: string;
154
142
  ipc_player_recording_now_tip: string;
@@ -9,11 +9,8 @@ declare const _default: {
9
9
  ipc_player_resolution_AUDIO: string;
10
10
  ipc_player_current_resolution_is_equal: string;
11
11
  ipc_player_screenshot_success_tip: string;
12
- ipc_player_screenshot_multi_success_tip: string;
13
12
  ipc_player_error_screenshot_error_tip: string;
14
13
  ipc_player_record_success_tip: string;
15
- ipc_player_record_multi_success_tip: string;
16
- ipc_player_multi_capture_success_count: string;
17
14
  ipc_player_shot_success_check: string;
18
15
  ipc_player_record_success_check: string;
19
16
  ipc_player_recording_now_tip: string;
@@ -54,11 +51,8 @@ declare const _default: {
54
51
  ipc_player_resolution_AUDIO: string;
55
52
  ipc_player_current_resolution_is_equal: string;
56
53
  ipc_player_screenshot_success_tip: string;
57
- ipc_player_screenshot_multi_success_tip: string;
58
54
  ipc_player_error_screenshot_error_tip: string;
59
55
  ipc_player_record_success_tip: string;
60
- ipc_player_record_multi_success_tip: string;
61
- ipc_player_multi_capture_success_count: string;
62
56
  ipc_player_shot_success_check: string;
63
57
  ipc_player_record_success_check: string;
64
58
  ipc_player_recording_now_tip: string;
@@ -9,11 +9,8 @@ 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',
13
12
  ipc_player_error_screenshot_error_tip: 'Screenshot failed. Please try again later.',
14
13
  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',
17
14
  ipc_player_shot_success_check: 'View',
18
15
  ipc_player_record_success_check: 'View',
19
16
  ipc_player_recording_now_tip: 'Recording in progress...',
@@ -54,11 +51,8 @@ export default {
54
51
  ipc_player_resolution_AUDIO: '音频模式',
55
52
  ipc_player_current_resolution_is_equal: '已是当前清晰度',
56
53
  ipc_player_screenshot_success_tip: '截图已保存在APP相册',
57
- ipc_player_screenshot_multi_success_tip: '图片已保存至相册',
58
54
  ipc_player_error_screenshot_error_tip: '截图失败了,请稍后再试',
59
55
  ipc_player_record_success_tip: '录像已保存在APP相册',
60
- ipc_player_record_multi_success_tip: '视频已保存至相册',
61
- ipc_player_multi_capture_success_count: '共{0}个',
62
56
  ipc_player_shot_success_check: '查看',
63
57
  ipc_player_record_success_check: '查看',
64
58
  ipc_player_recording_now_tip: '正在录像中...',
package/lib/index.d.ts CHANGED
@@ -5,3 +5,7 @@ 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,4 +4,6 @@ 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 };
7
+ export { Widgets, Features, Utils };
8
+ export { PlayerRenderModeContext } from './renderer/context';
9
+ export { LynxPlayerAdaptersContext } from './renderer/capabilities';
@@ -41,15 +41,12 @@ export type EventInstance = {
41
41
  };
42
42
  export type UseCtx = (options: {
43
43
  devId: string;
44
- /** 宿主决定是否禁用 Auto;null 表示本次配置查询尚未完成。 */
45
- autoClarityDisabled?: boolean | null;
46
44
  initTopLeftContent?: ComponentConfig[];
47
45
  initTopRightContent?: ComponentConfig[];
48
46
  initBottomLeftContent?: ComponentConfig[];
49
47
  initBottomRightContent?: ComponentConfig[];
50
48
  initAbsoluteContent?: ComponentConfig[];
51
49
  saveToAlbum?: 0 | 1;
52
- multiLens?: boolean;
53
50
  showPtzControlTip?: boolean;
54
51
  videoSplitProtocol?: VideoSplitProtocol;
55
52
  }) => {
@@ -57,7 +54,6 @@ export type UseCtx = (options: {
57
54
  brandColor: RetAtom<string>;
58
55
  verticalMic: RetAtom<boolean>;
59
56
  saveToAlbum: 0 | 1;
60
- multiLens: boolean;
61
57
  showPtzControlTip: boolean;
62
58
  screenType: RetAtom<ScreenType>;
63
59
  isVerticalFullLayout: RetAtom<boolean>;
@@ -93,8 +89,7 @@ export type UseCtx = (options: {
93
89
  setRecordingDisabled: (type: boolean) => void;
94
90
  setResolution: (type: string) => Promise<boolean>;
95
91
  setResolutionList: (type: string[]) => void;
96
- setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<CaptureResult>;
97
- stopRecordingOnUnload: () => Promise<CaptureResult>;
92
+ setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<RecordInfoData>;
98
93
  setIntercom: (value: boolean, onlyUpdateAtom?: boolean) => Promise<boolean>;
99
94
  setMute: (value: boolean) => Promise<boolean>;
100
95
  changeStreamStatus: (value: PlayerStreamStatus) => void;
@@ -125,12 +120,8 @@ export type ComponentConfig<T = ReturnType<UseCtx> & Record<string, any>> = {
125
120
  absoluteContentClassName?: string;
126
121
  absoluteContentStyle?: React.CSSProperties;
127
122
  absoluteNoCoverView?: boolean;
128
- renderWhen?: (state: ComponentRenderState) => boolean;
129
123
  hidden?: boolean;
130
124
  };
131
- export type ComponentRenderState = {
132
- playState: PlayState;
133
- };
134
125
  export type ComponentConfigProps = {
135
126
  IPCPlayerContext: IpcContext;
136
127
  } & ReturnType<UseCtx>;
@@ -138,17 +129,11 @@ export type PlayStatusData = {
138
129
  playState: PlayState;
139
130
  playCode: number;
140
131
  };
141
- export type CaptureFileInfo = {
142
- index?: number;
132
+ export type RecordInfoData = boolean | {
143
133
  tempImagePath: string;
144
134
  filePath: string;
145
- thumbPath?: string;
146
- width?: number;
147
- height?: number;
148
- data?: string;
135
+ thumbPath: string;
149
136
  };
150
- export type CaptureResult = boolean | CaptureFileInfo;
151
- export type RecordInfoData = CaptureResult;
152
137
  /**
153
138
  * 多目屏幕模式
154
139
  */
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export type LynxPlayerAdapters = Partial<Record<'zoomTurntable' | 'ptzZoom' | 'directionControl', React.ComponentType<any>>>;
3
+ export declare const LynxPlayerAdaptersContext: React.Context<Partial<Record<"zoomTurntable" | "ptzZoom" | "directionControl", React.ComponentType<any>>>>;
4
+ /** Never mount a WebView-only RJS renderer in the Lynx tree. */
5
+ export declare function withPlayerRenderer<P>(capability: keyof LynxPlayerAdapters, WebViewComponent: React.ComponentType<P>): {
6
+ (props: P): React.JSX.Element;
7
+ displayName: string;
8
+ };
@@ -0,0 +1,19 @@
1
+ import React, { createContext, useContext } from 'react';
2
+ import { usePlayerRenderMode } from './context';
3
+ export const LynxPlayerAdaptersContext = /*#__PURE__*/createContext({});
4
+
5
+ /** Never mount a WebView-only RJS renderer in the Lynx tree. */
6
+ export function withPlayerRenderer(capability, WebViewComponent) {
7
+ const RendererComponent = props => {
8
+ const mode = usePlayerRenderMode();
9
+ const adapters = useContext(LynxPlayerAdaptersContext);
10
+ if (mode !== 'lynx') return /*#__PURE__*/React.createElement(WebViewComponent, props);
11
+ const Adapter = adapters[capability];
12
+ if (!Adapter) {
13
+ throw new Error(`IPC_LYNX_CAPABILITY_MISSING:${capability}. Supply a supported Native/WebView adapter before enabling this widget.`);
14
+ }
15
+ return /*#__PURE__*/React.createElement(Adapter, props);
16
+ };
17
+ RendererComponent.displayName = `PlayerRenderer(${String(capability)})`;
18
+ return RendererComponent;
19
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const PlayerControlVisibilityContext: import("react").Context<boolean | undefined>;
3
+ export type PlayerRenderMode = 'webview' | 'lynx';
4
+ export declare const PlayerRenderModeContext: import("react").Context<PlayerRenderMode>;
5
+ export declare const usePlayerRenderMode: () => PlayerRenderMode;
@@ -0,0 +1,6 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ // Scoped to the control bars, not absolute widgets or the standalone intercom.
4
+ export const PlayerControlVisibilityContext = /*#__PURE__*/createContext(undefined);
5
+ export const PlayerRenderModeContext = /*#__PURE__*/createContext('webview');
6
+ export const usePlayerRenderMode = () => useContext(PlayerRenderModeContext);
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ (props: import("@ray-js/direction-control").IProps): import("react").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import WebViewDirectionControl from '@ray-js/direction-control';
2
+ import { withPlayerRenderer } from './capabilities';
3
+ export default withPlayerRenderer('directionControl', WebViewDirectionControl);