Catch the event when leaving the addon?
#1
Hello,
I apologize if similar question was asked before. Anyway, I am trying to write a simple video addon.
I found CCTV5 replay can be viewed with this kind of URL:
http://8.37.234.13/v.cctv.com/live_back/...host=local
the stream is five minutes long. It will be continued by
http://8.37.234.13/v.cctv.com/live_back/...host=local.
I figured out how to calculate the next url in general, (after the 19-23-012, the next one would be 20-00-001, etc),
So I simply create a dead loop to have the video keep going with something like "while TRUE: play url; time.sleep(300); generate the next url ...
However, from Kodi even if I quit this addon by press "menu" buttom on aTV's remote control, it seems the dead loop is still running because after within 5 minutes, a video come up playing again, and again, forever ...
Any way I can catch the event that user is leaving this addon so I can end the dead loop?
Instead of a dead loop, any better way to playing next segment until you click away this addon?
Sample codes will be greatly appreciated, or if someone could write an addon.
Thanks!
-Kang
Reply
#2
You could monitor the player events and exit the loop when the video is stopped.

http://mirrors.kodi.tv/docs/python-docs/...ackStopped
Reply
#3
Thank you for the quick response.
I am able to catch onPlayBackStopped() and onPlayBackEnded(), which let me tell if I should quit the player or load the next segment.
Thanks!
--Kang
Reply

Logout Mark Read Team Forum Stats Members Help
Catch the event when leaving the addon?0