Skip to content

Add mutechange event to Player#2378

Merged
JonnyBurger merged 2 commits intoremotion-dev:mainfrom
rjackson:mutechange
Jun 1, 2023
Merged

Add mutechange event to Player#2378
JonnyBurger merged 2 commits intoremotion-dev:mainfrom
rjackson:mutechange

Conversation

@rjackson
Copy link
Copy Markdown
Contributor

@rjackson rjackson commented Jun 1, 2023

This PR adds a new mutechange event emitter for Player.

It's implemented the same as the isMuted() method, where the player is considered muted if the mute button is pressed or the volume is currently set to zero.

Alongside this PR I have included a fix for the volumechange event, to make sure it is emitted every time the volume changes. Previously it was only emitting were programmatically changed via the setVolume() method, which means it was not emitting when the volume slider was changed.

To test this change I have expanded the packages/player-example. When running this example with:

cd packages/player-example
pnpm dev

And interacting with the mute button or volume slider, you can see the mutechange and fixed volumechange events being logged.

In the following screenshot, the left player shows mute being directly toggled, whereas the right shows the volume slider going down to zero and back up.

image

The Player API reference docs have been updated to note the new event:

image

Solves #2376
/claim #2376

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Jun 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
remotion ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 1, 2023 4:43pm

@JonnyBurger
Copy link
Copy Markdown
Member

Looks absolutely perfect! Thanks a lot.

Thanks for the bugfix as well, well caught! /tip 20

@algora-pbc
Copy link
Copy Markdown

algora-pbc bot commented Jun 1, 2023

🎉🎈 @rjackson has been awarded $20! 🎈🎊

@JonnyBurger JonnyBurger merged commit e88876c into remotion-dev:main Jun 1, 2023
@rjackson rjackson deleted the mutechange branch June 1, 2023 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants