How can I impliment this functionality. I need to play music in background even after killing the app or we can after removing the from recently use.
I tried changes in the main file according to a video
import 'package:just_audio_background/just_audio_background.dart';
import 'package:flutter/material.dart';
import 'Home.dart';
Future<void> main() async {
await JustAudioBackground.init(
androidNotificationChannelId: 'com.ryanheise.bg_demo.channel.audio',
androidNotificationChannelName: 'Audio playback',
androidNotificationOngoing: true,
);
runApp(Home());
}
CodePudding user response:
- Remove audioplayer.dispose() wherever implemented.
- Checkout didChangeAppLifecycleState implementation which allows you to control the app in inactive, paused, resumed states