Front-click button, execute JS event, jump to backstage code:
function Funshowvideo (index) {
var iTop = (window.screen.availheight-30-500)/2; Get the vertical position of the window;
var ileft = (window.screen.availwidth-10-660)/2; Get the horizontal position of the window;
window.open ("Showvideo.aspx? Showtype= "+ index," Newwindow1 "," width=660px,height=500px,top= "+ ITop +", left= "+ ILeft +", Toolbar=no,menubar=no,scro Llbars=yes,resizable=yes,location=no,status=no ");
}
The background receives the parameters passed by the foreground and executes the corresponding code:
if (request.querystring["ShowType"]! = NULL)
{
string strtype = request.querystring["ShowType"]. ToString ();
String Strvideopath = AppDomain.CurrentDomain.BaseDirectory + "videos\\";//Video path
\ \ AppDomain.CurrentDomain.BaseDirectory: Gets the current path
String strvideoname = ""; Video name
String strnodename = "";
if (strtype = = "1")
{
Strnodename = "Cleanvideo";
}
else if (strtype = = "2")
{
Strnodename = "Ajustvideo";
}
else if (strtype = = "3")
{
Strnodename = "Changevideo";
}
if (system.configuration.configurationmanager.appsettings[strnodename]! = NULL)
{
Strvideoname = System.configuration.configurationmanager.appsettings[strnodename]. ToString ();
Strvideopath + = Strvideoname;
if (file.exists (Strvideopath))
{
Label2.Text = PlayMedia (Strvideopath);
}
}
}
Code to play a video file
public string PlayMedia (string mediafile)
{
String strscript = "";
Strscript + = "<table id=\" table2\ "align=\" Center\ "border=\" 0\ "runat=\" server\ "width = ' 620 ' height = ' >";
Strscript + = "<TR>";
Strscript + = "<td align=\" Center\ ">";
Strscript + = "<object id=\" Mdptrailer\ "classid=\" clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95\ "name=\" MdpTrailer \ "Width= ' 620 ' height = ' >";
Strscript + = "<param name=\" audiostream\ "value=\" -1\ ">";
Strscript + = "<param name=\" autosize\ "value=\" -1\ ">";
Strscript + = "<param name=\" autostart\ "value=\" -1\ ">";
Strscript + = "<param name=\" animationatstart\ "value=\" -1\ ">";
Strscript + = "<param name=\" allowscan\ "value=\" -1\ ">";
Strscript + = "<param name=\" allowchangedisplaysize\ "value=\" -1\ ">";
Strscript + = "<param name=\" autorewind\ "value=\" 0\ ">";
Strscript + = "<param name=\" balance\ "value=\" 0\ ">";
Strscript + = "<param name=\" baseurl\ "value=\" \ ">";
Strscript + = "<param name=\" bufferingtime\ "value=\" 5\ ">";
Strscript + = "<param name=\" captioningid\ "value=\" \ ">";
Strscript + = "<param name=\" clicktoplay\ "value=\" -1\ ">";
Strscript + = "<param name=\" cursortype\ "value=\" 0\ ">";
Strscript + = "<param name=\" currentposition\ "value=\" -1\ ">";
Strscript + = "<param name=\" Currentmarker\ "value=\" 0\ ">";
Strscript + = "<param name=\" defaultframe\ "value=\" \ ">";
Strscript + = "<param name=\" displaybackcolor\ "value=\" 0\ ">";
Strscript + = "<param name=\" displayforecolor\ "value=\" 16777215\ ">";
Strscript + = "<param name=\" displaymode\ "value=\" 0\ ">";
Strscript + = "<param name=\" displaysize\ "value=\" 4\ ">";
Strscript + = "<param name=\" enabled\ "value=\" -1\ ">";
Strscript + = "<param name=\" enablecontextmenu\ "value=\" -1\ ">";
Strscript + = "<param name=\" Enablepositioncontrols\ "value=\" -1\ ">";
Strscript + = "<param name=\" Enablefullscreencontrols\ "value=\" 0\ ">";
Strscript + = "<param name=\" Enabletracker\ "value=\" -1\ ">";
Strscript + = "<param name=\" filename\ "value=\" "+ MediaFile +" \ ">";
Strscript + = "<param name=\" Invokeurls\ "value=\" -1\ ">";
Strscript + = "<param name=\" language\ "value=\" -1\ ">";
Strscript + = "<param name=\" mute\ "value=\" 0\ ">";
Strscript + = "<param name=\" playcount\ "value=\" 1\ ">";
Strscript + = "<param name=\" previewmode\ "value=\" 0\ ">";
Strscript + = "<param name=\" rate\ "value=\" 1\ ">";
Strscript + = "<param name=\" samilang\ "value=\" \ ">";
Strscript + = "<param name=\" samistyle\ "value=\" \ ">";
Strscript + = "<param name=\" samifilename\ "value=\" \ ">";
Strscript + = "<param name=\" selectionstart\ "value=\" -1\ ">";
Strscript + = "<param name=\" selectionend\ "value=\" -1\ ">";
Strscript + = "<param name=\" sendopenstatechangeevents\ "value=\" -1\ ">";
Strscript + = "<param name=\" sendwarningevents\ "value=\" -1\ ">";
Strscript + = "<param name=\" senderrorevents\ "value=\" -1\ ">";
Strscript + = "<param name=\" sendkeyboardevents\ "value=\" 0\ ">";
Strscript + = "<param name=\" sendmouseclickevents\ "value=\" 0\ ">";
Strscript + = "<param name=\" sendmousemoveevents\ "value=\" 0\ ">";
Strscript + = "<param name=\" sendplaystatechangeevents\ "value=\" -1\ ">";
Strscript + = "<param name=\" showcaptioning\ "value=\" 0\ ">";
Strscript + = "<param name=\" Showcontrols\ "value=\" -1\ ">";
Strscript + = "<param name=\" Showaudiocontrols\ "value=\" -1\ ">";
Strscript + = "<param name=\" showdisplay\ "value=\" 0\ ">";
Strscript + = "<param name=\" showgotobar\ "value=\" 0\ ">";
Strscript + = "<param name=\" Showpositioncontrols\ "value=\" -1\ ">";
Strscript + = "<param name=\" showstatusbar\ "value=\" 0\ ">";
Strscript + = "<param name=\" Showtracker\ "value=\" -1\ ">";
Strscript + = "<param name=\" transparentatstart\ "value=\" 0\ ">";
Strscript + = "<param name=\" videoborderwidth\ "value=\" 0\ ">";
Strscript + = "<param name=\" videobordercolor\ "value=\" 0\ ">";
Strscript + = "<param name=\" videoborder3d\ "value=\" 0\ ">";
Strscript + = "<param name=\" volume\ "value=\" -600\ ">";
Strscript + = "<param name=\" windowlessvideo\ "value=\" 0\ ">";
Strscript + = "</OBJECT>";
Strscript + = "</TD>";
Strscript + = "</TR>";
Strscript + = "</TABLE>";
return strscript;
}
. NET plays video file code with local player