track play state
#1
Hello

I'm working on a remote control for XBMC. I saw in other remotes e.g. the official IOS remote if you play an item the play
state is tracked. You can see the start time the end time and the actual play position and a thumbnail and stuff like that.

How can i do this? Do i need to poll every second a JSON request (Player.GetItem) to get the actual play state?

Any hints would be nice.

andy
Reply
#2
You can use WebSockets or a TCP connection to port 9090 to receive notifications from XBMC about state changes like Player.OnPlay/OnStop etc. Otherwise you need to poll Player.ActivePlayers and Player.GetItem as you suggested.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
Thank you Montellese.

If i monitor the port 9090 i can receive OnPlay/OnStop but i cannot monitor the actual play position. The output is void.
Do i need to combine the notifications and JSON request to get actual play time or is it possible to get the actual play time over port 9090?
Reply
#4
Yes the notifications only contain minimal data so that you can do a request to get the details you want. So in case of a movie you'll get the ID of the movie and then you can call VideoLibrary.GetMovieDetails with that ID and request whatever properties you want/need.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#5
Hello

I try to get the duration of a played file. Not a file in a library so without an id. If i use Frodo 12.3 i could use Player.GetItem and use the field duration or runtime.
If i use Gotham 13 latest nightly or beta 1 both fields are always empty.

Is this a bug or what i'm doing wrong?
Reply
#6
I'd suggest using Player.GetProperties to get the "time" and "totaltime" properties of the player to reliably track the playback progress.

I'll try to look into why "runtime" returns 0.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#7
OK I figured out why it wasn't working anymore. Now "runtime" should work again for videos through Player.GetItem.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#8
Thank you. I use time and totaltime from GetProperties. It works on Gotham and Frodo.
Reply
#9
Sorry for reviving this thread but can anyone show me how I would write a JSON request for Player.GetItem in order to know if Kodi is playing, paused or stopped?

In other words, how would the JSON Request look like in order to request that info?

Thanks in advanced!
Reply

Logout Mark Read Team Forum Stats Members Help
track play state0