Fixed issue, notification skip next not work.

This commit is contained in:
stonega 2020-11-06 22:04:08 +08:00
parent f282d3288b
commit b68d736d92
2 changed files with 33 additions and 26 deletions

View File

@ -23,12 +23,12 @@ MediaControl pauseControl = MediaControl(
label: 'Pause',
action: MediaAction.pause,
);
MediaControl skipToNext = MediaControl(
MediaControl skipToNextControl = MediaControl(
androidIcon: 'drawable/baseline_skip_next_white_24',
label: 'Next',
action: MediaAction.skipToNext,
);
MediaControl skipToPrevious = MediaControl(
MediaControl skipToPreviousControl = MediaControl(
androidIcon: 'drawable/ic_action_skip_previous',
label: 'Previous',
action: MediaAction.skipToPrevious,
@ -38,13 +38,13 @@ MediaControl stopControl = MediaControl(
label: 'Stop',
action: MediaAction.stop,
);
MediaControl forward = MediaControl(
MediaControl forwardControl = MediaControl(
androidIcon: 'drawable/baseline_fast_forward_white_24',
label: 'forward',
action: MediaAction.fastForward,
);
MediaControl rewind = MediaControl(
MediaControl rewindControl = MediaControl(
androidIcon: 'drawable/baseline_fast_rewind_white_24',
label: 'rewind',
action: MediaAction.rewind,
@ -1111,32 +1111,37 @@ class AudioPlayerTask extends BackgroundAudioTask {
List<MediaControl> _getControls(int index) {
switch (index) {
case 0:
if (_playing) {
return [pauseControl, forward, skipToNext, stopControl];
} else {
return [playControl, forward, skipToNext, stopControl];
}
return [
_playing ? pauseControl : playControl,
forwardControl,
skipToNextControl,
stopControl
];
break;
case 1:
if (_playing) {
return [pauseControl, rewind, skipToNext, stopControl];
} else {
return [playControl, rewind, skipToNext, stopControl];
}
return [
_playing ? pauseControl : playControl,
rewindControl,
skipToNextControl,
stopControl
];
break;
case 2:
if (_playing) {
return [rewind, pauseControl, forward, stopControl];
} else {
return [rewind, playControl, forward, stopControl];
}
return [
rewindControl,
_playing ? pauseControl : playControl,
forwardControl,
stopControl
];
break;
default:
if (_playing) {
return [pauseControl, forward, skipToNext, stopControl];
} else {
return [playControl, forward, skipToNext, stopControl];
}
return [
_playing ? pauseControl : playControl,
forwardControl,
skipToNextControl,
stopControl
];
break;
}
}

View File

@ -1,7 +1,7 @@
name: tsacdop
description: An open source podacasts player.
version: 0.5.0+38
version: 0.5.1+39
environment:
sdk: ">=2.6.0 <3.0.0"
@ -30,7 +30,6 @@ dependencies:
feature_discovery: ^0.12.1
file_picker: ^2.0.11
flutter_html: ^0.11.1
flutter_downloader: ^1.5.2
fluttertoast: ^4.0.0
flutter_isolate: ^1.0.0+14
flutter_linkify: ^3.1.3
@ -56,6 +55,9 @@ dependencies:
xml: ^4.2.0
workmanager: ^0.2.3
wc_flutter_share: ^0.2.2
flutter_downloader:
git:
url: https://github.com/stonega/flutter_downloader.git
audio_service:
git:
url: https://github.com/stonega/audio_service.git