@ray-js/ipc-player-integration 0.0.1-beta-6 → 0.0.1-beta-8

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 (38) hide show
  1. package/lib/ctx/ctx.composition.js +17 -1
  2. package/lib/ctx/ctx.d.ts +3 -2
  3. package/lib/ctx/ctx.js +29 -8
  4. package/lib/ctx/ports.output.d.ts +1 -0
  5. package/lib/hooks/index.d.ts +0 -1
  6. package/lib/hooks/index.js +0 -1
  7. package/lib/hooks/useTemperature/index.js +0 -1
  8. package/lib/iconfont/demo_index.html +491 -123
  9. package/lib/iconfont/iconfont.css +87 -23
  10. package/lib/iconfont/iconfont.js +15 -15
  11. package/lib/iconfont/iconfont.json +154 -42
  12. package/lib/iconfont/iconfont.ttf +0 -0
  13. package/lib/iconfont/iconfont.woff +0 -0
  14. package/lib/iconfont/iconfont.woff2 +0 -0
  15. package/lib/interface.d.ts +2 -0
  16. package/lib/plugins/battery/battery.composition.d.ts +1 -0
  17. package/lib/plugins/fullScreen/fullScreen.js +1 -1
  18. package/lib/plugins/fullScreen/verticalScreen.js +1 -1
  19. package/lib/plugins/muted/muted.js +2 -2
  20. package/lib/plugins/recordVideo/recordVideo.js +25 -7
  21. package/lib/plugins/recordVideo/recordVideo.less +6 -4
  22. package/lib/plugins/screenshot/screenshot.js +34 -23
  23. package/lib/plugins/screenshot/screenshot.less +6 -3
  24. package/lib/plugins/tempHumidity/tempHumidity.js +3 -3
  25. package/lib/plugins/videoBitKbps/videoBitKbps.js +24 -90
  26. package/lib/plugins/voiceIntercom/type.d.ts +4 -0
  27. package/lib/plugins/voiceIntercom/voice.gif +0 -0
  28. package/lib/plugins/voiceIntercom/voiceIntercom.d.ts +2 -1
  29. package/lib/plugins/voiceIntercom/voiceIntercom.js +41 -36
  30. package/lib/plugins/voiceIntercom/voiceIntercom.less +7 -1
  31. package/lib/ports.output.d.ts +4 -0
  32. package/lib/ui/ui.js +5 -3
  33. package/lib/ui/ui.less +7 -1
  34. package/package.json +3 -2
  35. package/lib/hooks/useVideoBitKbps/index.d.ts +0 -1
  36. package/lib/hooks/useVideoBitKbps/index.js +0 -20
  37. package/lib/utils/ipcApi/index.d.ts +0 -78
  38. package/lib/utils/ipcApi/index.js +0 -251
@@ -1,6 +1,9 @@
1
- import React, { useState, useEffect, useRef } from 'react';
1
+ import React, { useState, useEffect, useRef, useContext } from 'react';
2
2
  import { View } from '@ray-js/ray';
3
- import { useStore } from '../../ctx/store';
3
+ import clsx from 'clsx';
4
+ import { UIEventContext } from '../../ui/context';
5
+ import { startTimeToHideAllComponent, pauseTimeToHideAllComponent } from '../../ui/constant';
6
+ import { useStore, getDefaultStore } from '../../ctx/store';
4
7
  import './recordVideo.less';
5
8
  const RECORD_VIDEO_TOAST_ID = 'record_video_toast_id';
6
9
  function formatTimeDiff(diff) {
@@ -62,6 +65,9 @@ function TimeRecord() {
62
65
  }, sec));
63
66
  }
