Video position
#1
Hi,
I'm trying to write a simple video addon.
This addon has a Player script that implements onPlayerEnded and onPlayerStopped.
Now I want to know when the user stopped the video - i.e. how far in the video did this happen.
I saw there are getTime and getTotalTime methods for Player but when I call them from onPlayerStopped I get an error saying "XBMC is not playing any media file".
I also saw that there is an RPC method called 'Player.Position.Percentage' but I didn't manage to call it and I find it a bit odd that this basic operation sould be available only as RPC call.

Is there any other method I should use for after the video has been stopped? Should I override the stop method for that?

Thanks,
Ofir
Reply
#2
Isn't the getTime value is stored in he database?
Then, as long as you know what file is playing (get from onPlayer...something.. beginplaying.. ), and its in the database, you could read the value it from there?

Alternatively you could most likely poll at intervals to get the current value?

Sorry I don't know much Smile
Reply
#3
Thanks Torben, I guess this could work although I was hoping from something less hacky...
If someone has another idea, I would gladly hear it ...
Reply
#4
Np. I hope one of the gurus have a better solution.
Reply
#5
I also use the polling method in my addon (see v0.0.4 for example).

The "XBMC is not playing any media file" error seems to me to be normal, since the playing stopped when you are in the 'onPlayerStopped' event handler.

Disclaimer: I'm no guru Big Grin
Add-on : Bluray iso utils Rewrite of BR_iso_enhancements
Add-on : BR_iso_Enhancements Give theatrical & directors cut from the same bluray iso each their own library entry, use bluray iso's of tv shows as if they are already ripped.
Reply
#6
Thanks Wimpie,
While the error might be anticipated, don't you think there should be a method to get the position after the video stops?
Kodi itself does that when saving the last position in the DB ...

It seems that I would have to do with the polling solution ...
Reply
#7
(2016-05-15, 08:12)herzaso Wrote: While the error might be anticipated, don't you think there should be a method to get the position after the video stops?
Kodi itself does that when saving the last position in the DB ...

If the core developers have not exposed that part of Kodi, then there isn't much what we can do.

Maybe an idea. If the data you need is saved in the DB, then you should be able to extract that with a JSON call. Just don't know much about that part of Kodi/python...
Add-on : Bluray iso utils Rewrite of BR_iso_enhancements
Add-on : BR_iso_Enhancements Give theatrical & directors cut from the same bluray iso each their own library entry, use bluray iso's of tv shows as if they are already ripped.
Reply

Logout Mark Read Team Forum Stats Members Help
Video position1