Kodi Community Forum

Full Version: [Request] Log current video play time in milliseconds
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello All,

This is my first post so first of all my apologies if I didn't put it in the right place...

What I'm trying to achieve
I am trying to know, from an external process, the exact current playback time of a video that it is reproduced in kodi, with a precision of ~20 milliseconds. I do not need it from the very beginning of the video, I can perfectly wait 5 or 10 seconds to get this info. My idea to communicate kodi and this process is through a file

Environment description
I am using xbmc service callbacks to call an external process that is executed when the user starts playing a video:
https://github.com/pilluli/service.xbmc.callbacks

This solution works reasonable fine, but the external process and the video are not always started with the same delay.

Then I tried to look a little bit around the source code to check if I could find some point to retrieve this information and write it to a file. If I could get the exact playback time in a certain moment I could write it to a file and then read it from the external process. Apparently, in the DVDPlayer this information is available (I'm using commit c327c53ac534, but I could use any other version)

https://github.com/xbmc/xbmc/blob/c327c5...Player.cpp

In the .h I see a struct SPlayerState that has a property called double time, described as the current playback time so apparently writing that and the current timestamp should achieve what I need, but I would like to know if there's anybody that had similar need before and found a better way to solve it

Thanks for your help
Have you been able to solve this cyuste? Or is there anyone else who might have an idea on how to approach this?

Thanks in advance!
Hi,

Yes, in the end I used json-rpc api, that is way better than my original idea...
http://kodi.wiki/view/JSON-RPC_API
Hi again,

I started playing out with the JSON-RPC API, seems to have all you can need in order to communicate with Kodi.
Thanks a lot, have a good one!