@ray-js/ipc-player-integration 0.0.65-beta.4 → 0.0.66-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 (141) hide show
  1. package/README.md +6 -0
  2. package/lib/ctx/ctx.composition.js +3 -13
  3. package/lib/ctx/ctx.js +35 -46
  4. package/lib/ctx/multiCameraCtx.d.ts +0 -2
  5. package/lib/ctx/multiCameraCtx.js +1 -17
  6. package/lib/i18n/index.d.ts +0 -12
  7. package/lib/i18n/strings.d.ts +0 -6
  8. package/lib/i18n/strings.js +0 -6
  9. package/lib/index.d.ts +4 -0
  10. package/lib/index.js +3 -1
  11. package/lib/interface.d.ts +3 -17
  12. package/lib/renderer/capabilities.d.ts +8 -0
  13. package/lib/renderer/capabilities.js +19 -0
  14. package/lib/renderer/context.d.ts +5 -0
  15. package/lib/renderer/context.js +6 -0
  16. package/lib/renderer/directionControl.d.ts +6 -0
  17. package/lib/renderer/directionControl.js +3 -0
  18. package/lib/renderer/font.less +5 -0
  19. package/lib/renderer/glyphs.d.ts +1 -0
  20. package/lib/renderer/glyphs.js +256 -0
  21. package/lib/renderer/index.module.less +48 -0
  22. package/lib/renderer/ptzZoom.d.ts +6 -0
  23. package/lib/renderer/ptzZoom.js +3 -0
  24. package/lib/renderer/text.d.ts +4 -0
  25. package/lib/renderer/text.js +32 -0
  26. package/lib/renderer/text.module.less +4 -0
  27. package/lib/renderer/viewport.d.ts +7 -0
  28. package/lib/renderer/viewport.js +24 -0
  29. package/lib/res/lynx-signal/index.d.ts +1 -0
  30. package/lib/res/lynx-signal/index.js +22 -0
  31. package/lib/res/lynx-signal/signalFour0.png +0 -0
  32. package/lib/res/lynx-signal/signalFour1.png +0 -0
  33. package/lib/res/lynx-signal/signalFour2.png +0 -0
  34. package/lib/res/lynx-signal/signalFour3.png +0 -0
  35. package/lib/res/lynx-signal/signalFour4.png +0 -0
  36. package/lib/res/lynx-signal/signalThree0.png +0 -0
  37. package/lib/res/lynx-signal/signalThree1.png +0 -0
  38. package/lib/res/lynx-signal/signalThree2.png +0 -0
  39. package/lib/res/lynx-signal/signalThree3.png +0 -0
  40. package/lib/res/player-charging.png +0 -0
  41. package/lib/res/player-more-arrow.png +0 -0
  42. package/lib/res/player-solar.png +0 -0
  43. package/lib/ui/bottomLeftContent.js +119 -55
  44. package/lib/ui/bottomRightContent.js +6 -3
  45. package/lib/ui/scrollHintArrow.d.ts +23 -0
  46. package/lib/ui/scrollHintArrow.js +82 -0
  47. package/lib/ui/ui.d.ts +5 -0
  48. package/lib/ui/ui.js +89 -98
  49. package/lib/utils/navigation.d.ts +1 -2
  50. package/lib/utils/navigation.js +3 -13
  51. package/lib/widgets/battery/battery.js +7 -5
  52. package/lib/widgets/battery/batteryFull.js +7 -5
  53. package/lib/widgets/battery/statusIcon.d.ts +6 -0
  54. package/lib/widgets/battery/statusIcon.js +36 -0
  55. package/lib/widgets/battery/statusIcon.less +24 -0
  56. package/lib/widgets/floodlight/floodlight.js +2 -1
  57. package/lib/widgets/flowLowTip/flowLowTip.js +2 -1
  58. package/lib/widgets/fullScreen/fullScreen.js +2 -1
  59. package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
  60. package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
  61. package/lib/widgets/fullScreen/verticalScreen.js +2 -1
  62. package/lib/widgets/index.d.ts +0 -1
  63. package/lib/widgets/index.js +1 -2
  64. package/lib/widgets/moveInteractiveControl/controlButton.js +2 -1
  65. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +12 -3
  66. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +24 -4
  67. package/lib/widgets/multiCamera/index.less +0 -1
  68. package/lib/widgets/multiCamera/landscapeTip.js +2 -1
  69. package/lib/widgets/multiCamera/moveablePtzControl.js +5 -5
  70. package/lib/widgets/multiCamera/multiPtz.js +3 -2
  71. package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -1
  72. package/lib/widgets/multiCamera/switchLayout.js +2 -1
  73. package/lib/widgets/multiCamera/tileMultiPtz.js +3 -2
  74. package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
  75. package/lib/widgets/multiCamera/tileTip.js +2 -1
  76. package/lib/widgets/muted/muted.js +2 -1
  77. package/lib/widgets/muted/muted.test.js +66 -52
  78. package/lib/widgets/ptz/ptz.js +2 -1
  79. package/lib/widgets/ptz/ptzControl.js +1 -1
  80. package/lib/widgets/ptzControlTip/ptzControlTip.js +6 -3
  81. package/lib/widgets/ptzControlTip/ptzControlTip.less +6 -0
  82. package/lib/widgets/realTimeMagnification/realTimeMagnification.js +2 -1
  83. package/lib/widgets/recordVideo/recordVideo.js +54 -58
  84. package/lib/widgets/recordVideo/recordVideo.less +74 -17
  85. package/lib/widgets/recordVideo/recordVideo.test.js +0 -1
  86. package/lib/widgets/resolution/fullResolutionControl.js +29 -19
  87. package/lib/widgets/resolution/resolution.js +3 -2
  88. package/lib/widgets/screenshot/screenshot.js +45 -67
  89. package/lib/widgets/screenshot/screenshot.less +40 -1
  90. package/lib/widgets/signal4G/signal4G.js +4 -1
  91. package/lib/widgets/siren/siren.js +2 -1
  92. package/lib/widgets/tempHumidity/tempHumidity.js +2 -1
  93. package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +2 -1
  94. package/lib/widgets/trialBadge/index.d.ts +1 -2
  95. package/lib/widgets/trialBadge/index.js +17 -20
  96. package/lib/widgets/trialBadge/index.less +24 -0
  97. package/lib/widgets/trialBadge/useTrialBadge.d.ts +2 -3
  98. package/lib/widgets/trialBadge/useTrialBadge.js +2 -13
  99. package/lib/widgets/tryExperience/tryExperience.js +2 -1
  100. package/lib/widgets/videoBitKBP/videoBitKBP.js +2 -1
  101. package/lib/widgets/voiceIntercom/voiceIntercom.js +50 -24
  102. package/lib/widgets/voiceIntercom/voiceIntercom.less +16 -0
  103. package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +6 -0
  104. package/lib/widgets/zoomTurntable/lynxDockLayout.js +30 -0
  105. package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
  106. package/lib/widgets/zoomTurntable/turntable/index.js +3 -1
  107. package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +5 -0
  108. package/lib/widgets/zoomTurntable/turntable/lynx.js +273 -0
  109. package/lib/widgets/zoomTurntable/turntable/lynx.less +9 -0
  110. package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +37 -0
  111. package/lib/widgets/zoomTurntable/turntable/lynxModel.js +122 -0
  112. package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +3 -0
  113. package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +36 -0
  114. package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +2 -0
  115. package/lib/widgets/zoomTurntable/zoomTurntableDock.js +1 -1
  116. package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +31 -18
  117. package/lib/widgets/zoomTurntable/zoomTurntableTip.js +23 -3
  118. package/package.json +15 -7
  119. package/lib/ctx/ctx.album.test.d.ts +0 -1
  120. package/lib/ctx/ctx.album.test.js +0 -197
  121. package/lib/ctx/multiCameraCtx.test.d.ts +0 -1
  122. package/lib/ctx/multiCameraCtx.test.js +0 -65
  123. package/lib/ui/absoluteContent.d.ts +0 -2
  124. package/lib/ui/absoluteContent.js +0 -3
  125. package/lib/utils/captureResult.d.ts +0 -12
  126. package/lib/utils/captureResult.js +0 -70
  127. package/lib/utils/captureResult.test.d.ts +0 -1
  128. package/lib/utils/captureResult.test.js +0 -223
  129. package/lib/utils/fullLinkTracking.d.ts +0 -5
  130. package/lib/utils/fullLinkTracking.js +0 -71
  131. package/lib/widgets/captureResult/captureResult.d.ts +0 -16
  132. package/lib/widgets/captureResult/captureResult.js +0 -85
  133. package/lib/widgets/captureResult/captureResult.less +0 -144
  134. package/lib/widgets/captureResult/captureResult.test.d.ts +0 -1
  135. package/lib/widgets/captureResult/captureResult.test.js +0 -84
  136. package/lib/widgets/captureResult/index.d.ts +0 -2
  137. package/lib/widgets/captureResult/index.js +0 -2
  138. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +0 -1
  139. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +0 -106
  140. package/lib/widgets/screenshot/screenshot.test.d.ts +0 -1
  141. package/lib/widgets/screenshot/screenshot.test.js +0 -135
