Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] media_player_gst not working in fullscreen mode

edited September 2015 in OpenSesame

Hey there,

I encountered problems when using the media_player_gst item in certain modi:

  • With PsychoPy backend: Problems in test, window as well as fullscreen mode: Video suddenly stops and the screen turns white. Pressing another key finishes experiment regularly. No error messages.

  • With expyriment backend: Works fine in test and window mode. Same problem as with PsychoPy in fullscreen mode, but no white screen, experiment finishes instantly. If mp4 video is played that is smaller than screen resolution (no matter if fitted to screen), the last sketchpad screen flickers around the video.

  • With legacy backend: Works fine in test and window mode. Video finishes normally but is flickering/lagging in fullscreen mode . If mp4 video is played that is smaller than screen resolution (no matter if fitted to screen or not), the last sketchpad screen flickers around the video.

Since PsychoPy uses OpenGL in all modi and legacy/expyriment in fullscreen, I suppose this is a problem relating to the OpenGL implementation?!

I am using Windows 7 x64. The video formats I tested were .avi and .mp4.

Running the experiment in fullscreen mode is highly preferable as you can think, so help is really appreciated.

Cheers, Steffen

Comments

  • edited 12:14PM

    Hi Steffen,

    I'll pass this on to @dschreij, who's the developer of the media-player gst plugin.

    Cheers,
    Sebastiaan

  • edited 12:14PM

    Hi Steffen,

    could you tell me what OS you are running on, and which version of OpenSesame? In these cases it always helps if I can reproduce the problems. Can you send the experiment (with movies included in the file pool) to d.schreij (at) vu [dot] nl? I'll have a look and see if I can find what the problem is.

    Buy Me A Coffee

  • edited 12:14PM

    Hey thanks for getting back to me!

    I am working on Windows 7 x64 with the latest Version of OpenSesame (2.9.7)
    Alright, I will send you the file.

  • edited 12:14PM

    Ah, important to note is that I modified the Media_player_gst.py file: I replaced the original exec statement for individual python code in all handlers to:

    exec(self.custom_event_code, self.main_player.experiment.python_workspace._globals, locals())
    
  • edited 12:14PM

    I had a look at your experiment and it worked fine on my PC, which runs Windows 10 though. The movie played very smoothly with all backends, in both windowed and fullscreen mode, so I could not reproduce the flickering. Did you try running the experiment on another computer? What video card does the computer with problematic video rendering have?

    Regarding the change to the media_player_gst module, this should not be necessary if all you are trying to do is have access to global variables. The self.experiment or exp object is accessible in the event code section, so if you put all the variables you need in the exp object, you can access them through this object. Your preparation code then could be as follows:

    from multiprocessing.pool import ThreadPool
    from openexp.synth import synth
    from openexp.keyboard import keyboard
    
    #Initialise components
    exp.keybrd = keyboard(exp, keylist=['SPACE'], timeout=2000)
    exp.sound = synth(exp, length = 300)
    
    exp.sample_tms = [100,500]
    samples = len(exp.sample_tms)
    
    exp.prev_frame = 0
    
    #Initialise Threadpool
    exp.pool = ThreadPool(processes = 1)
    
    #Auditory response task for threads to run
    def play_sample(experiment, kbrd, snd):
        kbrd.flush()
        t1 = exp.time()
        snd.play()
        key, t2 = kbrd.get_key()
        rt = t2-t1
        if key == None:
            exp.set('rt_learn', 'timeout' )
        else:
            exp.set('rt_learn', t2-t1)
    
        print rt
        return
    
    exp.play_sample = play_sample
    

    The code in the media_player_gst event loop should then become

    if frame in exp.sample_tms and frame != exp.prev_frame:
        #Update previous frame
        exp.prev_frame = frame
    
        #Set frame and timestamp
        exp.set('frame_timestamp', exp.time())
        exp.set('frame', frame)
    
        #Play audio and collect response time in new thread
        exp.thread_result = exp.pool.apply_async(exp.play_sample, (exp, exp.keybrd, exp.sound))
    
        #Log all variables
        #log_vars()
    

    I commented log_vars() because I didn't understand exactly what you were trying to do there. It's best to just use the logger item for logging variables

    Buy Me A Coffee

  • edited 12:14PM

    Another thing that comes to my mind is that it might be a buffering setting of OpenGL. If you go to your graphic card properties page, see if you can play around with 'tripple buffering' settings and such of OpenGL

    Buy Me A Coffee

Sign In or Register to comment.