<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LiveVideoPlay.aspx.cs"
    Inherits="RM.Web.Live.LiveVideoPlay" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <title>
        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveVideoPlay_Title")%>
    </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css" media="screen">
        html, body { height: 100%; }
        body { margin: 0; padding: 0; overflow: auto; text-align: center; background-color: #ececec; }
        #flashContent { display: none; }
        .closeLiveResult { width: 1000px; margin: 0 auto; }
        .closeLiveResult { margin-top: 10px; background-color: #FFF; border: 1px solid #DEDEDE; box-shadow: 0 6px 9px -8px rgba(0, 0, 0, 0.5); display: none; font-size: 16pt; font-weight: bold; color: #4cb7db; text-align: center; height: 300px; line-height: 300px; }
        .warningImg { vertical-align: middle; }
    </style>
    <link rel="stylesheet" type="text/css" href="history/history.css" />
    <script type="text/javascript" src="history/history.js"></script>
    <script type="text/javascript" src="swfobject.js"></script>
    <script src="../Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <link href="../Themes/Scripts/ShowMsg/msgbox.css" rel="stylesheet" type="text/css" />
    <script src="../Themes/Scripts/ShowMsg/msgbox.js" type="text/javascript"></script>
</head>
<body>
    <div style="height: 53px; background-color: White;">
        <div style="width: 1000px; margin: 0 auto; text-align: left;">
            <img src="Images/liveroom_logo.gif" />
            <div style="float: right; font-size: 12px; margin-right: 10px; margin-top: 20px;"
                id="headname">
            </div>
        </div>
    </div>
    <div id="page" style="width: 1050px; margin: 0 auto; position: relative; top: 0;">
        <div id="a1" style="height: 600px;">
        </div>
    </div>
  <input type="hidden" id="data" value='<%=url %>' />
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <script type="text/javascript" src="/Training/Learn/m/ckplayer/ckplayer.js" charset="utf-8"></script>
    <script src="/live/swfobject.js" type="text/javascript"></script>
    <script type="text/javascript">
        var data = $("#data").val();
        data = JSON.parse(data);
        var index = 0;
        $(function () {
            if (data.length > 0) {
                DataLive();
            } else {
                alert("该直播暂未上传直播录像");
                window.close();
            }
        });
        function DataLive() {
            if ((parseInt(index) + parseInt(1)) > data.length) {
                alert("播放结束");
                window.close();
            } else {

                trysee(data[index].Url);
            }
            index++;
        }
        function trysee(url) {
            if (url == "") {
                alert("该直播暂未上传直播录像");
                window.close();
            }
            url = jiema(url);
            //url = "/Resources/movie/tara.mp4";
            var flashvars = { f: url, c: 0, b: 0, p: 1, e: 0, h: 3, j: 300, loaded: 'loadedHandler' };
            var params = { bgcolor: '#000', allowFullScreen: true, allowScriptAccess: 'always', wmode: 'opaque' };
            var video = [url + '->video/mp4'];
            var houzhui = url.substring(url.lastIndexOf(".") + 1); //获得主视频后缀名
            if (houzhui.indexOf("?") >= 0) {
                houzhui = url.substring(url.lastIndexOf(".") + 1, url.lastIndexOf("?"));
            }
            if (houzhui == "flv" || houzhui == "mp4") {
                CKobject.embed('/Training/Learn/m/ckplayer/ckplayer.swf', 'a1', 'ckplayer_a1', '100%', '100%', false, flashvars, video, params);
            }
            else if (houzhui == "swf") {
                var swfVersionStr = "10.0.0";
                var xiSwfUrlStr = "playerProductInstall.swf";
                var flashvars = {};
                var params = {};
                params.quality = "high";
                params.bgcolor = "#ececec";
                params.allowscriptaccess = "sameDomain";
                params.allowfullscreen = "true";
                var attributes = {};
                attributes.id = "trysee";
                attributes.name = "trysee";
                attributes.align = "middle";
                swfobject.embedSWF(url, "a1", "100%", "100%", swfVersionStr, xiSwfUrlStr, null, params, attributes);
            } else if (houzhui == "htm" || houzhui == "html") {
                jQuery("#a1").html("<iframe scrolling=\"no\" src=\"" + url + "\" frameborder=\"0\" width=\"100%\" height=\"100%\"></iframe>");
            } else {
               
                alert("目前暂不支持本课程播放，请浏览其它课程");
            }

        }
        function loadedHandler() {
            CKobject.getObjectById('ckplayer_a1').addListener('ended', 'endHandler');
        }
        function endHandler() {

            DataLive();
        }

        var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
        function jiema(str) { var c1, c2, c3, c4; var i, len, out; len = str.length; i = 0; out = ""; while (i < len) { do { c1 = base64DecodeChars[str.charCodeAt(i++) & 255] } while (i < len && c1 == -1); if (c1 == -1) { break } do { c2 = base64DecodeChars[str.charCodeAt(i++) & 255] } while (i < len && c2 == -1); if (c2 == -1) { break } out += String.fromCharCode((c1 << 2) | ((c2 & 48) >> 4)); do { c3 = str.charCodeAt(i++) & 255; if (c3 == 61) { return out } c3 = base64DecodeChars[c3] } while (i < len && c3 == -1); if (c3 == -1) { break } out += String.fromCharCode(((c2 & 15) << 4) | ((c3 & 60) >> 2)); do { c4 = str.charCodeAt(i++) & 255; if (c4 == 61) { return out } c4 = base64DecodeChars[c4] } while (i < len && c4 == -1); if (c4 == -1) { break } out += String.fromCharCode(((c3 & 3) << 6) | c4) } return out };
    </script>
</body>
</html>
