当前位置:编程学习 > C/C++ >>

网页中嵌入视频播放器代码

有时候我们会有这样的需求,在网页中嵌入视频播放器,以播放我们的服务器端的视频,下面我将代码贴出来:
嵌入快播播放器:
 
<table width="100%" align="left">  
        <tr>  
            <td width="320px">  
                <div class="box1"  panelTitle="文件列表" panelHeight="450" panelWidth="320" overflow="auto">  
                文件列表:  
                     <li><a href="javascript:void(0);"  onclick="play('F:\\30230201\\02-52-01.AVI')";>文件1</a></li>  
                     <li><a href="javascript:void(0);"  onclick="play('F:\\Movie\\NewMovie\\失恋33天_DVD.rmvb')";>失恋33天</a></li>  
                     <li><a href="javascript:void(0);"  onclick="play('F:\\Movie2\\毕加猪.AVI')";>毕加猪</a></li>  
                </div>  
            </td>  
            <td align="left">  
                <div panelHeight="450" panelTitle="视频播放" overflow="auto">  
                   <object classid="clsid:F3D0D36F-23F8-4682-A195-74C92B03D4AF" width="560" height="430" id="QvodPlayer" name="QvodPlayer" onError="downLoadQvod();">  
                      <param name="url" id="qvodurl0" value="">  
                      <param name="Autoplay" value="1">   
                      <param name="Showcontrol" value="1">  
                   </object>  
                </div>  
            </td>  
        </tr>  
    </table>    

 

 
快播播放器相应的js控制代码:
 
<Script Language="JavaScript" src="">  
setInterval(show1,5000);//5s显示一次下载进度  
var bstartnextplay = false;  
  
function show1()  
{  
    var pos = QvodPlayer.get_CurTaskProcess()/10;  
    alert(pos);  
    if(pos > 60)  
    {  
        StartNextDownFile();  
    }  
    var posv = "当前下载进度为:  "+ pos.toString(10) + "%";  
    var mediaInfo1 = document.getElementById("mediaInfo");  
    mediaInfo1.innerText = posv;  
}  
  
function PointPlay(playername)  
{  
    //alert(QvodPlayer);  
    QvodPlayer.URL = playername;  
    QvodPlayer.Play();  
}  
  
function Stop()  
{  
    QvodPlayer.Stop();  
}  
function Pause()  
{  
    QvodPlayer.Pause();  
}  
  
function Play()  
{  
    QvodPlayer.Play();  
}  
  
function GetS()  
{  
    var iv;  
    var is = QvodPlayer.PlayState;  
    alert(is);  
    //alert(iv);  
}  
  
function putview()  
{  
    var v = 0;  
    QvodPlayer.put_viewframe(v);  
}  
  
function puttrack(v)  
{  
    QvodPlayer.put_soundtrack(v);  
}  
  
function putAdjustVideo(v)  
{  
    QvodPlayer.put_AdjustVideo(v);  
}  
  
function putfull()  
{  
    var v = true;  
    QvodPlayer.Full = v;  
}  
  
var mute = false;  
function putmute()  
{  
    if(mute)  
    {  
        mute = false;  
        QvodPlayer.Mute = mute;  
    }  
    else  
    {  
        mute = true;  
        QvodPlayer.Mute = mute;  
    }  
      
}  
function curpos()  
{  
    var pos = 0;  
    pos  = QvodPlayer.Currentpos;  
    alert(pos);  
}  
function setpos(pos)  
{  
    QvodPlayer.Currentpos = pos;    
}  
function setvolue(pos)  
{  
    QvodPlayer.Volume = pos;  
}  
function OnLoad()  
{  
//  alert(document.protocol);  
    //var i = document.uniqueID;  
    var i = navigator.appName;  
    var b = navigator.userAgent;  
}  
function get_MainInfo()  
{  
    var filename ;  
    filename="this";  
    filename = QvodPlayer.get_MainInfo();  
    alert(filename);  
}  
function get_TaskDown()  
{  
    var taskdown1 = QvodPlayer.get_CurTaskProcess();  
    alert(taskdown1);  
}  
  
function StartNextDownFile()  
{  
    alert(QvodPlayer.get_CurTaskProcess());  
    if(QvodPlayer.get_CurTaskProcess() > 600 && !bstartnextplay)  
    {  
        var url = 'qvod://69999035|DBE1429630008370A3F01A38FC0C741ED648E9C0|香格里拉01.rmvb|';  
        var rv = QvodPlayer.StartNextDown(url);  
        bstartnextplay = true;  
    }  
}  

 

 
补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,