"Play using ..." via JSON API
#1
I am trying to play from a Kodi instance to another uPNP player. Via the Kodi UI this can be done via "Play using ..." from the context menu which then brings up a list of available players. It will then play the selected item via the selected uPNP sink. In my case I am playing from one Kodi instance to another, both have uPNP enabled and both have different names.

I can retrieve the available player names via Player.GetPlayers, and the desired player's name is showing up, in my case "Kodi (bushel-mint21)". This is the same name which also is listed in the Kodi UI.

My problem: I cannot trigger playback to this desired device. My common use case is
1. Create a playlist for playlistid 0 (= music)
2. Call Player.Open with following parameters:
Code:
{
    item =     {
        playlistid = 0;
        position = 0;
    };
    options =     {
        playername = "Kodi (buschel-mint)";
        shuffled = 0;
    };
}
As a result I now receive "OK" back as response, but the playback is done on the Kodi instance the JSON command is sent to, and not on the desired instance with the given playername.

Addition al info:
- This also does not work when playing a radio channel id.
- This does not work for Kodi 21.0 and for Kodi 20.5

Am I doing some wrong?
Reply
#2
Looks like is does work when not using playlistid/position but anything else, e.g. songid, albumid, file, folder. Will look into to this deeper to see how it can be used for the remote app.
Reply
#3
This took some time to figure out the details, but finally it is implemented in a PR. There are some hurdles though, and I will only support this from Kodi 21 on.
  • Three pre-requisites are required from the JSON API:
    • Reading supported players ("Player.GetPlayers") -> to be able to list the players after selecting "Play using..."
    • Playback to an external player ("Player.Open" with option "playername") -> to be able to play to the selected external player
    • Reading back the current active player needs to support external players ("Player.GetActivePlayers") -> to be able to actually control the playback (play/pause, seek, prev/next)
  • Even though "Player.GetActivePlayers" supports "playertype" from API 9.6.0 on I saw empty responses (no active player) for Kodi 20.5, and only saw this work in Kodi 21.0. As this does not result in a good user experience (playback to UPnP device works, but no control or visibility via Remote App), I support the whole feature from Kodi 21 on.
  • As playing to external player from a playlist is not supported, and attempting to do so, simply ends playback to external player (falling back to the default player), I also blocking the selection of a playlist item while being in "Play using..." mode.
  • Play/Pause, Seek, Next work as expected. But Previous only works for jumping back to the beginning of the current playing item. If Previous is hit once more, the playback to external device stops.
Some of the above limitations could be resolved by supporting external players when playing playlist items. And I am also not sure, if there are older Kodi versions which might properly support "playertype" in "Player.GetActivePlayers". But I am not interested in testing so many old versions. Maybe I need to add a settings section for experimental features which are disabled by default. Just to manage user expectations...
Reply

Logout Mark Read Team Forum Stats Members Help
"Play using ..." via JSON API0