请帮助我更正代码,以使用Deskto App从网站播放视频 [英] please help me to correct the code to play a video from a website using a deskto app
本文介绍了请帮助我更正代码,以使用Deskto App从网站播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;
namespace webplayer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
int width = panel1.Width;
int height = panel1.Height;
System.Uri u = new Uri("http://cassfordinfo.com/Testmovie.avi"); Video video;
video = Video.FromUrl(u);
video.Owner = panel1;
video.Stop();
video.Play();
// resize the video to the size original size of the panel
panel1.Size = new Size(width, height);
}catch(Exception gh)
{
MessageBox.Show(gh.ToString());
}
}
}
}
当我运行上面的代码时,它显示以下异常
when i run the above code it shows the below exception
System.IO.FileNotFoundException: Could not load file or assembly ''Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'' or one of its dependencies. The system cannot find the file specified.<br />
File name: ''Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35''<br />
at Microsoft.DirectX.AudioVideoPlayback.Video..ctor()<br />
at Microsoft.DirectX.AudioVideoPlayback.Video.FromUrl(Uri address)<br />
at webplayer.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\vishnu\My Documents\Visual Studio 2008\Projects\webplayer\webplayer\Form1.cs:line 28<br />
<br />
WRN: Assembly binding logging is turned OFF.<br />
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.<br />
Note: There is some performance penalty associated with assembly bind failure logging.<br />
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
推荐答案
这只是一个猜测,但是您是否安装了DirectX?尝试运行DXDiag,并确保正确安装了DXDiag,以及所需的版本.
作为预防措施,可能值得重新安装驱动程序.
This is just a guess, but do you have DirectX installed? Try running DXDiag and make sure it is correctly installed, and the version you expect.
It may be worth re-installing your drivers as a precaution.
这篇关于请帮助我更正代码,以使用Deskto App从网站播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文