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

feat: add media session action handlers for play and pause #2394

Merged
merged 2 commits into from
Dec 31, 2024

Conversation

kovsu
Copy link
Contributor

@kovsu kovsu commented Dec 31, 2024

Description

PR Type

  • Feature
  • Bugfix
  • Hotfix
  • Other (please describe):

Linked Issues

Additional context

CleanShot.2024-12-31.at.14.41.37.mp4

Changelog

  • I have updated the changelog/next.md with my changes.

@follow-reviewer-bot
Copy link

Thank you for your contribution. We will review it promptly.

Copy link

vercel bot commented Dec 31, 2024

@kovsu is attempting to deploy a commit to the RSS3 Team on Vercel.

A member of the Team first needs to authorize it.

@follow-reviewer-bot
Copy link

Suggested PR Title:

feat: add media session action handlers for playback control

Change Summary:
Added media session action handlers for play and pause functionality in CornerPlayer component, enhancing user interaction with media controls.

Code Review:

  • apps/renderer/src/modules/player/corner-player.tsx:
    • Line 133-143: The useEffect hook does not include a dependency array. This means the effect will run after every render, which can lead to performance issues and potentially problematic behavior. Add an empty dependency array [] to ensure the effect only runs once after the initial render, or specify the necessary dependencies.
useEffect(() => {
  navigator.mediaSession.setActionHandler("play", handleClickPlay)
  navigator.mediaSession.setActionHandler("pause", handleClickPlay)

  return () => {
    navigator.mediaSession.setActionHandler("play", null)
    navigator.mediaSession.setActionHandler("pause", null)
  }
}, []) // Include the dependency array here

@Innei Innei merged commit e7a1da3 into RSSNext:dev Dec 31, 2024
3 of 6 checks passed
@follow-reviewer-bot
Copy link

Thank you @kovsu for your contribution! 🎉

Your pull request has been merged and we really appreciate your help in making this project better. We hope to see more contributions from you in the future! 💪

@kovsu kovsu deleted the feat-1 branch January 1, 2025 09:32
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.

2 participants