Filter löschen
Filter löschen

appdesigner: use a slider to play a video

4 Ansichten (letzte 30 Tage)
Marina Llopis Segura
Marina Llopis Segura am 28 Mär. 2023
Good morning, I am making a program in appdesigner that needs to play a video and through a slider you can configure the second of video in which it is located. That is to say if the video lasts 30 seconds, the slider will have a length of 30 and if I put the arrow of the slider in 10 seconds the video will show what appears in the second 10. I have achieved that in an axes I see the video but it plays from beginning to end without stopping. I would appreciate if someone could help me.
this is the capture of the code that I have generated in the callback of a button in which you can choose the video that will be played in the axes when you press it.

Akzeptierte Antwort

Antoni Garcia-Herreros
Antoni Garcia-Herreros am 28 Mär. 2023
Hello Marina,
You could start by creating a startup Function where you create an array with all frames. Something like this:
function seleccionVideoButtonPushed(app, event)
%Select the video same way you are doing right now
% This array will contain all the video frames
for a=1:numFrames
Then you'll have to add a callback function when the slider is moved:
function SliderValueChanging(app, event)
changingValue = event.Value;
idx=floor(changingValue); % You may want to adjust this value based on the temporal resolution of your video
% The other option is to change the length of the slider to be
% the same as the number of frames.
Hope this helps!

Weitere Antworten (0)


Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by