Best way to return to window after video plays?
#1
I am trying to skin my addon and want it to disappear when the video is playing, but reappear after it ends. Basically the user has to decide to close the window, otherwise it stays "open".

I tried simply not closing the window in the code, but the video just plays behind it. So I have to close the window.

Then I tried using a video player infolabel to detect when a video isnt playing, but that made the window appear in between items in a playlist. This would also happen if I put a sleep delay in the "check infolabel" loop.

Just looking for ideas here. Not looking for anyone to burn a lot of calories Smile

P.S I tried adding a visibility criteria to the windows xml, but apparantly that only works for dialogs.
Reply
#2
(2014-06-03, 09:13)Karnagious Wrote: I am trying to skin my addon and want it to disappear when the video is playing, but reappear after it ends. Basically the user has to decide to close the window, otherwise it stays "open".

I tried simply not closing the window in the code, but the video just plays behind it. So I have to close the window.

Then I tried using a video player infolabel to detect when a video isnt playing, but that made the window appear in between items in a playlist. This would also happen if I put a sleep delay in the "check infolabel" loop.

Just looking for ideas here. Not looking for anyone to burn a lot of calories Smile

P.S I tried adding a visibility criteria to the windows xml, but apparantly that only works for dialogs.

This is just a wild guess and I've never actually tried it, but IMO you need to re-implement xbmc.Player class as following:

Code:
import xbmc

class MyPlayer(xbmc.Player):
    def __init__(self, core=xbmc.PLAYER_CORE_AUTO, parent=None):
        super(MyPlayer, self).__init__(core)
        self.parent_window = parent

    def onPlayBackStarted(self):
        self.parent_window.close()

    def onPlayBackEnded(self):
        self.parent_window.doModal()

Then you create MyPlayer instance and pass your UI class instance to its constructor. They you control your playback via the MyPlayer instance.

Again, I've never tried and not sure if it works as I expect. You need to experiment yourself.
Reply
#3
Interesting. I will give it a go, thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
Best way to return to window after video plays?0