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

1 回表示 (過去 30 日間)
Pollok Tim
Pollok Tim 2016 年 6 月 25 日
回答済み: Pollok Tim 2016 年 6 月 27 日
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.

回答 (1 件)

Pollok Tim
Pollok Tim 2016 年 6 月 27 日
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.

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by