我正在构建一个应用程序来连续播放给定文件夹的视频文件。
这是我过去通过给出路径来播放单个文件的内容。
axWindowsMediaPlayer1.URL = @"D:\ShortVideoFolder\Asterix And The Vikings - YouTube.MKV";
axWindowsMediaPlayer1.settings.autoStart = true;
axWindowsMediaPlayer1.stretchToFit = true;
axWindowsMediaPlayer1.settings.setMode("loop", true);
这工作得很好。这就是我访问文件夹中所有视频文件并播放这些文件的方法。
string folderPath = ConfigurationManager.AppSettings["videoFolderPath"]; //Getting folder path saved in App.config file
string[] fileNames = Directory.GetFiles(@folderPath); //Getting file names of each and every file name in the folder
foreach (string file in fileNames)
{
axWindowsMediaPlayer1.URL = @"folderPath" + "file";
axWindowsMediaPlayer1.settings.autoStart = true;
}
这不会播放单个文件。并且也不给出错误消息。我在这里做错了什么?