mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-04 01:00:44 +02:00
feat(player): add sleep timer
This commit is contained in:
@@ -69,6 +69,8 @@ class MusicPlayerController {
|
||||
|
||||
bool get isAvailable => _handler != null;
|
||||
|
||||
DateTime? get sleepTimerEndsAt => _handler?.sleepTimerEndsAt;
|
||||
|
||||
Future<MusicPlayerHandler?> ensureInitialized() async {
|
||||
try {
|
||||
return await initMusicPlayer();
|
||||
@@ -118,6 +120,10 @@ class MusicPlayerController {
|
||||
Future<void> next() async => _handler?.skipToNext();
|
||||
Future<void> previous() async => _handler?.skipToPrevious();
|
||||
|
||||
void setSleepTimer(Duration duration) => _handler?.setSleepTimer(duration);
|
||||
|
||||
void cancelSleepTimer() => _handler?.cancelSleepTimer();
|
||||
|
||||
Future<void> togglePlayPause(bool isPlaying) async {
|
||||
final handler = _handler;
|
||||
if (handler == null) return;
|
||||
|
||||
Reference in New Issue
Block a user