Kodi Community Forum
Bug player.onPlayBackStarted not firing for ext player - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Bug player.onPlayBackStarted not firing for ext player (/showthread.php?tid=197089)



player.onPlayBackStarted not firing for ext player - KenV99 - 2014-06-05

Tested on Gotham RC1 on windows7 x64:
Using Python API
Code:
import xbmc

class CapturePlayer(xbmc.Player):

    def __init__(self, *args):
        xbmc.Player.__init__(self)

    def onPlayBackStarted(self):
        xbmc.log("##### TEST - playback started", level=xbmc.LOGNOTICE)

    def onPlayBackEnded(self):
        xbmc.log("##### TEST - playback ended", level=xbmc.LOGNOTICE)

    def onPlayBackStopped(self):
        xbmc.log("##### TEST - playback stopped", level=xbmc.LOGNOTICE)


def main():

    player = CapturePlayer()
    while not xbmc.abortRequested:
        xbmc.sleep(500)
    del player

main()

To reproduce:
Configure an external player in playercorefactory.xml. For example:
Code:
<player name="MPC-HC" type="ExternalPlayer" audio="false" video="true">
     <filename>C:\Program Files\MPC-HC\mpc-hc.exe</filename>
     <args>"{1}" /fullscreen /play /close</args>
     <hidexbmc>false</hidexbmc>
     <hideconsole>false</hideconsole>
     <warpcursor>topright</warpcursor>
</player>
Then start a video using the context menu -> 'Play using...'
If the native DVDPlayer is chosen, onPlayBackStarted event fires and event written to log.
If an external Player is chosen (i.e. MPC-HC) onPlayBackStarted event is not fired.
However, for both, either the onPlayBackEnded or the onPlayBackStopped event fires.

Will post to trac.xbmc.org if confirmed or if no one comments, will post tomorrow.


RE: player.onPlayBackStarted not firing for ext player - KenV99 - 2014-06-06

In addition, while playing from an external player, player.isPlayingVideo() remains false so one cannot poll for that instead...

Edit: This isn't true...
For an example how to get around this bug for the time being, see here:
https://github.com/KenV99/script.testkv/blob/master/default.py


RE: player.onPlayBackStarted not firing for ext player - KenV99 - 2014-06-06

Submitted to trac.xbmc.org: http://trac.xbmc.org/ticket/15279


RE: player.onPlayBackStarted not firing for ext player - KenV99 - 2014-06-07

This was fixed and merged: 4855 (PR)
But won't be available until the next release after 13.1


RE: player.onPlayBackStarted not firing for ext player - Ben91 - 2014-07-14

Good job bro !

Thanks for the help.

http://forum.xbmc.org/showthread.php?tid=196483