Hi all, I am having trouble with stopping movie playback using
Screen(PlayMovie). Here is the script I am using:
for i=1:ntrials;
film=strcat('/Users/jeph/Documents/Psychtoolbox_experiments/scam/movies/',char(moviename(i)));
[movie] = Screen('OpenMovie', win, film);
Screen('PlayMovie', movie, 1, 0, 1.0);
movietexture=0;
while(movietexture>=0)
[movietexture] = Screen('GetMovieImage', win, movie, 0);
if (movietexture>0)
Screen('DrawTexture', win, movietexture);
Screen('Flip', win);
Screen('Close', movietexture);
movietexture=0;
end;
[keyIsDown, secs, keyCode]=KbCheck;
if (keyIsDown==1)
if keyCode(KbName('ESCAPE'))
droppedframes=Screen('PlayMovie', movie, 0, 0, 0);
Screen('CloseMovie', movie);
break;
end;
end;
end;
Screen('PlayMovie', movie, 0, 0, 0);
Screen('CloseMovie', movie);
end
Whenever I press ESC to stop playback, it gives the error message that
the movie handle does not exist. It does not have any problem when the
same code is used after the display while loop (no error then). Any ideas?
Thanks in advance,
- Jeff
Screen(PlayMovie). Here is the script I am using:
for i=1:ntrials;
film=strcat('/Users/jeph/Documents/Psychtoolbox_experiments/scam/movies/',char(moviename(i)));
[movie] = Screen('OpenMovie', win, film);
Screen('PlayMovie', movie, 1, 0, 1.0);
movietexture=0;
while(movietexture>=0)
[movietexture] = Screen('GetMovieImage', win, movie, 0);
if (movietexture>0)
Screen('DrawTexture', win, movietexture);
Screen('Flip', win);
Screen('Close', movietexture);
movietexture=0;
end;
[keyIsDown, secs, keyCode]=KbCheck;
if (keyIsDown==1)
if keyCode(KbName('ESCAPE'))
droppedframes=Screen('PlayMovie', movie, 0, 0, 0);
Screen('CloseMovie', movie);
break;
end;
end;
end;
Screen('PlayMovie', movie, 0, 0, 0);
Screen('CloseMovie', movie);
end
Whenever I press ESC to stop playback, it gives the error message that
the movie handle does not exist. It does not have any problem when the
same code is used after the display while loop (no error then). Any ideas?
Thanks in advance,
- Jeff