Unexpected behavior from xbmc.monitor()

I’ve been encountering unexpected behavior from xbmc.monitor.waitForAbort, Everytime either a single video or the first playlist entry ends the loop breaks.

I thought I was tracking a bug within xbmc.monitor(), but from what I can tell from the source this is a design feature?
https://github.com/xbmc/xbmc/blob/72d0c2…onitor.cpp

Endtime thread from player is included as abortEvent? am I correctly reading the source? I wonder what would be the appropriate solution (workaround) for my situation?

I’d like to have a loop running a function while a short video is playing… Would it be okay to use

Code:
while True:

and create my own break code since I can abort the loop based on the window status?

Example pseudo code below, thanks for any help.

Code:
class Screensaver(xbmcgui.WindowXMLDialog):
    def __init__(self, *args, **kwargs ):
        playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playlist.clear()
        for i in range(30):
            playlist.add(SHORTCLIP)
        xbmc.executebuiltin("PlayerControl(RepeatAll)")
        xbmc.Player().play(playlist)
        
        
    def onInit(self):
        self.start()
        
    
    def start(self):
        while not xbmc.Monitor().abortRequested():
            doSomething()
            if xbmc.Monitor().waitForAbort(30) == True:
                break
        self.closeWindow()

    def onAction(self, action):
        self.closeWindow()
        
        
    def closeWindow(self):
        xbmc.Player().stop()
        xbmc.executebuiltin("PlayerControl(RepeatOff)")
        self.close()