mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-04-29 19:11:45 -05:00
[podcast] Stop Audio Playback on Windows and Linux (#84)
On Windows and Linux it could happen that the audio playback for a podcast wasn't stopped when the item details view for a podcast item was closed. This commit "fixes" the problem, by pausing the audio player, before the widget is disposed. This commit also fixes the condition when the background audio services should be initialized in the `main.dart` file. Instead of the macOS check, we checked for iOS twice.
This commit is contained in:
@@ -57,7 +57,7 @@ void main() async {
|
||||
/// We can not initialize the [just_audio_background] package on Windows and
|
||||
/// Linux, because then the returned duration in the `_player.durationStream`
|
||||
/// isn't working correctly in the [ItemAudioPlayer] widget.
|
||||
if (kIsWeb || Platform.isAndroid || Platform.isIOS || Platform.isIOS) {
|
||||
if (kIsWeb || Platform.isAndroid || Platform.isIOS || Platform.isMacOS) {
|
||||
await JustAudioBackground.init(
|
||||
androidNotificationChannelId: 'com.ryanheise.bg_demo.channel.audio',
|
||||
androidNotificationChannelName: 'Audio playback',
|
||||
|
||||
@@ -65,6 +65,7 @@ class _ItemAudioPlayerState extends State<ItemAudioPlayer> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_player.pause();
|
||||
_player.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user