Open badrddinb opened 1 year ago
Hey @badrddinb, I'm pretty sure that's intended, the PlayerStateChanged
event is private. We make some events private by design. While we can't stop you from using them, we offer no support or guarantees that we won't break that API in future versions. The only public events are those included in the type definition file and the docs.
That being said, what's your use case for having this event?
I work with @badrddinb, we use the event in react to detect when the player is buffering to signal it to the user in UI.
useEffect(() => {
if (!player) return
const stateChangedListener = (state: unknown) => {
setIsPlayerBuffering(state === PlayerState.BUFFERING)
}
// The IVS Player TS SDK includes the PlayerStateChanged event in its runtime,
// but it has not been included in the TypeScript type declarations.
// Reported: https://github.com/aws-samples/amazon-ivs-player-web-sample/issues/80
const PlayerStateChanged = 'PlayerStateChanged' as PlayerEventType
player.addEventListener(PlayerStateChanged, stateChangedListener)
return () => {
player.removeEventListener(PlayerStateChanged, stateChangedListener)
}
}, [player])
The IVS Player TS SDK includes the
PlayerStateChanged
event in its runtime, but it has not been included in the TypeScript type declarations.