CodePudding user response:
Is the MediaPlayer Delphi does not support your filesYou can use Microsoft mulitmedia control 6.0 or Windows media play activeX component try
(you can use the menu on the componet - & gt; The import activeX control to install)
CodePudding user response:
Try NewAC controls, usefulNew Audio Components package
CodePudding user response:
Simple built-in mediaplayer control is weak, start playing a line still, if want to do something or formal use some controls, such as ffmpeg FFVCL, price is not too expensive, also have a free trial,Mediaplayer need in the system if you want to support more format decoder installed, installed decoder as long as it is system Windows media player can play the files, you do programs can be, but need to add suffix to the system registries,
The code is as follows:
procedure Tbcform. Btn1Click (Sender: TObject);
Var
ARegistry: TRegistry;
The begin
ARegistry:=TRegistry. Create;
With ARegistry do
The begin
RootKey:=HKEY_LOCAL_MACHINE;
If OpenKey (' Software \ Microsoft \ Windows NT \ CurrentVersion \ Extensions' MCI, True) then
WriteString (' avi ', 'avivideo');
WriteString (' cda ', 'CDAudio');
WriteString (' Mid ', 'Sequencer);
WriteString (' rmi ', 'Sequencer);
WriteString (' Wav ', 'WaveAudio');
WriteString (' aif ', 'MPEGVideo');
WriteString (' aifc ', 'MPEGVideo');
WriteString (' aiff ', 'MPEGVideo');
WriteString (' au ', 'MPEGVideo');
WriteString (' dat ', 'MPEGVideo');
WriteString (' m1v ', 'MPEGVideo');
WriteString (' mp2 ', 'MPEGVideo');
WriteString (' mpa ', 'MPEGVideo');
WriteString (' mpe ', 'MPEGVideo');
WriteString (' mpeg ', 'MPEGVideo');
WriteString (' MPG ', 'MPEGVideo');
WriteString (' SND ', 'MPEGVideo');
WriteString (' the asf ', 'MPEGVideo');
WriteString (' asx ', 'MPEGVideo');
WriteString (' ivf ', 'MPEGVideo');
WriteString (' m3u ', 'MPEGVideo');
WriteString (' mp2v ', 'MPEGVideo');
WriteString (' mp3 ', 'MPEGVideo');
WriteString (' mpv2 ', 'MPEGVideo');
WriteString (' idea ', 'MPEGVideo');
WriteString (' Windows', 'MPEGVideo');
WriteString (' wma ', 'MPEGVideo');
WriteString (' WMV ', 'MPEGVideo');
WriteString (' WVX ', 'MPEGVideo');
WriteString (' WMX ', 'MPEGVideo');
WriteString (' WPL ', 'MPEGVideo');
WriteString (' MP4 ', 'MPEGVideo');
WriteString (' MKV ', 'MPEGVideo');
WriteString (' flac ', 'MPEGVideo');
WriteString (' ape ', 'MPEGVideo');
WriteString (' aac ', 'MPEGVideo');
WriteString (' vob ', 'MPEGVideo');
WriteString (' mov ', 'MPEGVideo');
WriteString (' FLV ', 'MPEGVideo');
WriteString (' f4v ', 'MPEGVideo');
WriteString (' rm ', 'MPEGVideo');
WriteString (' RMVB ', 'MPEGVideo');
WriteString (' ogg ', 'MPEGVideo');
CloseKey;
Destroy;
end;
end;
Procedure Tbcform. Btn2Click (Sender: TObject);
Var
ARegistry: TRegistry;
The begin
ARegistry:=TRegistry. Create;
With ARegistry do
The begin
RootKey:=HKEY_LOCAL_MACHINE;
If OpenKey (' Software \ Microsoft \ Windows NT \ CurrentVersion \ MCI32 ', True) then
WriteString (' AVIVideo ', 'McIavi32. DLL);
WriteString (' CDAudio ', 'McIcda. DLL);
WriteString (' Sequencer ', 'McIseq. DLL);
WriteString (' WaveAudio ', 'McIwave. DLL);
WriteString (' MPEGVideo ', 'McIqtz32. DLL);
CloseKey;
Destroy;
end;
end;
This is also covered the common audio and video formats, to join the registry information, your application can directly show the type of document, decoder can choose K - Lite_Codec_Pack,
Open the play before you
If (MediaPlayer1 DeviceID & lt;> 0) then
The begin
If (MediaPlayer1. Mode=mpplaying) then
MediaPlayer1. Stop;
end;
Mediaplayer1. Open;
Mediaplayer1. Display:=pnl1;
Self. Mediaplayer1. FileName:='c:/*. Mp3';
Mediaplayer1. Play;