Full screen code for Web player

Source: Internet
Author: User

In MediaPlayer, full screen function can only be achieved in the state of playback. If the playback is audio files, the video area will be WMP itself with the dynamic pattern, but also full screen, but the monitor is not configured, easy to long black screen, at this time you have to wait, only to Full-screen dynamic patterns appear. This tells us that the full screen effect is best when the real video media is played. There is also a trick: Play WMP class video media "playing" state, whether you set or not Full-screen function, as long as in the video area double-click the mouse, you can achieve full screen playback, and then double-click Return, or press the "ESC" key to return.

The <object> of the player has an ID.

Full-screen JS code

<script language= "JavaScript" >
function Dofull ()
{
Windiow.objectid. displaysize = ' 3 ';
}
</script>

Call:

<input id= "full" onclick= "Dofull ()" type= "button" value= "Full-screen" >

Full screen code for RealPlayer:

<input type= "button" onclick= "if (Document.player.GetPlayState () ==3) Document.player.SetFullScreen ()" Name value= "Full screen play" style= "Border-style:ridge; Border-width:1 ">

In some cases, the file provided in the Web site is not a single format, then you need to judge the file to decide which player to call, which can be done in the background code.

private void Playvod (string strurl)
{
To determine the name extension
String Strproname;

int Lastnum=strurl. LastIndexOf (".");
Strproname=strurl.substring (Lastnum);

Switch (strproname)
{
Case ". rmvb":
Case ". RM":

Txtval.value= "2"; Here, a hidden control is used to achieve full screen for different players

     //defines the playback interface
     litplay.text= "<object id=" Realplay ' width= ' 100% ' height= ' 380 ' classid= ' CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA ' > ';
     litplay.text+= "<param name= ' CONTROLS ' value= ' Imagewindow ' >";
     litplay.text+= "<param name= ' CONSOLE ' value= ' video ' >";
     litplay.text+= "<param name= ' CENTER ' value= ' TRUE ' >";
     litplay.text+= "<param name= ' maintainspect ' value= ' TRUE ' >";
     litplay.text+= "</object>";

     //definition status bar
     litplay.text+= "<object width= ' 100% ' height= ' classid= ' CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA ' > ';
     litplay.text+= "<param name= ' CONTROLS ' value= ' StatusBar ' >";
     litplay.text+= "<param name= ' CONSOLE ' value= ' video ' >";
     litplay.text+= "</object>";

     //definition Control Panel
     litplay.text+= "<object width= ' 100 % ' height= ' classid= ' CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA ' > ';
     litplay.text+= "<param name= ' CONTROLS ' value= ' ControlPanel ' >";
     litplay.text+= "<param name= ' CONSOLE ' value= ' video ' >";
     litplay.text+= "<param name= ' SRC ' value= '" +strurl+ "' >";
     litplay.text+= "<param name= ' AUTOSTART ' value= ' TRUE ' >";
     litplay.text+= "<param name= ' PREFETCH ' value= ' 0 ' >";
     litplay.text+= "<param name= ' LOOP ' value= ' 0 ' >";
     litplay.text+= "<param name= ' numloop ' value= ' 0 ' >";
     litplay.text+= "</object>";

Break
Case ". wmv":

Txtval.value= "1"; Here, a hidden control is used to achieve full screen for different players

Call MediaPlayer player, omit related code here
Litplay. text= "<object classid= ' clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95 ' version= ' 7.0 ' height= '" 100% ' id= " Name= ' nsplay ' width= ' 100% ' standby= ' Loading Microsoft Windows Media playercomponents ... ' border= ' 0 ' viewastext> ';
litplay.text+= "<param name= ' audiostream ' value= '-1 ' >";
litplay.text+= "<param name= ' AutoSize ' value= ' 0 ' >";
litplay.text+= "<param name= ' AutoStart ' value= ' 1 ' >";
litplay.text+= "<param name= ' Animationatstart ' value= '-1 ' >";
litplay.text+= "<param name= ' Allowscan ' value= '-1 ' >";
litplay.text+= "<param name= ' allowchangedisplaysize ' value= '-1 ' >";
litplay.text+= "<param name= ' autorewind ' value= ' 0 ' >";
litplay.text+= "<param name= ' Balance ' value= ' 0 ' >";
litplay.text+= "<param name= ' BaseURL ' value>";
litplay.text+= "<param name= ' bufferingtime ' value= ' ' >";
litplay.text+= "<param name= ' Captioningid ' value>";
litplay.text+= "<param name= ' clicktoplay ' value= '-1 ' >";
litplay.text+= "<param name= ' cursortype ' value= ' 0 ' >";
litplay.text+= "<param name= ' currentposition ' value= '-1 ' >";
litplay.text+= "<param name= ' currentmarker ' value= ' 0 ' >";
litplay.text+= "<param name= ' defaultframe ' value>";
litplay.text+= "<param name= ' displaybackcolor ' value= ' 0 ' >";
litplay.text+= "<param name= ' displayforecolor ' value= ' 65280 ' >";
litplay.text+= "<param name= ' displaymode ' value= ' 0 ' >";
litplay.text+= "<param name= ' displaysize ' value= ' 1 ' >";
litplay.text+= "<param name= ' value= '-1 ' >";
litplay.text+= "<param name= ' enablecontextmenu ' value= '-1 ' >";
litplay.text+= "<param name= ' enablepositioncontrols ' value= '-1 ' >";
litplay.text+= "<param name= ' enablefullscreencontrols ' value= '-1 ' >";
litplay.text+= "<param name= ' enabletracker ' value= '-1 ' >";
litplay.text+= "<param name= ' Filename ' value= '" +strurl + "";
litplay.text+= "<param name= ' invokeurls ' value= '-1 ' >";
litplay.text+= "<param name= ' Language ' value= '-1 ' >";
litplay.text+= "<param name= ' Mute ' value= ' 0 ' >";
litplay.text+= "<param name= ' playcount ' value= ' 1 ' >";
litplay.text+= "<param name= ' previewmode ' value= ' 0 ' >";
litplay.text+= "<param name= ' Rate ' value= ' 1 ' >";
litplay.text+= "<param name= ' Samilang ' value>";
litplay.text+= "<param name= ' Samistyle ' value>";
litplay.text+= "<param name= ' samifilename ' value>";
litplay.text+= "<param name= ' SelectionStart ' value= '-1 ' >";
litplay.text+= "<param name= ' selectionend ' value= '-1 ' >";
litplay.text+= "<param name= ' sendopenstatechangeevents ' value= '-1 ' >";
litplay.text+= "<param name= ' sendwarningevents ' value= '-1 ' >";
litplay.text+= "<param name= ' senderrorevents ' value= '-1 ' >";
litplay.text+= "<param name= ' sendkeyboardevents ' value= ' 0 ' >";
litplay.text+= "<param name= ' sendmouseclickevents ' value= ' 0 ' >";
litplay.text+= "<param name= ' sendmousemoveevents ' value= ' 0 ' >";
litplay.text+= "<param name= ' sendplaystatechangeevents ' value= '-1 ' >";
litplay.text+= "<param name= ' showcaptioning ' value= ' 0 ' >";
litplay.text+= "<param name= ' showcontrols ' value= '-1 ' >";
litplay.text+= "<param name= ' showaudiocontrols ' value= ' 0 ' >";
litplay.text+= "<param name= ' showdisplay ' value= ' 0 ' >";
litplay.text+= "<param name= ' showgotobar ' value= ' 0 ' >";
litplay.text+= "<param name= ' showpositioncontrols ' value= '-1 ' >";
litplay.text+= "<param name= ' ShowStatusBar ' value= '-1 ' >";
litplay.text+= "<param name= ' showtracker ' value= '-1 ' >";
litplay.text+= "<param name= ' Transparentatstart ' value= '-1 ' >";
litplay.text+= "<param name= ' videoborderwidth ' value= ' 0 ' >";
litplay.text+= "<param name= ' videobordercolor ' value= ' 0 ' >";
litplay.text+= "<param name= ' videoborder3d ' value= '-1 ' >";
litplay.text+= "<param name= ' Volume ' value= ' 0 ' >";
litplay.text+= "<param name= ' windowlessvideo ' value= ' 0 ' >";
litplay.text+= "</object>";
Break
}
}

