@ray-js/ipc-player-integration 0.0.53-beta.8 → 0.0.54

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 (36) hide show
  1. package/lib/ctx/ctx.composition.js +3 -13
  2. package/lib/ctx/ctx.js +67 -71
  3. package/lib/i18n/index.d.ts +0 -12
  4. package/lib/i18n/strings.d.ts +0 -6
  5. package/lib/i18n/strings.js +0 -6
  6. package/lib/interface.d.ts +3 -16
  7. package/lib/ui/ui.js +25 -34
  8. package/lib/ui/useOfflineShownNotification.d.ts +1 -0
  9. package/lib/ui/useOfflineShownNotification.js +32 -0
  10. package/lib/ui/useOfflineShownNotification.test.js +98 -0
  11. package/lib/utils/ttt.js +5 -2
  12. package/lib/utils/ttt.notifyOfflineShown.test.js +30 -0
  13. package/lib/widgets/index.d.ts +0 -1
  14. package/lib/widgets/index.js +1 -2
  15. package/lib/widgets/recordVideo/recordVideo.js +36 -50
  16. package/lib/widgets/recordVideo/recordVideo.less +74 -17
  17. package/lib/widgets/screenshot/screenshot.js +66 -68
  18. package/lib/widgets/screenshot/screenshot.less +40 -1
  19. package/lib/widgets/videoBitKBP/videoBitKBP.js +29 -28
  20. package/lib/widgets/videoBitKBP/videoBitKBP.less +17 -14
  21. package/lib/widgets/videoBitKBP/videoBitKBP.test.js +76 -1
  22. package/lib/widgets/zoomTurntable/lensSkill.js +1 -4
  23. package/package.json +2 -2
  24. package/lib/ui/absoluteContent.d.ts +0 -2
  25. package/lib/ui/absoluteContent.js +0 -3
  26. package/lib/utils/captureResult.d.ts +0 -14
  27. package/lib/utils/captureResult.js +0 -70
  28. package/lib/utils/captureResult.test.js +0 -117
  29. package/lib/widgets/captureResult/captureResult.d.ts +0 -16
  30. package/lib/widgets/captureResult/captureResult.js +0 -85
  31. package/lib/widgets/captureResult/captureResult.less +0 -144
  32. package/lib/widgets/captureResult/captureResult.test.js +0 -80
  33. package/lib/widgets/captureResult/index.d.ts +0 -2
  34. package/lib/widgets/captureResult/index.js +0 -2
  35. /package/lib/{utils/captureResult.test.d.ts → ui/useOfflineShownNotification.test.d.ts} +0 -0
  36. /package/lib/{widgets/captureResult/captureResult.test.d.ts → utils/ttt.notifyOfflineShown.test.d.ts} +0 -0
@@ -0,0 +1,30 @@
1
+ import { notifyOfflineShown } from './ttt';
2
+ jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({
3
+ ClarityType: {}
4
+ }));
5
+ describe('notifyOfflineShown', () => {
6
+ const originalTy = globalThis.ty;
7
+ afterEach(() => {
8
+ globalThis.ty = originalTy;
9
+ });
10
+ it('passes the device ID and scene as one object to the TTT method', () => {
11
+ const nativeNotify = jest.fn();
12
+ globalThis.ty = {
13
+ ipc: {
14
+ notifyOfflineShown: nativeNotify
15
+ }
16
+ };
17
+ expect(notifyOfflineShown('camera-1')).toBe(true);
18
+ expect(nativeNotify).toHaveBeenCalledTimes(1);
19
+ expect(nativeNotify).toHaveBeenCalledWith({
20
+ deviceId: 'camera-1',
21
+ scene: 'preview_mini'
22
+ });
23
+ });
24
+ it('skips hosts without the TTT method', () => {
25
+ globalThis.ty = {
26
+ ipc: {}
27
+ };
28
+ expect(notifyOfflineShown('camera-1')).toBe(false);
29
+ });
30
+ });
@@ -24,4 +24,3 @@ export * from './toggleVerticalFull';
24
24
  export * from './flowLowTip';
25
25
  export * from './realTimeMagnification';
26
26
  export * from './zoomTurntable';
27
- export * from './captureResult';
@@ -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,12 +1,10 @@
1
1
  import React, { useState, useEffect, useRef, useContext } from 'react';
