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

View File

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