diff --git a/lib/audio.dart b/lib/audio.dart index da795eff2..dc0d03143 100644 --- a/lib/audio.dart +++ b/lib/audio.dart @@ -38,15 +38,15 @@ class Audio { return loadedFiles[fileName]; } - Future play(String fileName) async { + Future 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 loop(String fileName) async { + Future 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); } diff --git a/pubspec.yaml b/pubspec.yaml index 9c006cd14..db4629da5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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