Posts: 2,078
Joined: Nov 2012
Reputation:
176
enen92
Team-Kodi Member
Posts: 2,078
2015-08-12, 18:20
(This post was last modified: 2015-08-15, 22:20 by enen92.)
For one addon that I'm developing I need to grab the user request to stop the playback. I don't want to execute code onPlayBackStopped() but to literally know from python (or a service) the user has asked kodi to stop the playback. The reason I'm doing this is because I need to force close an external closed source application that is serving video to kodi (otherwise kodi will eventually crash).
Any suggestions?
Posts: 2,078
Joined: Nov 2012
Reputation:
176
enen92
Team-Kodi Member
Posts: 2,078
Onplaybackstoped will only be called if the playback is stopped. Problem is, Kodi freezes and the playback is not stopped. Hence, the code I want to run is never triggered.
To use on action I need to have a custom window right?
Posts: 245
Joined: Nov 2012
Reputation:
7
Wimpie
Senior Member
Posts: 245
2015-08-15, 21:03
(This post was last modified: 2015-08-15, 21:04 by Wimpie.)
Does anyone have a code snippet as an example?
I would need to capture the "on start" action, the onplaybackstarted event handler is to late for me. I need to know when the user would like to start playing a video, not when it is already playing...
Thanks!
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.
Posts: 2,078
Joined: Nov 2012
Reputation:
176
enen92
Team-Kodi Member
Posts: 2,078
2015-08-15, 22:19
(This post was last modified: 2015-08-15, 22:20 by enen92.)
I ended up starting a thread onPlaybackStarted to check (using the json-rpc api) for Player.GetActivePlayers. I found out that as soon as you hit stop, even though kodi freezes, the list of active players is null. So, I do my stuff as soon as the list of active players is empty and kodi won't freeze anymore.
I also looked into xbmc.getCondVisibility('Player.Playing') but it tends to report False when the stream is buffering, dropping the playback.
Wimpie, you probably want to do "your stuff" on player __init__ and not playbackstarted.
Thanks Lunatixz