suragch / flutter_audio_service_demo

Companion project for Flutter audio_service tutorial
https://suragch.medium.com/background-audio-in-flutter-with-audio-service-and-just-audio-3cce17b4a7d?sk=0837a1b1773e27a4f879ff3072e90305
MIT License
57 stars 28 forks source link

iOS keeps loading track but it works great on android #10

Open malikhamza88 opened 2 years ago

malikhamza88 commented 2 years ago

if anyone knows the solution then please let me know. I didn't change any code. Thank you.

kmigntw commented 2 years ago

Yep, same here. Could someone give some hints? On android is going through 3 processing states: paused, loading and then paused. And the track is ready to go on iOS - paused, loading and stays there

malikhamza88 commented 2 years ago

Still facing this problem

suragch commented 2 years ago

Eventually I'm planning to do an update on the tutorial and at that time I'll look at this issue. Recently I've been pretty busy, though. If anyone else finds the root cause first please post your answer here.

kmigntw commented 2 years ago

Eventually I'm planning to do an update on the tutorial and at that time I'll look at this issue. Recently I've been pretty busy, though. If anyone else finds the root cause first please post your answer here.

After a lot of hours bumping my head - the problem is in the audio_handler class, where you set the playlist. If you define it everything is fine, but if you need to load it dynamically and to have it empty on the initialisation it return non-stopping loading state


final _playlist = ConcatenatingAudioSource(children: [
    ClippingAudioSource(
      start: Duration(seconds: 60),
      end: Duration(seconds: 90),
      child: AudioSource.uri(Uri.parse("https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3")),
      tag: MediaItem(
        id: 'https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3',
        album: "Science Friday",
        title: "A Salute To Head-Scratching Science (30 seconds)",
        artUri: Uri.parse("https://media.wnyc.org/i/1400/1400/l/80/1/ScienceFriday_WNYCStudios_1400.jpg"),
      ),
    ),
    AudioSource.uri(
      Uri.parse("https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3"),
      tag: MediaItem(
        id: 'https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3',
        album: "Science Friday",
        title: "A Salute To Head-Scratching Science",
        artUri: Uri.parse("https://media.wnyc.org/i/1400/1400/l/80/1/ScienceFriday_WNYCStudios_1400.jpg"),
      ),
    ),
    AudioSource.uri(
      Uri.parse("https://s3.amazonaws.com/scifri-segments/scifri201711241.mp3"),
      tag: MediaItem(
        id: 'https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3',
        album: "Science Friday",
        title: "From Cat Rheology To Operatic Incompetence",
        artUri: Uri.parse("https://media.wnyc.org/i/1400/1400/l/80/1/ScienceFriday_WNYCStudios_1400.jpg"),
      ),
    ),
  ]);
malikhamza88 commented 2 years ago

Same thing happening with me.

Eventually I'm planning to do an update on the tutorial and at that time I'll look at this issue. Recently I've been pretty busy, though. If anyone else finds the root cause first please post your answer here.

After a lot of hours bumping my head - the problem is in the audio_handler class, where you set the playlist. If you define it everything is fine, but if you need to load it dynamically and to have it empty on the initialisation it return non-stopping loading state


final _playlist = ConcatenatingAudioSource(children: [
    ClippingAudioSource(
      start: Duration(seconds: 60),
      end: Duration(seconds: 90),
      child: AudioSource.uri(Uri.parse("https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3")),
      tag: MediaItem(
        id: 'https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3',
        album: "Science Friday",
        title: "A Salute To Head-Scratching Science (30 seconds)",
        artUri: Uri.parse("https://media.wnyc.org/i/1400/1400/l/80/1/ScienceFriday_WNYCStudios_1400.jpg"),
      ),
    ),
    AudioSource.uri(
      Uri.parse("https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3"),
      tag: MediaItem(
        id: 'https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3',
        album: "Science Friday",
        title: "A Salute To Head-Scratching Science",
        artUri: Uri.parse("https://media.wnyc.org/i/1400/1400/l/80/1/ScienceFriday_WNYCStudios_1400.jpg"),
      ),
    ),
    AudioSource.uri(
      Uri.parse("https://s3.amazonaws.com/scifri-segments/scifri201711241.mp3"),
      tag: MediaItem(
        id: 'https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3',
        album: "Science Friday",
        title: "From Cat Rheology To Operatic Incompetence",
        artUri: Uri.parse("https://media.wnyc.org/i/1400/1400/l/80/1/ScienceFriday_WNYCStudios_1400.jpg"),
      ),
    ),
  ]);

Same thing happening with me.

malikhamza88 commented 2 years ago

Did anyone got solution?

yekkaplan commented 2 years ago

I have same issue.

deep1931 commented 1 year ago

Same issue, i got platform exception when play stream on ios, on android is it working fine.

suragch commented 1 year ago

I've updated the tutorial with the updated versions of the plugins. Is anyone still getting this issue?