Use of "app.sharing.setActivePlayerUUID" by Remote App

To discuss development of addons / skins / customization of MediaMonkey.

Moderators: jiri, drakinite, Addon Administrators

MyVikes
Posts: 92
Joined: Sun Jul 02, 2017 1:20 am

Use of "app.sharing.setActivePlayerUUID" by Remote App

Post by MyVikes »

Hello,

I'm looking for a suggestion/guidance on a particular use case/problem i'm having with my remote control program written for Android and interacting with my custom MM5 scripts.

My app calls my MM5 script that uses the "app.sharing.setActivePlayerUUID" method (see here: https://www.mediamonkey.com/docs/api/cl ... PlayerUUID) to change the player (i.e. internal, cast, DNLA, etc.) and it works with no problems but there is no "promise" so i can't know for sure when or IF it completes successfully.

I am using "app.listen(app.player, 'playbackState', function (state) {" to detect state changes and set some values that i can return which works great also if the player is changed quickly (i.e. the internal or already active remote player) but since the app is remote (not on the PC like the actual MM5 app....disconnected so to speak) and changing the active player can take time it's reliability is quirky with remote players. As a workaround i have a timer in my android app that pings the MM5 script every 3 seconds for up to 10 times (all configurable) until i get a "playing status" which also works most of the time but seems like a hack.

BTW, i searched the MM5 code and can't find where it even uses the setActivePlayerUUID method so that wasn't helpful and following the debug log i think MM5 is using the app.listen playbackState i mentioned earlier to detect and update the MM5 UI but that doesn't work for me again because i my app is remote and i can't see where MM5 can "broadcast" a message which could be an option possibly.

Is it possible to add a promise to "app.sharing.setActivePlayerUUID" or what options might you suggest?

I hope this all made sense :-)

Thanks!
Ludek
Posts: 4996
Joined: Fri Mar 09, 2007 9:00 am

Re: Use of "app.sharing.setActivePlayerUUID" by Remote App

Post by Ludek »

Hi Mike,
ok, I'll make app.sharing.setActivePlayerUUID a Promise for the future builds, hopefully it helps..
Althoug you might still need to wait for the player to get status (even if it is already set)
Post Reply