@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.
- package/lib/ctx/ctx.composition.js +17 -1
- package/lib/ctx/ctx.d.ts +3 -2
- package/lib/ctx/ctx.js +29 -8
- package/lib/ctx/ports.output.d.ts +1 -0
- package/lib/hooks/index.d.ts +0 -1
- package/lib/hooks/index.js +0 -1
- package/lib/hooks/useTemperature/index.js +0 -1
- package/lib/iconfont/demo_index.html +491 -123
- package/lib/iconfont/iconfont.css +87 -23
- package/lib/iconfont/iconfont.js +15 -15
- package/lib/iconfont/iconfont.json +154 -42
- package/lib/iconfont/iconfont.ttf +0 -0
- package/lib/iconfont/iconfont.woff +0 -0
- package/lib/iconfont/iconfont.woff2 +0 -0
- package/lib/interface.d.ts +2 -0
- package/lib/plugins/battery/battery.composition.d.ts +1 -0
- package/lib/plugins/fullScreen/fullScreen.js +1 -1
- package/lib/plugins/fullScreen/verticalScreen.js +1 -1
- package/lib/plugins/muted/muted.js +2 -2
- package/lib/plugins/recordVideo/recordVideo.js +25 -7
- package/lib/plugins/recordVideo/recordVideo.less +6 -4
- package/lib/plugins/screenshot/screenshot.js +34 -23
- package/lib/plugins/screenshot/screenshot.less +6 -3
- package/lib/plugins/tempHumidity/tempHumidity.js +3 -3
- package/lib/plugins/videoBitKbps/videoBitKbps.js +24 -90
- package/lib/plugins/voiceIntercom/type.d.ts +4 -0
- package/lib/plugins/voiceIntercom/voice.gif +0 -0
- package/lib/plugins/voiceIntercom/voiceIntercom.d.ts +2 -1
- package/lib/plugins/voiceIntercom/voiceIntercom.js +41 -36
- package/lib/plugins/voiceIntercom/voiceIntercom.less +7 -1
- package/lib/ports.output.d.ts +4 -0
- package/lib/ui/ui.js +5 -3
- package/lib/ui/ui.less +7 -1
- package/package.json +3 -2
- package/lib/hooks/useVideoBitKbps/index.d.ts +0 -1
- package/lib/hooks/useVideoBitKbps/index.js +0 -20
- package/lib/utils/ipcApi/index.d.ts +0 -78
- package/lib/utils/ipcApi/index.js +0 -251
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["title", "duration"];
|
|
1
4
|
import { createUseCtx } from './ctx';
|
|
2
5
|
import { Battery, Screenshot, TempHumidity, RecordVideo, FullScreen, VideoBitKbps, Muted } from '../plugins';
|
|
3
6
|
import { authorizeStatus } from '../utils/authorize';
|
|
@@ -28,10 +31,23 @@ const bottomContent = [{
|
|
|
28
31
|
id: 'FullScreen',
|
|
29
32
|
content: FullScreen
|
|
30
33
|
}];
|
|
34
|
+
const toast = _ref => {
|
|
35
|
+
let {
|
|
36
|
+
title,
|
|
37
|
+
duration
|
|
38
|
+
} = _ref,
|
|
39
|
+
config = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
ty.showToast(_objectSpread({
|
|
41
|
+
title,
|
|
42
|
+
duration,
|
|
43
|
+
icon: 'none'
|
|
44
|
+
}, config));
|
|
45
|
+
};
|
|
31
46
|
export const useCtx = createUseCtx({
|
|
32
47
|
createPlayContext,
|
|
33
48
|
defaultTopContent: topContent,
|
|
34
49
|
defaultAbsoluteContent: absoluteContent,
|
|
35
50
|
defaultBottomContent: bottomContent,
|
|
36
|
-
authorizeStatus: authorizeStatus
|
|
51
|
+
authorizeStatus: authorizeStatus,
|
|
52
|
+
toast
|
|
37
53
|
});
|
package/lib/ctx/ctx.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ComponentConfig, UseCtx } from '../interface';
|
|
2
|
-
import type { createPlayContext, AuthorizeStatus } from './ports.output';
|
|
2
|
+
import type { createPlayContext, AuthorizeStatus, Toast } from './ports.output';
|
|
3
3
|
type Depend = {
|
|
4
4
|
createPlayContext: createPlayContext;
|
|
5
5
|
defaultTopContent?: ComponentConfig[];
|
|
6
6
|
defaultBottomContent?: ComponentConfig[];
|
|
7
7
|
defaultAbsoluteContent?: ComponentConfig[];
|
|
8
8
|
authorizeStatus: AuthorizeStatus;
|
|
9
|
+
toast: Toast;
|
|
9
10
|
};
|
|
10
|
-
export declare const createUseCtx: ({ createPlayContext, defaultTopContent, defaultBottomContent, defaultAbsoluteContent, authorizeStatus, }: Depend) => UseCtx;
|
|
11
|
+
export declare const createUseCtx: ({ createPlayContext, defaultTopContent, defaultBottomContent, defaultAbsoluteContent, authorizeStatus, toast, }: Depend) => UseCtx;
|
|
11
12
|
export {};
|
package/lib/ctx/ctx.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRef, useCallback } from 'react';
|
|
2
|
-
import { useAtom, updateAtom } from './store';
|
|
2
|
+
import { useAtom, updateAtom, getDefaultStore } from './store';
|
|
3
3
|
import { PlayState } from '../interface';
|
|
4
4
|
const SAVE_TO_ALBUM = 1;
|
|
5
5
|
export const createUseCtx = _ref => {
|
|
@@ -8,7 +8,8 @@ export const createUseCtx = _ref => {
|
|
|
8
8
|
defaultTopContent,
|
|
9
9
|
defaultBottomContent,
|
|
10
10
|
defaultAbsoluteContent,
|
|
11
|
-
authorizeStatus
|
|
11
|
+
authorizeStatus,
|
|
12
|
+
toast
|
|
12
13
|
} = _ref;
|
|
13
14
|
return _ref2 => {
|
|
14
15
|
let {
|
|
@@ -50,8 +51,13 @@ export const createUseCtx = _ref => {
|
|
|
50
51
|
playState,
|
|
51
52
|
setPlayState,
|
|
52
53
|
setIntercom: async target => {
|
|
53
|
-
const
|
|
54
|
-
|
|
54
|
+
const store = getDefaultStore();
|
|
55
|
+
const _intercom = store.get(intercom);
|
|
56
|
+
if (target && target === _intercom) {
|
|
57
|
+
console.log('Cannot intercom during video _intercom');
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
if (!target && target === _intercom) return true;
|
|
55
61
|
return new Promise((resolve, reject) => {
|
|
56
62
|
if (target) {
|
|
57
63
|
IPCPlayerInstance.current.startTalk({
|
|
@@ -61,6 +67,11 @@ export const createUseCtx = _ref => {
|
|
|
61
67
|
},
|
|
62
68
|
fail: err => {
|
|
63
69
|
reject(err);
|
|
70
|
+
const errObj = err.innerError || err || {};
|
|
71
|
+
const errMsg = errObj.errorMsg || I18n.t('error_intercom');
|
|
72
|
+
toast({
|
|
73
|
+
title: errMsg
|
|
74
|
+
});
|
|
64
75
|
}
|
|
65
76
|
});
|
|
66
77
|
} else {
|
|
@@ -83,7 +94,7 @@ export const createUseCtx = _ref => {
|
|
|
83
94
|
IPCPlayerInstance.current.setMuted({
|
|
84
95
|
mute: target,
|
|
85
96
|
success: () => {
|
|
86
|
-
updateAtom(mute,
|
|
97
|
+
updateAtom(mute, target);
|
|
87
98
|
resolve(true);
|
|
88
99
|
},
|
|
89
100
|
fail: err => {
|
|
@@ -94,8 +105,12 @@ export const createUseCtx = _ref => {
|
|
|
94
105
|
});
|
|
95
106
|
},
|
|
96
107
|
setRecording: async target => {
|
|
97
|
-
const
|
|
98
|
-
|
|
108
|
+
const store = getDefaultStore();
|
|
109
|
+
const _recording = store.get(recording);
|
|
110
|
+
if (target && target === _recording) {
|
|
111
|
+
console.log('Cannot record during video recording');
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
99
114
|
return new Promise((resolve, reject) => {
|
|
100
115
|
if (target) {
|
|
101
116
|
IPCPlayerInstance.current.startRecord({
|
|
@@ -118,6 +133,11 @@ export const createUseCtx = _ref => {
|
|
|
118
133
|
fail: err => {
|
|
119
134
|
updateAtom(recording, true);
|
|
120
135
|
reject(err);
|
|
136
|
+
const errObj = err.innerError || err || {};
|
|
137
|
+
const errMsg = errObj.errorMsg || I18n.t('error_recording');
|
|
138
|
+
toast({
|
|
139
|
+
title: errMsg
|
|
140
|
+
});
|
|
121
141
|
}
|
|
122
142
|
});
|
|
123
143
|
}
|
|
@@ -157,7 +177,8 @@ export const createUseCtx = _ref => {
|
|
|
157
177
|
},
|
|
158
178
|
getStreamStatus: () => {
|
|
159
179
|
return streamStatus.current;
|
|
160
|
-
}
|
|
180
|
+
},
|
|
181
|
+
toast
|
|
161
182
|
};
|
|
162
183
|
};
|
|
163
184
|
};
|
package/lib/hooks/index.d.ts
CHANGED
package/lib/hooks/index.js
CHANGED
|
@@ -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] + '');
|