-
Notifications
You must be signed in to change notification settings - Fork 60
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
No way to change meta info and Destroy needs to be invoked twice #90
Comments
My primary use is also for a music player app so I just had a look at my own code. I don't call destroy at all, just call create with new details each time the track changes, it will replace the existing instance by default. So for example when I catch the playback complete event, I start playback of the next track and call updateRemoteControls() which does a create() with new details, subscribe() and listen() for events. Once catch to look out for is to start the media playing first so that there is an active audiosession. |
I've ran into the "destroy twice" problem, too, but even then it was unreliable, even (maybe) leading to app crashes. My solution/workaround was to not use destroy, and instead keep the notification |
I’ll have a look at the destroy handling and see if I can reproduce this behaviour. |
@ghenry22 IIRC it wasn't consistent wrt android/ios and their versions. Wish I had taken better notes, sorry! |
@ghenry22 I went through my code and I had figured this out:
but this is in dead code now effectively since I don't show the close button any more (it was too tough to figure out consistently with Sorry for the info trickle, I hope it's not causing more confusion. |
I've read all your answers, but I didn't find out a way to make this component work properly. Followings are the problems I'm facing to, while I'm debugging my app:
If you all have any suggestions to solve these problems on Android, please let me know them. What I'm trying to do is to implement e Media Notification as Spotify do. Unfortunately, this component seems to be unable to give me that. |
So, yes, at this moment, this plugin (not a component, sorry to nitpick) is not able to give you that, from my understanding. |
What helped me in updating the cover picture is calling the create method multiple times. My scenario is I have wrapped the media controls functions into Promise, I'm attaching a snippet from my code that works for me
I'm not sure if all this blabber is needed (almost certainly sure that not), however it did solve the issue with cover picture not refreshing for me |
@brunolau I can see there are many commits here, from many contributors, since the 2017... but still missing features. I know this isn't a job for no one. But, in my opinion, since a plugin is sponsored by Ionic as the "official" plugin to do some things (https://ionicframework.com/docs/native/music-controls), that plugin should be developed and maintained as better as its owner can do it. The progress bar feature on Android is requested since almost 2 years by the users here. Today is still not supported. It actually took me 10 minutes to implement it on Android (and I'm not a Java developer). Now I'm working to fix both the destroy, the cover updating, and the headset and volume-buttons event. |
I think you're off here. I do not get "sponsored" in any sense, maybe "endorsed"? Or did you mean Capacitor? This is not a Capacitor plugin, it's a Cordova Community Plugin:
I hope you will fashion a PR from your welcome updates, I will gladly help to test. |
Yes, I meant "endorsed" or something like that. Sorry for my bad english: I'm not a native. I meant to tell this plugin is mentioned over the Ionic page I've linked above. |
Alright, language issue, no worries & sorry! But, I think it's important to acknowledge that the Ionic endorsement is -- and I'm guessing here -- rather unilateral, and maybe even something of a burden?
I feel like Ionic is happy to have something to point to, but I think their page could be worded better. It seems to bring in a sense of entitlement, from what I've seen in other plugins in the cordova ecosystem (and other places where certain commercial dev clashes with FOSS ideas). And while the owner theoretically profits from more attention -- in that there are more potential contributors for their own use of the plugin they "own" -- I don't think that the owner owes anybody anything. I'm happy this fork even exists! A different read: this plugin is "developed and maintained as best as its owner can do it". If their best is not good enough for you, contribute (as you've already started to), or fork, or complain at Ionic. On a personal note, as somebody who fell into the Cordova ecosystem and is struggling with sunk cost dread, I feel your frustration, but the (remaining) plugin maintainers are not the ones to blame. And to re-state & bring this back on topic, I will be happy to contribute to your efforts. |
That's cool that you managed to implement some new functionality! Please do submit a pull request with your changes to enable the new functionality and I am very happy to test and merge it. I maintain this entirely in my spare time for free, I have no involvement or endorsement from Ionic or anyone else. It's just me working for free. If you would also like to contribute some of your time for free that would be awesome and help to keep the plugin up to date :) The Ionic docs simply provide basic instructions on how to use their ionic-native wrapper with various plugins to make development easier and more approachable, even these docs and wrapper are maintained by the community these days under the awesome-cordova-plugins project. |
How will we know if these improvements have already been implemented? When can we download the plugin again? |
@SimoneVB It's been a while, but could you please share your improvements regards the progress bar? It doesn't matter if the work is not finished, we can continue it :) @ghenry22 by the way, I'm not a java developer, but SimoneVB said it was not hard to implement. Are you planning to have a look at this? Thanks! |
I'm using this plugin on Android 12, on my Xiaomi 11 lite.
The 1st thing:
I was trying to change the meta info when the MediaControls is already created,
when my app goes from one song to the next one.
It seems like there's no way to update those data: no "updateData" method.
So, I've invoked a 2nd "create" but it doen't seems to be the right approach: both track and artist name change,
but the cover doesn't. The cover stays the same given with the previous "create" calling.
So I've decided to destroy and re-create the MediaControl each time my app changes song;
but I've found that just one destroy calling isn't enough! I actually need to invoke the destroy twice,
to be able to really remove the MediaControl
this.musicControls.destroy().then((result) => { this.musicControls.destroy().then((result) => { console.log('destroy', result) }) })
The text was updated successfully, but these errors were encountered: