@ray-js/ipc-player-integration 0.0.53-beta.1 → 0.0.53-beta.2
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/i18n/index.d.ts +16 -0
- package/lib/i18n/strings.d.ts +8 -0
- package/lib/i18n/strings.js +8 -0
- package/lib/ui/constant.d.ts +1 -1
- package/lib/ui/constant.js +1 -1
- package/lib/utils/ttt.d.ts +14 -2
- package/lib/utils/ttt.js +54 -25
- package/lib/widgets/resolution/resolution.js +8 -12
- package/lib/widgets/videoBitKBP/videoBitKBP.js +20 -2
- package/package.json +1 -1
package/lib/i18n/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { kit } from '@ray-js/panel-sdk';
|
|
2
2
|
declare const Strings: kit.I18N<{
|
|
3
3
|
en: {
|
|
4
|
+
ipc_player_resolution_SS: string;
|
|
4
5
|
ipc_player_resolution_HD: string;
|
|
5
6
|
ipc_player_resolution_SD: string;
|
|
7
|
+
ipc_player_resolution_UD: string;
|
|
8
|
+
ipc_player_resolution_SSP: string;
|
|
6
9
|
ipc_player_resolution_AUTO: string;
|
|
10
|
+
ipc_player_resolution_AUDIO: string;
|
|
7
11
|
ipc_player_current_resolution_is_equal: string;
|
|
8
12
|
ipc_player_screenshot_success_tip: string;
|
|
9
13
|
ipc_player_screenshot_multi_success_tip: string;
|
|
@@ -42,9 +46,13 @@ declare const Strings: kit.I18N<{
|
|
|
42
46
|
ipc_player_low_phone_not_support: string;
|
|
43
47
|
};
|
|
44
48
|
zh: {
|
|
49
|
+
ipc_player_resolution_SS: string;
|
|
45
50
|
ipc_player_resolution_HD: string;
|
|
46
51
|
ipc_player_resolution_SD: string;
|
|
52
|
+
ipc_player_resolution_UD: string;
|
|
53
|
+
ipc_player_resolution_SSP: string;
|
|
47
54
|
ipc_player_resolution_AUTO: string;
|
|
55
|
+
ipc_player_resolution_AUDIO: string;
|
|
48
56
|
ipc_player_current_resolution_is_equal: string;
|
|
49
57
|
ipc_player_screenshot_success_tip: string;
|
|
50
58
|
ipc_player_screenshot_multi_success_tip: string;
|
|
@@ -83,9 +91,13 @@ declare const Strings: kit.I18N<{
|
|
|
83
91
|
ipc_player_low_phone_not_support: string;
|
|
84
92
|
};
|
|
85
93
|
}, {
|
|
94
|
+
ipc_player_resolution_SS: string;
|
|
86
95
|
ipc_player_resolution_HD: string;
|
|
87
96
|
ipc_player_resolution_SD: string;
|
|
97
|
+
ipc_player_resolution_UD: string;
|
|
98
|
+
ipc_player_resolution_SSP: string;
|
|
88
99
|
ipc_player_resolution_AUTO: string;
|
|
100
|
+
ipc_player_resolution_AUDIO: string;
|
|
89
101
|
ipc_player_current_resolution_is_equal: string;
|
|
90
102
|
ipc_player_screenshot_success_tip: string;
|
|
91
103
|
ipc_player_screenshot_multi_success_tip: string;
|
|
@@ -123,9 +135,13 @@ declare const Strings: kit.I18N<{
|
|
|
123
135
|
ipc_player_fetch_error: string;
|
|
124
136
|
ipc_player_low_phone_not_support: string;
|
|
125
137
|
} | {
|
|
138
|
+
ipc_player_resolution_SS: string;
|
|
126
139
|
ipc_player_resolution_HD: string;
|
|
127
140
|
ipc_player_resolution_SD: string;
|
|
141
|
+
ipc_player_resolution_UD: string;
|
|
142
|
+
ipc_player_resolution_SSP: string;
|
|
128
143
|
ipc_player_resolution_AUTO: string;
|
|
144
|
+
ipc_player_resolution_AUDIO: string;
|
|
129
145
|
ipc_player_current_resolution_is_equal: string;
|
|
130
146
|
ipc_player_screenshot_success_tip: string;
|
|
131
147
|
ipc_player_screenshot_multi_success_tip: string;
|
package/lib/i18n/strings.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
en: {
|
|
3
|
+
ipc_player_resolution_SS: string;
|
|
3
4
|
ipc_player_resolution_HD: string;
|
|
4
5
|
ipc_player_resolution_SD: string;
|
|
6
|
+
ipc_player_resolution_UD: string;
|
|
7
|
+
ipc_player_resolution_SSP: string;
|
|
5
8
|
ipc_player_resolution_AUTO: string;
|
|
9
|
+
ipc_player_resolution_AUDIO: string;
|
|
6
10
|
ipc_player_current_resolution_is_equal: string;
|
|
7
11
|
ipc_player_screenshot_success_tip: string;
|
|
8
12
|
ipc_player_screenshot_multi_success_tip: string;
|
|
@@ -41,9 +45,13 @@ declare const _default: {
|
|
|
41
45
|
ipc_player_low_phone_not_support: string;
|
|
42
46
|
};
|
|
43
47
|
zh: {
|
|
48
|
+
ipc_player_resolution_SS: string;
|
|
44
49
|
ipc_player_resolution_HD: string;
|
|
45
50
|
ipc_player_resolution_SD: string;
|
|
51
|
+
ipc_player_resolution_UD: string;
|
|
52
|
+
ipc_player_resolution_SSP: string;
|
|
46
53
|
ipc_player_resolution_AUTO: string;
|
|
54
|
+
ipc_player_resolution_AUDIO: string;
|
|
47
55
|
ipc_player_current_resolution_is_equal: string;
|
|
48
56
|
ipc_player_screenshot_success_tip: string;
|
|
49
57
|
ipc_player_screenshot_multi_success_tip: string;
|
package/lib/i18n/strings.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
en: {
|
|
3
|
+
ipc_player_resolution_SS: 'Data Saver',
|
|
3
4
|
ipc_player_resolution_HD: 'HD',
|
|
4
5
|
ipc_player_resolution_SD: 'SD',
|
|
6
|
+
ipc_player_resolution_UD: 'Ultra HD',
|
|
7
|
+
ipc_player_resolution_SSP: 'Super Ultra HD',
|
|
5
8
|
ipc_player_resolution_AUTO: 'Auto',
|
|
9
|
+
ipc_player_resolution_AUDIO: 'Audio Mode',
|
|
6
10
|
ipc_player_current_resolution_is_equal: 'Already at current clarity',
|
|
7
11
|
ipc_player_screenshot_success_tip: 'Screenshot saved to album',
|
|
8
12
|
ipc_player_screenshot_multi_success_tip: 'Screenshots saved to album',
|
|
@@ -41,9 +45,13 @@ export default {
|
|
|
41
45
|
ipc_player_low_phone_not_support: 'This feature is not supported on this device'
|
|
42
46
|
},
|
|
43
47
|
zh: {
|
|
48
|
+
ipc_player_resolution_SS: '省流量',
|
|
44
49
|
ipc_player_resolution_HD: '高清',
|
|
45
50
|
ipc_player_resolution_SD: '标清',
|
|
51
|
+
ipc_player_resolution_UD: '超清',
|
|
52
|
+
ipc_player_resolution_SSP: '超超清',
|
|
46
53
|
ipc_player_resolution_AUTO: '自动',
|
|
54
|
+
ipc_player_resolution_AUDIO: '音频模式',
|
|
47
55
|
ipc_player_current_resolution_is_equal: '已是当前清晰度',
|
|
48
56
|
ipc_player_screenshot_success_tip: '截图已保存在APP相册',
|
|
49
57
|
ipc_player_screenshot_multi_success_tip: '图片已保存至相册',
|
package/lib/ui/constant.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare const bottomLeftContentResize = "bottomLeftContentResize";
|
|
|
62
62
|
export declare const zoomLevelChange = "zoomLevelChange";
|
|
63
63
|
/**
|
|
64
64
|
* 自动清晰度状态变化事件:Resolution 控件检测到清晰度进入/退出自动模式或收到
|
|
65
|
-
*
|
|
65
|
+
* onClarityChanged 事件时触发,携带 { enabled, clarity }(clarity 为 ClarityType | null)。
|
|
66
66
|
* VideoBitKBP 监听此事件,在码率前展示当前高清/标清文案。
|
|
67
67
|
*/
|
|
68
68
|
export declare const autoClarityChange = "autoClarityChange";
|
package/lib/ui/constant.js
CHANGED
|
@@ -66,7 +66,7 @@ export const zoomLevelChange = 'zoomLevelChange';
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* 自动清晰度状态变化事件:Resolution 控件检测到清晰度进入/退出自动模式或收到
|
|
69
|
-
*
|
|
69
|
+
* onClarityChanged 事件时触发,携带 { enabled, clarity }(clarity 为 ClarityType | null)。
|
|
70
70
|
* VideoBitKBP 监听此事件,在码率前展示当前高清/标清文案。
|
|
71
71
|
*/
|
|
72
72
|
export const autoClarityChange = 'autoClarityChange';
|
package/lib/utils/ttt.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
1
2
|
export type SmartImageQualityResult = {
|
|
2
3
|
isPurchase: boolean;
|
|
3
4
|
buttonState: number;
|
|
@@ -48,6 +49,17 @@ export declare function notifyOfflineShown(deviceId: string): boolean;
|
|
|
48
49
|
export declare function getNgRawData(): Promise<unknown>;
|
|
49
50
|
export declare function isClarityChangedSupported(): boolean;
|
|
50
51
|
export type ClarityChangedResult = {
|
|
51
|
-
|
|
52
|
+
deviceId?: string;
|
|
53
|
+
clarity: ClarityType;
|
|
52
54
|
};
|
|
53
|
-
export
|
|
55
|
+
export type ClarityChangedHandler = (result: ClarityChangedResult) => void;
|
|
56
|
+
type ClarityChangedListener = (payload: ClarityChangedResult) => void;
|
|
57
|
+
export declare function offClarityChanged(listener: ClarityChangedListener): void;
|
|
58
|
+
/**
|
|
59
|
+
* 监听自动清晰度变化,返回取消监听函数。
|
|
60
|
+
*
|
|
61
|
+
* onClarityChanged / offClarityChanged 均使用同一个 listener 引用,
|
|
62
|
+
* 否则宿主无法正确移除监听。
|
|
63
|
+
*/
|
|
64
|
+
export declare function subscribeClarityChanged(devId: string, handler: ClarityChangedHandler): () => void;
|
|
65
|
+
export {};
|
package/lib/utils/ttt.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
2
3
|
export function getSmartImageQualityState(devId) {
|
|
3
4
|
return new Promise(resolve => {
|
|
4
5
|
var _ty$ipc;
|
|
@@ -165,35 +166,63 @@ export function getNgRawData() {
|
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
// 是否支持自动清晰度(ttt 方法
|
|
169
|
+
// 是否支持自动清晰度(ttt 方法 onClarityChanged 存在即支持)
|
|
169
170
|
export function isClarityChangedSupported() {
|
|
170
|
-
var
|
|
171
|
-
return typeof ((
|
|
171
|
+
var _ty5;
|
|
172
|
+
return typeof ty !== 'undefined' && typeof ((_ty5 = ty) === null || _ty5 === void 0 || (_ty5 = _ty5.ipc) === null || _ty5 === void 0 ? void 0 : _ty5.onClarityChanged) === 'function';
|
|
172
173
|
}
|
|
173
|
-
export function
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
export function offClarityChanged(listener) {
|
|
175
|
+
var _ty6;
|
|
176
|
+
const ipc = typeof ty !== 'undefined' ? (_ty6 = ty) === null || _ty6 === void 0 ? void 0 : _ty6.ipc : undefined;
|
|
177
|
+
if (!ipc || typeof ipc.offClarityChanged !== 'function') {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
ipc.offClarityChanged(listener);
|
|
182
|
+
} catch (error) {
|
|
183
|
+
console.warn('res===offClarityChanged fail', error);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 监听自动清晰度变化,返回取消监听函数。
|
|
189
|
+
*
|
|
190
|
+
* onClarityChanged / offClarityChanged 均使用同一个 listener 引用,
|
|
191
|
+
* 否则宿主无法正确移除监听。
|
|
192
|
+
*/
|
|
193
|
+
export function subscribeClarityChanged(devId, handler) {
|
|
194
|
+
var _ty7;
|
|
195
|
+
const ipc = typeof ty !== 'undefined' ? (_ty7 = ty) === null || _ty7 === void 0 ? void 0 : _ty7.ipc : undefined;
|
|
196
|
+
if (!ipc || typeof ipc.onClarityChanged !== 'function') {
|
|
197
|
+
return () => undefined;
|
|
198
|
+
}
|
|
199
|
+
const listener = payload => {
|
|
200
|
+
console.log('[resolution] onClarityChanged 事件到达', JSON.stringify(payload !== null && payload !== void 0 ? payload : null));
|
|
201
|
+
const {
|
|
202
|
+
deviceId,
|
|
203
|
+
clarity
|
|
204
|
+
} = payload || {};
|
|
205
|
+
if (!Object.values(ClarityType).includes(clarity)) {
|
|
206
|
+
console.warn('[resolution] onClarityChanged 缺少 clarity');
|
|
178
207
|
return;
|
|
179
208
|
}
|
|
180
|
-
|
|
181
|
-
|
|
209
|
+
// 一页多设备时只认自己的;宿主没带 deviceId 就不过滤
|
|
210
|
+
if (deviceId && deviceId !== devId) {
|
|
211
|
+
console.warn('[resolution] onClarityChanged 非本设备,已忽略', `${deviceId} != ${devId}`);
|
|
182
212
|
return;
|
|
183
213
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
});
|
|
214
|
+
handler({
|
|
215
|
+
deviceId,
|
|
216
|
+
clarity
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
try {
|
|
220
|
+
ipc.onClarityChanged(listener);
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.warn('res===onClarityChanged fail', error);
|
|
223
|
+
return () => undefined;
|
|
224
|
+
}
|
|
225
|
+
return () => {
|
|
226
|
+
offClarityChanged(listener);
|
|
227
|
+
};
|
|
199
228
|
}
|
|
@@ -9,7 +9,7 @@ import { FullResolutionControl } from './fullResolutionControl';
|
|
|
9
9
|
import { fullResolutionId, pauseTimeToHideAllComponent, hideAllComponent, widgetLabs, widgetClick, autoClarityChange } from '../../ui/constant';
|
|
10
10
|
import { UIEventContext } from '../../ui/context';
|
|
11
11
|
import { useStore } from '../../ctx/store';
|
|
12
|
-
import {
|
|
12
|
+
import { subscribeClarityChanged } from '../../utils/ttt';
|
|
13
13
|
import './resolution.less';
|
|
14
14
|
export const Resolution = props => {
|
|
15
15
|
const {
|
|
@@ -33,7 +33,7 @@ export const Resolution = props => {
|
|
|
33
33
|
} = useContext(UIEventContext);
|
|
34
34
|
|
|
35
35
|
// 广播自动清晰度状态给 VideoBitKBP 等监听方;
|
|
36
|
-
//
|
|
36
|
+
// 自动模式下监听当前实际清晰度,仅用于码率区域展示。
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
const emitClarity = (enabled, clarity) => {
|
|
39
39
|
event.emit(autoClarityChange, {
|
|
@@ -43,18 +43,14 @@ export const Resolution = props => {
|
|
|
43
43
|
};
|
|
44
44
|
if (resolution !== ClarityType.AUTO) {
|
|
45
45
|
emitClarity(false, null);
|
|
46
|
-
return;
|
|
46
|
+
return undefined;
|
|
47
47
|
}
|
|
48
48
|
emitClarity(true, null);
|
|
49
|
-
if (devId)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
|
-
}, [devId, resolution]);
|
|
49
|
+
if (!devId) return undefined;
|
|
50
|
+
return subscribeClarityChanged(devId, res => {
|
|
51
|
+
emitClarity(true, res.clarity);
|
|
52
|
+
});
|
|
53
|
+
}, [devId, event, resolution]);
|
|
58
54
|
const onResolution = useMemoizedFn(() => {
|
|
59
55
|
event.emit(widgetClick, {
|
|
60
56
|
widgetId: widgetLabs.RESOLUTION
|
|
@@ -29,7 +29,6 @@ export const VideoBitKBP = props => {
|
|
|
29
29
|
event
|
|
30
30
|
} = useContext(UIEventContext);
|
|
31
31
|
const timerRef = useRef();
|
|
32
|
-
|
|
33
32
|
// 监听 Resolution 控件广播的自动清晰度状态
|
|
34
33
|
useEffect(() => {
|
|
35
34
|
const onAutoClarityChange = payload => {
|
|
@@ -103,7 +102,26 @@ export const VideoBitKBP = props => {
|
|
|
103
102
|
className: "ipc-player-plugin-videoBitKBP-kbps"
|
|
104
103
|
}, autoClarity && /*#__PURE__*/React.createElement(Text, {
|
|
105
104
|
className: "ipc-player-plugin-videoBitKBP-clarity"
|
|
106
|
-
},
|
|
105
|
+
}, (clarity => {
|
|
106
|
+
switch (clarity) {
|
|
107
|
+
case ClarityType.SS:
|
|
108
|
+
return Strings.getLang('ipc_player_resolution_SS');
|
|
109
|
+
case ClarityType.SD:
|
|
110
|
+
return Strings.getLang('ipc_player_resolution_SD');
|
|
111
|
+
case ClarityType.HD:
|
|
112
|
+
return Strings.getLang('ipc_player_resolution_HD');
|
|
113
|
+
case ClarityType.UD:
|
|
114
|
+
return Strings.getLang('ipc_player_resolution_UD');
|
|
115
|
+
case ClarityType.SSP:
|
|
116
|
+
return Strings.getLang('ipc_player_resolution_SSP');
|
|
117
|
+
case ClarityType.AUTO:
|
|
118
|
+
return Strings.getLang('ipc_player_resolution_AUTO');
|
|
119
|
+
case ClarityType.AUDIO:
|
|
120
|
+
return Strings.getLang('ipc_player_resolution_AUDIO');
|
|
121
|
+
default:
|
|
122
|
+
return clarity;
|
|
123
|
+
}
|
|
124
|
+
})(autoClarity)), /*#__PURE__*/React.createElement(Text, null, bitKBP), /*#__PURE__*/React.createElement(Text, {
|
|
107
125
|
className: "ipc-player-plugin-videoBitKBP-unit-kbs"
|
|
108
126
|
}, "KB/S"))));
|
|
109
127
|
};
|