Python: Call on pause and resume?
#1
Hi,

I'm trying to develop an addon to XBMC. I have successfully overrided onPlaybackStarted and onPlaybackStopped, but is there any way to catch pause and resumed playback as well?

I've seen other plugins that try to call onPlaybackPaused, but I can't get them to work.

I'm using Eden (Beta 1) on Linux.

Code:
import xbmc

class MyPlayer(xbmc.Player):
    def __init__(self):
        xbmc.Player.__init__(self)

    def onPlayBackStarted(self):
        if xbmc.Player().isPlayingVideo():
            updateState("XBMCVideoPlaying", 1)    
    
    def onPlaybackStopped(self):
        xbmc.log(str(xbmc.Player().isPlayingVideo()))
    
    def onPlaybackEnded(self):
        if(VIDEO == 1):
            updateState("XBMCVideoPlaying", 0)
            
    def onPlaybackPaused(self):
        if xbmc.Player().isPlayingVideo(): #OK; we've paused a Video.
            updateState("XBMCVideoPaused", 1)

    
    def onPlaybackResumed(self):
        if xbmc.Player().isPlayingVideo(): #OK, resumed a paused video
            updateState("XBMCVideoPaused", 0)

            

xbmc.log("myAddon: Init");

player = MyPlayer()

while(not xbmc.abortRequested):
    if xbmc.Player().isPlayingVideo():
        VIDEO = 1
    else:
        VIDEO = 0
    
    xbmc.sleep(1000)


xbmc.log("Finished running")
Reply

Logout Mark Read Team Forum Stats Members Help
Python: Call on pause and resume?0