This commit fixes the issue where the audio session is prematurely activated when TrackPlayer.play() or TrackPlayer.setPlayWhenReady(true) is called with an empty queue.
move configureAudioSession from play & setPlayWhenReady to handlePlayWhenReadyChange
add configureAudioSession to handleAudioPlayerCurrentItemChange when we go from no queue items to the first or the other way around
remove setActive parameter from configureAudioSession. Instead, activate the audio session when there is a currentItem and playWhenReady == true. Deactivate the session when there is no currentItem.
in configureAudioSession remove unnecessary ios 13.0 available check, since there is already one for ios 11
remove try? audioSessionController.deactivateSession() before try? audioSessionController.activateSession() until we can figure out why it is necessary (see #2110)
This commit fixes the issue where the audio session is prematurely activated when
TrackPlayer.play()
orTrackPlayer.setPlayWhenReady(true)
is called with an empty queue.play
&setPlayWhenReady
tohandlePlayWhenReadyChange
configureAudioSession
tohandleAudioPlayerCurrentItemChange
when we go from no queue items to the first or the other way aroundsetActive
parameter fromconfigureAudioSession
. Instead, activate the audio session when there is acurrentItem
andplayWhenReady == true
. Deactivate the session when there is nocurrentItem
.try? audioSessionController.deactivateSession()
beforetry? audioSessionController.activateSession()
until we can figure out why it is necessary (see #2110)