florent37 / Flutter-AssetsAudioPlayer

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications
https://pub.dartlang.org/packages/assets_audio_player
Apache License 2.0
757 stars 364 forks source link

Next audio from an assets playlist is never called #393

Open GabrielRegis opened 4 years ago

GabrielRegis commented 4 years ago

Flutter Version

My version : Flutter 1.23.0-18.1.pre

Lib Version

My version : ^2.0.12

Platform (Android / iOS / web) + version

Platform : iOS - 14

Describe the bug

After the first audio is completed from an assets playlist, the next audio never plays.

Small code to reproduce

 AssetsAudioPlayer player = AssetsAudioPlayer();

    await player.open(
      Playlist(audios: [
        Audio("assets/audios/example.mp3",),
        Audio("assets/audios/exampleB.mp3",),
      ]),
    );
johnareid54 commented 4 years ago

It works fine for me, here is the code I use:

void playword(String file) { _assetsAudioPlayer.open( Playlist(audios: [Audio("assets/$file.mp3"), Audio("assets/audio/blank.mp3")]), loopMode: LoopMode.playlist); }

Note: I do not have await in my code, but I do have loopmode as I want to audio to repeat. I suspect the error in your code is the await keyword.

Hope it helps!

GabrielRegis commented 4 years ago

Hey @johnareid54, thanks for helping me out. I tried your example (Without using the await keyword), but unfortunately, it still not working :( Any guesses?

Note: I just updated to the new assets_audio_player version (^2.0.13).

johnareid54 commented 4 years ago

Sorry @GabrielRegis, I have been using AssetsAudioPlayer for a few months now, and have been very pleased with it.

All I can suggest is make sure the player can play each file separately, I don't know what happens if you put in a file name that does not exist, does it go unto the next file or does it stop? I notice you are using IOS and the second file is called "exampleB.mp3" with an upper case B. IOS is case sensitive so in my app I always use lowercase only to avoid the problem.

alichter commented 4 years ago

I'm experiencing the same playlist issue on iOS.

johnareid54 commented 4 years ago

OK, I just run the IOS simulator on my Macbook (normally I just use the web version as it is faster), eight minutes later I was able to test it out. The app played the first audio file and then stopped, it would not play any further audio files. No messages were shown in the debug window.

This is very disappointing, I know it worked last time I tried the simulator with version 2.0.9. There was a bug then, in that IOS was not reporting when an audio file finished, but the looping method worked. {see closed issue 329)

kalismeras61 commented 3 years ago

@GabrielRegis can you test this with latest version of this plugin ?

GabrielRegis commented 3 years ago

@kalismeras61 I just updated the lib to the new version (^2.0.13+1), it's still not working properly :(

garlicgit commented 3 years ago

I am having the same problem on audio.network. The list plays ok, but the next() does not play next and no exception is thrown. Otherwise, very happy with this package.

iPhone SE emulator, IOS 14.2

startPlayList(List list){ playListPlayer = new AssetsAudioPlayer(); List

// Stop any currently playing players
stopAllPlayers();

playListPlayer.open(
    Playlist(
        audios: audioList
    ),
    //loopMode: LoopMode.playlist //loop the full playlist
);

}

stopPlayList(){ print("playlist stop"); playListPlayer.stop(); }

nextPlayList(){ print("playlist next"); try { playListPlayer.next(); } catch (e){ print("error for playlist next: " + e.toString()); } }

marcqtan commented 3 years ago

any news on this? having the same issue here using latest ^2.0.13. it worked in 2.0.10.

i've reverted #377 and it's now working fine.

please check why #377 causes this issue.

@florent37 @kalismeras61 @Timus23