callback stop

3 views (last 30 days)
Pan
Pan on 28 Feb 2012
Hi
I wamt to set up button controling "stop" video, but when I push one "stop" button,then the button callback one video stop,other video also play video continuely.
this is my code
function vidplayer()
obj = mmreader('can.avi');
obj1 = mmreader('watch.avi');
obj2 = mmreader('phone.avi');
obj3 = mmreader('can.avi');
v = read(obj);
v1 = read(obj1);
v2 = read(obj2);
v3 = read(obj3);
figure('Name','scene ',...
'NumberTitle','off',...
'Visible','on',...
'Position',[150 100 1000 500],...
'Color',[1,1,0.95],'HandleVisibility','on',...
'Menubar','none',...
'IntegerHandle','off',...
'Resize','on');
hstat = uicontrol('style','checkbox','value',0,'position',...
[160 10 25 25]);
hplay = uicontrol('style','pushbutton','string','PLAY',...
'position',[10 130 50 25],'backgroundColor',[1,1,0.2],'callback',{@play_callback,v});
hplay = uicontrol('style','pushbutton','string','PLAY',...
'position',[10 90 50 25],'backgroundColor',[1,1,0.2],'callback',{@play_callback1,v1});
hplay = uicontrol('style','pushbutton','string','PLAY',...
'position',[10 50 50 25],'backgroundColor',[1,1,0.2],'callback',{@play_callback2,v2});
hplay = uicontrol('style','pushbutton','string','PLAY',...
'position',[10 10 50 25],'backgroundColor',[1,1,0.2],'callback',{@play_callback3,v3});
hstop = uicontrol('style','pushbutton','string','STOP',...
'position',[60 130 50 25],'backgroundColor',[1,0.5,0.5],'callback',{@stop_callback,v});
hstop = uicontrol('style','pushbutton','string','STOP',...
'position',[60 90 50 25],'backgroundColor',[1,0.5,0.5],'callback',{@stop_callback1,v1});
hstop = uicontrol('style','pushbutton','string','STOP',...
'position',[60 50 50 25],'backgroundColor',[1,0.5,0.5],'callback',{@stop_callback2,v2});
hstop = uicontrol('style','pushbutton','string','STOP',...
'position',[60 10 50 25],'backgroundColor',[1,0.5,0.5],'callback',{@stop_callback3,v3});
hexit = uicontrol('style','pushbutton','string','EXIT',...
'position',[110 10 50 25],'backgroundColor',[1,0,0.1],'callback',@exit_callback);
function play_callback(hObject,eventdata,vid)
set(hstat,'value',1);
for frame = 1 : size(vid,4)
if get(hstat,'value') == 1,
subplot(2,2,1); imshow(vid(:,:,:,frame));
drawnow;
else, break; end
end
end
function play_callback1(hObject,eventdata,vid)
set(hstat,'value',1);
for frame = 1 : size(vid,4)
if get(hstat,'value') == 1,
subplot(2,2,2); imshow(vid(:,:,:,frame));
drawnow;
else, break; end
end
end
function play_callback2(hObject,eventdata,vid)
set(hstat,'value',1);
for frame = 1 : size(vid,4)
if get(hstat,'value') == 1,
subplot(2,2,3); imshow(vid(:,:,:,frame));
drawnow;
else, break; end
end
end
function play_callback3(hObject,eventdata,vid)
set(hstat,'value',1);
for frame = 1 : size(vid,4)
if get(hstat,'value') == 1,
subplot(2,2,4); imshow(vid(:,:,:,frame));
drawnow;
else, break; end
end
end
function stop_callback(hObject,eventdata,vid)
set(hstat,'value',0);
end
function stop_callback1(hObject,eventdata,vid)
set(hstat,'value',0);
end
function stop_callback2(hObject,eventdata,vid)
set(hstat,'value',0);
end
function stop_callback3(hObject,eventdata,vid)
set(hstat,'value',0);
end
function exit_callback(hObject,eventdata)
stop_callback;
close gcf;
end
end
please give me something advice. Thank!
  1 Comment
Jiro Doke
Jiro Doke on 28 Feb 2012
Please format your code. Highlight the code portion of the text and click on the "{}Code" button.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!