Video playback Screen error

I am trying to write a script that plays a video in Psychtoolbox. I keep encountering Screen errors along my way and was wondering if anyone could help? Below is the script so far (part of it at least.) The line that is causing me errors is [tex]=Screen('GetMovieImage', w, movie;
Thanks
Annie

screenNumber = max(Screen('Screens'));
HideCursor;
gray=GrayIndex(screenNumber);
[w, wRect]=Screen('OpenWindow', screenNumber, [127 127 127]); %127 127 127 colour of mask
[a, b] = WindowCenter(w);
priorityLevel = MaxPriority(w);
Priority(priorityLevel);
[movie movieduration fps w h count] = Screen('OpenMovie', w, moviename)



 %read in frame by frame
while ~KbCheck
    % Wait for next movie frame, retrieve texture handle to it
    [tex] = Screen('GetMovieImage', w, movie);

    % Valid texture returned? A negative value means end of movie reached:
    if tex<=0
        % We're done, break out of loop:
        break;
    end;

    % Draw the new texture immediately to screen:
    Screen('DrawTexture', w, tex);

    % Update display:
    Screen('Flip', w);

    % Release texture:
    Screen('Close', tex);
end;

GlobalStart = GetSecs;
tic
for j = 1:length(seqEx)
   
    Start = GetSecs;
    stimno = seqEx(j);
   
    if (stimno < 2)
       
      Screen('PlayMovie',movie, 1, 1, 0);
        %timeindex = Screen('GetMovieTimeIndex', movie);
       % [tex] = Screen('GetMovieImage', w, movie);
       %Screen('DrawTexture', tex, window);
       % movie(mov, 1, obj.FrameRate);
       % Screen('Flip', w)
      Screen('CloseMovie', movie);
        % Update display:
        Screen('Flip', w);
    elseif (stimno > 1 && stimno < 9)
        %Fix cross:
        Screen('DrawText', w, '+', a, b,0);
        Screen('Flip', w);
       
        %read in voices instead
        x = voices{stimno};
        SDur(j) = size(x, 1) / fs;
        % Present the voice
        wavplay(x, fs);
        SOnset(j) = GetSecs - GlobalStart;
        step(j) = mstep(seqEx(j));
       
        %Answer loop
        success = 0;
        keyPressed = 0;
        ISI = 5 + rand;
        while success == 0 && GetSecs - Start < ISI
            [keyDown, keyTime, keyCode] = KbCheck;
            if strcmp(KbName(keyCode), 'z') == 1 % Button 1
                success = 1;
                RT(j) = keyTime - Start;
                Answers(j) = 1;
            elseif strcmp(KbName(keyCode), 'm') == 1 % Button 2
                success = 1;
                RT(j) = keyTime - Start;
                Answers(j) = 2;
            end
        end
    end
end
toc
Hi Annie,
Basic info is missing:
- what OS + matlab version?
- what is the error you get
Furthermore:
- did you run UpdatePsychtoolbox() lately?
- did you read the install instructions for GStreamer?
- did you have a look at the movie playback demos? Do they work? if so, base your code on those demos.
Best,
Dee

On Fri, Jan 18, 2013 at 10:57 PM, Annie Pye <annie_pye@...> wrote:

I am trying to write a script that plays a video in Psychtoolbox. I keep encountering Screen errors along my way and was wondering if anyone could help? Below is the script so far (part of it at least.) The line that is causing me errors is [tex]=Screen('GetMovieImage', w, movie;
Thanks
Annie

screenNumber = max(Screen('Screens'));
HideCursor;
gray=GrayIndex(screenNumber);
[w, wRect]=Screen('OpenWindow', screenNumber, [127 127 127]); %127 127 127 colour of mask
[a, b] = WindowCenter(w);
priorityLevel = MaxPriority(w);
Priority(priorityLevel);
[movie movieduration fps w h count] = Screen('OpenMovie', w, moviename)



%read in frame by frame
while ~KbCheck
% Wait for next movie frame, retrieve texture handle to it
[tex] = Screen('GetMovieImage', w, movie);

% Valid texture returned? A negative value means end of movie reached:
if tex<=0
% We're done, break out of loop:
break;
end;

% Draw the new texture immediately to screen:
Screen('DrawTexture', w, tex);

% Update display:
Screen('Flip', w);

% Release texture:
Screen('Close', tex);
end;

GlobalStart = GetSecs;
tic
for j = 1:length(seqEx)

Start = GetSecs;
stimno = seqEx(j);

if (stimno < 2)

Screen('PlayMovie',movie, 1, 1, 0);
%timeindex = Screen('GetMovieTimeIndex', movie);
% [tex] = Screen('GetMovieImage', w, movie);
%Screen('DrawTexture', tex, window);
% movie(mov, 1, obj.FrameRate);
% Screen('Flip', w)
Screen('CloseMovie', movie);
% Update display:
Screen('Flip', w);
elseif (stimno > 1 && stimno < 9)
%Fix cross:
Screen('DrawText', w, '+', a, b,0);
Screen('Flip', w);

%read in voices instead
x = voices{stimno};
SDur(j) = size(x, 1) / fs;
% Present the voice
wavplay(x, fs);
SOnset(j) = GetSecs - GlobalStart;
step(j) = mstep(seqEx(j));

%Answer loop
success = 0;
keyPressed = 0;
ISI = 5 + rand;
while success == 0 && GetSecs - Start < ISI
[keyDown, keyTime, keyCode] = KbCheck;
if strcmp(KbName(keyCode), 'z') == 1 % Button 1
success = 1;
RT(j) = keyTime - Start;
Answers(j) = 1;
elseif strcmp(KbName(keyCode), 'm') == 1 % Button 2
success = 1;
RT(j) = keyTime - Start;
Answers(j) = 2;
end
end
end
end
toc