@@ -23,5 +23,4 @@ export * from './smallIntercom';
23
23
  export * from './toggleVerticalFull';
24
24
  export * from './flowLowTip';
25
25
  export * from './realTimeMagnification';
26
- export * from './zoomTurntable';
27
- export * from './captureResult';
26
+ export * from './zoomTurntable';
@@ -1,6 +1,7 @@
1
1
  import React, { useContext } from 'react';
2
- import { View, Text } from '@ray-js/ray';
2
+ import { View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { useStore } from '../../ctx/store';
5
6
  import { UIEventContext } from '../../ui/context';
6
7
  import { hideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
@@ -4,6 +4,8 @@ import "core-js/modules/esnext.iterator.map.js";
4
4
  import React from 'react';
5
5
  import { View, ScrollView, CoverView } from '@ray-js/ray';
6
6
  import clsx from 'clsx';
7
+ import { usePlayerRenderMode } from '../../renderer/context';
8
+ import { PlayerText } from '../../renderer/text';
7
9
  import './moveInteractiveControlUI.less';
8
10
  const defaultMenu = [{
9
11
  key: '0',
@@ -62,6 +64,7 @@ const defaultCSSVariable = {
62
64
  '--activeColor': '#FF592A'
63
65
  };
64
66
  export function MoveInterActiveControlUI(props) {
67
+ const isLynx = usePlayerRenderMode() === 'lynx';
65
68
  const {
66
69
  contentClsName,
67
70
  wrapClsName,
@@ -80,13 +83,17 @@ export function MoveInterActiveControlUI(props) {
80
83
  // @ts-ignore
81
84
  , {
82
85
  style: _objectSpread({}, CSSVariable),
83
- className: clsx('ipc-player-plugin-active-control-wrap', wrapClsName)
86
+ className: clsx('ipc-player-plugin-active-control-wrap', wrapClsName, {
87
+ 'ipc-player-plugin-active-control-wrap-lynx': isLynx,
88
+ 'ipc-player-plugin-active-control-wrap-webview': !isLynx
89
+ })
84
90
  }, /*#__PURE__*/React.createElement(View, {
85
91
  className: clsx('ipc-player-plugin-active-control-title')
86
92
  }, I18n.t('homeFeatureInteractiveMenuTitle')), /*#__PURE__*/React.createElement(ScrollView, {
87
93
  style: {
88
94
  flex: 1
89
95
  },
96
+ className: isLynx ? 'ipc-player-plugin-active-control-scroll-lynx' : undefined,
90
97
  scrollY: true
91
98
  }, /*#__PURE__*/React.createElement(View, {
92
99
  className: clsx('ipc-player-plugin-active-control', contentClsName)
@@ -98,9 +105,11 @@ export function MoveInterActiveControlUI(props) {
98
105
  })
99
106
  }, /*#__PURE__*/React.createElement(View, {
100
107
  className: clsx('ipc-player-plugin-active-control-item-icon')
101
- }, /*#__PURE__*/React.createElement(View, {
108
+ }, !isLynx && /*#__PURE__*/React.createElement(View, {
102
109
  className: clsx('ipc-player-plugin-active-control-item-icon-mask')
103
- }), /*#__PURE__*/React.createElement(View, {
110
+ }), isLynx ? /*#__PURE__*/React.createElement(PlayerText, {
111
+ className: clsx('icon-panel', item.iconName, 'ipc-player-plugin-interactive-icon')
112
+ }) : /*#__PURE__*/React.createElement(View, {
104
113
  className: clsx('icon-panel', item.iconName, 'ipc-player-plugin-interactive-icon')
105
114
  })), /*#__PURE__*/React.createElement(View, {
106
115
  className: clsx('ipc-player-plugin-active-control-item-title')
@@ -43,8 +43,6 @@
43
43
  }
44
44
  }
45
45
  .ipc-player-plugin-active-control-item-icon {
46
- position: relative;
47
- z-index: 1;
48
46
  width: calc(42px * var(--ipc-player-size-scale, 1));
49
47
  height: calc(42px * var(--ipc-player-size-scale, 1));
50
48
  border-radius: calc(42px * var(--ipc-player-size-scale, 1));
@@ -54,7 +52,6 @@
54
52
  justify-content: center;
55
53
  font-size: calc(16px * var(--ipc-player-size-scale, 1));
56
54
  color: var(--color);
57
- overflow: hidden;
58
55
  .ipc-player-plugin-active-control-item-icon-mask {
59
56
  position: absolute;
60
57
  width: 100%;
@@ -64,6 +61,14 @@
64
61
  opacity: 1;
65
62
  }
66
63
  }
64
+
65
+ .ipc-player-plugin-active-control-wrap-webview {
66
+ .ipc-player-plugin-active-control-item-icon {
67
+ position: relative;
68
+ z-index: 1;
69
+ overflow: hidden;
70
+ }
71
+ }
67
72
  .ipc-player-plugin-active-control-item-title {
68
73
  width: calc(70px * var(--ipc-player-size-scale, 1));
69
74
  white-space: nowrap; /* 防止文本换行 */
@@ -73,4 +78,19 @@
73
78
  }
74
79
  .ipc-player-plugin-interactive-icon {
75
80
  font-size: calc(20px * var(--ipc-player-size-scale, 1));;
76
- }
81
+ }
82
+
83
+ .ipc-player-plugin-active-control-wrap-lynx {
84
+ min-height: 0;
85
+
86
+ .ipc-player-plugin-active-control-scroll-lynx {
87
+ height: 0;
88
+ min-height: 0;
89
+ overflow: hidden;
90
+ }
91
+
92
+ .ipc-player-plugin-active-control-item-icon {
93
+ // The background belongs to the scrolling card, not a separate absolute layer.
94
+ background: var(--iconBgColor);
95
+ }
96
+ }
@@ -39,7 +39,6 @@
39
39
  }
40
40
 
41
41
  .@{prefix}-moveable-ptz-control {
42
- touch-action: none;
43
42
  --ptz-bg-color: rgba(0, 0, 0, 0.4);
44
43
  --ptz-arrow-bg-color: rgba(0, 0, 0, 0.4);
45
44
  --app-native-btn-bg-color: transparent;
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react';
2
- import { View, CoverView, Text } from '@ray-js/ray';
2
+ import { View, CoverView } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { useStore } from '../../ctx/store';
5
6
  import { landscapeTipId } from '../../ui/constant';
6
7
  import { PlayState } from '../../interface';
@@ -7,7 +7,7 @@ import { getDpIdByCode, publishDps } from '@ray-js/ray-ipc-utils';
7
7
  import _find from 'lodash/find';
8
8
  import _get from 'lodash/get';
9
9
  import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
10
- import IpcPtzZoom from '@ray-js/ipc-ptz-zoom';
10
+ import IpcPtzZoom from '../../renderer/ptzZoom';
11
11
  import { useStore } from '../../ctx/store';
12
12
  import { useMemoizedFn } from '../../hooks';
13
13
  import { MultiCameraScreenMode } from '../../interface';
@@ -390,7 +390,7 @@ export const MoveablePtzControlItem = props => {
390
390
  ptzData: selectedLenInfo.supportPTZ ? ptzData : [],
391
391
  onTouchPtzStart: onTouchPtzStart,
392
392
  onTouchPtzEnd: async () => {
393
- screenMode !== MultiCameraScreenMode.short && event.emit(startTimeToHideAllComponent);
393
+ screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
394
394
  const stopConfig = dpSupportMap.ipc_multi_ptz_control ? {
395
395
  code: 'ipc_multi_ptz_stop',
396
396
  value: JSON.stringify({
@@ -415,7 +415,7 @@ export const MoveablePtzControlItem = props => {
415
415
  },
416
416
  onTouchZoomStart: onTouchZoomStart,
417
417
  onTouchZoomEnd: async () => {
418
- screenMode !== MultiCameraScreenMode.short && event.emit(startTimeToHideAllComponent);
418
+ screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
419
419
  const stopConfig = dpSupportMap.ipc_multi_zoom_control ? {
420
420
  code: 'ipc_multi_zoom_stop',
421
421
  value: JSON.stringify({
@@ -464,10 +464,10 @@ export const MoveablePtzControl = props => {
464
464
  // 处理因为状态更新不同步导致的闪烁问题
465
465
  const activeViewRef = useRef(0);
466
466
  const onDragStart = () => {
467
- screenMode !== MultiCameraScreenMode.short && event.emit(pauseTimeToHideAllComponent);
467
+ screenMode === MultiCameraScreenMode.landscape && event.emit(pauseTimeToHideAllComponent);
468
468
  };
469
469
  const onDragEnd = data => {
470
- screenMode !== MultiCameraScreenMode.short && event.emit(startTimeToHideAllComponent);
470
+ screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
471
471
  activeViewRef.current = activeViewRef.current === 0 ? 1 : 0;
472
472
  setStyle(prev => _objectSpread(_objectSpread({}, prev), {}, {
473
473
  positionLeft: data.positionLeft,
@@ -1,8 +1,9 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import { View, Text } from '@ray-js/ray';
2
+ import { View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import React from 'react';
5
5
  import { useMemoizedFn } from 'ahooks';
6
+ import { PlayerText as Text } from '../../renderer/text';
6
7
  import { useStore } from '../../ctx/store';
7
8
  import './index.less';
8
9
  /**
@@ -26,7 +27,7 @@ export const MultiPtz = props => {
26
27
  selectedLenInfo: multiCameraCtx.selectedLenInfo
27
28
  });
28
29
  const onPtz = useMemoizedFn(() => {
29
- multiCameraCtx.togglePtz();
30
+ multiCameraCtx.setPtzStatus(!ptzStatus);
30
31
  });
31
32
  if (!selectedLenInfo.supportPTZ && !selectedLenInfo.supportZoom) {
32
33
  return null;
@@ -1,6 +1,7 @@
1
1
  import React, { useMemo, useState } from 'react';
2
- import { View, CoverView, Text } from '@ray-js/ray';
2
+ import { View, CoverView } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { useStore } from '../../ctx/store';
5
6
  import { ptzMoveableTipId } from '../../ui/constant';
6
7
  import { PlayState } from '../../interface';
@@ -1,6 +1,7 @@
1
- import { Text, View } from '@ray-js/ray';
1
+ import { View } from '@ray-js/ray';
2
2
  import clsx from 'clsx';
3
3
  import React, { useMemo } from 'react';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { useStore } from '../../ctx/store';
5
6
  import { MultiCameraLayoutStyle, MultiCameraScreenMode } from '../../interface';
6
7
  import { multiPrefix } from './constants';
@@ -1,9 +1,10 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import { View, Text } from '@ray-js/ray';
2
+ import { View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import React from 'react';
5
5
  import { useMemoizedFn } from 'ahooks';
6
6
  import Color from 'color';
7
+ import { PlayerText as Text } from '../../renderer/text';
7
8
  import { useStore } from '../../ctx/store';
8
9
  import { multiPrefix } from './constants';
9
10
  import './index.less';
@@ -27,7 +28,7 @@ export const TileMultiPtz = props => {
27
28
  });
28
29
  const lighterBrandColor = new Color(brandColor).alpha(0.2).hexa();
29
30
  const onPtz = useMemoizedFn(() => {
30
- multiCameraCtx.togglePtz();
31
+ multiCameraCtx.setPtzStatus(!ptzStatus);
31
32
  });
32
33
  if (!selectedLenInfo.supportPTZ && !selectedLenInfo.supportZoom) {
33
34
  return null;
@@ -1,6 +1,7 @@
1
- import { View, Text } from '@ray-js/ray';
1
+ import { View } from '@ray-js/ray';
2
2
  import React, { useMemo } from 'react';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { MultiCameraLayoutStyle } from '../../interface';
5
6
  import { multiPrefix } from './constants';
6
7
  import { useStore } from '../../ctx/store';
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react';
2
- import { View, CoverView, Text } from '@ray-js/ray';
2
+ import { View, CoverView } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { useStore } from '../../ctx/store';
5
6
  import { tileTipId } from '../../ui/constant';
6
7
  import { PlayState } from '../../interface';
@@ -1,6 +1,7 @@
1
- import { View, Text } from '@ray-js/ray';
1
+ import { View } from '@ray-js/ray';
2
2
  import React, { useContext } from 'react';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { useStore } from '../../ctx/store';
5
6
  import { UIEventContext } from '../../ui/context';
6
7
  import { widgetLabs, widgetClick, pauseTimeToHideAllComponent, startTimeToHideAllComponent } from '../../ui/constant';
@@ -1,5 +1,7 @@
1
- import { act, renderHook } from '@testing-library/react-hooks/dom';
1
+ import React from 'react';
2
+ import { act, renderHook as renderPlayerHook } from '@testing-library/react-hooks/dom';
2
3
  import { atom, getDefaultStore } from 'jotai';
4
+ import { PlayerRenderModeContext } from '../../renderer/context';
3
5
  import { IntercomMode } from '../../interface';
4
6
  import { Muted } from './muted';
5
7
  jest.mock('@ray-js/ray', () => ({
@@ -27,55 +29,67 @@ const createProps = function () {
27
29
  }
28
30
  };
29
31
  };
30
- it.each([[IntercomMode.OneWay, true], [IntercomMode.OneWay, false], [IntercomMode.TwoWay, true], [IntercomMode.TwoWay, false]])('blocks speaker changes and control events during talk in mode=%s, muted=%s', (mode, muted) => {
31
- const props = createProps(true, mode, muted);
32
- const {
33
- result,
34
- unmount
35
- } = renderHook(() => Muted(props));
36
- act(() => result.current.props.onClick());
37
- expect(props.setMute).not.toHaveBeenCalled();
38
- expect(props.event.emit).not.toHaveBeenCalled();
39
- expect(result.current.props.className).toContain('ipc-player-plugin-muted-disabled');
40
- unmount();
41
- });
42
- it.each([[false, IntercomMode.OneWay, true, false], [false, IntercomMode.OneWay, false, true], [false, IntercomMode.TwoWay, true, false], [false, IntercomMode.TwoWay, false, true]])('keeps speaker switching when talking=%s, mode=%s, muted=%s', (talking, mode, muted, target) => {
43
- const props = createProps(talking, mode, muted);
44
- const {
45
- result,
46
- unmount
47
- } = renderHook(() => Muted(props));
48
- act(() => result.current.props.onClick());
49
- expect(props.setMute).toHaveBeenCalledTimes(1);
50
- expect(props.setMute).toHaveBeenCalledWith(target);
51
- expect(result.current.props.className).not.toContain('ipc-player-plugin-muted-disabled');
52
- unmount();
53
- });
54
- it.each([IntercomMode.OneWay, IntercomMode.TwoWay])('uses shared talk state after remount and unlocks when talk ends in mode=%s', mode => {
55
- const props = createProps(false, mode);
56
- const store = getDefaultStore();
57
- const first = renderHook(() => Muted(props));
58
- act(() => store.set(props.intercom, true));
59
- act(() => first.result.current.props.onClick());
60
- expect(props.setMute).not.toHaveBeenCalled();
61
- first.unmount();
62
- const second = renderHook(() => Muted(props));
63
- act(() => second.result.current.props.onClick());
64
- expect(props.setMute).not.toHaveBeenCalled();
65
- act(() => store.set(props.intercom, false));
66
- act(() => second.result.current.props.onClick());
67
- expect(props.setMute).toHaveBeenCalledWith(false);
68
- second.unmount();
69
- });
70
- it.each([[IntercomMode.OneWay, IntercomMode.TwoWay], [IntercomMode.TwoWay, IntercomMode.OneWay]])('keeps the speaker locked when active talk changes from %s to %s', (mode, nextMode) => {
71
- const props = createProps(true, mode);
72
- const {
73
- result,
74
- unmount
75
- } = renderHook(() => Muted(props));
76
- act(() => getDefaultStore().set(props.intercomMode, nextMode));
77
- act(() => result.current.props.onClick());
78
- expect(props.setMute).not.toHaveBeenCalled();
79
- expect(props.event.emit).not.toHaveBeenCalled();
80
- unmount();
32
+ describe.each(['webview', 'lynx'])('%s speaker interactions', renderMode => {
33
+ const renderHook = callback => renderPlayerHook(callback, {
34
+ wrapper: _ref => {
35
+ let {
36
+ children
37
+ } = _ref;
38
+ return /*#__PURE__*/React.createElement(PlayerRenderModeContext.Provider, {
39
+ value: renderMode
40
+ }, children);
41
+ }
42
+ });
43
+ it.each([[IntercomMode.OneWay, true], [IntercomMode.OneWay, false], [IntercomMode.TwoWay, true], [IntercomMode.TwoWay, false]])('blocks speaker changes and control events during talk in mode=%s, muted=%s', (mode, muted) => {
44
+ const props = createProps(true, mode, muted);
45
+ const {
46
+ result,
47
+ unmount
48
+ } = renderHook(() => Muted(props));
49
+ act(() => result.current.props.onClick());
50
+ expect(props.setMute).not.toHaveBeenCalled();
51
+ expect(props.event.emit).not.toHaveBeenCalled();
52
+ expect(result.current.props.className).toContain('ipc-player-plugin-muted-disabled');
53
+ unmount();
54
+ });
55
+ it.each([[false, IntercomMode.OneWay, true, false], [false, IntercomMode.OneWay, false, true], [false, IntercomMode.TwoWay, true, false], [false, IntercomMode.TwoWay, false, true]])('keeps speaker switching when talking=%s, mode=%s, muted=%s', (talking, mode, muted, target) => {
56
+ const props = createProps(talking, mode, muted);
57
+ const {
58
+ result,
59
+ unmount
60
+ } = renderHook(() => Muted(props));
61
+ act(() => result.current.props.onClick());
62
+ expect(props.setMute).toHaveBeenCalledTimes(1);
63
+ expect(props.setMute).toHaveBeenCalledWith(target);
64
+ expect(result.current.props.className).not.toContain('ipc-player-plugin-muted-disabled');
65
+ unmount();
66
+ });
67
+ it.each([IntercomMode.OneWay, IntercomMode.TwoWay])('uses shared talk state after remount and unlocks when talk ends in mode=%s', mode => {
68
+ const props = createProps(false, mode);
69
+ const store = getDefaultStore();
70
+ const first = renderHook(() => Muted(props));
71
+ act(() => store.set(props.intercom, true));
72
+ act(() => first.result.current.props.onClick());
73
+ expect(props.setMute).not.toHaveBeenCalled();
74
+ first.unmount();
75
+ const second = renderHook(() => Muted(props));
76
+ act(() => second.result.current.props.onClick());
77
+ expect(props.setMute).not.toHaveBeenCalled();
78
+ act(() => store.set(props.intercom, false));
79
+ act(() => second.result.current.props.onClick());
80
+ expect(props.setMute).toHaveBeenCalledWith(false);
81
+ second.unmount();
82
+ });
83
+ it.each([[IntercomMode.OneWay, IntercomMode.TwoWay], [IntercomMode.TwoWay, IntercomMode.OneWay]])('keeps the speaker locked when active talk changes from %s to %s', (mode, nextMode) => {
84
+ const props = createProps(true, mode);
85
+ const {
86
+ result,
87
+ unmount
88
+ } = renderHook(() => Muted(props));
89
+ act(() => getDefaultStore().set(props.intercomMode, nextMode));
90
+ act(() => result.current.props.onClick());
91
+ expect(props.setMute).not.toHaveBeenCalled();
92
+ expect(props.event.emit).not.toHaveBeenCalled();
93
+ unmount();
94
+ });
81
95
  });
@@ -1,8 +1,9 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import { View, Text } from '@ray-js/ray';
2
+ import { View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import React, { useEffect, useState, useContext } from 'react';
5
5
  import { useMemoizedFn } from 'ahooks';
6
+ import { PlayerText as Text } from '../../renderer/text';
6
7
  import { UIEventContext } from '../../ui/context';
7
8
  import { usePtz } from '../../hooks';
8
9
  import { useStore } from '../../ctx/store';
@@ -4,8 +4,8 @@ import { CoverView } from '@ray-js/ray';
4
4
  import clsx from 'clsx';
5
5
  import _find from 'lodash/find';
6
6
  import _get from 'lodash/get';
7
- import IpcPtzZoom from '@ray-js/ipc-ptz-zoom';
8
7
  import { getDpIdByCode, publishDps } from '@ray-js/ray-ipc-utils';
8
+ import IpcPtzZoom from '../../renderer/ptzZoom';
9
9
  import { Storage } from '../../utils/storage';
10
10
  import { useMemoizedFn } from '../../hooks';
11
11
  import { useComponentHideState } from '../../ui/hooks';
@@ -1,6 +1,8 @@
1
1
  import React, { useState } from 'react';
2
- import { View, Image, CoverView, Text, setStorage } from '@ray-js/ray';
2
+ import { View, Image, CoverView, setStorage } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
5
+ import { usePlayerRenderMode } from '../../renderer/context';
4
6
  import { useStore } from '../../ctx/store';
5
7
  import { ptzControlTipId, widgetLabs, widgetClick } from '../../ui/constant';
6
8
  import { PlayState } from '../../interface';
@@ -12,6 +14,7 @@ export const PtzControlTip = props => {
12
14
  devId,
13
15
  deleteContent
14
16
  } = props;
17
+ const isLynx = usePlayerRenderMode() === 'lynx';
15
18
  const [showTipModal, setShowTipModal] = useState(true);
16
19
  const {
17
20
  playState
@@ -34,9 +37,9 @@ export const PtzControlTip = props => {
34
37
  return /*#__PURE__*/React.createElement(CoverView, {
35
38
  className: clsx('playerControlTipContainer')
36
39
  }, /*#__PURE__*/React.createElement(Image, {
37
- mode: "widthFix",
40
+ mode: isLynx ? 'aspectFit' : 'widthFix',
38
41
  src: playerPtzControlTip,
39
- className: clsx('controlTipImage')
42
+ className: clsx('controlTipImage', isLynx && 'controlTipImageLynx')
40
43
  }), /*#__PURE__*/React.createElement(Text, {
41
44
  className: clsx('controlTipText')
42
45
  }, Strings.getLang('ipc_player_ptz_control_tip')), /*#__PURE__*/React.createElement(View, {
@@ -39,3 +39,9 @@
39
39
  color: #ffffff;
40
40
  }
41
41
  }
42
+
43
+ // Original PNG is 404 x 158. Lynx needs both dimensions; widthFix is WebView-only.
44
+ .playerControlTipContainer .controlTipImageLynx {
45
+ height: calc(66.4851485149px * var(--ipc-player-size-scale, 1));
46
+ flex-shrink: 0;
47
+ }
@@ -1,6 +1,7 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
- import { View, Text } from '@ray-js/ray';
2
+ import { View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { PlayState } from '../../interface';
5
6
  import { useStore } from '../../ctx/store';
6
7
  import { useDpSupport } from '../../hooks/useDpSupport';