bluefireteam / audioplayers

A Flutter package to play multiple audio files simultaneously (Android/iOS/web/Linux/Windows/macOS)
https://pub.dartlang.org/packages/audioplayers
MIT License
2.01k stars 845 forks source link

AVPlayerItem.Status.failed on setSourceUrl, null #1668

Open vinh-savvycom opened 1 year ago

vinh-savvycom commented 1 year ago

Checklist

Current bug behaviour

I tried to play remote url mp3 but I have this error message AudioPlayers Exception: AudioPlayerException( UrlSource(url: http://cdn.mos.musicradar.com/audio/samples/80s-heat-demos/AM_Eighties08_85-01.mp3), PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null)<…> [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null)

Expected behaviour

Please help me play remote url

Steps to reproduce

  1. Execute flutter run on the code sample
  2. ...
  3. ...

Code sample

Code sample ```dart Future test() async { const String demo1 = "https://dw3ipxb2b87nb.cloudfront.net/Sonata%20Pathetique%20by%20Anton%20Tolpeev-MUSIC_FILES.mp3"; const String demo2 = "http://cdn.mos.musicradar.com/audio/samples/80s-heat-demos/AM_Eighties08_85-01.mp3"; const String demo = "https://dict.youdao.com/dictvoice?audio=hobby&type=1.mp3"; // final player = AudioPlayer(); final player = AudioPlayer()..setReleaseMode(ReleaseMode.stop); await player.play(UrlSource(demo2)); } ```

Affected platforms

iOS

Platform details

No response

AudioPlayers Version

5.2.0

Build mode

debug

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

my relevant logs
Full Logs ``` AudioPlayers Exception: AudioPlayerException( UrlSource(url: http://cdn.mos.musicradar.com/audio/samples/80s-heat-demos/AM_Eighties08_85-01.mp3), PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null)<…> [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null) ``` Flutter doctor: ``` Output of: flutter doctor -v ```

Related issues / more information

No response

Working on PR

no way

tjbaba2 commented 1 year ago

Faced Same issue

thonn96 commented 1 year ago

I get same issue, how to fix it?

Gustl22 commented 1 year ago

Hi there. Did you read the troubleshooting guide? Did you searched the other issues?

thonn96 commented 1 year ago

@Gustl22 yes, I have added all permission IOS but still getting issue UrlSource(url: https://thonn.mthana.shop/91a3c69bef6a9383e01df5e38e7db720.mp3), PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null)<…> [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null) [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null) [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null)

i try with url: https://www.kozco.com/tech/piano2-CoolEdit.mp3 and it's working well

Gustl22 commented 1 year ago

@thonn96 thats because there is no file here: https://thonn.mthana.shop/91a3c69bef6a9383e01df5e38e7db720.mp3

You can check your file format also with this tool: https://www.aconvert.com/analyze.html

And also always use Code blocks for code and logs.

Gustl22 commented 1 year ago

@vinh-savvycom You are missing an s in http://. The url in without s is just a scripted forwarding, so it doesn't actually work.

thonn96 commented 1 year ago

@Gustl22 Sorry for mistake, I using this url: https://thonn.mthana.shop/static/91a3c69bef6a9383e01df5e38e7db720.mp3, and it's not working

Gustl22 commented 1 year ago

@thonn96 have you checked the url with this tool? https://www.aconvert.com/analyze.html Does apple support this file format or maybe it's just labeled wrong?

thonn96 commented 1 year ago

@Gustl22 I have put 91a3c69bef6a9383e01df5e38e7db720.mp3 in the assets file and it's working well, I paste the URL to Safari and it's working, and i use the tool https://www.aconvert.com/analyze.html to convert new URLs and it's working well, but if I use this https://thonn.mthana.shop/static/91a3c69bef6a9383e01df5e38e7db720.mp3 : it's not working, could you show me how to check the format or label of the audio. this is the format audio: image and i see an error: FileExtension_Invalid : act at9 wav. is it the root cause? i have updated file audio to 2 channels but it's not working: this is new urls: https://thonn.mthana.shop/static/166e08fea6ff037a3769b1aea0fb41f0_stereo.wav

UrlSource(url: https://thonn.mthana.shop/static/166e08fea6ff037a3769b1aea0fb41f0_stereo.wav), PlatformException(DarwinAudioError, Failed to set source. For troubleshooting, see https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md, AVPlayerItem.Status.failed on setSourceUrl, null)<…>

Gustl22 commented 1 year ago

@thonn96 your url is again not valid. Also if you have questions and need help, better ask in our Discord server: https://discord.com/channels/509714518008528896/533299043686940692 . When I checked the url back then, the format was WAV Riff, which is probably not supported by Apple, but there are plenty of converters out there or use VLC or ffmpeg. Also the file extension must match the format. Please don't delete or change any files, it makes it hard to validate any of your findings. See also #803 .

Again also use code blocks for error messages or logs!

thonn96 commented 1 year ago

@Gustl22 i can't join Discord server: https://discord.com/channels/509714518008528896/533299043686940692. image

my account is thonn96, could you allow to access this group

Gustl22 commented 1 year ago

@thonn96 the invite link is in the readme. This was only the link to the according channel.

thonn96 commented 1 year ago

@Gustl22 Thank you for your support, I have resolved this issue. but i got a new issue onDurationChanged not working on IOS. how to fix this issue? i post messages in the discord but don't get the answer