位置:海鸟网 > IT > JavaScript >

网页播放器实现全屏方法的总结

    网页播放器全屏的方法(有点气,少写了)这是自己总结的,刚刚要完的时候点错了,重新发送一次,老子好气,该打游戏的时间,浪费了,这里就偷工减料了! 

    1、media player全屏方法

   <script language="JavaScript">
    <!--

    var Real;
    Real='MediaPlayer1.';
    var Mute=false;
    var CanSetPos=true;
    var SetPosStart=false;
    var SetVolStart=false;
    var loop, timer, initialised;
    var speed=50;
    var oldwidth=566,oldheight=502;


    function DoFull()
    {
        eval(Real+'DisplaySize=3');
    }

NetShowServer = "" ;

var mPath = NetShowServer + "";


function LoadVideo(c1,c2) {
 if (c1=="") return;
 video_filename = c1;

 MusicPlayer.Cancel()
 timer=window.setTimeout("video_play()",2000)
}
function video_play(fn) {
 var mName = mPath + video_filename;
 MusicPlayer.Open(mName)
}
    //-->
          </script>
          <td width="39%" height="1" bgcolor="#E0E0E0">
          <input type="button" onMouseDown="DoFull()" value="全屏显示" style="border-style: ridge; border-width: 1">
          <span lang="en-us">ESC</span>返回</td>
        </tr>
      </table>
      </td>
    </tr>
    <tr>
      <td width="100%">
      <p align="center">

            <object id=MediaPlayer1 classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95 width=468 height=358>
              <param name="filename" value=/film/play.asp>
              <param name="AutoStart" value="-1">
              <param name="Enabled" value="-1">
              <param name="ShowControls" value="-1">
              <param name="ShowGotoBar" value="0">
              <param name="ShowStatusBar" value="-1">
              <param name="EnableFullScreenControls" value="0">
              <param name="EnablePositionControls" value="0">
              <param name="Volume" value="0">
              <param name="DisplaySize" value="4">
              <param name="SendErrorEvents" value="0">
              <param name="enableContextMenu" value="0">
              <param name="EnableTracker" value="-1">
              <param name="AudioStream" value="-1">
              <param name="AutoSize" value="0">
              <param name="AnimationAtStart" value="-1">
              <param name="AllowScan" value="-1">
              <param name="AllowChangeDisplaySize" value="-1">
              <param name="AutoRewind" value="0">
              <param name="Balance" value="0">
              <param name="BaseURL" value>
              <param name="BufferingTime" value="5">
              <param name="CaptioningID" value>
              <param name="ClickToPlay" value="-1">
              <param name="CursorType" value="0">
              <param name="CurrentPosition" value="-1">
              <param name="CurrentMarker" value="0">
              <param name="DefaultFrame" value>
              <param name="DisplayBackColor" value="0">
              <param name="DisplayForeColor" value="16777215">
              <param name="DisplayMode" value="0">
              <param name="InvokeURLs" value="-1">
              <param name="Language" value="-1">
              <param name="Mute" value="0">
              <param name="PlayCount" value="1">
              <param name="PreviewMode" value="0">
              <param name="Rate" value="1">
              <param name="SAMILang" value>
              <param name="SAMIStyle" value>
              <param name="SAMIFileName" value>
              <param name="SelectionStart" value="-1">
              <param name="SelectionEnd" value="-1">
              <param name="SendOpenStateChangeEvents" value="-1">
              <param name="SendWarningEvents" value="-1">
              <param name="SendKeyboardEvents" value="0">
              <param name="SendMouseClickEvents" value="0">
              <param name="SendMouseMoveEvents" value="0">
              <param name="SendPlayStateChangeEvents" value="-1">
              <param name="ShowCaptioning" value="0">
              <param name="ShowAudioControls" value="-1">
              <param name="ShowDisplay" value="0">
              <param name="ShowPositionControls" value="-1">
              <param name="ShowTracker" value="-1">
              <param name="TransparentAtStart" value="0">
              <param name="VideoBorderWidth" value="0">
              <param name="VideoBorderColor" value="0">
              <param name="VideoBorder3D" value="0">
              <param name="WindowlessVideo" value="0">
            </object>

      </td>
    </tr>
  </table>

还有一种我在网上找的,没有用,不过楼主好像说功能好用,呵呵。

