Activex vlc plugin: Need help retrieving duration of video

조회 수: 2 (최근 30일)
Andre
Andre 2011년 9월 27일
댓글: Arjun Nagendran 2019년 9월 19일
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
Arjun Nagendran
Arjun Nagendran 2019년 9월 19일
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;

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by