64
67
  export function RecordVideo(props) {
68
+ const {
69
+ event
70
+ } = useContext(UIEventContext);
65
71
  const {
66
72
  addContent,
67
73
  deleteContent
@@ -75,23 +81,35 @@ export function RecordVideo(props) {
75
81
  } = useStore({
76
82
  recording: recordingAtom
77
83
  });
78
- const handRecordVideo = async target => {
79
- await setRecording(target);
84
+ const handRecordVideo = async () => {
85
+ const store = getDefaultStore();
86
+ const _recording = store.get(recordingAtom);
87
+ const target = !_recording;
80
88
  if (target) {
81
- deleteContent('absolute', RECORD_VIDEO_TOAST_ID);
89
+ event.emit(pauseTimeToHideAllComponent);
82
90
  } else {
91
+ event.emit(startTimeToHideAllComponent);
92
+ }
93
+ await setRecording(target);
94
+ if (target) {
83
95
  addContent('absolute', {
84
96
  id: RECORD_VIDEO_TOAST_ID,
97
+ absoluteContentClassName: 'ipc-player-plugin-record-video-toast-wrap',
85
98
  content: () => /*#__PURE__*/React.createElement(View, {
86
99
  className: "ipc-player-plugin-record-video-toast"
87
100
  }, /*#__PURE__*/React.createElement(View, {
88
101
  className: "ipc-player-plugin-record-video-toast-point"
89
102
  }), /*#__PURE__*/React.createElement(TimeRecord, null))
90
103
  });
104
+ } else {
105
+ deleteContent('absolute', RECORD_VIDEO_TOAST_ID);
91
106
  }
92
107
  };
93
108
  return /*#__PURE__*/React.createElement(View, {
94
- onClick: () => handRecordVideo(!recording),
95
- className: "ipc-player-plugin-record-video-icon icon-panel icon-panel-luping"
109
+ onClick: () => handRecordVideo(),
110
+ className: clsx('ipc-player-plugin-record-video-icon', 'icon-panel', recording ? 'icon-panel-record-stop' : 'icon-panel-record'),
111
+ style: {
112
+ color: recording ? 'rgba(255, 56, 56, 1)' : undefined
113
+ }
96
114
  });
97
115
  }
@@ -2,15 +2,17 @@
2
2
  font-size: calc(var(--iconFontSize) * var(--ipc-player-size-scale, 1));
3
3
  color: var(--iconColor);
4
4
  }
5
- .ipc-player-plugin-record-video-toast {
5
+ .ipc-player-plugin-record-video-toast-wrap {
6
6
  z-index: 2;
7
7
  position: absolute;
8
+ top: calc(7px * var(--ipc-player-size-scale, 1));
9
+ left: 50%;
10
+ transform: translateX(-50%);
11
+ }
12
+ .ipc-player-plugin-record-video-toast {
8
13
  display: flex;
9
14
  padding: calc(12px * var(--ipc-player-size-scale, 1));
10
15
  align-items: center;
11
- left: 50%;
12
- transform: translateX(-50%);
13
- top: calc(7px * var(--ipc-player-size-scale, 1));
14
16
  background-color: var(--bg-color);
15
17
  border-radius: calc(8px * var(--ipc-player-size-scale, 1));
16
18
  .ipc-player-plugin-record-video-toast-point {
@@ -1,5 +1,6 @@
1
1
  import React, { useRef } from 'react';
2
- import { View, Image, CoverView } from '@ray-js/ray';
2
+ import { View, Image } from '@ray-js/ray';
3
+ import IpcUtils from '@ray-js/ray-ipc-utils';
3
4
  import './screenshot.less';
4
5
  const CLOSE_TIME = 5000;
5
6
  export function Screenshot(props) {
@@ -7,7 +8,9 @@ export function Screenshot(props) {
7
8
  IPCPlayerContext,
8
9
  addContent,
9
10
  saveToAlbum,
10
- deleteContent
11
+ deleteContent,
12
+ devId,
13
+ toast
11
14
  } = props;
12
15
  const timer = useRef();
13
16
  const timeToCloseToast = () => {
@@ -18,7 +21,28 @@ export function Screenshot(props) {
18
21
  }, CLOSE_TIME);
19
22
  };
20
23
  const handCheck = () => {
21
- console.log('handCheck');
24
+ IpcUtils.goToIpcPageNativeRoute('ipc_album_panel', devId);
25
+ };
26
+ const showToast = str => {
27
+ deleteContent('absolute', 'plugin-screenshot-toast');
28
+ addContent('absolute', {
29
+ id: 'plugin-screenshot-toast',
30
+ absoluteContentClassName: 'ipc-player-plugin-screenshot-toast-warp',
31
+ content: () => {
32
+ return /*#__PURE__*/React.createElement(View, {
33
+ className: "ipc-player-plugin-screenshot-toast"
34
+ }, /*#__PURE__*/React.createElement(Image, {
35
+ className: "ipc-player-plugin-screenshot-toast-image",
36
+ src: str
37
+ }), /*#__PURE__*/React.createElement(View, {
38
+ className: "ipc-player-plugin-screenshot-toast-title"
39
+ }, I18n.t('screenshot_success_tip')), /*#__PURE__*/React.createElement(View, {
40
+ onClick: handCheck,
41
+ className: "ipc-player-plugin-screenshot-toast-bottom"
42
+ }, I18n.t('check')));
43
+ }
44
+ });
45
+ timeToCloseToast();
22
46
  };
23
47
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
24
48
  onClick: () => {
@@ -26,30 +50,17 @@ export function Screenshot(props) {
26
50
  saveToAlbum,
27
51
  // 保存到 IPC 相册
28
52
  success: res => {
29
- deleteContent('absolute', 'plugin-screenshot-toast');
30
- addContent('absolute', {
31
- id: 'plugin-screenshot-toast',
32
- content: () => {
33
- return /*#__PURE__*/React.createElement(CoverView, {
34
- className: "ipc-player-plugin-screenshot-toast"
35
- }, /*#__PURE__*/React.createElement(Image, {
36
- className: "ipc-player-plugin-screenshot-toast-image",
37
- src: res.tempImagePath
38
- }), /*#__PURE__*/React.createElement(View, {
39
- className: "ipc-player-plugin-screenshot-toast-title"
40
- }, "\u622A\u56FE\u5DF2\u4FDD\u5B58\u81F3\u76F8\u518C"), /*#__PURE__*/React.createElement(View, {
41
- onClick: handCheck,
42
- className: "ipc-player-plugin-screenshot-toast-bottom"
43
- }, "\u67E5\u770B"));
44
- }
45
- });
46
- timeToCloseToast();
53
+ showToast(res.tempImagePath);
47
54
  },
48
55
  fail: err => {
49
- console.log('保存相册失败', err);
56
+ const errObj = err.innerError || err || {};
57
+ const errMsg = errObj.errorMsg || I18n.t('error_screenshot');
58
+ toast({
59
+ title: errMsg
60
+ });
50
61
  }
51
62
  });
52
63
  },
53
- className: "icon-panel icon-panel-jieping ipc-player-plugin-screenshot-icon"
64
+ className: "icon-panel icon-panel-screenshot ipc-player-plugin-screenshot-icon"
54
65
  }));
