Skip to content

Commit

Permalink
rm kplayer
Browse files Browse the repository at this point in the history
Change-Id: Ic8932ae3155a4f99822909e37ff03133a25ab251
  • Loading branch information
calcitem committed Jun 15, 2024
1 parent 1edac8c commit b25f653
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/ui/flutter_app/lib/game_page/services/mill.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:kplayer/kplayer.dart' as kplayer;
import 'package:path_provider/path_provider.dart';
import 'package:soundpool/soundpool.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class SoundManager {
};

// Change to maintain a map of PlayerController instances for each sound.
final Map<Sound, kplayer.PlayerController> _players =
<Sound, kplayer.PlayerController>{};

final Map<Sound, int> _soundIds = <Sound, int>{};

Expand All @@ -67,14 +65,6 @@ class SoundManager {
return;
}

kplayer.Player.boot();
kplayer.PlayerController.enableLog = false;

// Initialize a PlayerController for each sound
_soundFiles.forEach((Sound sound, String fileName) {
_players[sound] = kplayer.Player.asset(fileName, autoPlay: false);
});

booted = true;
} else {
_soundpool = Soundpool.fromOptions();
Expand Down Expand Up @@ -119,9 +109,7 @@ class SoundManager {
if (Platform.isIOS) {
await _stopAllSounds();

final kplayer.PlayerController? player = _players[sound];
try {
await player?.play();
} catch (e) {
logger.e("$_logTag Error playing sound: $e");
}
Expand All @@ -134,9 +122,6 @@ class SoundManager {
Future<void> _stopAllSounds() async {
if (Platform.isIOS) {
final List<Future<void>> stopFutures = <Future<void>>[];
_players.forEach((_, kplayer.PlayerController player) {
stopFutures.add(player.stop());
});
await Future.wait(stopFutures);
}
}
Expand All @@ -155,9 +140,6 @@ class SoundManager {
}

if (Platform.isIOS) {
_players
.forEach((_, kplayer.PlayerController player) => player.dispose());
_players.clear();
} else {
_soundpool.dispose();
}
Expand Down

0 comments on commit b25f653

Please sign in to comment.