how to get fixed figure (via actxcontrol) in a gui

1 visualización (últimos 30 días)
Pollok Tim
Pollok Tim el 25 de Jun. de 2016
Respondida: Pollok Tim el 27 de Jun. de 2016
Hi Community,
I am creating a GUI and I want to place 2 video.avi with fixed position in my interface. After long search I chose actxcontrol for my videos. Actxcontrol places a video into a figure and as I now it is not possible to get this figure in axes whose I created with GUIDE. To place something in axes is the commmon way I know when I have to add a plot, picture,... in my GUI.
Is there any way to have my video fixed in a gui?
This is the main part I use for my video, don't know if you need it.
function PlayVideoFile(filepath)
handles.filepath = filepath;
% Create figure to receive activex
handles.hFigure = figure('position', [50 50 960 560], 'menubar', 'none', 'numbertitle','off','name', ['Video: ' filepath], 'tag', 'VideoPlay', 'resize', 'off');
% Create play/pause and seek to 0 button
handles.hTogglePlayButton = uicontrol(handles.hFigure, 'position', [0 540 80 21], 'string', 'play/pause', 'callback', @TogglePlayPause);
handles.hSeekToZeroButton = uicontrol(handles.hFigure, 'position', [81 540 80 21], 'string', 'begining', 'callback', @SeekToZero);
% Create activex control
handles.vlc = actxcontrol('VideoLAN.VLCPlugin.2', [0 0 960 540], handles.hFigure);
% Format filepath so that VLC can use it (it's what was a problematic for me initialy)
filepath(filepath=='\')='/';
filepath = ['file://localhost/' filepath];
% Add file to playlist
handles.vlc.playlist.add(filepath);
% Deinterlace
handles.vlc.video.deinterlace.enable('x');
% Go back to begining of file
handles.vlc.input.time = 0;
% Register an event to trigger when video is being played regularly
handles.vlc.registerevent({'MediaPlayerTimeChanged', @MediaPlayerTimeChanged});
% Save handles
guidata(handles.hFigure, handles);
Thanks.

Respuestas (1)

Pollok Tim
Pollok Tim el 27 de Jun. de 2016
Ok I found a valid answer.
h = actxcontrol('progid',position,fig_handle,event_handler)
for fig_handle I selected gcf to get my GUI to be the figure for actxcontrol. No need for a new figure. Simple answer but only visible for me on the second view.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by