bluefireteam/audioplayers

PlatformException(DarwinAudioError, Failed to set source. Failed to set source.

ahmed-raza-92 opened this issue · 7 comments

Checklist

  • I read the troubleshooting guide before raising this issue
  • I made sure that the issue I am raising doesn't already exist

Current bug behaviour

Whenever I try to run audio by giving url. It gives error.
^[[31mAudioPlayers Exception: AudioPlayerException(
UrlSource(url: https://firebasestorage.googleapis.com/v0/b/learnfinity-448ec.appspot.com/o/audio%2Fbooks%2F[…]?alt=media&token=c77a4b6b-c1ff-481e-bed8-da8f4b4f9f01, mimeType: audio/mpeg),
PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl: Unknown error, null)<…>

Expected behaviour

Play Audio

Steps to reproduce

Just try to play the audio using AudioPlayer and it gives exception

Code sample

Code sample
   if (isUrl) {
      await audioPlayer.play(UrlSource(url,mimeType: "audio/mpeg"));
      print(audioPlayer.state);
      print("audio player state");
    } else {
      await audioPlayer.play(DeviceFileSource(url));
    }

Affected platforms

iOS

Platform details

Platform : ios 17.5.1

AudioPlayers Version

6.0.0

Build mode

debug

Audio Files/URLs/Sources

Sample Url = "https://firebasestorage.googleapis.com/v0/b/learnfinity-448ec.appspot.com/o/audio%2Fbooks%2F4Q7iETsQTFGkhLhhEZOy?alt=media&token=720c4f44-ca1e-4868-8a5e-452068037ab1"

Logs

Full Logs

Flutter doctor:

**[!] Flutter (Channel stable, 3.22.1, on macOS 14.5 23F79 darwin-arm64, locale en-PK)
  • Flutter version 3.22.1 on channel stable at /Users/ahmed/development/flutter
  ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.0.7/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
    /Users/ahmed/development/flutter. Consider adding /Users/ahmed/development/flutter/bin to the front of your path.
  • Upstream repository https://github.com/flutter/flutter.git
  • Framework revision a14f74ff3a (5 weeks ago), 2024-05-22 11:08:21 -0500
  • Engine revision 55eae6864b
  • Dart version 3.4.1
  • DevTools version 2.34.3
  • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
  • Android SDK at /Users/ahmed/Library/Android/sdk
  • Platform android-34, build-tools 33.0.0
  • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
  • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
  • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
  • Xcode at /Applications/Xcode.app/Contents/Developer
  • Build 15E204a
  • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
  • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
  • Android Studio at /Applications/Android Studio.app/Contents
  • Flutter plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/9212-flutter
  • Dart plugin can be installed from:
    🔨 https://plugins.jetbrains.com/plugin/6351-dart
  • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] Connected device (4 available)
  • Ahmed (mobile)                  • 00008110-00163D242E6B801E • ios            • iOS 17.5.1 21F90
  • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
  • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.5 23F79 darwin-arm64
  • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 126.0.6478.63

[✓] Network resources
  • All expected network resources are available.

! Doctor found issues in 1 category.
**

Related issues / more information

No response

Working on PR

no way

same issue on simulator ios 17.2

I figured it out myself. I added mimeType while playing and it's working for me
await audioPlayer.play(UrlSource(currentUrl,mimeType: "audio/mp3"));

I figured it out myself. I added mimeType while playing and it's working for me await audioPlayer.play(UrlSource(currentUrl,mimeType: "audio/mp3"));

Thankkk youu!!

You're Welcome.

I figured it out myself. I added mimeType while playing and it's working for me await audioPlayer.play(UrlSource(currentUrl,mimeType: "audio/mp3"));
I try on real iPhone device but it doesn't help

I try on real iPhone device but it doesn't help