New audioplayers, of course

This commit is contained in:
Luan Nico
2017-12-02 11:39:56 -02:00
committed by feroult
parent 4b8ad974ba
commit 80254f28c5
2 changed files with 5 additions and 5 deletions

View File

@ -38,15 +38,15 @@ class Audio {
return loadedFiles[fileName];
}
Future<int> play(String fileName) async {
Future<int> play(String fileName, { volume: 1.0 }) async {
File file = await load(fileName);
return await new AudioPlayer().play(file.path, isLocal: true);
return await new AudioPlayer().play(file.path, isLocal: true, volume: volume);
}
Future<int> loop(String fileName) async {
Future<int> loop(String fileName, { volume: 1.0 }) async {
File file = await load(fileName);
AudioPlayer player = new AudioPlayer();
player.setCompletionHandler(() => player.play(file.path, isLocal: true));
player.setCompletionHandler(() => player.play(file.path, isLocal: true, volume: volume));
return await player.play(file.path, isLocal: true);
}

View File

@ -10,7 +10,7 @@ flutter:
dependencies:
flutter:
sdk: flutter
audioplayers: ^0.3.0
audioplayers: ^0.4.0
path_provider: ^0.2.1+1
box2d: ^0.3.0