I am using AVPlayer to stream some live HTTP audio, not AVAudioPlayer which does not support live HTTP audio streaming, the question is, how do I get the status of current playback? For example:
Tap Play Button -> [Loading] -> [Playing] Tap Pause Button -> [Paused]
I need to show a spinner when loading, show a pause button when playing and show a play button when paused, I know I can observe the 'status' and 'rate' properties of AVPlayer:
rate: the current rate of playback. 0.0 means “stopped”, 1.0 means “play at the natural rate of the current item”.
status: Indicates whether the player can be used for playback.
AVPlayerStatusUnknown,
AVPlayerStatusReadyToPlay,
AVPlayerStatusFailed
so there is no way to indicate the audio is "LOADING", and after the status changes to AVPlayerStatusReadyToPlay, it still takes some time to have the audio playing(maybe because it is a live audio).
But anyway, how do I get the correct status of current playback? I know there is an AudioStream from Matt, but it does not support HTTP Live audio.
Thanks very much!