audioplayers
audioplayers copied to clipboard
[web] Error when pausing and resuming audio from stream URLSource
Checklist
- [x] I read the troubleshooting guide before raising this issue
- [x] I made sure that the issue I am raising doesn't already exist
An error is thrown when pausing a currently playing audioplayer using a URLSource from a stream. This breaks the audioplayer and makes it impossible to resume playing any source after that.
Current bug behaviour
Starting an audioplayer
using a stream URLSource
works as intended. When pausing the audioplayer
using audioPlayer.pause()
and then resuming using audioPlayer.resume()
, the following error is thrown and the audioplayer
becomes unresponsive to any further commands:
Error: NotSupportedError: Failed to load because no supported source was found.
at Object.createErrorWithStack (http://localhost:8080/dart_sdk.js:5093:12)
at Error._throw (http://localhost:8080/dart_sdk.js:20399:18)
at Error.throwWithStackTrace (http://localhost:8080/dart_sdk.js:20396:18)
at async._AsyncCallbackEntry.new.callback (http://localhost:8080/dart_sdk.js:40921:18)
at Object._microtaskLoop (http://localhost:8080/dart_sdk.js:40778:13)
at _startMicrotaskLoop (http://localhost:8080/dart_sdk.js:40784:13)
at http://localhost:8080/dart_sdk.js:36261:9
Expected behaviour
The audio should be paused when calling audioPlayer.pause()
and resume when calling audioPlayer.resume()
.
Steps to reproduce
- Create an
audioplayer
- Start playback using
audioplayer.play(URLSource(sourceUrl))
- Pause playback by calling
audioPlayer.pause()
- Resume playback by calling
audioPlayer.resume()
- => Error is thrown and audioplayer breaks
Code sample
I'm working on reproducing the error in a minimal example project, however it seems to be somewhat specific to certain technology choices I made, specifically on how the source is provided.
Logs
The error being thrown:
Error: NotSupportedError: Failed to load because no supported source was found.
at Object.createErrorWithStack (http://localhost:8080/dart_sdk.js:5093:12)
at Error._throw (http://localhost:8080/dart_sdk.js:20399:18)
at Error.throwWithStackTrace (http://localhost:8080/dart_sdk.js:20396:18)
at async._AsyncCallbackEntry.new.callback (http://localhost:8080/dart_sdk.js:40921:18)
at Object._microtaskLoop (http://localhost:8080/dart_sdk.js:40778:13)
at _startMicrotaskLoop (http://localhost:8080/dart_sdk.js:40784:13)
at http://localhost:8080/dart_sdk.js:36261:9
Full Logs
Flutter doctor:
[✓] Flutter (Channel stable, 3.0.5, on Ubuntu 22.04.1 LTS 5.15.0-46-generic, locale en_US.UTF-8)
• Flutter version 3.0.5 at /home/masus/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (7 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /home/masus/Android/Sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /snap/android-studio/123/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
• cmake version 3.10.2
• ninja version 1.8.2
• pkg-config version 0.29.1
[✓] Android Studio (version 2021.2)
• Android Studio at /snap/android-studio/123/android-studio
• Flutter plugin version 69.0.2
• Dart plugin version 212.5744
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code
• VS Code at /snap/code/current
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.1 LTS 5.15.0-46-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.101
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Audio Files/URLs/Sources
Environment information
- audioplayers version:
Platform 1:
- OS name and version:
- Device:
- build mode:
debug
& release
More information
Followup issue for https://github.com/bluefireteam/audioplayers/issues/1249
Ok thanks, it would be good to have at least a public API to test the UrlSource against. Otherwise it's almost impossible to help. Good luck.
I managed to reproduce the error here: https://github.com/masus04/flutter-audiplayers-error
Make sure to run both the frontend & backend. Commands are provided in the readme.
I tried your example and could not reproduce the bug. I used the test.mp3
in the root folder.
Maybe this is solved by #1268
Plz try again with this in your pubspec file:
dependency_overrides:
audioplayers:
git:
url: https://github.com/bluefireteam/audioplayers.git
path: 'packages/audioplayers'
audioplayers_platform_interface:
git:
url: https://github.com/bluefireteam/audioplayers.git
path: 'packages/audioplayers_platform_interface'
audioplayers_web:
git:
url: https://github.com/bluefireteam/audioplayers.git
path: 'packages/audioplayers_web'
audioplayers_linux:
git:
url: https://github.com/bluefireteam/audioplayers.git
path: 'packages/audioplayers_linux'
audioplayers_android:
git:
url: https://github.com/bluefireteam/audioplayers.git
path: 'packages/audioplayers_android'
You can now also use the newest release: audioplayers: ^1.1.0
@masus04 can you reconfirm with newer versions of AP?
Can confirm that the issue no longer persists with the latest versions.