<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&reg;Windows&reg; 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();

                }
            }

posted on 2010-08-05 13:06  酷&酷  阅读(3547)  评论(0编辑  收藏  举报