audioplayers icon indicating copy to clipboard operation
audioplayers copied to clipboard

AVPlayerItem.Status.failed on setSourceUrl, null

Open vinh-savvycom opened this issue 1 year ago • 13 comments

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

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
Future<void> 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

vinh-savvycom avatar Oct 09 '23 10:10 vinh-savvycom

Faced Same issue

tjbaba2 avatar Oct 10 '23 08:10 tjbaba2

I get same issue, how to fix it?

thonn96 avatar Oct 26 '23 14:10 thonn96

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

Gustl22 avatar Oct 26 '23 15:10 Gustl22

@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

thonn96 avatar Oct 26 '23 15:10 thonn96

@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 avatar Oct 26 '23 15:10 Gustl22

@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.

Gustl22 avatar Oct 26 '23 16:10 Gustl22

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

thonn96 avatar Oct 26 '23 17:10 thonn96

@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?

Gustl22 avatar Oct 26 '23 18:10 Gustl22

@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)<…>

thonn96 avatar Oct 27 '23 02:10 thonn96

@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!

Gustl22 avatar Oct 27 '23 08:10 Gustl22

@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

thonn96 avatar Oct 27 '23 09:10 thonn96

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

Gustl22 avatar Oct 27 '23 09:10 Gustl22

@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

thonn96 avatar Oct 27 '23 15:10 thonn96