How to make a basic Media player to play a video in avi format?

橙三吉。 提交于 2019-12-12 04:54:31

问题


I want to play a video in Delphi. This is the code that I've got:

if OpenDialog1.Execute  then
 begin
  MediaPlayer1.FileName:=OpenDialog1.FileName;
  MediaPlayer1.Open;
  MediaPlayer1.Display:=pnlVideo;
  MediaPlayer1.Play;
 end;

But I get an error message:'The specified file cannot be played on the specified MCI device.The file may be corrupt, not in the correct format or no available file handler available for this format.' The format of the video that I use is avi. All help is appreciated.


回答1:


There is a compatibility issue with the media player component in Delphi on our "modern" computers. I'm not tech savvy on what exactly the problem is :P. It is best to make your own component in Delphi to play media.

This link can help you make a Windows Media Player component, or you can adjust it to make another active X media player component - such as VLC.

https://chapmanworld.com/windows-media-player-in-delphi/

I hope this will help. :D



来源:https://stackoverflow.com/questions/45661792/how-to-make-a-basic-media-player-to-play-a-video-in-avi-format

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!