ui: fixup autoplay on inactive tabs
This commit is contained in:
parent
77bbb5af36
commit
0360e3726e
1 changed files with 12 additions and 9 deletions
|
|
@ -38,8 +38,8 @@ function WebPlayer(props: any) {
|
||||||
uxtestingStore,
|
uxtestingStore,
|
||||||
uiPlayerStore,
|
uiPlayerStore,
|
||||||
integrationsStore,
|
integrationsStore,
|
||||||
userStore,
|
|
||||||
} = useStore();
|
} = useStore();
|
||||||
|
const devTools = sessionStore.devTools
|
||||||
const session = sessionStore.current;
|
const session = sessionStore.current;
|
||||||
const { prefetched } = sessionStore;
|
const { prefetched } = sessionStore;
|
||||||
const startedAt = sessionStore.current.startedAt || 0;
|
const startedAt = sessionStore.current.startedAt || 0;
|
||||||
|
|
@ -57,14 +57,17 @@ function WebPlayer(props: any) {
|
||||||
const [fullView, setFullView] = useState(false);
|
const [fullView, setFullView] = useState(false);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (windowActive) {
|
const handleActivation = () => {
|
||||||
const handleActivation = () => {
|
if (!document.hidden) {
|
||||||
if (!document.hidden) {
|
setWindowActive(true);
|
||||||
setWindowActive(true);
|
document.removeEventListener('visibilitychange', handleActivation);
|
||||||
document.removeEventListener('visibilitychange', handleActivation);
|
}
|
||||||
}
|
};
|
||||||
};
|
document.addEventListener('visibilitychange', handleActivation);
|
||||||
document.addEventListener('visibilitychange', handleActivation);
|
|
||||||
|
return () => {
|
||||||
|
devTools.update('network', { activeTab: 'ALL' });
|
||||||
|
document.removeEventListener('visibilitychange', handleActivation);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue