Skip to content

Position gets stuck on Safari (MacOS and iOS) for long audio files #1510

@dbmessina

Description

@dbmessina

Which API doesn't behave as documented, and how does it misbehave?
I'm listening to positionStream from just_audio 0.10.4, and it does not emit updates as frequently as expected. Based on the documentation - "The interval between each update will be no quicker than once every 16ms and no slower than once every 200ms." However, this is not the behavior on Safari (MacOS and iOS) for long audio files as the stream can emit updates slower than this and stops emitting them altogether within a few seconds.

This is not an issue with the stream itself as checking the player's position on a timer shows that it isn't updating.

The longest file I have seen work normally is 32 minutes. A 38 minute file and the 1:35:39 file used in the example app both experience the problem. This is with MP3/MP4. Using HLS makes it worse by extending the issue to shorter files.

Minimal reproduction project
The example

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Run example app in Safari (Mac or iOS)
  2. Press play
  3. Quickly observe the remaining time getting stuck and the loading/buffering spinner (though playback is continuing)

Error messages

n/a

Expected behavior
The position should reliably update while the audio is playing

Screenshots
n/a

Desktop (please complete the following information):

  • OS: MacOS Sonoma 14.6.1 / Sequoia 15.5
  • Browser: Safari 17.6 / 18.5

Smartphone (please complete the following information):

  • Device: iPhone 13
  • OS: iOS 18.4.1 / 18.5
  • Browser: Safari 18.4.1 / 18.5

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.29.3, on Microsoft Windows [Version 10.0.26100.4061], locale en-US)
[√] Windows Version (Windows 11 or higher, 24H2, 2009)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.2)
[√] VS Code (version 1.101.0)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.

Additional context
n/a

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions