Events and error handling
MKPlayer fires events throughout the player lifecycle, from setup through playback to teardown. You subscribe to events either in the player configuration or dynamically using player.on(). Errors arrive as a specific event type with a structured error object.
Subscribe to events
You can register event handlers in two ways.
In the player configuration (before the player is created):
Dynamically at runtime using player.on():
Remove event handlers
To remove a specific handler:
To remove all handlers for a given event type:
Key player events
See the MKPlayerEvent enum in the SDK reference for the full list of events.
Handle errors
All errors arrive on the Error event. The event object implements MKErrorEvent and includes:
Common error codes
Setup errors
Source errors
Network errors
DRM errors
See DRM protection for the full list of DRM-specific error codes and guidance on resolving them.