C# axWindowsMediaPlayer 多个文件循环播放

今天在要实现一个用 C# WinForm 上 循环播放 mp4 视频

在网上看了很多博主的文章。学习整理出一个可用方案。记录下来供大家参考

   //this.axWindowsMediaPlayer1.URL = @"mp4/A1.mp4";
   //this.axWindowsMediaPlayer1.URL = @"C:\Users\Administrator\Desktop\LawSever\bin\Debug\mp4\A1.mp4";

   string strWavPath1 = @"mp4/A1.mp4";
   string strWavPath2 = @"mp4/A2.mp4";
   //创建播放列表    列表名称可为空
   //this.axWindowsMediaPlayer1.currentPlaylist = this.axWindowsMediaPlayer1.newPlaylist("  ", "");
   this.axWindowsMediaPlayer1.currentPlaylist = this.axWindowsMediaPlayer1.newPlaylist("myPlayList", "");
   //播放列表加入要播放的文件
   this.axWindowsMediaPlayer1.currentPlaylist.appendItem(this.axWindowsMediaPlayer1.newMedia(strWavPath1));
   this.axWindowsMediaPlayer1.currentPlaylist.appendItem(this.axWindowsMediaPlayer1.newMedia(strWavPath2));

   this.axWindowsMediaPlayer1.settings.volume = 1;//指定音量
   this.axWindowsMediaPlayer1.enableContextMenu = true;//启用/禁用右键菜单
   this.axWindowsMediaPlayer1.uiMode = "Full";//播放器界面模式,可为Full, Mini, None, Invisible

   this.axWindowsMediaPlayer1.settings.setMode("Loop", true);//循环播放

   this.axWindowsMediaPlayer1.Ctlcontrols.play();//开始播放

 

posted @ 2022-11-22 16:01  海乐学习  阅读(1071)  评论(0编辑  收藏  举报