mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-04 04:47:13 +08:00
New audioplayers, of course
This commit is contained in:
@ -38,15 +38,15 @@ class Audio {
|
|||||||
return loadedFiles[fileName];
|
return loadedFiles[fileName];
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> play(String fileName) async {
|
Future<int> play(String fileName, { volume: 1.0 }) async {
|
||||||
File file = await load(fileName);
|
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);
|
File file = await load(fileName);
|
||||||
AudioPlayer player = new AudioPlayer();
|
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);
|
return await player.play(file.path, isLocal: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ flutter:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
audioplayers: ^0.3.0
|
audioplayers: ^0.4.0
|
||||||
path_provider: ^0.2.1+1
|
path_provider: ^0.2.1+1
|
||||||
box2d: ^0.3.0
|
box2d: ^0.3.0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user