Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure screen saver blocker removed when window closed #3557

Merged

Conversation

PikachuEXE
Copy link
Collaborator

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

Similar to #1217
Might work for reload case in #3286 too

Description

beforeDestroy doesn't work for window close
nklayman/vue-cli-plugin-electron-builder#389

Screenshots

Lazy! (Well or a video with at least 1 min is needed, definitely too big to be uploaded)

Testing

  • Change screen saver to minimum (1 min for MacOS I think)
  • Use FT to play random video
  • Close window
  • Wait 1 min to ensure screen saver/sleep triggered

Desktop

  • OS: MacOS
  • OS Version:
  • FreeTube version:

Additional context

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 16, 2023 01:52
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label May 16, 2023
@@ -42,6 +42,10 @@ const VHS_BANDWIDTH_VARIANCE = videojs.Vhs.BANDWIDTH_VARIANCE

export default defineComponent({
name: 'FtVideoPlayer',
beforeRouteLeave: function (_to, _from, next) {
window.removeEventListener('beforeunload', this.stopPowerSaveBlocker)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this can/should be moved into beforeDestroy
But this is how it's done currently in Watch view

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be moved to beforeDestroy, the route hooks only get triggered in components that are directly inside the router view. So for us those are the components in the src/renderer/views. Additionally the player gets destroyed and a new instance created when you change formats (maybe we can change that in the future, but for the moment that makes it easier for us), so you want this removed as soon as it's destroyed, so that you get rid of the event handler for all instances of the player.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@efb4f5ff-1298-471a-8973-3d47447115dc

@ChunkyProgrammer need more approval chunks

@FreeTubeBot FreeTubeBot merged commit da6acf2 into FreeTubeApp:development May 23, 2023
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants