Flutter app with just_audio package for bug review
AudioSource.uri with headers not playing after screen is locked.
Basically the whole issue is described here: https://stackoverflow.com/questions/72425614/audiosource-uri-with-headers-not-working-when-app-is-locked-for-some-amount-of-t
Here you will find videos and exact steps to reproduce this issue.
The issue only happens on real iOS device – release and profile mode. Issue is not present when running iOS simulator.
Credentials are:
- email: test@test.sk
- password: asdfasdf
Please don’t mind the missing images, the root api url is set to test version. Audiofiles are present, that’s what matters.
Here are the steps captured in video:
video 1
- Login to the app
lib/screens/login.dart
- After login, user gets redirected to my books screen
lib/screens/books/my_books.dart
- After selecting audiobook, user gets redirected to book detail screen
lib/screens/books/book.dart
- Press play button (the floating action button), this triggers following:
- Clear playlist (
lib/services/audio_player_state.dart:51
) - Build new playlist (
lib/services/audio_player_state.dart:67
) - Redirect to player screen (
lib/screens/player.dart
)
- Clear playlist (
- Audio starts playing, since there is
myAudioPlayerState.play()
method called on player screen in theinitState()
method (which triggerslib/services/audio_player_state.dart:33
) - Pause the audio by pressing the pause button under the seeker, this triggers this:
lib/services/audio_player_state.dart:35
- Lock the screen
RPReplay_Final1653914411.MP4
video 2
- After locking the screen and keeping it locked for about 20 seconds, user returns to app an press play – audio starts playing (
lib/services/audio_player_state.dart:33
triggered) - User skips to next chapter – next chapter starts playing (
lib/services/audio_player_state.dart:41
triggered) - (THIS IS THE ISSUE) When user tries to skip to another chapter:
- no audio is playing
- player index quickly iterates through remaining items in queue
- player state gets stuck in loading state.
RPReplay_Final1653914522.MP4
When I remove headers from AudioSource.uri
constructor (lib/services/audio_handler.dart:114
), the issue disappears.