<!DOCTYPE html>
<!--[if lt IE 9]>
<html class="degrade">
<![endif]-->
<html>
<head>
<meta charset="gb2312" />
<title>迅雷APlayer媒体播放引擎</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div id="divDemo" class="sec present">
<div class="header">
<h1>此页需要<a href='http://aplayer.open.xunlei.com/'>迅雷APlayer媒体播放引擎</a>或<a href='http://www.kankan.com/app/xmp.html'>迅雷看看</a>支持,不能显示播放器请先下载安装!</h1>
<h2>演示<i></i></h2><span>在线播放 FLV 封装的 H.265 视频 (分辨率1280x544、码率1120Kbps)</span>
</div>
<object
id="Player"
width="990"
height="550"
classid="CLSID:23A860E9-0C41-4E01-9206-D3FC0E413645"
style="left:20; top:90;" VIEWASTEXT>
<embed
id="Player_FF"
type="application/x-thunder-aplayer"
width="990"
height="550"
clsid="{23A860E9-0C41-4E01-9206-D3FC0E413645}"
Event_OnStateChanged="OnStateChanged"
Event_OnFlashCall="OnFlashCall"
Event_OnFlashReadyStateChange="OnFlashReadyStateChange"
Event_OnDocumentComplete="OnDocumentComplete"
Event_OnPictureLBtnDown="OnPictureLBtnDown"
Event_OnOpenSucceeded="OnOpenSucceeded">
</embed>
</object>
<script type="text/javascript">
var EventUtil =
{
addHandler: function(element, type, handler)
{
if (element.addEventListener) {
element.addEventListener(type, handler, false);
}
else {
element.attachEvent("on" + type, handler);
}
},
removeHandler: function(element, type, handler)
{
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
}
else {
element.detachEvent("on" + type, handler);
}
}
};
</script>
<script type="text/javascript">
var player = null;
var Aplayer = null;
var ID1 = null;
var flash1 = null;
var ID2 = null;
var flash2 = null;
var bShow = true;
var bEnable = false;
var position = null;
var duration = null;
var unloadhandler = function()
{
if (ID1 != null) {
player.RemoveElement(ID1);
ID1 = null;
flash1 = null;
}
if (ID2 != null) {
player.RemoveElement(ID2);
ID2 = null;
flash2 = null;
}
};
var loadhandler = function()
{
player = GetElementById("Player");
Aplayer = player.GetAPlayerObject();
if(player == null || Aplayer == null)
return;
player.ShowDefaultControlBar(false, 40);
ID1 = Aplayer.Open(
http://f1.flv.kankan.xunlei.com/data/cdn_transfer/demo.hflv);
player.SetElementPosition(ID1, 7, 0, 0, 100, 100);
player.SetElementVisible(ID1, true);
player.ShowDefaultControlBar(bShow, 40);
player.SetElementVisible(ID1, true);
flash1 = player.GetElementObject(ID1);
};
function UpdateTime()
{
var text = null;
if (Aplayer != null)
{
if (Aplayer.GetState() == 5)
{
position = Aplayer.GetPosition();
position = MillisecondToText(position);
var p = Aplayer.GetBufferProgress();
if (p == -1)
text = position + " / " + duration;
else
text = position + " / " + duration + " (正在缓冲..." + p + "%)";
var para = "<invoke name=\"callflash\" returntype=\"xml\"><arguments><string>";
para = para + text;
para = para + "</string></arguments></invoke>";
player.CallFlashFunction(ID1, para);
}
else
{
var nResult = Aplayer.GetConfig(7);
if(nResult != 0 && nResult != 1)
text= "播放失败, 错误码 = " + nResult;
else
text = "";
}
}
setTimeout(function () { UpdateTime(); }, 1000);
}
UpdateTime();
function OnOpenSucceeded() {
var nDuration = Aplayer.GetDuration();
duration = MillisecondToText(nDuration);
}
function OnDocumentComplete(nID, URL)
{
//alert("ID="+nID+", 网页 "+URL+" 加载完成!");
}
/*function thisMovie(movieName)
{
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
}
else {
return document[movieName];
}
}*/
function GetElementById(Id)
{
if (navigator.appName.indexOf("Microsoft") != -1) {
return document.getElementById(Id);
}
else {
return document.getElementById(Id+"_FF");
}
}
EventUtil.addHandler(window, "load", loadhandler);
EventUtil.addHandler(window, "unload", unloadhandler);
</script>
<h1>注:IE10,IE11的请使用兼容模式运行,否则不能正常播放!</h1>
</body>
</html>