Microsoft.DirectX.AudioVideoPlayback 播放视频文件 全屏 问题
我使用Microsoft.DirectX.AudioVideoPlayback写了一个小程序,用来顺序,循环播放一些视频文件,并且是全屏播放。
我的问题是,尽管我设置了属性Fullscreen=true; 但是播放的时候还是会跳到非全屏的窗口。郁闷!!!
代码如下:
using System;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private Video myVideo;
private Video myVideo1;
private int currentIndex = 0;
private bool PrimaryVideoPlaying = true;
private string[] pl = { "c:\\media\\a.mpg", "c:\\media\\b.mpg", "c:\\media\\c.mpg" };
public Form1()
{
InitializeComponent();
PlayList();
}
private void PlayList()
{
currentIndex = 0;
if (pl.Length > 0)
{
PlayMedia(pl[currentIndex]);
}
}
private void PlayMedia(string fileName)
{
try
{
if (PrimaryVideoPlaying)
{
PrimaryVideoPlaying = false;
if (myVideo1 != null)
myVideo1.Dispose();
myVideo1 = new Video(fileName);
myVideo1.Ending += new EventHandler(myVideo_Ending);
myVideo1.Owner = this;
myVideo1.Play();
myVideo1.Fullscreen = true;
}
else
{
PrimaryVideoPlaying = true;
if (myVideo != null)
myVideo.Dispose();
myVideo = new Video(fileName);
myVideo.Ending += new EventHandler(myVideo_Ending);
myVideo.Owner = this;
myVideo.Play();
myVideo.Fullscreen = true;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void myVideo_Ending(object sender, EventArgs e)
{
currentIndex = (currentIndex + 1) % pl.Length;
((Video)sender).Ending -= new EventHandler(myVideo_Ending);
PlayMedia(pl[currentIndex]);
}
}
}
------解决方案--------------------没遇到过,帮顶顺便学习了!~
------解决方案--------------------期待答案
------解决方案--------------------奇怪,没看出哪有问题
这个只能仔细调试下了,一步一步跟踪,看看哪里myVideo1.Fullscreen = false了
------解决方案--------------------我以前做个小的播放器也是这样的.
------解决方案--------------------没做过,帮你顶