<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="MediaPlayer1" width="580" height="435">
<param name="AudioStream" value="-1">
<param name="AutoSize" value="0">
<param name="AutoStart" value="-1">
<param name="AnimationAtStart" value="-1">
<param name="AllowScan" value="-1">
<param name="AllowChangeDisplaySize" value="-1">
<param name="AutoRewind" value="0">
<param name="Balance" value="0">
<param name="BaseURL" value>
<param name="BufferingTime" value="5">
<param name="CaptioningID" value>
<param name="ClickToPlay" value="-1">
<param name="CursorType" value="0">
<param name="CurrentPosition" value="-1">
<param name="CurrentMarker" value="0">
<param name="DefaultFrame" value>
<param name="DisplayBackColor" value="0">
<param name="DisplayForeColor" value="16777215">
<param name="DisplayMode" value="0">
<param name="DisplaySize" value="2">
<param name="Enabled" value="-1">
<param name="EnableContextMenu" value="-1">
<param name="EnablePositionControls" value="-1">
<param name="EnableFullScreenControls" value="0">
<param name="EnableTracker" value="-1">
<param name="Filename" value="刘德华-缺憾美.mpg">
<param name="InvokeURLs" value="-1">
<param name="Language" value="-1">
<param name="Mute" value="0">
<param name="PlayCount" value="1">
<param name="PreviewMode" value="0">
<param name="Rate" value="1">
<param name="SAMILang" value>
<param name="SAMIStyle" value>
<param name="SAMIFileName" value>
<param name="SelectionStart" value="-1">
<param name="SelectionEnd" value="-1">
<param name="SendOpenStateChangeEvents" value="-1">
<param name="SendWarningEvents" value="-1">
<param name="SendErrorEvents" value="-1">
<param name="SendKeyboardEvents" value="0">
<param name="SendMouseClickEvents" value="0">
<param name="SendMouseMoveEvents" value="0">
<param name="SendPlayStateChangeEvents" value="-1">
<param name="ShowCaptioning" value="0">
<param name="ShowControls" value="-1">
<param name="ShowAudioControls" value="-1">
<param name="ShowDisplay" value="0">
<param name="ShowGotoBar" value="0">
<param name="ShowPositionControls" value="-1">
<param name="ShowStatusBar" value="-1">
<param name="ShowTracker" value="-1">
<param name="TransparentAtStart" value="0">
<param name="VideoBorderWidth" value="0">
<param name="VideoBorderColor" value="0">
<param name="VideoBorder3D" value="0">
<param name="Volume" value="-40">
<param name="WindowlessVideo" value="0">
</object>

这个功能比较完整,支持原有的快捷键以及右键菜单

    2、real player全屏的方法一

realplayer播放4(带视频)
<SCRIPT language=javascript>
Real='document.RAOCX.'
function DoPlay()
{eval(Real+'DoPlay()');}
function DoStop()
{eval(Real+'DoStop()');}
function DoPlayPause()
{eval(Real+'DoPlayPause()');}
function SetFullScreen()
{
eval(Real+'SetFullScreen()');
fullscreen=true;
DoPlayPause();
DoPlay();
}
function GetFullScreen()
{
if(eval(Real+'GetFullScreen()'))
return true;
else
return false;
}
</SCRIPT>

<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width=376 height=248>
<PARAM NAME=SRC VALUE="../upload/<%=rsp("path")%>">
<PARAM NAME=CONSOLE VALUE=Clip1>
<PARAM NAME=CONTROLS VALUE=imagewindow>
<PARAM NAME=AUTOSTART VALUE=true></OBJECT><br/>
<OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=24 id=video2 width=376>
<PARAM NAME=SRC VALUE="../upload/<%=rsp("path")%>">
<PARAM NAME=AUTOSTART VALUE=-1>
<PARAM NAME=CONTROLS VALUE=controlpanel>
<PARAM NAME=CONSOLE VALUE=Clip1></OBJECT>

<a href="#" title="全屏幕欣赏,按ESC键还原。" style="CURSOR: hand" onclick=SetFullScreen()>□全屏播放□</a>

    3、real player全屏的方法二 

<html>
<head>
<title>在线播放</title>
<SCRIPT>
<!--
function bookmarkit(){window.external.addFavorite('','魔幻天空')} 
//-->
</SCRIPT>
</head>
<body marginwidth="0" leftmargin="0" topmargin="0" bgcolor="#000000" scroll="no" oncontextmenu="window.event.returnValue=false" ondragstart="window.event.returnValue=false" onselectstart="event.returnValue=false">
<script language="JAVASCRIPT">
<!-- Begin
var ap_name = navigator.appName;
var ap_vinfo = navigator.appVersion;
var ap_ver = parseFloat(ap_vinfo.substring(0,ap_vinfo.indexOf('(')));

var time_start = new Date();
var clock_start = time_start.getTime();
var dl_ok=false;

function init ()
{
if(ap_name=="Netscape" && ap_ver>=3.0)
dl_ok=true;
return true;
}

function get_time_spent ()
{
var time_now = new Date();
return((time_now.getTime() - clock_start)/1000);
}

function show_secs () 
{
var i_total_secs = Math.round(get_time_spent());
var i_secs_spent = i_total_secs % 60;
var i_mins_spent = Math.round((i_total_secs-30)/60);
var s_secs_spent = "" + ((i_secs_spent>9) ? i_secs_spent : "0" + i_secs_spent);
var s_mins_spent = "" + ((i_mins_spent>9) ? i_mins_spent : "0" + i_mins_spent);
document.fm0.time_spent.value = s_mins_spent + ":" + s_secs_spent;
window.setTimeout('show_secs()',1000);
}
init();
window.setTimeout('show_secs()',1);
//  End -->
          </script>
<center>
<p></p>
</center>
<div align="center">
  <center>
  <table border="0" cellspacing="0" width="337" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
    <tr>
      <td width="100%">
      <table border="0" cellspacing="0" style="border-collapse: collapse" width="108%" id="AutoNumber1" bgcolor="#F0F0F0" cellpadding="0">
        <tr>
          <td width="55%" height="1" bgcolor="#E0E0E0">
          <p align="left"> <font size="2">谢谢你的访问!!!!!</font></td>
          <form name="fm0" onSubmit="0">
            <td width="7%" height="1" bgcolor="#E0E0E0">
            <input type="text" name="time_spent" size="5" onFocus="this.blur()" style="border-style: groove; border-width: 1; background-color: #EEEEEE"></td>
          </form>
          <script language="JavaScript">
    <!--

    var Real;
    Real='document.RP1.';
    var Mute=false;
    var CanSetPos=true;
    var SetPosStart=false;
    var SetVolStart=false;
    var loop, timer, initialised;
    var speed=50;
    var oldwidth=566,oldheight=502;

    function DoFull()
{//全屏播放
eval(Real+'SetFullScreen()');
}

NetShowServer = "" ;

var mPath = NetShowServer + "";


function LoadVideo(c1,c2) {
 if (c1=="") return;
 video_filename = c1;

 MusicPlayer.Cancel()
 timer=window.setTimeout("video_play()",2000)
}
function video_play(fn) {
 var mName = mPath + video_filename;
 MusicPlayer.Open(mName)
}
    //-->
          </script>
          <td width="38%" height="1" bgcolor="#E0E0E0">
          <input type="button" onMouseDown="DoFull()" value="全屏显示" style="border-style: ridge; border-width: 1">
                <span lang="en-us"><font size="2">ESC</font></span><font size="2">返回</font></td>
        </tr>
      </table>
      </td>
    </tr>
    <tr>
        <td width="100%"> <p align="center"> 
            <object id="RP1" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width=468 height=358>
  <param name="_ExtentX" value="4445"> 
<param name="_ExtentY" value="3334"> 
<param name="AUTOSTART" value="-1"> 
<param name="SHUFFLE" value="0"> 
<param name="PREFETCH" value="0"> 
<param name="NOLABELS" value="-1"> 
<param name="SRC" value="rtsp://61.177.95.61:554/ent/2005/promise_1104.rm"> 
<param name="CONTROLS" value="Imagewindow,StatusBar,ControlPanel"> 
<param name="CONSOLE" value="clip1"> 
<param name="LOOP" value="0"> 
<param name="NUMLOOP" value="0"> 
<param name="CENTER" value="0"> 
<param name="MAINTAINASPECT" value="0"> 
<param name="BACKGROUNDCOLOR" value="#000000"><embed src="rtsp://61.177.95.61:554/ent/2005/promise_1104.rm" type="audio/x-pn-realaudio-plugin"> 
</object>
        </td>
    </tr>
  </table>
  </center>
</div>
</body>
</html>

    4、real player全屏的方法三

如果是realone要全屏只要HEAD加入以下这段JS代码
function setFull()
{
if(!document.playfull.CanStop())
{
alert("影片未开始播放无法切换为全屏模式")
}
else
{
alert("点击确定按钮后进入全屏播放模式,在全屏播放模式中按 Esc 键退出全屏模式")
document.playfull.SetFullScreen()
}
}
//-->
</script>

在body里面
<a href="#" onclick="setFull();">全屏</a>