Kodi Community Forum

Full Version: Close + reopen window dialog after playback = jerky playback
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a modal dialog which opens (extendedinfo_mod) and I would like to have it reopen after playback ends.
However I have tried various methods of storing the dialog variable and whatever way I store it leads to jerky playback:

The following will produce jerky video playback:

python:

    def play_from_button(self, url, listitem, window=False, type='', dbid=0):
        from resources.lib.WindowManager import wm
        super(VideoPlayer, self).play(item=url, listitem=listitem, windowed=False, startpos=-1)
        window2 = window
        window.close()
        window = None
        del window
        gc.collect()
        del gc.garbage[:]
        for i in range(600):
            if xbmc.getCondVisibility('VideoPlayer.IsFullscreen'):
                self.wait_for_video_end()
                params = {'sender': addon_ID_short(),
                                  'message': 'SetFocus',
                                  'data': {'command': 'SetFocus',
                                               'command_params': {'container': container, 'position': position}
                                               },
                                  }

                command = json.dumps({'jsonrpc': '2.0',
                                              'method': 'JSONRPC.NotifyAll',
                                              'params': params,
                                              'id': 1,
                                              })
                result = xbmc.executeJSONRPC(command)
                wm.pop_stack2(window2)
                window2 = None
                del window2
                gc.collect()
                del gc.garbage[:]
                return
            xbmc.sleep(50)
        return

While this does not:
python:

    def play_from_button1(self, url, listitem, window=False, type='', dbid=0):
        from resources.lib.WindowManager import wm
            super(VideoPlayer, self).play(item=url, listitem=listitem, windowed=False, startpos=-1)
            window.close()
            gc.collect()
            del window
            return

I've tried threading within and without the current procedure, ive tried pickling/dill (which doesnt work for cpython objects apparently) and any other method I can think of to store the variable and nothing appears to work.

I think its a graphical memory issue, this is on a Vero4k kodi box which will have a rasonable amount of ram but no dedicated graphics hardware.  Therefore I think the dialog is stored in what little memory has been allocated to the graphics, and once it loads a bunch of stuff to the modal dialog this causes performance issues.

It doesnt appear to be an issue on windows.

Changing between "super(VideoPlayer, self).play(item=url, listitem=listitem, windowed=False, startpos=-1)" and "xbmc.executebuiltin('RunPlugin(%s)' % url)" does seem to have some performance benefit but the window is still jerky.

Does anyone know how I can completely close a window dialog AND store it for reopening without a significant performance impact?
Is there any reasonable way to store this in a file?

Any thoughts appreciated.
So no one has any thoughts about how to store a window dialog in memory and restore it without impacting performance?