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

iOS: Lockscreen controls play/pause events not triggered. Title not updated #80

Open
srividya-sharma opened this issue May 23, 2022 · 5 comments

Comments

@srividya-sharma
Copy link

Hello,
I followed the documentation to use this plugin but I am unable to get this plugin to work in iOS 14 (version does not matter).
It works in Android but not in iOS.
I did a bit of debugging and seems like
remoteControlReceivedWithEvent method is never triggered. The title also is not updated in the controls.
Please let me know how I should fix this.
Thanks.

@stoi2m1
Copy link

stoi2m1 commented May 25, 2022

I this I am having the same issue. I too am not seeing any events after clicking pause and play on the music controls. I am not seeing remoteControlReceivedwithEvent being called, but I think this is due to an error in the pauseEvent and playEvent methods. I am clueless with working in Object-C, just started working in it yesterday.

Everything is working as it should in Android my only issue at this time is with iOS. I can get the Title, Cover Art and even the Play and Pause buttons to display correctly on the music controls, but when I click play or pause I get the following message in Xcode terminal:

Invalid callback id received by sendPluginResult

I put some console.log()s in MusicControls.js and some NSLog's in the MusicControls.m file to verify everything is being called in the correct order. per this post ##12 subscribe() and listen() should called before create(). Below is the logs of messages coming from each method to ensure I am calling things in the right order.

2022-05-25 13:45:44.501378-0700 The History of England[9763:405153] is ready?!?
2022-05-25 13:45:44.501482-0700 The History of England[9763:405153] subscribe called
2022-05-25 13:45:44.501583-0700 The History of England[9763:405153] listen called
2022-05-25 13:46:08.496087-0700 The History of England[9763:405153] Will use resource 'https://domain.com/audio.mp3' from the Internet.
2022-05-25 13:46:08.515953-0700 The History of England[9763:405153] create called
2022-05-25 13:46:08.527015-0700 The History of England[9763:405153] currentPodcast is changing...
2022-05-25 13:46:13.520159-0700 The History of England[9763:405323] Playing stream with AVPlayer & default rate
2022-05-25 13:46:13.543021-0700 The History of England[9763:405153] MEDIA_RUNNING
2022-05-25 13:46:17.365420-0700 The History of England[9763:405153] Invalid callback id received by sendPluginResult
2022-05-25 13:46:25.683562-0700 The History of England[9763:405153] Invalid callback id received by sendPluginResult
2022-05-25 13:46:29.396358-0700 The History of England[9763:405153] Paused playing audio sample

Any input or advice as to why event notifications are not being sent to the callback?

@bikubi
Copy link

bikubi commented Sep 19, 2022

What I've noticed here, on iOS 12 fwiw, is that this happens only when destroy was called. Because then, latestCallBackId is set to nil, and never restored (by watch: command).
My workaround, which seems to work for now, is to never destory the MusicControls (which is much less an issue than on Android, I believe).

@stoi2m1
Copy link

stoi2m1 commented Sep 19, 2022

I reworked my entire app into a simpler demo for sharing and seeking help on a freelance site. When I did I found my app worked as it should.

I believe my issue was in the way I was using Vue and Vuex to achieve my app. I was using the store for all of my functionality. Once I moved that functionality (and reworked my logic) into my component and only used the store to track state and not functionality my issue was resolved.

@bikubi
Copy link

bikubi commented Sep 19, 2022

@stoi2m1 -- interesting, thanks. I solved some issues on the Android side, which might be related, by strictly enforcing the async-ness. I also have a rather complex Vue/Vuex app and this helped for the time being. Got this idea from #41 (comment)

@ghenry22
Copy link
Owner

What I've noticed here, on iOS 12 fwiw, is that this happens only when destroy was called. Because then, latestCallBackId is set to nil, and never restored (by watch: command). My workaround, which seems to work for now, is to never destory the MusicControls (which is much less an issue than on Android, I believe).

I'll look into this and see what is happening there, thanks for the info.

At the same time though I use this plugin extensively on iOS and have not seen this issue at all (I do call destroy). Was this specifically with iOS12 or did it persist for you with later iOS updates?

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

No branches or pull requests

4 participants