Handling Events
useYouTubeEvent supports both reactive state subscriptions and callback-style side effects.
1. State-style subscriptions
Use this when your UI should re-render with the latest value.
2. Callback-style subscriptions
Use this for side effects, analytics, toasts, logging, or one-off app reactions.
Optional dependency array for callbacks
If your callback depends on changing values, pass a dependency array as the fourth argument.
Event list
ready payload
ready provides a rich initial snapshot:
availablePlaybackRatesavailableQualityLevelscurrentTimedurationmutedplaybackQualityplaybackRateplayerStatesizevolume
progress payload
progress includes:
Progress interval behavior
progress is special:
- third argument = polling interval in milliseconds
- default =
1000 - pass
0if you do not want interval-based progress updates
The bridge also refreshes progress shortly after seekTo() so the UI catches up quickly after manual seeking.
Mute tracking nuance
Muted state tracking is enabled only while muteChange is subscribed. This keeps the feature user-friendly without paying the tracking cost when the app does not need it.
