0

I am making a music player Android App with Kotlin and building UI with Jetpack Compose, using ExoPlayer as the player. Currently I'm using Hilt to inject ExoPlayer directly into the ViewModel responsible for controlling the player.

@HiltViewModel class MusicViewModel @Inject constructor( private val exoPlayer: ExoPlayer, private val listenToSongUseCase: ListenToSongUseCase // To add song to history ) : ViewModel() { private val _state = MutableStateFlow(MusicState()) val state: StateFlow<MusicState> = _state.asStateFlow() init { // Listener to make UI change according to the exoPlayer state } // Function to control exoPlayer: prev, next, play/pause, setQueue... } 

Now I want to make this app to continue playing music in the background, also having a notification to control the player (only prev, next, play/pause,) and show the data of the current MediaItem (title, artist). I have followed some guides on Youtube and the android developer docs, but I can't seem to make it work. Can someone please help me to create a media service and customize the notification like I want. Thank you very much!!

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.