Looping movie / video

558 views
Skip to first unread message

Alon Hafri

unread,
Feb 16, 2012, 10:38:19 AM2/16/12
to E-Prime
Hi everyone,

I'd love to get your help with this! We are looking to loop a
SlideMovie object until the Enter key is pressed. Meanwhile, the user
may type what they see in the video (using the echo response feature
of Input Masks).

Unlike the SoundOut objects, there is no documentation on MovieDisplay
or SlideMovie objects, and so we can't figure out if there are
properties that allow this. David McFarlane put in a feature request
for this here http://support.pstnet.com/forum/Topic2772-12-1.aspx but
until then, I'm wondering if someone could help me figure this out
with InLine.

With sound objects, you can do it with InLine by playing the soundout
object, and then testing for the buffer status (e.g. the following):
Do While ...
If SoundBuffer.Status = ebBufferStatusStopped Then SoundBuffer.Play
Loop

Is there an equivalent property for MovieDisplay? Or alternatively, is
there a way to test at runtime the length/duration of a movie, so that
we can have the program wait that long and then play the movie again?
I guess the only other option is to manually code the duration of each
video, and then use the InLine to wait that long before replaying the
movie.

Thanks so much for all your help!
Alon

keywords: video movie loop slidemovie moviedisplay moviebuffer status

Alon Hafri

unread,
Feb 17, 2012, 11:31:26 AM2/17/12
to E-Prime
Well an update on my own post in case anyone's interested -- got it to
work by running a While loop and starting the clip over if it reached
the duration threshold for the video. First, set the Slide or
MovieDisplay object duration to 0, with the video setting StopAfter
set to "No" and EndMovieAction set to "none". Also make sure the
slide's setting for "ClearAfter" is set to "No". Then put the
following InLine after the Slide or MovieDisplay object, substituting
the relevant names:

Dim Vid1 As SlideMovie 'or as MovieDisplay object, as the case may be
Set Vid1 = CSlideMovie(yourSlide.States("Default").Objects("Movie"))
'instead of "yourSlide" put in your slide's name, or if it's a
moviedisplay object named "MovieObject", just do "Set Vid1 =
MovieObject"
Dim lngVideoOnsetTime As Long

lngVideoOnsetTime = Clock.Read
Do While... 'set the condition for the loop to end here
If Clock.Read > lngVideoOnsetTime + [insert video duration here in
msec] Then
Vid1.Load
Vid1.Play
lngVideoOnsetTime = Clock.Read
End If
[insert other relevant loop code here]
Loop

Vid1.Stop
Set Vid1 = Nothing


You'll need to know your video's duration. If it's a variable duration
depending on the trial, then you can add an attribute to the list
called "VideoDuration", and then replace the part in brackets above
about duration with CLng(c.GetAttrib("VideoDuration")).

Hope that helps -- if anyone knows how to loop a video in an easier
way, please post. Or if you know how to automatically read in the
video's duration so having a manually specified attribute
"VideoDuration" is not needed.

Alon

Alon Hafri

unread,
Feb 22, 2012, 12:09:26 PM2/22/12
to E-Prime
Update again. I got a response from PST! Apparently in the newer
versions of E-Prime 2.0 (2.0.10.174 or later), SlideMovie and
MovieDisplay objects have the same "Status" property that SoundBuffer
objects do:
http://www.pstnet.com/support/kb.asp?TopicID=4373

Or alternatively, you can also wait until the last frame was displayed
and then replay the video:
http://www.pstnet.com/support/kb.asp?TopicID=3158

Alon
Reply all
Reply to author
Forward
0 new messages