22 lines
468 B
Dart
22 lines
468 B
Dart
import 'package:media_kit/media_kit.dart';
|
|
|
|
class PlayerService {
|
|
static final PlayerService _instance = PlayerService._internal();
|
|
factory PlayerService() => _instance;
|
|
PlayerService._internal();
|
|
|
|
final Player _player = Player();
|
|
|
|
void play(String url) {
|
|
_player.open(Media(url));
|
|
}
|
|
|
|
void pause() => _player.pause();
|
|
void resume() => _player.play();
|
|
void stop() => _player.stop();
|
|
|
|
void dispose() => _player.dispose();
|
|
|
|
// 状态监听...
|
|
}
|