Play, Pause, Rewind, and Fast Forward Buttons (App Designer)
Show older comments
I am using the app designer and was wondering about implementing Play, Pause, Rewind, and Fast Forward buttons. Right now I do not have these features implemented - I just have a video playing using a combination of VideoReader, hasFrame, readFrame, and imshow functions. Here is my code:
filename = vidfile;
v = VideoReader(filename);
frame = 0;
app.OffsetFrameNumberEditField.Value = offsets(index);
ix = 1;
x = 1;
while hasFrame(v)
frame = frame + 1;
app.AbsoluteFrameNumberEditField.Value = frame;
app.OffsetFrameNumberEditField.Value = frame+offsets(index);
if frame == 1
cla(app.Video)
fig = imshow(readFrame(v), 'Parent', app.Video);
else
set(fig,'CData',readFrame(v))
end
if ge(frame,range(1)) && le(frame,range(end))
if x == 1
SP = scatter(app.SagittalAxes,dataS(ix,1), dataS(ix,4),'MarkerFaceColor','k','MarkerEdgeColor','k');
FP = scatter(app.FrontalAxes,dataF(ix,1), dataF(ix,4),'MarkerFaceColor','k','MarkerEdgeColor','k');
TP = scatter(app.TransverseAxes,dataT(ix,1), dataT(ix,4),'MarkerFaceColor','k','MarkerEdgeColor','k');
x = x+1;
else
set(SP,'XData',dataS(ix,1))
set(SP,'YData',dataS(ix,4))
set(FP,'XData',dataF(ix,1))
set(FP,'YData',dataF(ix,4))
set(TP,'XData',dataT(ix,1))
set(TP,'YData',dataT(ix,4))
end
ix = ix+1;
end
pause(0.005)
end
Accepted Answer
More Answers (0)
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!