Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loop #10

Closed
felschr opened this issue Mar 26, 2018 · 2 comments
Closed

loop #10

felschr opened this issue Mar 26, 2018 · 2 comments

Comments

@felschr
Copy link

felschr commented Mar 26, 2018

Android's media player allows looping the audio with:

mediaPlayer.setLooping(true);

It would be nice if you could integrate this functionality.

@luanpotter
Copy link
Member

That`s a good idea; currently what flame does to allow this is the following:

  Future<AudioPlayer> loop(String fileName, { volume: 1.0 }) async {
    File file = await load(fileName);
    AudioPlayer player = new AudioPlayer();
    player.setCompletionHandler(() => player.play(file.path, isLocal: true, volume: volume));
    return await player..play(file.path, isLocal: true);
  }

A completion handler that replays the sound. It'd be nice to have a native option to do it; we just need to consider if it is as easy on iOS. If you'd like, please consider submitting a PR ;)

Thanks so much for the contributions, and sorry for the delay!

@luanpotter
Copy link
Member

This was added on 0.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants