Kodi Community Forum

Full Version: Inconsistency in Player.GetProperties ? ("position": -1 in result in some cases)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I have a problem similar as the one in this thread (with no responses) http://forum.xbmc.org/showthread.php?tid=174322 . However I have a few more details.

The call that gives inconsistencies is Player.GetProperties (with playerid changed to the good value according to the use-case) :

Code:
{"jsonrpc":"2.0","method":"Player.GetProperties","params":{ "playerid": 0, "properties": ["position"]},"id":1}

When I launch an album from my XBMC library or when I load a m3u file, the call returns the correct current position, from 0 to n.

However if I construct a playlist on the fly by making this sequence of calls :

Code:
{ jsonrpc: '2.0', method: 'Playlist.Clear', params: { playlistid: 1 }, id: 1 }
{ jsonrpc: '2.0', method: 'Playlist.Add', params: { playlistid: 1, item: { file: '/tmp/test1.ogg' } }, id: 2 }
{ jsonrpc: '2.0', method: 'Playlist.Add', params: { playlistid: 1, item: { file: '/tmp/test2.ogg' } }, id: 3 }
{ jsonrpc: '2.0', method: 'Player.Open', params: { item: { playlistid: 1 } }, id: 4 }

Then the position returned from the call to GetProperties is always -1.

There is probably something I don't get, but what ? Is there something like two kinds of playlists, the "fixed" ones (first case) and the "temporary" ones (second case) ?

Is there a workaround to get the correct position while constructing playlists "on the fly" (they're not always playlists of music, they can be playlists of Youtube videos or other kind of contents, so a music only solution like constructing a m3u file would not work) ?

I tried this on XBMC 12.2, Mac and Linux (raspbmc).

Thanks, regards

--
Pierre-Rudolf Gerlach
I think you are mixing the video playlist and the music playlist.

You are getting the properties for the music playlist ("playerid": 0) while adding entries to the video playlist (playlistid: 1).

I always have music playlists be 0, and video playlists be 1.
Music:
playerid: 0
playlistid: 0
Video:
playerid: 1
playlistid: 1
Hi ! Thanks for the reply. You're totally right, but as I said, I call Player.GetProperties
Quote:with playerid changed to the good value according to the use-case

In fact, before calling Player.GetProperties, I call Player.GetActivePlayers to know on which player to do the call.

Anyway, if I make the call on the wrong player, I get an error Smile
Sorry. I should have explained better.

XBMC has two playlists. Music and Video. It seems you can play music files on the video playlist, but the player's properties will not be updated correctly if you do.

I can replicate your problem by adding music to the video playlist. (Playlist.Add with playlistid: 1) then playing from the video playlist (Player.Open with playlistid: 1). Getting the player properties for video (Player.GetProperties with playerid: 1) will return a position of -1.


To make this work correctly add music to the music playlist (Playlist.Add with playlistid: 0) then play from the music playlist (Player.Open with playlistid: 0). Getting the player properties for music (Player.GetProperties with playerid: 0) should return the correct position.

Hope this helps.
... damn. I knew there were these two playlists, one for audio and one for video. This is an extract from my code :

Code:
var PLAYLISTID_VIDEO = 0;
var PLAYLISTID_AUDIO = 1;
var PLAYLISTID_PHOTO = 1;

As you can see, I had ... inverted audio and video, and it led to all my problems !

Isn't the behavior of XBMC quite strange though, as it permits me to put videos in the audio playlist, launch it, and have it working *except* for the Player.GetProperties method ?

Anyway, thanks so much for your help.
Yeah, the whole playlist handling in XBMC is quite a mess which is also why the behaviour and output of some of the JSON-RPC API calls can be confusing.