55
66
  }
@@ -2,14 +2,17 @@
2
2
  color: var(--iconColor);
3
3
  font-size: calc(var(--iconFontSize) * var(--ipc-player-size-scale, 1));
4
4
  }
5
- .ipc-player-plugin-screenshot-toast {
5
+ .ipc-player-plugin-screenshot-toast-warp {
6
6
  position: absolute;
7
7
  width: 90%;
8
- border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
9
- background-color: var(--bg-color);
8
+ max-width: 750rpx;
10
9
  left: 50%;
11
10
  transform: translateX(-50%);
12
11
  top: calc(16px * var(--ipc-player-size-scale, 1));
12
+ }
13
+ .ipc-player-plugin-screenshot-toast {
14
+ border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
15
+ background-color: var(--bg-color);
13
16
  display: flex;
14
17
  align-items: center;
15
18
  padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(16px * var(--ipc-player-size-scale, 1));
@@ -17,20 +17,20 @@ export const TempHumidity = props => {
17
17
  const tempRender = () => {
18
18
  if (tempUnit === '1') {
19
19
  return tempF && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
20
- className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-wendu"
20
+ className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-temperature"
21
21
  }), /*#__PURE__*/React.createElement(Text, {
22
22
  className: "tempHumidity"
23
23
  }, tempF));
24
24
  }
25
25
  return tempC && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
26
- className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-wendu"
26
+ className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-temperature"
27
27
  }), /*#__PURE__*/React.createElement(Text, null, tempC), /*#__PURE__*/React.createElement(Text, {
28
28
  className: "ipc-player-plugin-tempHumidity-divider"
29
29
  }, "/"));
