There are lots of situations where we have to play a video in our web page.
I describe the way of playing video in your webpage. There are two processes I illustrate here. One is from Html or Source view, and another is from code behind.
Process One:
<object id="MediaPlayer" height="200" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
standby="Loading Windows Media Player components..." type="application/x-oleobject" width="200">
<param name="FileName" value="mobile.wmv">
<param name="ShowControls" value="true">
<param name="ShowStatusBar" value="false">
<param name="ShowDisplay" value="false">
<param name="autostart" value="true">
<embed type="application/x-mplayer2" src="mobile.wmv" name="MediaPlayer" width="100%"
height="190" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>
<br /></object>
OR
BY Using Interop, you can acheive this by the following three methods:
Process Two
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Media;
using WMPLib;
public partial class Play : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnPlay_Click(object sender, EventArgs e)
{
string _path = "Your File Path";
SoundPlayer _sm = new SoundPlayer(_path);
_sm.Play();
Microsoft.VisualBasic.Devices.Audio _mvda = new Microsoft.VisualBasic.Devices.Audio();
_mvda.Play(_path, Microsoft.VisualBasic.AudioPlayMode.Background);
WindowsMediaPlayerClass _wmpc = new WindowsMediaPlayerClass();
_wmpc.openPlayer(_path);
_wmpc.play();
}
}
This member doesn't quite have enough reputation to be able to display their biography and homepage.