@trtc/calls-uikit-react 4.4.8 → 4.5.0
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/package.json +4 -4
- package/src/TUICallService/CallService/backgroundHandler.ts +182 -0
- package/src/TUICallService/CallService/index.ts +1 -1
- package/src/index.ts +1 -1
- package/tuicall-uikit-react.es.js +2 -2
- package/tuicall-uikit-react.umd.js +2 -2
- package/types/TUICallService/CallService/backgroundHandler.d.ts +27 -0
- package/types/TUICallService/CallService/index.d.ts +1 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BackgroundHandler - Mini Program background detection and auto hangup handler
|
|
3
|
+
*
|
|
4
|
+
* When mini program goes to background for more than 4s, automatically hang up the call
|
|
5
|
+
* to avoid issues caused by WeChat disconnecting WebSocket after 5s.
|
|
6
|
+
*/
|
|
7
|
+
export interface IBackgroundConfig {
|
|
8
|
+
enableAutoHangup: boolean;
|
|
9
|
+
hangupTimeout: number;
|
|
10
|
+
}
|
|
11
|
+
export default class BackgroundHandler {
|
|
12
|
+
private _callService;
|
|
13
|
+
private _hangupTimer;
|
|
14
|
+
private _backgroundTimestamp;
|
|
15
|
+
private _isInBackground;
|
|
16
|
+
private _config;
|
|
17
|
+
private _isInitialized;
|
|
18
|
+
constructor(callService: any);
|
|
19
|
+
initBackgroundDetection(): void;
|
|
20
|
+
destroyBackgroundDetection(): void;
|
|
21
|
+
private _handleAppHide;
|
|
22
|
+
private _handleAppShow;
|
|
23
|
+
private _showToast;
|
|
24
|
+
private _handleBackgroundTimeout;
|
|
25
|
+
private _checkCallStatusAfterBackground;
|
|
26
|
+
private _clearTimers;
|
|
27
|
+
}
|