30
30
  };
31
31
  const humRender = () => {
32
32
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
33
- className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-shidu"
33
+ className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-humidity"
34
34
  }), /*#__PURE__*/React.createElement(Text, {
35
35
  className: "tempHumidity"
36
36
  }, `${humidity}`));
@@ -1,102 +1,36 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { View } from '@ray-js/ray';
3
- import { useVideoBitKbps } from '../../hooks';
4
3
  import './videoBitKbps.less';
5
- import { getCurrentSupportedTalkMode, getMobileOrientation, getVideoBitrateKbps, requestWifiSignal, isSupportedTalk, isSupportFloatWindow, openFloatWindow, setScreenOrientation, wakeUpDevice } from '../../utils/ipcApi';
4
+ import IpcUtils from '@ray-js/ray-ipc-utils';
5
+ import { PlayState } from '../../interface';
6
+ import { useStore } from '../../ctx/store';
6
7
  export const VideoBitKbps = props => {
7
8
  const {
8
9
  devId,
9
- IPCPlayerContext
10
+ playState
10
11
  } = props;
11
- const bitKbps = useVideoBitKbps(devId);
12
+ const [bitKbps, setBitKbps] = useState('');
13
+ const store = useStore({
14
+ playState
15
+ });
12
16
  useEffect(() => {
13
- // TODO: test
14
- // test();
15
- }, []);
16
- useEffect(() => {
17
- // TODO: test
18
- testOther();
19
- }, []);
20
- const testOther = async () => {
21
- console.log('res===ttt');
22
- try {
23
- await requestWifiSignal(devId);
24
- } catch (error) {
25
- console.log('res===catch', error);
17
+ let timer;
18
+ if (store.playState === PlayState.PLAYING) {
19
+ init();
20
+ timer = setInterval(() => {
21
+ init();
22
+ }, 5000);
23
+ }
24
+ return () => {
25
+ clearInterval(timer);
26
+ };
27
+ }, [store.playState]);
28
+ const init = async () => {
29
+ const res = await IpcUtils.getVideoBitrateKbps(devId);
30
+ if (res.code !== -1) {
31
+ setBitKbps(`${res.data.kbps}KB/S`);
26
32
  }
27
- await getVideoBitrateKbps(devId); // 过
28
- await wakeUpDevice(devId); // 过
29
- await getMobileOrientation(); // 过
30
- await setScreenOrientation('portrait'); // xxx
31
- await isSupportFloatWindow(devId);
32
- await isSupportedTalk(devId);
33
- await getCurrentSupportedTalkMode(devId);
34
- await openFloatWindow(devId); // 无
35
33
  };
36
-
37
- // const test = () => {
38
- // console.log('res===ppp test');
39
- // // 缩放倍数
40
- // IPCPlayerContext.setScaleMultiple({
41
- // scaleMultiple: 1,
42
- // success: res => {
43
- // console.log('res===ppp setScaleMultiple success', res);
44
- // },
45
- // fail: error => {
46
- // console.log('res===ppp setScaleMultiple fail', error);
47
- // },
48
- // });
49
-
50
- // IPCPlayerContext.setTrackingStatus({
51
- // // status: false, // 非必传
52
- // success: res => {
53
- // console.log('res===ppp setTrackingStatus success', res);
54
- // },
55
- // fail: error => {
56
- // console.log('res===ppp setTrackingStatus fail', error);
57
- // },
58
- // });
59
-
60
- // IPCPlayerContext.setScalable({
61
- // scaleble: 1,
62
- // success: res => {
63
- // console.log('res===ppp setScalable success', res);
64
- // },
65
- // fail: error => {
66
- // console.log('res===ppp setScalable fail', error);
67
- // },
68
- // });
69
-
70
- // IPCPlayerContext.isPTZControllable({
71
- // success: res => {
72
- // console.log('res===ppp isPTZControllable success', res);
73
- // },
74
- // fail: error => {
75
- // console.log('res===ppp isPTZControllable fail', error);
76
- // },
77
- // });
78
-
79
- // IPCPlayerContext.setRotateZ({
80
- // rotateZ: 0,
81
- // success: res => {
82
- // console.log('res===ppp setRotateZ success', res);
83
- // },
84
- // fail: error => {
85
- // console.log('res===ppp setRotateZ fail', error);
86
- // },
87
- // });
88
-
89
- // // IPCPlayerContext.setMaxScaleMultiple({
90
- // // maxScaleMultiple: 90, // 0-360
91
- // // success: (res) => {
92
- // // console.log('res===ppp maxScaleMultiple success', res);
93
- // // },
94
- // // fail: (error) => {
95
- // // console.log('res===ppp maxScaleMultiple fail', error);
96
- // // }
97
- // // })
98
- // };
99
-
100
34
  return /*#__PURE__*/React.createElement(View, {
101
35
  className: "ipc-player-plugin-videoBitKbps"
102
36
  }, bitKbps);
@@ -0,0 +1,4 @@
1
+ declare module '*.gif' {
2
+ const content: any;
3
+ export default content;
4
+ }
@@ -5,8 +5,9 @@ import { ComponentConfigProps } from '../../interface';
5
5
  type Props = ComponentConfigProps & {
6
6
  style?: React.CSSProperties;
7
7
  className?: string;
8
+ iconClassName?: string;
8
9
  onTouchStart?: TouchEventHandler['onTouchStart'];
9
10
  onTouchEnd?: TouchEventHandler['onTouchEnd'];
10
11
  };
11
- export declare function VoiceIntercom({ style, className, recording: recordingAtom, intercom: intercomAtom, setIntercom, mute: muteAtom, setMute, getStreamStatus, onTouchStart, onTouchEnd, }: Props): React.JSX.Element;
12
+ export declare function VoiceIntercom({ style, className, iconClassName, recording: recordingAtom, intercom: intercomAtom, setIntercom, mute: muteAtom, setMute, getStreamStatus, onTouchStart, onTouchEnd, }: Props): React.JSX.Element;
12
13
  export {};
@@ -1,15 +1,19 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import React, { useRef } from 'react';
3
- import { View } from '@ray-js/ray';
2
+ import React, { useRef, useContext } from 'react';
3
+ import { View, Image } from '@ray-js/ray';
4
4
  import clsx from 'clsx';
5
- import { useStore } from '../../ctx/store';
5
+ import Res from './voice.gif';
6
+ import { useStore, getDefaultStore } from '../../ctx/store';
6
7
  import './voiceIntercom.less';
7
8
  import { PlayerStreamStatus } from '../../interface';
9
+ import { UIEventContext } from '../../ui/context';
10
+ import { startTimeToHideAllComponent, pauseTimeToHideAllComponent } from '../../ui/constant';
8
11
  const NILL = () => null;
9
12
  export function VoiceIntercom(_ref) {
10
13
  let {
11
14
  style,
12
15
  className,
16
+ iconClassName,
13
17
  recording: recordingAtom,
14
18
  intercom: intercomAtom,
15
19
  setIntercom,
@@ -20,62 +24,63 @@ export function VoiceIntercom(_ref) {
20
24
  onTouchEnd = NILL
21
25
  } = _ref;
22
26
  const {
23
- recording,
27
+ event
28
+ } = useContext(UIEventContext);
29
+ const {
24
30
  mute,
25
31
  intercom
26
32
  } = useStore({
27
- recording: recordingAtom,
28
33
  mute: muteAtom,
29
34
  intercom: intercomAtom
30
35
  });
31
- const longClickStartedRef = useRef(false);
32
36
  // 对讲开始之前的静音状态
33
37
  const originMuteStatusBeforeVoice = useRef(mute);
34
- const intercomRef = useRef(false);
35
- const startVoice = async (_intercom, _recording, _mute) => {
36
- if (intercomRef.current) return;
37
- if (_recording) {
38
- console.log('Cannot talk during video recording');
39
- return;
40
- }
38
+ const loading = useRef(false);
39
+ const startVoice = async _mute => {
41
40
  if (getStreamStatus() !== PlayerStreamStatus.PreviewSuccess) {
42
41
  console.log('PlayerStreamStatus not 1002');
43
42
  return;
44
43
  }
45
- intercomRef.current = true;
46
44
  originMuteStatusBeforeVoice.current = _mute;
47
45
  // 如果对讲开始之前,是静音的,则需要关闭静音
48
46
  if (_mute) {
49
47
  await setMute(false);
50
48
  }
51
- setIntercom(_intercom);
49
+ await setIntercom(true);
52
50
  };
53
51
  const endVoice = async () => {
54
- try {
55
- // 将静音状态恢复为开始对讲之前的状态
56
- await setMute(originMuteStatusBeforeVoice.current);
57
- await setIntercom(false);
58
- } catch (err) {
59
- //
60
- } finally {
61
- intercomRef.current = false;
62
- }
52
+ await setMute(originMuteStatusBeforeVoice.current);
53
+ await setIntercom(false);
63
54
  };
64
55
  return /*#__PURE__*/React.createElement(View, {
65
56
  style: _objectSpread({}, style),
66
57
  className: clsx('ipc-player-plugin-voice-intercom', className),
67
- onTouchStart: onTouchStart,
68
- onLongClick: () => {
69
- longClickStartedRef.current = true;
70
- startVoice(!intercom, recording, mute);
58
+ onTouchStart: async e => {
59
+ onTouchStart(e);
60
+ const store = getDefaultStore();
61
+ if (loading.current) return;
62
+ loading.current = true;
63
+ const _intercom = store.get(intercomAtom);
64
+ const _recording = store.get(recordingAtom);
65
+ if (!_intercom && _recording) {
66
+ console.log('录制中,无法对讲');
67
+ loading.current = false;
68
+ return;
69
+ }
70
+ if (!_intercom) {
71
+ event.emit(pauseTimeToHideAllComponent);
72
+ await startVoice(mute);
73
+ } else {
74
+ event.emit(startTimeToHideAllComponent);
75
+ await endVoice();
76
+ }
77
+ loading.current = false;
71
78
  },
72
- onTouchEnd: e => {
73
- onTouchEnd(e);
74
- if (!longClickStartedRef.current) return;
75
- longClickStartedRef.current = false;
76
- endVoice();
77
- }
78
- }, /*#__PURE__*/React.createElement(View, {
79
- className: "icon-panel icon-panel-yuyin"
79
+ onTouchEnd: onTouchEnd
80
+ }, intercom ? /*#__PURE__*/React.createElement(Image, {
81
+ src: Res,
82
+ className: clsx('ipc-player-plugin-voice-intercom-img', iconClassName)
83
+ }) : /*#__PURE__*/React.createElement(View, {
84
+ className: clsx('icon-panel', 'icon-panel-one-way-intercom', iconClassName)
80
85
  }));
81
86
  }
@@ -1,3 +1,5 @@
1
+ @size: 24px;
2
+
1
3
  .ipc-player-plugin-voice-intercom {
2
4
  background: var(--ipc-player-plugin-voice-bg, radial-gradient(77% 77% at 34% 28%, #FF997C 0%, #FF592A 99%));
3
5
  width: calc(72px * var(--ipc-player-size-scale, 1));
@@ -6,6 +8,10 @@
6
8
  display: flex;
7
9
  justify-content: center;
8
10
  align-items: center;
9
- font-size: calc(29px * var(--ipc-player-size-scale, 1));
11
+ font-size: calc(@size * var(--ipc-player-size-scale, 1));
10
12
  color: #fff;
13
+ }
14
+ .ipc-player-plugin-voice-intercom-img {
15
+ width: calc(@size * var(--ipc-player-size-scale, 1));
16
+ height: calc(@size * var(--ipc-player-size-scale, 1));;
11
17
  }
@@ -4,3 +4,7 @@ export type UseBattery = (devId: string) => {
4
4
  };
5
5
  export type UseTemperature = (devId: string) => number;
6
6
  export type UseHumidity = () => number;
7
+ export type Toast = (options: {
8
+ title: string;
9
+ duration?: number;
10
+ } & Record<string, any>) => void;
package/lib/ui/ui.js CHANGED
@@ -85,7 +85,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
85
85
  * 视频流加载状态封装
86
86
  */
87
87
 
88
- const handPlayerTap = useCallback(() => {
88
+ const handPlayerTap = useCallback(data => {
89
+ console.log('res===on onVideoTap', data);
89
90
  const store = getDefaultStore();
90
91
  const _screenType = store.get(instance.screenType);
91
92
  eventRef.current.emit(playerTap);
@@ -138,7 +139,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
138
139
  eventRef.current.off(pauseTimeToHideAllComponent, listenPause);
139
140
  };
140
141
  });
141
- const playerReady = playState === PlayState.PLAYING;
142
+ // const playerReady = playState === PlayState.PLAYING;
143
+ const playerReady = true;
142
144
  return /*#__PURE__*/React.createElement(UIEventContext.Provider, {
143
145
  value: {
144
146
  event: eventRef.current
@@ -188,7 +190,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
188
190
  },
189
191
  clarity: "hd",
190
192
  privateState: false,
191
- onPlayerTap: handPlayerTap
193
+ onPlayerTap: handPlayerTap // 对应原来的onVideoTap
192
194
  }), playerReady && /*#__PURE__*/React.createElement(TopContent, {
193
195
  ctx: instance
194
196
  }, renderTopContent), playerReady && /*#__PURE__*/React.createElement(BottomContent, {
package/lib/ui/ui.less CHANGED
@@ -1,6 +1,7 @@
1
1
  .ipc-player-content {
2
2
  position: relative;
3
3
  overflow: hidden;
4
+
4
5
  .ipc-player-top-content-warp {
5
6
  position: absolute;
6
7
  width: 100%;
@@ -8,6 +9,7 @@
8
9
  top: 0;
9
10
  z-index: 100;
10
11
  }
12
+
11
13
  .ipc-player-bottom-content-warp {
12
14
  position: absolute;
13
15
  z-index: 100;
@@ -15,6 +17,7 @@
15
17
  left: 0;
16
18
  bottom: 0;
17
19
  }
20
+
18
21
  .ipc-player-content-item {
19
22
  --height: 48px;
20
23
  --gap: 10px;
@@ -26,12 +29,15 @@
26
29
  padding: 0 calc(16px * var(--ipc-player-size-scale, 1));
27
30
  transform: translate(0, 0);
28
31
  transition: transform ease-in 0.3s;
32
+
29
33
  &.ipc-player-top-content {
30
34
  justify-content: flex-end;
35
+
31
36
  &.ipc-player-top-content-hide {
32
37
  transform: translate(0, -110%);
33
38
  }
34
39
  }
40
+
35
41
  &.ipc-player-bottom-content {
36
42
  &.ipc-player-bottom-content-hide {
37
43
  transform: translate(0, 110%)
@@ -46,5 +52,5 @@
46
52
  }
47
53
 
48
54
  .ipc-player-element-hidden {
49
- visibility: hidden !important;
55
+ // visibility: hidden !important;
50
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.1-beta-6",
3
+ "version": "0.0.1-beta-8",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -35,7 +35,8 @@
35
35
  "@ray-js/ray": "^1.4.9"
36
36
  },
37
37
  "dependencies": {
38
- "@ray-js/ray-ipc-player": "2.0.17-beta-beta-1",
38
+ "@ray-js/ray-ipc-player": "2.0.18-beta-beta-1",
39
+ "@ray-js/ray-ipc-utils": "1.1.0-beta-7",
39
40
  "clsx": "^1.2.1",
40
41
  "jotai": "^2.10.2"
41
42
  },
@@ -1 +0,0 @@
1
- export declare const useVideoBitKbps: (devId: string) => string;
@@ -1,20 +0,0 @@
1
- import { getVideoBitrateKbps } from '../../utils/ipcApi';
2
- import { useEffect, useState } from 'react';
3
- export const useVideoBitKbps = devId => {
4
- const [bitKbps, setBitKbps] = useState('');
5
- useEffect(() => {
6
- // const timer = setInterval(() => {
7
- init();
8
- // }, 5000);
9
- // return () => {
10
- // clearInterval(timer);
11
- // timer === null;
12
- // };
13
- }, []);
14
- const init = async () => {
15
- const res = await getVideoBitrateKbps(devId);
16
- console.log('res===bitKbps', res);
17
- setBitKbps(res.kpbs + 'KB/S');
18
- };
19
- return bitKbps;
20
- };