How to create a movie player?
5 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (2 件)
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:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Audio and Video Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!