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

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.
@@ -10,7 +10,6 @@ export const useTemperature = devId => {
10
10
  dpCodes: [TEMP_UNIT_SELECT, SENSOR_TEMPERATURE, TEMP_REPORT_F]
11
11
  });
12
12
  useEffect(() => {
13
- console.log('res===1', dpState);
14
13
  // 1=华氏度 0=摄氏度
15
14
  if (dpState[TEMP_UNIT_SELECT] !== undefined) {
16
15
  setTempUnit(dpState[TEMP_UNIT_SELECT] + '');
@@ -1,20 +1,22 @@
1
- import { getVideoBitrateKbps } from '../../utils/ipcApi';
2
1
  import { useEffect, useState } from 'react';
2
+ import IpcUtils from '@ray-js/ray-ipc-utils';
3
3
  export const useVideoBitKbps = devId => {
4
4
  const [bitKbps, setBitKbps] = useState('');
5
5
  useEffect(() => {
6
6
  // const timer = setInterval(() => {
7
7
  init();
8
- // }, 5000);
8
+ // }, 1000);
9
9
  // return () => {
10
10
  // clearInterval(timer);
11
11
  // timer === null;
12
12
  // };
13
13
  }, []);
14
14
  const init = async () => {
15
- const res = await getVideoBitrateKbps(devId);
16
- console.log('res===bitKbps', res);
17
- setBitKbps(res.kpbs + 'KB/S');
15
+ const res = await IpcUtils.getVideoBitrateKbps(devId);
16
+ console.log('res===getVideoBitrateKbps', res);
17
+ if (res.code !== -1) {
18
+ setBitKbps(res.data.kbps + 'KB/S');
19
+ }
18
20
  };
19
21
  return bitKbps;
20
22
  };
@@ -1,102 +1,12 @@
1
- import React, { useEffect } from 'react';
1
+ import React from 'react';
2
2
  import { View } from '@ray-js/ray';
3
3
  import { useVideoBitKbps } from '../../hooks';
4
4
  import './videoBitKbps.less';
5
- import { getCurrentSupportedTalkMode, getMobileOrientation, getVideoBitrateKbps, requestWifiSignal, isSupportedTalk, isSupportFloatWindow, openFloatWindow, setScreenOrientation, wakeUpDevice } from '../../utils/ipcApi';
6
5
  export const VideoBitKbps = props => {
7
6
  const {
8
- devId,
9
- IPCPlayerContext
7
+ devId
10
8
  } = props;
11
9
  const bitKbps = useVideoBitKbps(devId);
12
- 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);
26
- }
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
- };
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
10
  return /*#__PURE__*/React.createElement(View, {
101
11
  className: "ipc-player-plugin-videoBitKbps"
102
12
  }, bitKbps);
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);
@@ -188,7 +189,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
188
189
  },
189
190
  clarity: "hd",
190
191
  privateState: false,
