diff --git a/lib/screens/player/view.dart b/lib/screens/player/view.dart index ed46b63..2675869 100644 --- a/lib/screens/player/view.dart +++ b/lib/screens/player/view.dart @@ -240,7 +240,7 @@ class _PlayerScreenState extends State { width: 56, height: 56, child: IconButton.filled( - icon: _isFetchingActiveTrack + icon: (_isFetchingActiveTrack && _isPlaying) ? const SizedBox( height: 20, width: 20, @@ -255,9 +255,7 @@ class _PlayerScreenState extends State { : Icons.pause, size: 28, ), - onPressed: _isFetchingActiveTrack - ? null - : _togglePlayState, + onPressed: _togglePlayState, ), ), ), diff --git a/lib/services/server/active_sourced_track.dart b/lib/services/server/active_sourced_track.dart index 23d4f57..b07ff4f 100755 --- a/lib/services/server/active_sourced_track.dart +++ b/lib/services/server/active_sourced_track.dart @@ -25,12 +25,12 @@ class ActiveSourcedTrackProvider extends GetxController { try { if (state.value == null) return; + await audioPlayer.pause(); await populateSibling(); final newTrack = await state.value!.swapWithSibling(sibling); if (newTrack == null) return; state.value = newTrack; - await audioPlayer.pause(); final playback = Get.find(); final oldActiveIndex = audioPlayer.currentIndex; @@ -40,12 +40,11 @@ class ActiveSourcedTrackProvider extends GetxController { await audioPlayer.removeTrack(oldActiveIndex); await playback.jumpToTrack(newTrack); - - await audioPlayer.resume(); } catch (e, stack) { log('[Playback] Failed to swap with siblings. Error: $e; Trace:\n$stack'); } finally { query.isQueryingTrackInfo.value = false; + await audioPlayer.resume(); } } } diff --git a/lib/widgets/player/controls.dart b/lib/widgets/player/controls.dart index ccb80b6..c5c7f2b 100644 --- a/lib/widgets/player/controls.dart +++ b/lib/widgets/player/controls.dart @@ -47,18 +47,19 @@ class _PlayerControlsState extends State { onPressed: _isFetchingActiveTrack ? null : audioPlayer.skipToNext, ), IconButton.filled( - icon: _isFetchingActiveTrack + icon: (_isFetchingActiveTrack && _isPlaying) ? const SizedBox( height: 20, width: 20, child: CircularProgressIndicator( strokeWidth: 3, + color: Colors.white, ), ) : Icon( !_isPlaying ? Icons.play_arrow : Icons.pause, ), - onPressed: _isFetchingActiveTrack ? null : _togglePlayState, + onPressed: _togglePlayState, ), if (MediaQuery.of(context).size.width >= 720) IconButton( diff --git a/pubspec.yaml b/pubspec.yaml index 62b217a..376307d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 +version: 1.0.0+3 environment: sdk: ^3.5.0