How to set custom layout and font in Exoplayer notification?

1.8k Views Asked by At

I'm using PlayerNotificationManager for displaying playback notifications in my application. Everything is working fine but I want to add my application's logo in the notification with custom fonts.

I changed the play & pause buttons on the notification by adding drawables.xml. But can't find a way to change the font.

So, how can I change the default notification layout and characteristics that Exoplayer provides?

Edit: I have seen this issue on Github which says that we need to extend PlayerNotificationManager in order to use custom layout. But I can't seem to get it working.

Here is my code:

 private void setPlayerNotificationManager(Player player) {


    playerNotificationManager = new PlayerNotificationManager(context, "123", 1234, mediaDescriptionAdapter);
    playerNotificationManager.setUseNavigationActions(false);
    playerNotificationManager.setUsePlayPauseActions(true);
    playerNotificationManager.setRewindIncrementMs(0);
    playerNotificationManager.setFastForwardIncrementMs(0);
    //playerNotificationManager.setColor(Color.GREEN);
    playerNotificationManager.setColorized(true);
    playerNotificationManager.setUseChronometer(false);
    playerNotificationManager.setSmallIcon(R.drawable.logo);
    playerNotificationManager.setPlayer(player);

}
1

There are 1 best solutions below

5
On BEST ANSWER

As said on the repo you need to extends the PlayerNotificationManager to do that you need to create this class and copy everything inside your project, and then add the layout you want to use as described in this link

You need to add your layout in the builder here