The media_player plug-in plays back a video file. Many formats are supported, but the playback quality of certain formats varies. The recommended formats for now are DivX or XVid (avi) and Flash Video (flv). For successful playback of MPEG (mpg) and Windows Media (wmv) files, please make sure the files are not corrupt and the indices of keyframes are intact. If this is not the case, it will result in choppy playback and skipping audio. The following options are available:
Video file: A video file from the file pool. Which formats are supported depends on your platform, but most common formats (such as .avi and .mpeg) are supported everywhere.
Resize to fit screen: Indicates if the video needs to be resized so that it fits the entire screen. If not, the video will be displayed in the center of the display.
Play audio: Specify if the sound that comes with the video has to be played. If no is selected, the sound is muted during playback of the video
Audio delay: If the audio is out of sync with the video, you can correct the timing with this slider. If the audio seems behind on the video footage, slide the notch to the left. Conversely, when the audio comes too quickly, slide the notch to the right
Send frame no. to EyeLink: If this PC can connect to an SR Research EyeLink, the media player can automatically log the number of each frame that is displayed. This makes it easier later to analyze the data file per frame. For this to work, it is required that the connection to the eyelink has been established already and that the OpenSesame eyelink plug-ins are installed.
Duration: A duration in seconds, 'keypress' (to stop when a key is pressed) or 'mouseclick' (to stop when a mousbutton is clicked).
If you enter 'keypress' or 'mouseclick' as a duration, responses will be logged in the regular way. That is, the following variables will be set:
response
response_time
correct
average_response_time (or avg_rt)
accuracy (or acc)
If you want, you can override the duration setting and use your own code to handle keypress and mouseclick events, which should be entered in the edit field. The PyGame event is passed as 'event' and you can control playback by setting the the 'continue_playing' and 'self.paused' variables. For example, in order to pause playback when the spacebar is pressed and stop playback when a mousebutton is clicked, you enter:
if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE: self.paused = not self.paused if event.type == pygame.MOUSEBUTTONDOWN: continue_playback = False
Please refer to the PyGame documentation for more information:
http://www.pygame.org/docs/ref/key.html
The number of the last played frame is also available under the variable: frame_no