You can control the different players by hiding the controls in the page.

<input id= "full" onclick= "Dofull ()" type= "button" value= "Full-screen" >
<input id= "Txtval" Type=hidden runat= "Server" >

The script will be written behind the hidden control to recognize it.

<script language=javascript >
function Dofull ()
{
Switch (document.all ("Txtval"). Value)
{
Case ' 1 ':
Document.mediaplayer.displaysize= ' 3 ';
Break

Case ' 2 ':
if (document. Realplay.getplaystate () ==3)
Document. Realplay.setfullscreen ()
Break
}
}
</script>

Attached: The method of controlling the channel (MediaPlayer).

<input id= "audiobalance" onclick= "balance ()" type= "button" value= "Toggle Channel" >

<script language= "JavaScript" >
function balance ()
{
Switch (window. Mediaplayer.balance)
{
Case 0:
Window. Mediaplayer.balance = '-9600 ';

Audiobalance.value= "accompaniment";
Break

case-9600:
Window. mediaplayer.balance = ' 9600 ';
Audiobalance.value= "Original singing";
Break

Case 9600:
Window. Mediaplayer.balance = ' 0 ';
Audiobalance.value= "Stereo";
Break

Default:
Window. Mediaplayer.balance = ' 0 ';
Audiobalance.value= "Stereo";
Break

}
}
</SCRIPT>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.