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

Adding support for mediakeys #193

Merged
merged 2 commits into from
Jan 11, 2024
Merged

Conversation

NereaCassian
Copy link

Please describe the changes this PR makes and why it should be merged:

This pull request adds support for using Media Keys through MediaSessions, allowing you to control the bot's playback without having the browser window in focus and without using commands. The only downside is that in order to use the mediaSessions API, the page has to play audio. Therefore, I have added an tag that plays a soundless file as a workaround. I welcome any suggestions for doing this differently

Status and versioning classification:

  • Code changes have been tested against the Discord API

@github-actions github-actions bot added the dashboard Issue with frontend label Jan 10, 2024
@@ -507,6 +531,7 @@ const Player: NextPageWithLayout = () => {

return (
<div className="player-page-container">
<audio id="audio" src="https://github.com/anars/blank-audio/raw/master/10-minutes-of-silence.mp3" style={{ display: 'none' }}></audio>
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm this is a hack, i wonder if there's anyway to do this without audio element.

Also it only works with chrome it seems, firefox won't set the media applet for me.

Copy link
Author

@NereaCassian NereaCassian Jan 11, 2024

Choose a reason for hiding this comment

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

I have checked playing just audio with JS, but it doesn't work. And regarding Firefox, that's weird newer version of Firefox should be compatible https://developer.mozilla.org/en-US/docs/Web/API/MediaSession#browser_compatibility

@Neko-Life
Copy link
Collaborator

Is firefox works for u @NereaCassian? idk what's wrong with my firefox. It only works on chrome for some reason

@Neko-Life
Copy link
Collaborator

anyway i will merge this for now, pretty cool feature. Fixing firefox can be some other day

@Neko-Life Neko-Life merged commit 0d257cc into wtfnotavailable:develop Jan 11, 2024
1 check passed
@NereaCassian
Copy link
Author

Is firefox works for u @NereaCassian? idk what's wrong with my firefox. It only works on chrome for some reason

It doesn't work in Firefox for me either. It will require some investigation.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dashboard Issue with frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants