How to create a movie player?

5 ビュー (過去 30 日間)
Ken
Ken 2013 年 1 月 4 日
回答済み: Gautam 2024 年 11 月 26 日
Hi,
I need to create a movie player that uses Windows Media Player (WMP).
So far I can only get to play the movie via WMP.
I want to have external buttons such as play, stop, pause, forward, backwards, etc, to control the media player.
Can anyone get me started?
Thank you very much.

回答 (2 件)

Walter Roberson
Walter Roberson 2013 年 1 月 4 日
You will need to use an ActiveX connection to WMP.

Gautam
Gautam 2024 年 11 月 26 日
Hello Ken,
MATLAB provides the capability to interact with COM objects, such as Windows Media Player, using ActiveX controls. You can use the actxcontrol function to embed Windows Media Player in the figure and UI controls to create buttons for play, stop, pause etc. The code below shows a workflow that can be implemented.
hFig = figure('Position', [100, 100, 600, 400], 'MenuBar', 'none', 'Name', 'Custom Media Player', 'NumberTitle', 'off');
hWMP = actxcontrol('WMPlayer.OCX.7', [0, 50, 600, 350], hFig);
uicontrol('Style', 'pushbutton', 'String', 'Play', 'Position', [10, 10, 50, 30], 'Callback', @(~,~) hWMP.controls.play());
uicontrol('Style', 'pushbutton', 'String', 'Pause', 'Position', [70, 10, 50, 30], 'Callback', @(~,~) hWMP.controls.pause());
uicontrol('Style', 'pushbutton', 'String', 'Stop', 'Position', [130, 10, 50, 30], 'Callback', @(~,~) hWMP.controls.stop());
However, please note that the function actxcontrol” relies on a third party technology, namely, Microsoft COM and Java Swing, and will be removed in a future version of MATLAB due to MathWorks transitioning its UI building infrastructure to web technologies. There is currently no simple replacement for this function. You can view UI alternatives for MATLAB apps in the document linked below
Also, the below File Exchange submission could provide you with useful alternatives:
For more information on the functions used, please refer to the documents below:

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by