iOS background playing

This commit is contained in:
LittleSheep 2024-08-30 22:57:38 +08:00
parent 4bf8715486
commit c97a7ae859
4 changed files with 29 additions and 24 deletions

View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
@ -22,12 +24,24 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.music</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMicrophoneUsageDescription</key>
<string>To provide information for RhythmBox to normalize the output audio</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
@ -41,15 +55,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.music</string>
<key>NSMicrophoneUsageDescription</key>
<string>To provide information for RhythmBox to normalize the output audio</string>
<key>UIStatusBarHidden</key>
<false/>
</dict>
</plist>

View File

@ -240,7 +240,7 @@ class _PlayerScreenState extends State<PlayerScreen> {
width: 56,
height: 56,
child: IconButton.filled(
icon: (_isFetchingActiveTrack && _isPlaying)
icon: _isFetchingActiveTrack
? const SizedBox(
height: 20,
width: 20,

View File

@ -46,6 +46,8 @@ class _BottomPlayerState extends State<BottomPlayer>
late final AudioPlayerProvider _playback = Get.find();
late final QueryingTrackInfoProvider _query = Get.find();
bool get _isFetchingActiveTrack => _query.isQueryingTrackInfo.value;
String? get _albumArt =>
(_playback.state.value.activeTrack?.album?.images).asUrlString(
index:
@ -102,19 +104,18 @@ class _BottomPlayerState extends State<BottomPlayer>
behavior: HitTestBehavior.translucent,
child: Column(
children: [
if (_playback.durationCurrent.value != Duration.zero)
TweenAnimationBuilder<double>(
tween: Tween(
begin: 0,
end: _playback.durationCurrent.value.inMilliseconds /
max(_playback.durationTotal.value.inMilliseconds, 1),
),
duration: const Duration(milliseconds: 1000),
builder: (context, value, _) => LinearProgressIndicator(
minHeight: 3,
value: value,
),
TweenAnimationBuilder<double>(
tween: Tween(
begin: 0,
end: _playback.durationCurrent.value.inMilliseconds /
max(_playback.durationTotal.value.inMilliseconds, 1),
),
duration: const Duration(milliseconds: 1000),
builder: (context, value, _) => LinearProgressIndicator(
minHeight: 3,
value: _isFetchingActiveTrack ? null : null,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [

View File

@ -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+3
version: 1.0.0+4
environment:
sdk: ^3.5.0