191
- onPlayerTap: handPlayerTap
192
+ onPlayerTap: handPlayerTap // 对应原来的onVideoTap
192
193
  }), playerReady && /*#__PURE__*/React.createElement(TopContent, {
193
194
  ctx: instance
194
195
  }, 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-7",
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,78 +0,0 @@
1
- export interface IApiError {
2
- errorMsg: string;
3
- errorCode: string;
4
- innerError: {
5
- errorMsg: string;
6
- errorCode: string;
7
- };
8
- }
9
- /**
10
- * 获取信号强度
11
- * @param devId
12
- * @param dps 扩展参数
13
- * @returns
14
- */
15
- export declare const requestWifiSignal: <T>(devId: string, dps?: {}) => Promise<IApiError | T>;
16
- /**
17
- * 获取视频码率
18
- * @param devId
19
- * @param extendParam 扩展参数
20
- * @returns
21
- */
22
- export declare const getVideoBitrateKbps: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
23
- export declare const addCameraDeviceObserver: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
24
- export declare const networkStatusDidChangedEvent: (callback: any) => void;
25
- /**
26
- * IPC-低功耗唤醒:低功耗唤醒,唤醒门铃设备
27
- * 需引入DeviceKit,且在>=3.1.0-ipcwake.1版本才可使用
28
- * @param devId
29
- * @returns
30
- */
31
- export declare const wakeUpDevice: <T>(devId: string, dps?: {}) => Promise<IApiError | T>;
32
- /**
33
- * 画中画:是否支持画中画:只有安卓在用
34
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
35
- * @param devId
36
- * @param extendParam 扩展参数
37
- * @returns
38
- */
39
- export declare const getMobileOrientation: <T>() => Promise<IApiError | T>;
40
- /**
41
- * 屏幕旋转设置,auto(暂不支持) / portrait / landscape。pad 模式下不支持屏幕旋转
42
- * 需引入MiniKit,且在>=2.4.1版本才可使用
43
- * @param pageOrientation
44
- * @returns
45
- */
46
- export declare const setScreenOrientation: <T>(pageOrientation: string) => Promise<IApiError | T>;
47
- /**
48
- * 画中画:是否支持画中画:只有安卓在用
49
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
50
- * @param devId
51
- * @param extendParam 扩展参数
52
- * @returns
53
- */
54
- export declare const isSupportFloatWindow: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
55
- /**
56
- * 画中画:开启画中画
57
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
58
- * @param devId
59
- * @param extendParam 扩展参数
60
- * @returns
61
- */
62
- export declare const openFloatWindow: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
63
- /**
64
- * IPC-APP 缓存支持的对讲方式:是否支持对讲
65
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
66
- * @param devId
67
- * @param extendParam 扩展参数
68
- * @returns
69
- */
70
- export declare const isSupportedTalk: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
71
- /**
72
- * 设备支持的对讲模式
73
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
74
- * @param devId
75
- * @param extendParam 扩展参数
76
- * @returns 设备支持的对讲模式。回掉方法的参数为数值型,0 未知;1:单向对讲;2:双向对讲。
77
- */
78
- export declare const getCurrentSupportedTalkMode: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
@@ -1,251 +0,0 @@
1
- /**
2
- * 获取信号强度
3
- * @param devId
4
- * @param dps 扩展参数
5
- * @returns
6
- */
7
- export const requestWifiSignal = function (devId) {
8
- let dps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9
- return new Promise((resolve, reject) => {
10
- ty.device.requestWifiSignal({
11
- deviceId: devId,
12
- dps: dps,
13
- success: res => {
14
- console.log('res===ttt requestWifiSignal success', res);
15
- resolve(res);
16
- },
17
- fail: error => reject(error)
18
- });
19
- }).catch(error => {
20
- console.log('res===ttt requestWifiSignal error', error);
21
- throw error;
22
- });
23
- };
24
-
25
- /**
26
- * 获取视频码率
27
- * @param devId
28
- * @param extendParam 扩展参数
29
- * @returns
30
- */
31
- export const getVideoBitrateKbps = function (devId) {
32
- let extendParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
33
- return new Promise((resolve, reject) => {
34
- ty.ipc.getVideoBitrateKbps({
35
- devId,
36
- extendParam: extendParam,
37
- success: res => {
38
- console.log('res===ttt getVideoBitrateKbps success', res);
39
- resolve(res);
40
- },
41
- fail: error => reject(error)
42
- });
43
- }).catch(error => {
44
- console.log('res===ttt getVideoBitrateKbps error', error);
45
- throw error;
46
- });
47
- };
48
-
49
- // addCameraDeviceObserver
50
- export const addCameraDeviceObserver = function (devId) {
51
- let extendParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52
- return new Promise((resolve, reject) => {
53
- ty.ipc.addCameraDeviceObserver({
54
- devId,
55
- extendParam: extendParam,
56
- success: res => {
57
- console.log('res===ttt addCameraDeviceObserver success', res);
58
- resolve(res);
59
- },
60
- fail: error => reject(error)
61
- });
62
- }).catch(error => {
63
- console.log('res===ttt addCameraDeviceObserver error', error);
64
- throw error;
65
- });
66
- };
67
- // networkStatusDidChangedEvent,
68
- // 事件:监听网络状态事件
69
- // 通用
70
- // ty.onNetworkStatusChange
71
- export const networkStatusDidChangedEvent = callback => {
72
- ty.onNetworkStatusChange(callback);
73
- };
74
-
75
- // cameraNotifyWeakNetworkEvent
76
- // 事件:画面网速监听状态值事件
77
- // TUNIIPCCameraManager
78
-
79
- // sessionDidDisconnectedEvent
80
-
81
- // cameraPreviewFailureEvent
82
-
83
- /**
84
- * IPC-低功耗唤醒:低功耗唤醒,唤醒门铃设备
85
- * 需引入DeviceKit,且在>=3.1.0-ipcwake.1版本才可使用
86
- * @param devId
87
- * @returns
88
- */
89
- export const wakeUpDevice = function (devId) {
90
- let dps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
91
- return new Promise((resolve, reject) => {
92
- ty.device.wakeUpDevice({
93
- deviceId: devId,
94
- dps: dps,
95
- success: res => {
96
- console.log('res===ttt wakeUpDevice success', res);
97
- resolve(res);
98
- },
99
- fail: error => reject(error)
100
- });
101
- }).catch(error => {
102
- console.log('res===ttt wakeUpDevice error', error);
103
- throw error;
104
- });
105
- };
106
-
107
- /**
108
- * 画中画:是否支持画中画:只有安卓在用
109
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
110
- * @param devId
111
- * @param extendParam 扩展参数
112
- * @returns
113
- */
114
- export const getMobileOrientation = () => {
115
- return new Promise((resolve, reject) => {
116
- ty.getSystemInfo({
117
- success: res => {
118
- console.log('res===ttt getMobileOrientation success', res);
119
- resolve(res);
120
- },
121
- fail: error => reject(error)
122
- });
123
- }).catch(error => {
124
- console.log('res===ttt getMobileOrientation error', error);
125
- throw error;
126
- });
127
- };
128
-
129
- /**
130
- * 屏幕旋转设置,auto(暂不支持) / portrait / landscape。pad 模式下不支持屏幕旋转
131
- * 需引入MiniKit,且在>=2.4.1版本才可使用
132
- * @param pageOrientation
133
- * @returns
134
- */
135
- export const setScreenOrientation = pageOrientation => {
136
- return new Promise((resolve, reject) => {
137
- ty.setPageOrientation({
138
- pageOrientation: pageOrientation,
139
- success: res => {
140
- console.log('res===ttt setScreenOrientation success', res);
141
- resolve(res);
142
- },
143
- fail: error => reject(error)
144
- });
145
- }).catch(error => {
146
- console.log('res===ttt setScreenOrientation error', error);
147
- throw error;
148
- });
149
- };
150
-
151
- /**
152
- * 画中画:是否支持画中画:只有安卓在用
153
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
154
- * @param devId
155
- * @param extendParam 扩展参数
156
- * @returns
157
- */
158
- export const isSupportFloatWindow = function (devId) {
159
- let extendParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
160
- return new Promise((resolve, reject) => {
161
- ty.ipc.isSupportFloatWindow({
162
- deviceId: devId,
163
- extendParam: extendParam,
164
- success: res => {
165
- console.log('res===ttt isSupportFloatWindow success', res);
166
- resolve(res);
167
- },
168
- fail: error => reject(error)
169
- });
170
- }).catch(error => {
171
- console.log('res===ttt isSupportFloatWindow error', error);
172
- throw error;
173
- });
174
- };
175
-
176
- /**
177
- * 画中画:开启画中画
178
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
179
- * @param devId
180
- * @param extendParam 扩展参数
181
- * @returns
182
- */
183
- export const openFloatWindow = function (devId) {
184
- let extendParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
185
- return new Promise((resolve, reject) => {
186
- ty.ipc.openFloatWindow({
187
- deviceId: devId,
188
- extendParam: extendParam,
189
- success: res => {
190
- console.log('res===ttt openFloatWindow success');
191
- resolve(res);
192
- },
193
- fail: error => reject(error)
194
- });
195
- }).catch(error => {
196
- console.log('res===ttt openFloatWindow error', error);
197
- throw error;
198
- });
199
- };
200
-
201
- /**
202
- * IPC-APP 缓存支持的对讲方式:是否支持对讲
203
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
204
- * @param devId
205
- * @param extendParam 扩展参数
206
- * @returns
207
- */
208
- export const isSupportedTalk = function (devId) {
209
- let extendParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
210
- return new Promise((resolve, reject) => {
211
- ty.ipc.isSupportedTalk({
212
- deviceId: devId,
213
- extendParam: extendParam,
214
- success: res => {
215
- console.log('res===ttt isSupportedTalk success', res);
216
- resolve(res);
217
- },
218
- fail: error => reject(error)
219
- });
220
- }).catch(error => {
221
- console.log('res===ttt isSupportedTalk error', error);
222
- throw error;
223
- });
224
- };
225
-
226
- /**
227
- * 设备支持的对讲模式
228
- * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
229
- * @param devId
230
- * @param extendParam 扩展参数
231
- * @returns 设备支持的对讲模式。回掉方法的参数为数值型,0 未知;1:单向对讲;2:双向对讲。
232
- */
233
- export const getCurrentSupportedTalkMode = function (devId) {
234
- let extendParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
235
- return new Promise((resolve, reject) => {
236
- ty.ipc.getCurrentSupportedTalkMode({
237
- deviceId: devId,
238
- extendParam: extendParam,
239
- success: res => {
240
- console.log('res===ttt getCurrentSupportedTalkMode success', res);
241
- resolve(res);
242
- },
243
- fail: error => reject(error)
244
- });
245
- }).catch(error => {
246
- console.log('res===ttt getCurrentSupportedTalkMode error', error);
247
- throw error;
248
- });
249
- };
250
-
251
- // 挂在了page生命周期的onResize下面