Пример #1
0
    def play(self):
        """Play the video stimulus from the current position.
        
        Notes
        -----
        When the audio from the video should be played as well, the audiosystem
        has to be stopped (by calling expyriment.control.stop_audiosystem() )
        BEFORE the video stimulus is preloaded! After the stimulus has been played
        the audiosystem can be started again (by calling
        expyriment.control.start_audiosystem() ).

        When showing videos in large dimensions, and your computer is not fast
        enough, frames might be dropped! When using Video.wait_frame() or
        Video.wait_end(), dropped video frames will be reported and logged.
        
        """

        if mixer.get_init() is not None:
            message = "Mixer is still initialized, cannot play audio! Call \
expyriment.control.stop_audiosystem() before preloading the video."
            print "Warning: ", message
            if self._logging:
                expyriment._active_exp._event_file_log(
                    "Video,warning," + message)

        if not self._is_preloaded:
            self.preload()
        if self._logging:
            expyriment._active_exp._event_file_log(
                "Video,playing,{0}".format(unicode2str(self._filename)))
        self._file.play()
Пример #2
0
    def play(self):
        """Play the video stimulus from the current position.
        
        Notes
        -----
        When the audio from the video should be played as well, the audiosystem
        has to be stopped (by calling expyriment.control.stop_audiosystem() )
        BEFORE the video stimulus is preloaded! After the stimulus has been played
        the audiosystem can be started again (by calling
        expyriment.control.start_audiosystem() ).

        When showing videos in large dimensions, and your computer is not fast
        enough, frames might be dropped! When using Video.wait_frame() or
        Video.wait_end(), dropped video frames will be reported and logged.
        
        """

        if mixer.get_init() is not None:
            message = "Mixer is still initialized, cannot play audio! Call \
expyriment.control.stop_audiosystem() before preloading the video."

            print "Warning: ", message
            if self._logging:
                expyriment._active_exp._event_file_log("Video,warning," +
                                                       message)

        if not self._is_preloaded:
            self.preload()
        if self._logging:
            expyriment._active_exp._event_file_log("Video,playing,{0}".format(
                unicode2str(self._filename)))
        self._file.play()
Пример #3
0
    def play(self, loop=False, log_event_tag=None, audio=True):
        """Play the video stimulus from the current position.

        Parameters
        ----------
        loop : bool, optional
            loop video playback (will be ignored when using play to unpause!)
        log_event_tag : numeral or string, optional
            if log_event_tag is defined and if logging is switched on for this
            stimulus (default), a summary of the inter-event-intervalls are
            appended at the end of the event file
        audio : bool, optional
            whether audio of video (if present) should be played (default=True)

        Notes
        -----
        When the audio from the video should be played as well, the audiosystem
        has to be stopped (by calling expyriment.control.stop_audiosystem() )
        BEFORE the video stimulus is preloaded! After the stimulus has been
        played the audiosystem can be started again (by calling
        expyriment.control.start_audiosystem() ).

        When showing videos in large dimensions, and your computer is not fast
        enough, frames might be dropped! When using Video.wait_frame() or
        Video.wait_end(), dropped video frames will be reported and logged.

        """

        if self._is_paused:
            if audio and not self._audio_started:
                self._audio.stream.start()
                self._audio_started = True
            elif not audio and self._audio_started:
                self._audio.stream.stop()
                self._audio_started = False
            self.pause()
        else:
            if self._backend == "pygame" and mixer.get_init() is not None:
                message = "Mixer is still initialized, cannot play audio! Call \
    expyriment.control.stop_audiosystem() before preloading the video."

                print("Warning: ", message)
                if self._logging:
                    _internals.active_exp._event_file_log("Video,warning," +
                                                          message)

            if not self._is_preloaded:
                self.preload()
            if self._logging:
                _internals.active_exp._event_file_log(
                    "Video,playing,{0}".format(self._filename),
                    log_level=1,
                    log_event_tag=log_event_tag)
            if self._backend == "mediadecoder" and self._file.audioformat and audio:
                self._audio.start()
                self._audio_started = True
            self._file.loop = loop
            self._file.play()
Пример #4
0
    def play(self, loop=False, log_event_tag=None, audio=True):
        """Play the video stimulus from the current position.

        Parameters
        ----------
        loop : bool, optional
            loop video playback (will be ignored when using play to unpause!)
        log_event_tag : numeral or string, optional
            if log_event_tag is defined and if logging is switched on for this
            stimulus (default), a summary of the inter-event-intervalls are
            appended at the end of the event file
        audio : bool, optional
            whether audio of video (if present) should be played (default=True)

        Note
        ----
        When the audio from the video should be played as well, the audiosystem
        has to be stopped (by calling expyriment.control.stop_audiosystem() )
        BEFORE the video stimulus is preloaded! After the stimulus has been
        played the audiosystem can be started again (by calling
        expyriment.control.start_audiosystem() ).

        When showing videos in large dimensions, and your computer is not fast
        enough, frames might be dropped! When using Video.wait_frame() or
        Video.wait_end(), dropped video frames will be reported and logged.

        """

        if self._is_paused:
            if audio and not self._audio_started:
                self._audio.stream.start()
                self._audio_started = True
            elif not audio and self._audio_started:
                self._audio.stream.stop()
                self._audio_started = False
            self.pause()
        else:
            if self._backend == "pygame" and mixer.get_init() is not None:
                message = "Mixer is still initialized, cannot play audio! Call \
    expyriment.control.stop_audiosystem() before preloading the video."
                print("Warning: ", message)
                if self._logging:
                    _internals.active_exp._event_file_log(
                        "Video,warning," + message)

            if not self._is_preloaded:
                self.preload()
            if self._logging:
                _internals.active_exp._event_file_log(
                    "Video,playing,{0}".format(unicode2byte(self._filename)),
                    log_level=1, log_event_tag=log_event_tag)
            if self._backend == "mediadecoder" and self._file.audioformat and audio:
                self._audio.start()
                self._audio_started = True
            self._file.loop = loop
            self._file.play()
Пример #5
0
    def play(self):
        """Play the video stimulus from the current position."""

        if mixer.get_init() is not None:
            message = "Mixer is still initialized, cannot play audio! Call \
expyriment.control.stop_audiosystem() before preloading the video."
            print "Warning: ", message
            if self._logging:
                expyriment._active_exp._event_file_log(
                    "Video,warning," + message)

        if not self._is_preloaded:
            self.preload()
        if self._logging:
            expyriment._active_exp._event_file_log(
                "Video,playing,{0}".format(unicode2str(self._filename)))
        self._file.play()