<script>
function show(ur, id) {
var plaryer = document.getElementById("mediaplayer1")
for (var i = 0; i < plaryer.currentPlaylist.count; i++) {
// alert(plaryer.currentPlaylist.Item(i).getItemInfo("Title"));
if (plaryer.currentPlaylist.Item(i).getItemInfo("Title") == id) { //根據div中vid與播放器title進行對應
plaryer.controls.playItem(plaryer.currentPlaylist.Item(i)); //指定播放第幾首
plaryer.controls.CurrentPosition = ur; //設定播放的時間
}
}
}
function pause() {
var vID = document.getElementById("mediaplayer1").currentMedia.getItemInfo("Title");
// alert(s);
var current_time = document.getElementById("MediaPlayer1").controls.currentPosition;
var current_times = parseInt(current_time);
var obj = window.top.frames['PPTSld'];
var returns = obj.document.getElementsByName("showsd");
if (returns.length > 0) return returns;
returns = new Array();
var e = obj.document.getElementsByTagName("div");
var urls = obj.location.href; //擷取url中"?"符後的字串
var url = "";
var va = "";
if (urls.indexOf("#") >= 0) {
url = urls.substr(0, urls.indexOf("#"));
va = urls.substr(urls.indexOf("#"), urls.length);
} else {
url = urls;
}
var j = 0;
for (var i = 0; i < e.length; i++) {
if (e[i].getAttribute("name") == "showsd") {
if (e[i].className != "box2") {
e[i].className = "box2"; //回複樣式
}
if (e[i].getAttribute("vID") == vID) {
if (current_times >= e[i].getAttribute("timeflag")) {//判斷目前時間如果小於找到的ppt時間則現正播放該ppt
j = i;
}
}
}
if (i + 1 == e.length) {
// alert(e[i].getAttribute("id"));
if (va == "") {
obj.location.href = url + "#" + e[j].getAttribute("id");
} else {
if (va != "#" + e[j].getAttribute("id")) {
//alert(va);
obj.location.href = url + "#" + e[j].getAttribute("id");
// alert(obj.location.href);
}
}
if (e[j].className != "") {
e[j].className = "box"//改變其樣式讓其現正播放
}
}
}
setTimeout('pause()', 1000);
}
// alert(document.getElementById("mediaplayer1").GetMediaInfoString(9));
</script>
</head>
<body onload="pause()">
<form id="form1" runat="server">
<div id="txt" style="color: #ff0000; font-weight: bold; font-size: 18px; font-family: arial">
<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="286" height="255"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,
52,701" id="MediaPlayer1" type="application/x-oleobject" standby="Loading Microsoft®Windows® Media Player components...">
<param name="AutoStart" value="-1" />
<!--是否自動播放-->
<param name="Balance" value="0" />
<!--調整左右聲道平衡,同上面舊播放器代碼-->
<param name="enabled" value="-1" />
<!--播放器是否可人為控制-->
<param name="EnableContextMenu" value="-1" />
<!--是否啟用操作功能表-->
<param name="url" value='<%=url %>' />
<!--播放的檔案地址-->
<param name="PlayCount" value="1000" />
<!--播放次數控制,為整數-->
<param name="rate" value="1" />
<!--播放速率控制,1為正常,允許小數,1.0-2.0-->
<param name="currentPosition" value="0" />
<!--控制項設定:當前位置-->
<param name="currentMarker" value="0" />
<!--控制項設定:當前標記-->
<param name="defaultFrame" value="" />
<!--顯示預設架構-->
<param name="invokeURLs" value="-1" />
<!--指令碼命令設定:是否調用URL-->
<param name="baseURL" value="" />
<!--指令碼命令設定:被調用的URL-->
<param name="stretchToFit" value="0" />
<!--是否按比例伸展-->
<param name="volume" value="50" />
<!--預設聲音大小0%-100%,50則為50%-->
<param name="mute" value="0" />
<!--是否靜音-->
<param name="uiMode" value="Full" />
<!--播放器顯示模式:Full顯示全部;mini最簡化;None不顯示播放控制,只顯示視頻視窗;invisible全
部不顯示-->
<param name="windowlessVideo" value="0" />
<!--如果是0可以允許全屏,否則只能在視窗中查看-->
<param name="fullScreen" value="0" />
<!--開始播放是否自動全屏-->
<param name="enableErrorDialogs" value="-1" />
<!--是否啟用錯誤提示報告-->
<param name="SAMIFilename" />
<!--字幕ID-->
<param name="DisplaySize" value="3" />
<param name="ShowDisplay" value="1">
</object>
<div id="mu" runat="server">
</div>
</div>
</form>
</body>
</html>
<script>
function goNote(pa) {
var obj = window.top.frames['PPTOtl'];
var vid = pa.vID;
var plaryer = obj.document.getElementById("mediaplayer1");
//alert(plaryer.currentPlaylist.Item(0));
var titles = plaryer.currentMedia.getItemInfo("Title");
//alert(plaryer.currentPlaylist.Item(1).getItemInfo("Title"));
for (var i = 0; i < plaryer.currentPlaylist.count; i++) {
// alert(plaryer.currentPlaylist.Item(i).getItemInfo("Title"));
if (plaryer.currentPlaylist.Item(i).getItemInfo("Title") == vid) { //根據div中vid與播放器title進行對應
plaryer.controls.playItem(plaryer.currentPlaylist.Item(i)); //指定播放第幾首
plaryer.controls.CurrentPosition = pa.timeflag;
}
}
}
</script>
asx播放清單:
if (!IsPostBack)
{
// string s = Request.ServerVariables["HTTP_REFERER"].ToString();
//string s = Request.UrlReferrer.ToString();
//Session["video"] != null
if (Session["video"] != null)
{
int vID = 0;
if (Request.QueryString["vID"] != null)
{
vID = int.Parse(Request.QueryString["vID"].ToString());
}
string sql = "select paths,pID from voidepathtb where vID=" + vID;
DataTable dt = DBHelper.GetDataTable(sql, CommandType.Text, null);
Response.Clear();
string Info = "<asx version=\"3.0\">";
for (int i = 0; i < dt.Rows.Count; i++)
{
Info += "<entry><title>" + dt.Rows[i]["pID"].ToString() + "</title><ref href=" + "\"" + Server.UrlPathEncode(dt.Rows[i]["paths"].ToString()) + "\" /></entry>";
}
Info += "</asx>";
Response.Write(Info);
Session.Remove("video");
Response.End();
}
}