Activex vlc plugin: Need help retrieving duration of video
2 views (last 30 days)
Show older comments
Hey,
I am building a non-guide gui with an activex vlc player plugin. I am trying to sync the slider to the current time of the videofile being played. To do this I need to know the duration of the video file but cannot seem to get this information from the built in activex controls. I have been using the mmfileinfo function to do this. Is there a way for me to do this without having to resort to mmfileinfo? A sample from my code is shown below.
% video code
fig = figure('position', [100 100 500 500]);
set(fig,'Position',[50, 250, 500, 500],'Color',[0.5 0.5 0.5],'DoubleBuffer', 'on','Tool','none');
vlc1 = actxcontrol('VideoLAN.VLCPlugin.2', [0 100 500 400], fig); % creates a vlc active x pnel on the gui window
vlc1.playlist.add('Bicycle.wmv');
vlc1.AutoLoop = 1;
vlc1.AutoPlay = 1;
vlc1.playlist.get_length(); % should return file duration instead I get the following message - No appropriate method, property, or field get_length for class Interface.VideoLAN_VLC_ActiveX_Plugin.IVLCPlaylist.
vlc1.input.length; % should also return file duration, i get an error message 'Invoke Error, Dispatch Exception: Unspecified error'
I am using r2011b.
Thanks in advance!
1 Comment
Arjun Nagendran
on 19 Sep 2019
Coming across this issue nearly 8 years later, but calling play() before querying the length seems like one way to solve the issue. Code snippet below:
handles.vlc.playlist.play();
pause(0.1);
handles.vlc.playlist.togglePause();
videolength = handles.vlc.input.length;
Answers (0)
See Also
Categories
Find more on ActiveX 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!