Player Event
Constants defining external events dispatched by the player to registered listeners. These events represent significant state changes or conditions during playback.
Event Order
The following events are emitted during a playback session, in a typical but not strictly guaranteed order:
1. [BUFFERING]: Indicates that playback is stalled due to insufficient data, such as during initial loading or network slowdowns.
- Triggered when data availability delays playback.
2. [METADATA_LOADED]: Indicates that media metadata (e.g., track information) has been received.
- Triggered when metadata becomes available from the media source.
3. [BUFFERING_ENDED]: Indicates that buffering has completed and playback can proceed or resume.
- Triggered when sufficient data is available to continue playback.
4. [READY_TO_START]: Indicates that the player is fully prepared to begin playback.
- Triggered when all prerequisites for playback are met.
5. [PLAYBACK_STARTED]: Indicates that playback has begun, typically when the first media frame is rendered.
- Triggered upon initial playback start.
6. [PLAYBACK_ENDED]: Indicates that playback has concluded or been terminated.
- Triggered when the media ends or the session is closed.
Content copied to clipboard
Notes on Event Ordering
- Non-Strict Sequence: The order above is typical, but variations can occur due to implementation or external conditions:
- [BUFFERING_ENDED] may precede [METADATA_LOADED] if buffering resolves and playback resumes before metadata is fully processed. This can happen when data delivery outpaces metadata parsing.
- Multiple [BUFFERING]/[BUFFERING_ENDED] pairs may repeat during playback if data availability fluctuates (e.g., due to slow network speeds).
- Concurrency: Events are dispatched asynchronously, typically on a main thread, but their triggers depend on underlying media and network behavior.
Content copied to clipboard
Example Event Log
18:02:52.457 D/libPlayer: 2 onEvent: BUFFERING, Bundle[{playerId=2}]
18:02:53.505 D/libPlayer: 2 onEvent: BUFFERING_ENDED, Bundle[{playerId=2}]
18:02:53.506 D/libPlayer: 2 onEvent: METADATA_LOADED, Bundle[{playerId=2}]
18:02:55.309 D/libPlayer: 2 onEvent: READY_TO_START, Bundle[{playerId=2}]
18:02:55.318 D/libPlayer: 2 onEvent: PLAYBACK_STARTED, Bundle[{playerId=2}]
18:05:04.426 D/libPlayer: 2 onEvent: PLAYBACK_ENDED, Bundle[{playerId=2}]
Content copied to clipboard
Properties
Link copied to clipboard
Event indicating that buffering has completed.
Link copied to clipboard
Event indicating a decryption failure (e.g., DRM issue).
Link copied to clipboard
Event indicating that media metadata has been loaded.
Link copied to clipboard
Event indicating that playback has ended.
Link copied to clipboard
Event indicating that playback has been paused.
Link copied to clipboard
Event indicating that the player is ready to start playback.
Link copied to clipboard
Event indicating that playback has started.