@ray-js/ray-ipc-player 2.1.0 → 2.1.1-beta.1
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/hooks/usePlayerProps.js +3 -1
- package/lib/index.js +24 -0
- package/lib/typings/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -44,7 +44,8 @@ export const usePlayerProps = props => {
|
|
|
44
44
|
hideFeedBackButton = false,
|
|
45
45
|
playerRoute = '',
|
|
46
46
|
defaultAutoPlay = true,
|
|
47
|
-
limitFlow = false
|
|
47
|
+
limitFlow = false,
|
|
48
|
+
autoWakeUp = false
|
|
48
49
|
} = props;
|
|
49
50
|
|
|
50
51
|
// 解构 playerStyle
|
|
@@ -85,6 +86,7 @@ export const usePlayerProps = props => {
|
|
|
85
86
|
playerRoute,
|
|
86
87
|
defaultAutoPlay,
|
|
87
88
|
limitFlow,
|
|
89
|
+
autoWakeUp,
|
|
88
90
|
// 样式相关
|
|
89
91
|
borderRadius,
|
|
90
92
|
bgColor,
|
package/lib/index.js
CHANGED
|
@@ -56,6 +56,7 @@ const Player = props => {
|
|
|
56
56
|
playerRoute,
|
|
57
57
|
defaultAutoPlay,
|
|
58
58
|
limitFlow,
|
|
59
|
+
autoWakeUp,
|
|
59
60
|
borderRadius,
|
|
60
61
|
bgColor,
|
|
61
62
|
borderStyle,
|
|
@@ -375,6 +376,20 @@ const Player = props => {
|
|
|
375
376
|
};
|
|
376
377
|
}, [stopPreview, disconnect]);
|
|
377
378
|
|
|
379
|
+
/**
|
|
380
|
+
* autoWakeUp 模式:视图就绪后立即开始唤醒设备,但不拉流
|
|
381
|
+
*/
|
|
382
|
+
useEffect(() => {
|
|
383
|
+
if (!(autoWakeUp && isLowPowerDevice && playState.initLy && !awakeStatus)) {
|
|
384
|
+
return undefined;
|
|
385
|
+
}
|
|
386
|
+
setEnableWakeUpInterval(true);
|
|
387
|
+
const timeout = setTimeout(() => {
|
|
388
|
+
setEnableWakeUpInterval(false);
|
|
389
|
+
}, 30000);
|
|
390
|
+
return () => clearTimeout(timeout);
|
|
391
|
+
}, [autoWakeUp, isLowPowerDevice, playState.initLy, awakeStatus]);
|
|
392
|
+
|
|
378
393
|
/**
|
|
379
394
|
* 唤醒设备TTT能力
|
|
380
395
|
*/
|
|
@@ -384,6 +399,15 @@ const Player = props => {
|
|
|
384
399
|
intervalTime: 300
|
|
385
400
|
});
|
|
386
401
|
|
|
402
|
+
/**
|
|
403
|
+
* autoWakeUp 模式下,设备进入唤醒状态后停止继续下发唤醒指令
|
|
404
|
+
*/
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
if (autoWakeUp && isLowPowerDevice && awakeStatus) {
|
|
407
|
+
setEnableWakeUpInterval(false);
|
|
408
|
+
}
|
|
409
|
+
}, [awakeStatus, isLowPowerDevice, autoWakeUp]);
|
|
410
|
+
|
|
387
411
|
/**
|
|
388
412
|
* 监听设备休眠状态变化
|
|
389
413
|
* 当检测到设备上报休眠后,触发重新连接
|
package/lib/typings/index.d.ts
CHANGED
|
@@ -228,4 +228,10 @@ export type IProps = {
|
|
|
228
228
|
* @default false
|
|
229
229
|
*/
|
|
230
230
|
limitFlow?: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* @description.en Auto wake up device on init (low power device only)
|
|
233
|
+
* @description.zh 初始化时是否自动唤醒设备(仅低功耗设备生效),需配合 defaultAutoPlay=false 使用实现"唤醒但不拉流"
|
|
234
|
+
* @default false
|
|
235
|
+
*/
|
|
236
|
+
autoWakeUp?: boolean;
|
|
231
237
|
};
|