0

I have an application which uses exoplayer to play videos.

When the user is on player page and presses the power button to close the screen I want the audio to keep playing in the background and notification should be visible to user with controls of play, pause , video metadata etc similar to what we have for every music playing app.

I can keep the audio of video playing from exoplayer using setPlayWhenReady(true).

But I am stuck in for notification. Should I be using MediaBrowserServiceCompat or I will have to create custom notification to handle it?

WISHY
  • 11,067
  • 25
  • 105
  • 197

2 Answers2

0

I think what you should do is to create ForegroundService and create notification as you mentioned to have the ForegroundService working. I think this post might help you:

https://androidwave.com/foreground-service-android-example/

Mariusz Brona
  • 1,549
  • 10
  • 12
0

Use a foreground service to implement something like this.This can help you

Nitin Tej
  • 353
  • 1
  • 7