Implementing onPlayBackEnded
#1
I'm trying to implement a callback feature when an item has finished playing by overriding xbmc.Player.onPlayBackEnded, but the function is not being called. My code so far is this:

Code:
import xbmc

class Player(xbmc.Player):

    def __init__(self):
        xbmc.Player.__init__(self)
        
    def onPlayBackEnded(self):
        print "onPlayBackEnded: %s" % self.callback
        
    def setCallback(self, callback):
        self.callback = callback

Any idea on what I am doing wrong? Or any better ideas on implementing this?
Reply
#2
Is that your full code?

You don't seem to be creating an instance of your player class so there is no reason for your events to be called.

I think you'll need something like this at the end:

Code:
player=Player()
while (not xbmc.abortRequested):
  xbmc.sleep(100)
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#3
Sorry I wasn't clear. That wasn't my complete code. It was essentially being called from a separate file in a way similar to the code you posted without the while loop. Adding the loop, the callback works as expected. Thank you for your help.
Reply
#4
Def __init__ (self, *args):

Should make sure playback stopped and ended both work

Look at this if you need help seeing how that class should be.

https://github.com/Karrade/xbmc-repo/blo...default.py
Reply

Logout Mark Read Team Forum Stats Members Help
Implementing onPlayBackEnded0