Connect with spotify

This commit is contained in:
2024-08-29 15:02:49 +08:00
parent be44aadc07
commit 7285eb4959
13 changed files with 1004 additions and 1042 deletions

View File

@ -15,7 +15,7 @@ class WindowsAudioService {
final subscriptions = <StreamSubscription>[];
WindowsAudioService() : smtc = SMTCWindows(enabled: false) {
smtc.setPlaybackStatus(PlaybackStatus.Stopped);
smtc.setPlaybackStatus(PlaybackStatus.stopped);
final buttonStream = smtc.buttonPressStream.listen((event) {
switch (event) {
case PressedButton.play:
@ -42,16 +42,16 @@ class WindowsAudioService {
audioPlayer.playerStateStream.listen((state) async {
switch (state) {
case AudioPlaybackState.playing:
await smtc.setPlaybackStatus(PlaybackStatus.Playing);
await smtc.setPlaybackStatus(PlaybackStatus.playing);
break;
case AudioPlaybackState.paused:
await smtc.setPlaybackStatus(PlaybackStatus.Paused);
await smtc.setPlaybackStatus(PlaybackStatus.paused);
break;
case AudioPlaybackState.stopped:
await smtc.setPlaybackStatus(PlaybackStatus.Stopped);
await smtc.setPlaybackStatus(PlaybackStatus.stopped);
break;
case AudioPlaybackState.completed:
await smtc.setPlaybackStatus(PlaybackStatus.Changing);
await smtc.setPlaybackStatus(PlaybackStatus.changing);
break;
default:
break;