Comment 4 for bug 1022053

Revision history for this message
Phill (phill-ridout) wrote :

I have looked at the code and tried to fix it, but it is far to involved for me and I end up getting stuck. It may be best put off until after 2.4.

The key reason for this behaviour is:

openlp/core/ui/media/mediacontroller.py:174:
Creates a dict of media players from the backends. Each back-end is instantiated The dict looks like this:
    {'vlc': <openlp.core.ui.media.vlcplayer.VlcPlayer object at 0x7f4410913f28>,
    'phonon': <openlp.core.ui.media.phononplayer.PhononPlayer object at 0x7f4410913ef0>,
    'webkit': <openlp.core.ui.media.webkitplayer.WebkitPlayer object at 0x7f4410913eb8>}

openlp/core/ui/media/mediacontroller.py:532 & openlp/core/ui/media/mediacontroller.py:537:
Adds the instace of the media player with a key (1 for preview & 0 for live)

After starting OpenLP and sending a video to preview, the dict looks like this:
    {1: <openlp.core.ui.media.webkitplayer.WebkitPlayer object at 0x7fef5572ae10>}

Then after sending the video to live, the dict looks like this (notice that the live and preview players are the same object):
    {0: <openlp.core.ui.media.webkitplayer.WebkitPlayer object at 0x7fef5572ae10>,
    1: <openlp.core.ui.media.webkitplayer.WebkitPlayer object at 0x7fef5572ae10>}

So in the case of webkit when the pause button is clicked (openlp.core.ui.media.webkitplayer.WebkitPlayer#pause), the code :
    display.frame.evaluateJavaScript('show_video("pause");')

is excuted, because this is based on display (which is a different object for preview and live) the video in the correct controller is affected.
However when the state of the player is updated with:
    self.state = self.state = MediaState.Paused

 both players states are updated (because they are the same object).