Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom logo icon instead of default speaker icon #6

Open
AKempente opened this issue Dec 22, 2022 · 4 comments
Open

Custom logo icon instead of default speaker icon #6

AKempente opened this issue Dec 22, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@AKempente
Copy link

I love this plugin, after migrating from cordova to capacitor, i confirm this is the best external player for Android and web.
I can't comment on iOS as i haven't tried it yet.

One question or maybe feature request would be on how to add custom logo icon instead of the default speaker icon displayed on Android.

Please let me know a suggested way to implement it if possible. I couldn't find any info on the documentation or examples.

Cheerios ;)

@jofr jofr self-assigned this Dec 26, 2022
@jofr jofr added the enhancement New feature or request label Dec 26, 2022
@jofr
Copy link
Owner

jofr commented Jan 10, 2023

Hi, so there is currently no option to change the notification icon on Android but I guess that could be added as an option in the plugin configuration, I'll look into that.

In the meantime: the relevant part of the code that needs to be changed is this line in MediaSessionService.java. If you change this to some other icon (that has been added as a resource to the Android project) then that icon will be used for the media notification on Android.

@AKempente
Copy link
Author

AKempente commented Jan 15, 2023

@jofr you're a star. the suggested method, changing the icon in MediaSessionService.java has done the job for me.

Thank you

@kaaloo
Copy link

kaaloo commented Mar 2, 2023

How did you go about this @AKempente ? That file is in node_modules which I don't check into git. 🤔

@AKempente
Copy link
Author

AKempente commented Jun 16, 2023

@kaaloo sorry for the delay in responding, I changed MediaSessionService.java file line (107) in Android Studio:

  1. Open your project in Android Studio
  2. You should see jofr-capacitor-media-session folder
  3. open the java/io.github.jofr.capa...../MediaSessionService
  4. change line 107 to ".setSmallIcon(R.drawable.customicon)"
  5. add the icon (customicon.png) inside jofr-capacitor-media-session.../res/drawable

I hope that helps.

here is the change .setSmallIcon(R.drawable.customicon_24)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants