trouble with videowindow and faster list scrolling
#1
Hi,

I have some trouble with autoplaying videos in windowed mode. I am using a videowindow in the skin file and the following code to play the video when a list item is selected:
Code:
    if(self.player.isPlayingVideo()):            
    playingFile =  self.player.getPlayingFile()                
    if(playingFile != video):
        self.player.stop()
    else:
        return
                    
self.player.play(video, selectedGame, True)

This works well if you browse the list step by step. But if you scroll down the list a bit faster video playback switches to fullscreen.

Here is a debug log when switching to fullscreen:
http://pastebin.org/277740

And here is the log while playing fine in windowed mode:
http://pastebin.org/277742


I already tried to place a time.sleep() before and after stopping and starting the video. Nothing helps.

Any ideas?

Regards,
malte
Reply
#2
I found a work around to solve this issue.

The auto playback of the video files must be delayed for a short time (1s for example). This will be enough to scroll down the list and just starts the video playback if you stop at one list item for a while. To be able to interrupt this waiting time when a new item is selected I had to start a new thread that does the video playback:

Code:
self.playVideoThread = Thread(target=self.playVideo, args=(video, selectedGame))
self.playVideoThread.start()

Method playVideo looks like this:
Code:
def playVideo(self, video, selectedGame):
        
    timestamp1 = time.clock()        
    while True:
        timestamp2 = time.clock()
        diff = (timestamp2 - timestamp1) * 1000
        if(diff > 1000):                
            break
            
        if(self.stopPlayVideoThread):
            self.stopPlayVideoThread = False
            return
            
    self.player.play(video, selectedGame, True)


When a new list item is selected the stopVideo-Flag is toggled:

Code:
if(self.playVideoThread != None and self.playVideoThread.isAlive()):            
    self.stopPlayVideoThread = True


I have tested this on windows and linux and it works for me. Scrolling down bigger lists with (nearly) all items set to auto playback works smooth now. Otherwise I really had big problems with video going to fullscreen or suddenly clearing the complete list. Maybe this helps someone or anybody has a better idea to solve this.
Reply

Logout Mark Read Team Forum Stats Members Help
trouble with videowindow and faster list scrolling0