@ray-js/ipc-player-integration 0.0.1-beta-9 → 0.0.1-beta-10

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.
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  const _excluded = ["title", "duration"];
4
4
  import { createUseCtx } from './ctx';
5
- import { Battery, Screenshot, TempHumidity, RecordVideo, FullScreen, VideoBitKbps, Muted } from '../plugins';
5
+ import { Battery, Screenshot, TempHumidity, RecordVideo, FullScreen, VideoBitKbps, Muted, Resolution } from '../plugins';
6
6
  import { authorizeStatus } from '../utils/authorize';
7
7
  const createPlayContext = ty.createIpcPlayerContext;
8
8
  // const createPlayContext = () => null;
@@ -27,6 +27,9 @@ const bottomContent = [{
27
27
  }, {
28
28
  id: 'Muted',
29
29
  content: Muted
30
+ }, {
31
+ id: 'Resolution',
32
+ content: Resolution
30
33
  }, {
31
34
  id: 'FullScreen',
32
35
  content: FullScreen
package/lib/ctx/ctx.js CHANGED
@@ -28,6 +28,9 @@ export const createUseCtx = _ref => {
28
28
  // 静音
29
29
  const mute = useAtom(false);
30
30
 
31
+ // 清晰度
32
+ const resolution = useAtom('HD');
33
+
31
34
  // 对讲中
32
35
  const intercom = useAtom(false);
33
36
  const playState = useAtom(PlayState.CONNECTING);
@@ -41,12 +44,19 @@ export const createUseCtx = _ref => {
41
44
  if (!IPCPlayerInstance.current) {
42
45
  IPCPlayerInstance.current = createPlayContext(devId);
43
46
  }
47
+
48
+ /**
49
+ * 设置清晰度
50
+ *
51
+ */
52
+
44
53
  return {
45
54
  devId,
46
55
  saveToAlbum,
47
56
  screenType,
48
57
  recording,
49
58
  mute,
59
+ resolution,
50
60
  intercom,
51
61
  playState,
52
62
  setPlayState,
@@ -104,6 +114,24 @@ export const createUseCtx = _ref => {
104
114
  });
105
115
  });
106
116
  },
117
+ setResolution: async target => {
118
+ console.log('执行清晰度方法');
119
+ return new Promise((resolve, reject) => {
120
+ IPCPlayerInstance.current.setClarity({
121
+ clarity: target,
122
+ success: () => {
123
+ console.log('setClarity success');
124
+ updateAtom(resolution, target === 'hd' ? 'HD' : 'SD');
125
+ resolve(true);
126
+ },
127
+ fail: err => {
128
+ console.log('setClarity err');
129
+ // updateAtom(mute, !target);
130
+ reject(err);
131
+ }
132
+ });
133
+ });
134
+ },
107
135
  setRecording: async target => {
108
136
  const store = getDefaultStore();
109
137
  const _recording = store.get(recording);
@@ -6,3 +6,4 @@ export * from './fullScreen';
6
6
  export * from './videoBitKbps';
7
7
  export * from './voiceIntercom';
8
8
  export * from './muted';
9
+ export * from './resolution';
@@ -5,4 +5,5 @@ export * from './recordVideo';
5
5
  export * from './fullScreen';
6
6
  export * from './videoBitKbps';
7
7
  export * from './voiceIntercom';
8
- export * from './muted';
8
+ export * from './muted';
9
+ export * from './resolution';
@@ -0,0 +1 @@
1
+ export * from './resolution';
@@ -0,0 +1 @@
1
+ export * from './resolution';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ComponentConfigProps } from '../../interface';
3
+ import './resolution.less';
4
+ export declare const Resolution: (props: ComponentConfigProps) => React.JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { View, Text } from '@ray-js/ray';
2
+ import React, { useEffect } from 'react';
3
+ import { useStore } from '../../ctx/store';
4
+ import './resolution.less';
5
+ export const Resolution = props => {
6
+ console.log(props, 'props');
7
+ const {
8
+ IPCPlayerContext,
9
+ resolution,
10
+ setResolution
11
+ } = props;
12
+ const {
13
+ currentResolution
14
+ } = useStore({
15
+ currentResolution: resolution
16
+ });
17
+ // const setIsMuted = (value: typeof currentResolution) => {
18
+ // // updateAtom(mute, value);
19
+ // };
20
+
21
+ useEffect(() => {
22
+ // init();
23
+ }, []);
24
+ return /*#__PURE__*/React.createElement(View, {
25
+ onClick: () => {
26
+ console.log('_____');
27
+ setResolution(currentResolution === 'HD' ? 'normal' : 'hd');
28
+ // // IPCPlayerContext.setMuted({
29
+ // // mute: !isMuted,
30
+ // // success: res => {
31
+ // // setIsMuted(!isMuted);
32
+ // // },
33
+ // // fail: res => {
34
+ // // console.log('res===setMuted err', res);
35
+ // // },
36
+ // // });
37
+ },
38
+ className: "resolutionWrapper"
39
+ }, /*#__PURE__*/React.createElement(Text, {
40
+ className: "resolutionText"
41
+ }, currentResolution));
42
+ };
@@ -0,0 +1,15 @@
1
+ .resolutionWrapper {
2
+ background-color: rgba(255,255,255,0.2);
3
+ padding: 2px 4px;
4
+ display: flex;
5
+ justify-content: center;
6
+ align-items: center;
7
+ border-radius: 8rpx;
8
+ backdrop-filter: blur(8rpx);
9
+ .resolutionText {
10
+ color: #ffffff;
11
+ font-weight: 600;
12
+ font-size: 24rpx;
13
+
14
+ }
15
+ }
package/lib/ui/ui.js CHANGED
@@ -175,17 +175,41 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
175
175
  // onCtx={getIpcPlayer}
176
176
  // onPlayerTap={handlePlayerClick}
177
177
  ,
178
- onZoomChange: () => {
179
- console.log('res===onZoomChange');
178
+ onZoomChange: data => {
179
+ console.log(`zoomChange事件: ${JSON.stringify(data)}`);
180
+ ty.showToast({
181
+ title: `zoomChange事件: ${JSON.stringify(data)}`
182
+ });
183
+ setTimeout(() => {
184
+ ty.hideToast();
185
+ }, 3000);
180
186
  },
181
- onSessionDidDisconnected: () => {
182
- console.log('res===onSessionDidDisconnected');
187
+ onSessionDidDisconnected: data => {
188
+ console.log(`sessionDidDisconnected事件: ${JSON.stringify(data)}`);
189
+ ty.showToast({
190
+ title: `sessionDidDisconnected事件: ${JSON.stringify(data)}`
191
+ });
192
+ setTimeout(() => {
193
+ ty.hideToast();
194
+ }, 3000);
183
195
  },
184
- onCameraPreviewFailure: () => {
185
- console.log('res===onCameraPreviewFailure');
196
+ onCameraPreviewFailure: data => {
197
+ console.log(`onCameraPreviewFailure事件: ${JSON.stringify(data)}`);
198
+ ty.showToast({
199
+ title: `onCameraPreviewFailure事件: ${JSON.stringify(data)}`
200
+ });
201
+ setTimeout(() => {
202
+ ty.hideToast();
203
+ }, 3000);
186
204
  },
187
- onCameraNotifyWeakNetwork: () => {
188
- console.log('res===onCameraNotifyWeakNetwork');
205
+ onCameraNotifyWeakNetwork: data => {
206
+ console.log(`onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`);
207
+ ty.showToast({
208
+ title: `onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`
209
+ });
210
+ setTimeout(() => {
211
+ ty.hideToast();
212
+ }, 3000);
189
213
  },
190
214
  clarity: "hd",
191
215
  privateState: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.1-beta-9",
3
+ "version": "0.0.1-beta-10",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [