Skip to content

Commit

Permalink
Revert "[WIP] pause video when leaving tab (#484)" (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
incognitojam authored Jun 20, 2024
1 parent 1520e16 commit 74f3544
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/DriveVideo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,4 @@ const stateToProps = Obstruction({
currentRoute: 'currentRoute',
});

export default connect(stateToProps)(DriveVideo);
export default connect(stateToProps)(DriveVideo);
14 changes: 0 additions & 14 deletions src/components/TimeDisplay/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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() {
Expand Down

0 comments on commit 74f3544

Please sign in to comment.