From 74f35449dc73d36fa03dd9c0ddf902bb156adc29 Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Thu, 20 Jun 2024 20:17:29 +0100 Subject: [PATCH] Revert "[WIP] pause video when leaving tab (#484)" (#529) --- src/components/DriveVideo/index.jsx | 2 +- src/components/TimeDisplay/index.jsx | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/components/DriveVideo/index.jsx b/src/components/DriveVideo/index.jsx index 7fbee0c8..bf947606 100644 --- a/src/components/DriveVideo/index.jsx +++ b/src/components/DriveVideo/index.jsx @@ -311,4 +311,4 @@ const stateToProps = Obstruction({ currentRoute: 'currentRoute', }); -export default connect(stateToProps)(DriveVideo); \ No newline at end of file +export default connect(stateToProps)(DriveVideo); diff --git a/src/components/TimeDisplay/index.jsx b/src/components/TimeDisplay/index.jsx index 7d4d9d6d..d716189a 100644 --- a/src/components/TimeDisplay/index.jsx +++ b/src/components/TimeDisplay/index.jsx @@ -118,7 +118,6 @@ class TimeDisplay extends Component { this.decreaseSpeed = this.decreaseSpeed.bind(this); this.jumpBack = this.jumpBack.bind(this); this.jumpForward = this.jumpForward.bind(this); - this.onVisibilityChange = this.onVisibilityChange.bind(this); this.state = { desiredPlaySpeed: 1, @@ -129,23 +128,10 @@ class TimeDisplay extends Component { componentDidMount() { this.mounted = true; raf(this.updateTime); - document.addEventListener('visibilitychange', this.onVisibilityChange); } componentWillUnmount() { this.mounted = false; - document.removeEventListener('visibilitychange', this.onVisibilityChange); - } - - onVisibilityChange() { - const { dispatch } = this.props; - if (document.visibilityState === 'hidden') { - dispatch(pause()); - } else if (document.visibilityState === 'visible') { - const { desiredPlaySpeed } = this.state; - let curIndex = timerSteps.indexOf(desiredPlaySpeed); - dispatch(play(timerSteps[curIndex])); - } } getDisplayTime() {