2
- import { View, Text, getSystemInfoSync } from '@ray-js/ray';
2
+ import { View, Text, Image, getSystemInfoSync } from '@ray-js/ray';
3
3
  import { useSetState, useUpdateEffect } from 'ahooks';
4
4
  import clsx from 'clsx';
5
5
  import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
6
6
  import Strings from '../../i18n';
7
7
  import { PlayState } from '../../interface';
8
- import { getCaptureResultSummary } from '../../utils/captureResult';
9
- import { CaptureResultToast } from '../captureResult/captureResult';
10
8
  import { UIEventContext } from '../../ui/context';
11
9
  import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
12
10
  import { useStore, getDefaultStore } from '../../ctx/store';
@@ -104,48 +102,20 @@ export function RecordVideo(props) {
104
102
  const [state, setState] = useSetState({
105
103
  showTimer: false,
106
104
  showShot: false,
107
- shotUrl: '',
108
- shotCount: 0
105
+ shotUrl: ''
109
106
  });
110
- const recordResultRequestIdRef = useRef(0);
111
- useEffect(() => {
112
- return () => {
113
- recordResultRequestIdRef.current += 1;
114
- };
115
- }, []);
116
- const showRecordResult = async recordInfo => {
117
- var _props$multiCameraCtx;
118
- const requestId = ++recordResultRequestIdRef.current;
119
- const splitNum = (_props$multiCameraCtx = props.multiCameraCtx) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.protocol) === null || _props$multiCameraCtx === void 0 ? void 0 : _props$multiCameraCtx.total_split_num;
120
- const summary = await getCaptureResultSummary(recordInfo, {
121
- multiLens: props.multiLens,
122
- protocolCount: splitNum,
123
- devId
124
- });
125
- if (requestId !== recordResultRequestIdRef.current) return;
126
- if (!summary) return;
127
- setState({
128
- showTimer: false,
129
- showShot: true,
130
- shotUrl: summary.thumbnailPath,
131
- shotCount: summary.isMultiLens ? summary.count : 0
132
- });
133
- };
134
107
 
135
108
  /**
136
109
  * 针对 playState为非连接中状态时,如果处于录制中, 结束录制
137
110
  */
138
111
  useEffect(() => {
139
112
  (async () => {
140
- if (playState !== PlayState.PLAYING && recording) {
141
- try {
113
+ if (playState !== PlayState.PLAYING) {
114
+ if (recording) {
142
115
  setState({
143
116
  showTimer: false
144
117
  });
145
- const recordInfo = await setRecording(false);
146
- await showRecordResult(recordInfo);
147
- } catch {
148
- // setRecording reports the native failure through the configured toast.
118
+ await setRecording(false);
149
119
  }
150
120
  }
151
121
  })();
@@ -159,8 +129,7 @@ export function RecordVideo(props) {
159
129
  timer.current = setTimeout(() => {
160
130
  setState({
161
131
  showShot: false,
162
- shotUrl: '',
163
- shotCount: 0
132
+ shotUrl: ''
164
133
  });
165
134
  deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
166
135
  }, CLOSE_TIME);
@@ -195,8 +164,7 @@ export function RecordVideo(props) {
195
164
  const handCheck = () => {
196
165
  setState({
197
166
  showShot: false,
198
- shotUrl: '',
199
- shotCount: 0
167
+ shotUrl: ''
200
168
  });
201
169
  deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
202
170
  clearInterval(timer.current);
@@ -218,13 +186,27 @@ export function RecordVideo(props) {
218
186
  marginLeft: screenType === 'vertical' ? '0' : '-200px'
219
187
  },
220
188
  content: () => {
221
- return /*#__PURE__*/React.createElement(CaptureResultToast, {
222
- brandColor: brandColor,
223
- count: state.shotCount,
224
- kind: "record",
225
- onCheck: handCheck,
226
- thumbnailPath: state.shotUrl
227
- });
189
+ return /*#__PURE__*/React.createElement(View, {
190
+ className: "ipc-player-plugin-record-success-toast"
191
+ }, /*#__PURE__*/React.createElement(View, {
192
+ className: "ipc-player-plugin-record-success-toast-image-box"
193
+ }, /*#__PURE__*/React.createElement(Image, {
194
+ className: "ipc-player-plugin-record-success-toast-image",
195
+ src: state.shotUrl
196
+ }), /*#__PURE__*/React.createElement(View, {
197
+ className: "ipc-player-plugin-record-success-play-icon-box"
198
+ }, /*#__PURE__*/React.createElement(Text, {
199
+ className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-record-success-play-icon')
200
+ }))), /*#__PURE__*/React.createElement(View, {
201
+ className: "ipc-player-plugin-record-success-toast-title"
202
+ }, Strings.getLang('ipc_player_record_success_tip')), /*#__PURE__*/React.createElement(View, {
203
+ onClick: handCheck,
204
+ className: "ipc-player-plugin-record-success-toast-bottom",
205
+ style: {
206
+ color: brandColor,
207
+ borderColor: brandColor
208
+ }
209
+ }, Strings.getLang('ipc_player_record_success_check')));
228
210
  }
229
211
  });
230
212
  timeToCloseRecordToast();
@@ -248,8 +230,9 @@ export function RecordVideo(props) {
248
230
  });
249
231
  };
250
232
  const handRecordVideo = async () => {
251
- var _props$event;
252
- ((_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event).emit(widgetClick, {
233
+ var _props$event, _props$event2;
234
+ (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
235
+ ((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(widgetClick, {
253
236
  widgetId: widgetLabs.RECORD_VIDEO
254
237
  });
255
238
  event.emit(pauseTimeToHideAllComponent);
@@ -259,7 +242,6 @@ export function RecordVideo(props) {
259
242
  if (recordingDisabled) {
260
243
  return false;
261
244
  }
262
- recordResultRequestIdRef.current += 1;
263
245
  if (state.showShot && _recording) {
264
246
  setState({
265
247
  showShot: false
@@ -283,7 +265,11 @@ export function RecordVideo(props) {
283
265
  timeToResetRecordDisabled();
284
266
  } else {
285
267
  props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
286
- await showRecordResult(recordInfo);
268
+ setState({
269
+ showTimer: false,
270
+ showShot: true,
271
+ shotUrl: recordInfo.tempImagePath
272
+ });
287
273
  }
288
274
  } catch (err) {
289
275
  props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
@@ -1,59 +1,116 @@
1
1
  .ipc-player-plugin-record-video-icon {
2
- color: var(--iconColor);
3
2
  font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
3
+ color: var(--iconColor);
4
4
  }
5
-
6
5
  .ipc-player-plugin-record-video-toast-wrap {
6
+ z-index: 400;
7
7
  position: absolute;
8
8
  top: calc(7px * var(--ipc-player-size-scale, 1));
9
9
  left: 50%;
10
- z-index: 400;
11
10
  transform: translateX(-50%);
12
11
  }
13
12
 
13
+ // 计时器显示
14
14
  .ipc-player-plugin-record-video-toast-show {
15
15
  transform: translate(0, 0) !important;
16
16
  transition: transform ease-in 3s;
17
17
  }
18
-
18
+ // 计时器隐藏
19
19
  .ipc-player-plugin-record-video-toast-hide {
20
20
  transform: translate(0, -110%) !important;
21
21
  transition: transform 0.3s ease-in-out;
22
22
  }
23
23
 
24
24
  .ipc-player-plugin-record-video-toast {
25
+ transform: translate(0, -110%);
25
26
  display: flex;
26
- align-items: center;
27
27
  padding: calc(12px * var(--ipc-player-size-scale, 1));
28
- background: linear-gradient(0deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15)),
29
- #000000;
28
+ align-items: center;
29
+ background-color: var(--shot-card-bg-color);
30
30
  border-radius: calc(8px * var(--ipc-player-size-scale, 1));
31
- transform: translate(0, -110%);
32
-
31
+ // background-color: #fff;
32
+ background: linear-gradient(0deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15)), #000000;
33
33
  .ipc-player-plugin-record-video-toast-point {
34
34
  width: calc(6px * var(--ipc-player-size-scale, 1));
35
35
  height: calc(6px * var(--ipc-player-size-scale, 1));
36
36
  border-radius: calc(6px * var(--ipc-player-size-scale, 1));
37
37
  }
38
-
39
38
  .ipc-player-plugin-record-video-toast-time {
39
+ font-size: calc(12px * var(--ipc-player-size-scale, 1));;
40
+ font-weight: 700;
41
+ color: var(--fontColor);
42
+ margin-left: calc(8px * var(--ipc-player-size-scale, 1));;
40
43
  display: flex;
41
44
  align-items: center;
42
- margin-left: calc(8px * var(--ipc-player-size-scale, 1));
43
- color: var(--fontColor);
44
- font-weight: 700;
45
- font-size: calc(12px * var(--ipc-player-size-scale, 1));
46
-
47
45
  .ipc-player-plugin-record-video-toast-time-warp {
48
46
  text-align: center;
49
47
  }
50
-
51
48
  .ipc-player-plugin-record-video-toast-time-delimiter {
52
- margin: 0 calc(2px * var(--ipc-player-size-scale, 1));
49
+ margin: 0 calc(2px * var(--ipc-player-size-scale, 1));;
53
50
  }
54
51
  }
55
52
  }
56
53
 
54
+ /** 录制成功弹窗 */
57
55
  .ipc-player-plugin-record-success-toast-wrap {
58
56
  position: absolute;
59
57
  }
58
+ .ipc-player-plugin-record-success-toast {
59
+ flex: 1;
60
+ border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
61
+ background-color: var(--shot-card-bg-color);
62
+ display: flex;
63
+ align-items: center;
64
+ padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
65
+ z-index: 100;
66
+ .ipc-player-plugin-record-success-toast-image-box {
67
+ border-radius: calc(4px * var(--ipc-player-size-scale, 1));
68
+ overflow: hidden;
69
+ width: calc(66px * var(--ipc-player-size-scale, 1));
70
+ height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
71
+ position: relative;
72
+ }
73
+ .ipc-player-plugin-record-success-toast-image {
74
+ width: 100%;
75
+ height: 100%;
76
+ object-fit: cover;
77
+ }
78
+ .ipc-player-plugin-record-success-play-icon-box {
79
+ width: 30px;
80
+ height: 30px;
81
+ background-color: rgba(0, 0, 0, 0.2);
82
+ border-radius: 50%;
83
+ overflow: hidden;
84
+ position: absolute;
85
+ top: 50%;
86
+ left: 50%;
87
+ transform: translate(-50%, -50%);
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: center;
91
+ }
92
+ .ipc-player-plugin-record-success-play-icon {
93
+ font-size: calc(18px * var(--ipc-player-size-scale, 1)) !important;
94
+ color: #ffffff;
95
+ }
96
+ .ipc-player-plugin-record-success-toast-title {
97
+ flex: 1;
98
+ margin-left: calc(12px * var(--ipc-player-size-scale, 1));
99
+ font-size: calc(14px * var(--ipc-player-size-scale, 1));
100
+ color: var(--fontColor);
101
+ margin-right: calc(12px * var(--ipc-player-size-scale, 1));
102
+ word-break: break-word;
103
+
104
+ }
105
+ .ipc-player-plugin-record-success-toast-bottom {
106
+ border: 1px solid #1989FA;
107
+ min-width: calc(52px * var(--ipc-player-size-scale, 1));
108
+ max-width: calc(100px * var(--ipc-player-size-scale, 1));
109
+ border-radius: calc(4px * var(--ipc-player-size-scale, 1));
110
+ padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
111
+ font-size: calc(14px * var(--ipc-player-size-scale, 1));
112
+ white-space: nowrap;
113
+ overflow: hidden;
114
+ text-overflow: ellipsis;
115
+ }
116
+ }
@@ -1,5 +1,5 @@
1
- import React, { useContext, useEffect, useRef } from 'react';
2
- import { View, Text, showModal, openAppSystemSettingPage, getSystemInfoSync } from '@ray-js/ray';
1
+ import React, { useContext, useRef } from 'react';
2
+ import { View, Image, Text, showModal, openAppSystemSettingPage, getSystemInfoSync } from '@ray-js/ray';
3
3
  import { useSetState, useUpdateEffect, useMemoizedFn } from 'ahooks';
4
4
  import clsx from 'clsx';
5
5
  import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
@@ -7,8 +7,6 @@ import Strings from '../../i18n';
7
7
  import { useStore } from '../../ctx/store';
8
8
  import { UIEventContext } from '../../ui/context';
9
9
  import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
10
- import { getCaptureResultSummary } from '../../utils/captureResult';
11
- import { CaptureResultToast } from '../captureResult/captureResult';
12
10
  import './screenshot.less';
13
11
  const CLOSE_TIME = 5000;
14
12
  export function Screenshot(props) {
@@ -36,15 +34,8 @@ export function Screenshot(props) {
36
34
  /** 记录截屏url */
37
35
  const [state, setState] = useSetState({
38
36
  showShot: false,
39
- shotUrl: '',
40
- shotCount: 0
37
+ shotUrl: ''
41
38
  });
42
- const snapshotRequestIdRef = useRef(0);
43
- useEffect(() => {
44
- return () => {
45
- snapshotRequestIdRef.current += 1;
46
- };
47
- }, []);
48
39
  useUpdateEffect(() => {
49
40
  if (state.showShot && screenType) {
50
41
  showShotToast();
@@ -57,8 +48,7 @@ export function Screenshot(props) {
57
48
  timer.current = setTimeout(() => {
58
49
  setState({
59
50
  showShot: false,
60
- shotUrl: '',
61
- shotCount: 0
51
+ shotUrl: ''
62
52
  });
63
53
  deleteContent('absolute', 'plugin-screenshot-toast');
64
54
  }, CLOSE_TIME);
@@ -68,8 +58,7 @@ export function Screenshot(props) {
68
58
  const handCheck = () => {
69
59
  setState({
70
60
  showShot: false,
71
- shotUrl: '',
72
- shotCount: 0
61
+ shotUrl: ''
73
62
  });
74
63
  deleteContent('absolute', 'plugin-screenshot-toast');
75
64
  clearInterval(timer.current);
@@ -91,20 +80,31 @@ export function Screenshot(props) {
91
80
  marginLeft: screenType === 'vertical' ? '0' : '-200px'
92
81
  },
93
82
  content: () => {
94
- return /*#__PURE__*/React.createElement(CaptureResultToast, {
95
- brandColor: brandColor,
96
- count: state.shotCount,
97
- kind: "screenshot",
98
- onCheck: handCheck,
99
- thumbnailPath: state.shotUrl
100
- });
83
+ return /*#__PURE__*/React.createElement(View, {
84
+ className: "ipc-player-plugin-screenshot-toast"
85
+ }, /*#__PURE__*/React.createElement(View, {
86
+ className: "ipc-player-plugin-screenshot-toast-image-box"
87
+ }, /*#__PURE__*/React.createElement(Image, {
88
+ className: "ipc-player-plugin-screenshot-toast-image",
89
+ src: state.shotUrl
90
+ })), /*#__PURE__*/React.createElement(View, {
91
+ className: "ipc-player-plugin-screenshot-toast-title"
92
+ }, Strings.getLang('ipc_player_screenshot_success_tip')), /*#__PURE__*/React.createElement(View, {
93
+ onClick: handCheck,
94
+ className: "ipc-player-plugin-screenshot-toast-bottom",
95
+ style: {
96
+ color: brandColor,
97
+ borderColor: brandColor
98
+ }
99
+ }, Strings.getLang('ipc_player_shot_success_check')));
101
100
  }
102
101
  });
103
102
  timeToCloseToast();
104
103
  };
105
104
  const handClick = useMemoizedFn(() => {
106
- var _props$event;
107
- ((_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event).emit(widgetClick, {
105
+ var _props$event, _props$event2;
106
+ (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
107
+ ((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(widgetClick, {
108
108
  widgetId: widgetLabs.SCREENSHOT
109
109
  });
110
110
  console.log('截屏!!!');
@@ -118,58 +118,56 @@ export function Screenshot(props) {
118
118
  props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, true);
119
119
  }
120
120
  event.emit(pauseTimeToHideAllComponent);
121
- const setIgnoreHideStopPreview = value => {
122
- var _props$event2;
123
- ((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(changeIgnoreHideStopPreview, value);
124
- };
125
- const handleSnapshotFail = err => {
126
- setIgnoreHideStopPreview(false);
127
- console.log(err, 'err');
128
- const errObj = err.innerError || err || {};
129
- const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
130
- toast({
131
- title: errMsg
132
- });
133
- };
134
- const takeSnapshot = () => {
135
- const requestId = ++snapshotRequestIdRef.current;
136
- IPCPlayerContext.snapshot({
137
- saveToAlbum,
138
- success: async res => {
139
- var _props$multiCameraCtx;
140
- setIgnoreHideStopPreview(false);
141
- const splitNum = (_props$multiCameraCtx = props.multiCameraCtx) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.protocol) === null || _props$multiCameraCtx === void 0 ? void 0 : _props$multiCameraCtx.total_split_num;
142
- const summary = await getCaptureResultSummary(res, {
143
- multiLens: props.multiLens,
144
- protocolCount: splitNum,
145
- devId
146
- });
147
- if (requestId !== snapshotRequestIdRef.current) return;
148
- if (!summary) {
149
- handleSnapshotFail({});
150
- return;
151
- }
152
- setState({
153
- showShot: true,
154
- shotUrl: summary.thumbnailPath,
155
- shotCount: summary.isMultiLens ? summary.count : 0
156
- });
157
- },
158
- fail: handleSnapshotFail
159
- });
160
- };
161
121
  ty.authorizeStatus({
162
122
  // 相册写入权限
163
123
  scope: 'scope.writePhotosAlbum',
164
124
  success: () => {
165
- setIgnoreHideStopPreview(false);
166
- takeSnapshot();
125
+ props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
126
+ IPCPlayerContext.snapshot({
127
+ saveToAlbum,
128
+ // 保存到 IPC 相册
129
+ success: res => {
130
+ console.log(res, 'res');
131
+ props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
132
+ setState({
133
+ showShot: true,
134
+ shotUrl: res.tempImagePath
135
+ });
136
+ },
137
+ fail: err => {
138
+ props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
139
+ console.log(err, 'err');
140
+ const errObj = err.innerError || err || {};
141
+ const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
142
+ toast({
143
+ title: errMsg
144
+ });
145
+ }
146
+ });
167
147
  },
168
148
  fail: () => {
169
149
  ty.authorize({
170
150
  scope: 'scope.writePhotosAlbum',
171
151
  success: () => {
172
- takeSnapshot();
152
+ IPCPlayerContext.snapshot({
153
+ saveToAlbum,
154
+ // 保存到 IPC 相册
155
+ success: res => {
156
+ console.log(res, 'res');
157
+ setState({
158
+ showShot: true,
159
+ shotUrl: res.tempImagePath
160
+ });
161
+ },
162
+ fail: err => {
163
+ console.log(err, 'err');
164
+ const errObj = err.innerError || err || {};
165
+ const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
166
+ toast({
167
+ title: errMsg
168
+ });
169
+ }
170
+ });
173
171
  },
174
172
  fail: () => {
175
173
  showModal({
@@ -2,7 +2,46 @@
2
2
  color: var(--iconColor);
3
3
  font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
4
4
  }
5
-
6
5
  .ipc-player-plugin-screenshot-toast-wrap {
7
6
  position: absolute;
8
7
  }
8
+ .ipc-player-plugin-screenshot-toast {
9
+ flex: 1;
10
+ border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
11
+ background-color: var(--shot-card-bg-color);
12
+ display: flex;
13
+ align-items: center;
14
+ padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
15
+ z-index: 100;
16
+ .ipc-player-plugin-screenshot-toast-image-box {
17
+ border-radius: calc(4px * var(--ipc-player-size-scale, 1));
18
+ overflow: hidden;
19
+ width: calc(66px * var(--ipc-player-size-scale, 1));
20
+ height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
21
+ }
22
+ .ipc-player-plugin-screenshot-toast-image {
23
+ width: 100%;
24
+ height: 100%;
25
+ object-fit: cover;
26
+ }
27
+ .ipc-player-plugin-screenshot-toast-title {
28
+ flex: 1;
29
+ margin-left: calc(12px * var(--ipc-player-size-scale, 1));
30
+ font-size: calc(14px * var(--ipc-player-size-scale, 1));
31
+ color: var(--fontColor);
32
+ margin-right: calc(12px * var(--ipc-player-size-scale, 1));
33
+ word-break: break-word;
34
+
35
+ }
36
+ .ipc-player-plugin-screenshot-toast-bottom {
37
+ border: 1px solid #1989FA;
38
+ min-width: calc(52px * var(--ipc-player-size-scale, 1));
39
+ max-width: calc(100px * var(--ipc-player-size-scale, 1));
40
+ border-radius: calc(4px * var(--ipc-player-size-scale, 1));
41
+ padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
42
+ font-size: calc(14px * var(--ipc-player-size-scale, 1));
43
+ white-space: nowrap;
44
+ overflow: hidden;
45
+ text-overflow: ellipsis;
46
+ }
47
+ }
@@ -61,31 +61,7 @@ export const VideoBitKBP = props => {
61
61
  const hasSignal = isPlaying && !hideSignalMenu && signalStrength !== null;
62
62
  const activeClarity = store.resolution === ClarityType.AUTO ? store.autoClarity : null;
63
63
  const hasClarity = Boolean(activeClarity);
64
- if (!hasKbps && !hasSignal && !hasClarity) {
65
- return null;
66
- }
67
- return /*#__PURE__*/React.createElement(View, {
68
- className: clsx({
69
- 'ipc-player-plugin-videoBitKBP-container': true,
70
- [className]: !!className
71
- })
72
- }, /*#__PURE__*/React.createElement(View, {
73
- className: "ipc-player-plugin-videoBitKBP"
74
- }, hasSignal && /*#__PURE__*/React.createElement(View, {
75
- className: "ipc-player-plugin-videoBitKBP-signal"
76
- }, /*#__PURE__*/React.createElement(Text, {
77
- className: clsx('icon-panel', 'icon-panel-wi-Fi', 'ipc-player-plugin-videoBitKBP-signal-icon')
78
- }), /*#__PURE__*/React.createElement(Text, null, signalStrength), /*#__PURE__*/React.createElement(Text, {
79
- className: "ipc-player-plugin-videoBitKBP-unit-percent"
80
- }, signalStrength > 0 ? '%' : 'dBm')), hasSignal && (hasKbps || hasClarity) && /*#__PURE__*/React.createElement(View, {
81
- className: "ipc-player-plugin-videoBitKBP-divider"
82
- }), (hasKbps || hasClarity) && /*#__PURE__*/React.createElement(View, {
83
- className: "ipc-player-plugin-videoBitKBP-kbps"
84
- }, activeClarity && /*#__PURE__*/React.createElement(Text, {
85
- className: clsx('ipc-player-plugin-videoBitKBP-clarity', {
86
- 'ipc-player-plugin-videoBitKBP-clarity-only': !hasKbps
87
- })
88
- }, (clarity => {
64
+ const bitrateLabel = [activeClarity ? (clarity => {
89
65
  switch (clarity) {
90
66
  case ClarityType.SS:
91
67
  return Strings.getLang('ipc_player_resolution_SS');
@@ -104,7 +80,32 @@ export const VideoBitKBP = props => {
104
80
  default:
105
81
  return clarity;
106
82
  }
107
- })(activeClarity)), hasKbps && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, bitKBP), /*#__PURE__*/React.createElement(Text, {
108
- className: "ipc-player-plugin-videoBitKBP-unit-kbs"
109
- }, "KB/S")))));
83
+ })(activeClarity) : '', hasKbps ? `${bitKBP} KB/S` : ''].filter(Boolean).join(' ');
84
+ if (!hasKbps && !hasSignal && !hasClarity) {
85
+ return null;
86
+ }
87
+ return /*#__PURE__*/React.createElement(View, {
88
+ className: clsx({
89
+ 'ipc-player-plugin-videoBitKBP-container': true,
90
+ [className]: !!className
91
+ })
92
+ }, /*#__PURE__*/React.createElement(View, {
93
+ className: "ipc-player-plugin-videoBitKBP"
94
+ }, /*#__PURE__*/React.createElement(View, {
95
+ className: "ipc-player-plugin-videoBitKBP-content"
96
+ }, hasSignal && /*#__PURE__*/React.createElement(View, {
97
+ className: "ipc-player-plugin-videoBitKBP-signal"
98
+ }, /*#__PURE__*/React.createElement(Text, {
99
+ className: clsx('icon-panel', 'icon-panel-wi-Fi', 'ipc-player-plugin-videoBitKBP-signal-icon')
100
+ }), /*#__PURE__*/React.createElement(Text, {
101
+ className: "ipc-player-plugin-videoBitKBP-signal-text"
102
+ }, signalStrength), /*#__PURE__*/React.createElement(Text, {
103
+ className: "ipc-player-plugin-videoBitKBP-signal-text ipc-player-plugin-videoBitKBP-unit-percent"
104
+ }, signalStrength > 0 ? '%' : 'dBm')), hasSignal && (hasKbps || hasClarity) && /*#__PURE__*/React.createElement(View, {
105
+ className: "ipc-player-plugin-videoBitKBP-divider"
106
+ }), (hasKbps || hasClarity) && /*#__PURE__*/React.createElement(View, {
107
+ className: "ipc-player-plugin-videoBitKBP-kbps"
108
+ }, /*#__PURE__*/React.createElement(Text, {
109
+ className: "ipc-player-plugin-videoBitKBP-kbps-text"
110
+ }, bitrateLabel)))));
110
111
  };