To detect changes in the play state, read the state object in delta mode.
The state object is updated based on input attachment and playback events, as
follows:
- When there's no input attached, the state attribute (within the
state object) is idle, and no other attributes are present.
- When an input is attached, the state attribute changes from idle
to stopped.
- When playback begins, the state attribute changes from stopped to
playing, and any error and error_pos attributes are
deleted.
- When the end of media is reached, the state attribute changes from
playing to stopped, and the error attribute is set to
MMR_ERROR_NONE.
- When playback is explicitly stopped by a function call, no error code is published
to the state object.
A warning is a problem that doesn't stop playback. If there's a warning, the
state remains as playing, and the warning and
warning_pos attributes are set.
An error is a problem that stops playback. If there's an error:
- the warning and warning_pos attributes, if any, are deleted
- the state attribute is set to stopped
- the error and error_pos attributes are set