windows media player

4 visualizaciones (últimos 30 días)
Ash
Ash el 15 de Mayo de 2012
Respondida: Gautam el 26 de Nov. de 2024
how to play a .wav file using Windows Media Player, ActiveX Control. kindly help

Respuestas (1)

Gautam
Gautam el 26 de Nov. de 2024
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:

Categorías

Más información sobre App Building en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by