The following diagram illustrates state changes driven by AudioPlayer components. Boxes represent AudioPlayer states and the connectors indicate state transitions.
AudioPlayer has the following states:
IDLE: AudioPlayer is only in an idle state when a product is initially powered on or rebooted and prior to acting on a
Play
directive.
PLAYING: When your client initiates playback of an audio stream, AudioPlayer should transition from an idle state to playing.
If you receive a directive instructing your client to perform an action, such as pausing or stopping the audio stream, if the client has trouble buffering the stream, or if playback fails, AudioPlayer should transition to the appropriate state when the action is performed (and send an event to AVS). Otherwise, AudioPlayer should remain in the playing state until the current stream has finished.
Additionally, AudioPlayer should remain in the playing state when:
- Reporting playback progress to AVS
- Sending stream metadata to AVS
STOPPED: There are four instances when AudioPlayer should transition to the stopped state. While in the playing state, AudioPlayer should transition to stopped when:
- An issue with the stream is encountered and playback fails
- The client receives a
Stop
directive from AVS - A
ClearQueue
directive with aclearBehavior
ofCLEAR_ALL
is received - A
Play
directive with aplayBehavior
ofREPLACE_ALL
is received
While in the paused or buffer_underrun states, AudioPlayer should transition to stopped when a
ClearQueue
directive to CLEAR_ALL
is received.
AudioPlayer should transition from stopped to playing whenever your client receives a
Play
directive, starts playing an audio stream, and sends a PlaybackStarted
event to the AVS.
PAUSED: AudioPlayer should transition to the paused state when audio on the Content channel is paused to accommodate a higher priority input/output (such as user or Alexa speech). Playback should resume when the prioritized activity completes. For more information on prioritizing audio input/outputs, see Interaction Model.
BUFFER_UNDERRUN: AudioPlayer should transition to the buffer_underrun state when the client is being fed data slower than it is being read. AudioPlayer should remain in this state until the buffer is full enough to resume playback, at which point it should return to the playing state.
FINISHED: When a stream is finished playing, AudioPlayer should transition to the finished state. This is true for every stream in your playback queue. Even if there are streams queued to play, your client is required to send a
PlaybackFinished
event to AVS, and subsequently, transition from the playing state to finished when each stream is finished playing.
AudioPlayer should transition from finished to playing when:
- The client receives a
Play
directive - The next stream in the playback queue starts playing (following a
PlaybackStarted
event).

No comments:
Post a Comment