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

<!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>
        <%=liveName %>-<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room")%>
    </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 onload="myfunction()">
        

<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="flashContent">
            <p>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room_flash")%>.
            </p>
            <script type="text/javascript">
                var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
                document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
								+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>"); 
            </script>
        </div>
        <noscript>
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"
                id="TKSLIVE">
                <param name="movie" value="TKSLIVE.swf" />
                <param name="wmode" value="opaque"/> 
                <param name="quality" value="high" />
                <param name="bgcolor" value="#ececec" />
                <param name="allowScriptAccess" value="sameDomain" />
                <param name="allowFullScreen" value="true" />
                <!--[if !IE]>-->
                <object type="application/x-shockwave-flash" data="TKSLIVE.swf" width="100%" height="100%">
                     <param name="wmode" value="opaque"/> 
                    <param name="quality" value="high" />
                    <param name="bgcolor" value="#ececec" />
                    <param name="allowScriptAccess" value="sameDomain" />
                    <param name="allowFullScreen" value="true" />
                    <!--<![endif]-->
                    <!--[if gte IE 6]>-->
                    <p>
                        Either scripts and active content are not permitted to run or Adobe Flash Player
                        version 10.0.0 or greater is not installed.
                    </p>
                    <!--<![endif]-->
                    <a href="http://www.adobe.com/go/getflashplayer">
                        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
                            alt="Get Adobe Flash Player" />
                    </a>
                    <!--[if !IE]>-->
                </object>
                <!--<![endif]-->
            </object>
        </noscript>
        
        
        <div id="chattext" style=" position:absolute; right:0;top:0px;margin:0; padding:5px; width:190px;height:440px;word-wrap: 
         break-word;text-align:left;overflow-y:auto;font-size:12px;z-index:999;"></div>
    </div>


    

    <div class="closeLiveResult" id="closeWarning">
        <img src="/LiveTelecast/Images/LiveWarning.png" alt="" class="warningImg" />
        <span id="warningText">
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room_end")%></span>
    </div>
   
        
    <script type="text/javascript">

      
        function myfunction(){
        $("#chattext").css("top",(window.innerHeight-600)/2);
         var browser = {
            versions: function () {
                var u = navigator.userAgent, app = navigator.appVersion;
                return {         //移动终端浏览器版本信息
                    trident: u.indexOf('Trident') > -1, //IE内核
                    presto: u.indexOf('Presto') > -1, //opera内核
                    webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                    gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
                    mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                    ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                    android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
                    iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
                    iPad: u.indexOf('iPad') > -1, //是否iPad
                    wp: u.indexOf('IEMobile') > -1, //是否wp
                    symbianos: !!u.match(/SymbianOS.*/), //是否SymbianOS
                    webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部
                };
            } (),
            language: (navigator.browserLanguage || navigator.language).toLowerCase()
        }
            if (browser.versions.mobile || browser.versions.ios || browser.versions.android || browser.versions.symbianos || browser.versions.wp) {
            
                   window.location.href="/Live/Video.aspx?rid=<%=roomId %>&bookname="+encodeURI("<%=LiveTelecast_Name%>");
            }
            else {
              //window.location.href="/Live/Video.aspx?rid=<%=roomId %>&bookname="+encodeURI("<%=LiveTelecast_Name%>");
                //alert("电脑");
                //m1();
            }
        }
     //得到QueryString
        function QueryString(fieldName) {
            var urlString = document.location.search;
            if (urlString != null) {
                var typeQu = fieldName + "=";
                var urlEnd = urlString.indexOf(typeQu);
                if (urlEnd != -1) {
                    var paramsUrl = urlString.substring(urlEnd + typeQu.length);
                    var isEnd = paramsUrl.indexOf('&');
                    if (isEnd != -1) {
                        return paramsUrl.substring(0, isEnd);
                    }
                    else {
                        return paramsUrl;
                    }
                }
                else {
                    return "";
                }
            }
            else {
                return "";
            }
        }



       

    var a="<%=item.LiveTelecast_CreateUserId%>";  
    var b="<%=LiveTelecast_TeacherId %>";

    if(a!=b){
    var flashvars = {
            	rid:'<%=roomId %>',
            	name:'<%=item.LiveTelecast_CreateUserName %>',
            	id:'<%=item.LiveTelecast_CreateUserId%>',
            	type:<%=item.LiveTelecast_InType=="3"?0:item.LiveTelecast_InType=="1"?1:item.LiveTelecast_InType=="2"?1:item.LiveTelecast_InType=="4"?1:0 %>,
            	rtmpGo:'<%=RM.Common.DotNetConfig.ConfigHelper.GetAppSettings("rtmpGo")%>', 
            	rtmpVideo:'<%=RM.Common.DotNetConfig.ConfigHelper.GetAppSettings("RmtpURLvLive")%>',
            	rtmpWhiteboard:'<%=RM.Common.DotNetConfig.ConfigHelper.GetAppSettings("RmtpURLvLive")%>',
            	//rtmpWhiteboard:'rtmp://vlive2.rtmp.cdn.ucloud.com.cn/ucloud/',
            	//rtmpVideo:'<%=RM.Common.DotNetConfig.ConfigHelper.GetAppSettings("RmtpURL")%>',
            	//rtmpWhiteboard:'<%=RM.Common.DotNetConfig.ConfigHelper.GetAppSettings("RmtpURL")%>',
            	tkspath: tksurl,
                record:'<%=IsVideo%>',
                bookname:"<%=LiveTelecast_Name%>",
                data:"<%=LiveTelecast_StartDate%>",
                createuserName:"<%=LiveTelecast_Teacher%>",
                teacherid:"<%=LiveTelecast_TeacherId %>"
     };
    var swfVersionStr = "10.0.0";
    var xiSwfUrlStr = "playerProductInstall.swf";
    var tksurl='http://'+window.location.host;
    var params = {quality:"high",bgcolor:"#ececec",allowscriptaccess:"sameDomain",allowfullscreen:"true"};
    var attributes = {id:"TKSLIVE",name:"TKSLIVE",align:"middle"};
        params.wmode = "opaque";  
        var id = getCookie("liveroomT-"+flashvars.rid);
        if(id == flashvars.id){
                    showWarning("很抱歉，您已经被管理员T出直播间！");
                   window.location.reload(); 
        }
        else{
             document.getElementById("headname").innerHTML = "您好，"+flashvars.name;
              var h = document.documentElement.clientHeight;
              swfobject.embedSWF("TKSLIVE.swf", "flashContent", "1100",h-53,swfVersionStr, xiSwfUrlStr,flashvars, params, attributes);
              swfobject.createCSS("#flashContent", "display:block;text-align:left;");
       }
   }
   else{
        showWarning("请主讲人，使用软件登陆！！");
   }


    window.onbeforeunload = onbeforeunload_handler;
    function onbeforeunload_handler() {
        var warning = "";
        var fxControl = document.TKSLIVE || window.TKSLIVE;
        if (fxControl)
            if (typeof fxControl.getUnsavedDataWarning == "function")
                warning = fxControl.getUnsavedDataWarning();    //This calls a function in our Flex app  

        if (warning != '')
            return warning;
        else
            return void (0);
    }

    //window.onunload = function () {
      function m1(){
        var fxControl = document.TKSLIVE || window.TKSLIVE;
        if (fxControl)
            if (typeof fxControl.javascriptOnUnload == "function")
                fxControl.javascriptOnUnload();  // This calls a function in our Flex app  
      }
    function close() {
        ///<summary>
        ///踢出
        ///</summary>
        SetCookie("liveroomT-"+flashvars.rid,flashvars.id);
        showWarning("您已经被老师从直播间中移出！");
        reload();
    }
    function showWarning (text) {
            /// <summary>
            ///     1: 页面呈现指定的警告内容【注：此页面数据将被移除，不可再用】
            ///     &#10;    1.1 - showWarning(text) - 在页面中呈现指定的警告内容，同时将该页面数据清空，注：所有被清空的内容不再恢复，之后页面将无法进行任何操作
            /// </summary>
            /// <param name="text" type="String">
            ///     要显示的警告内容
            /// </param>
            /// <returns type="String" />
            var obj = document.getElementById('content');
            var closeBtn = document.getElementById('liveClose');
            var page = document.getElementById('page');
            if (obj) {
                obj.parentNode.removeChild(obj);
            }
            if (closeBtn) {
                closeBtn.parentNode.removeChild(closeBtn);
            }
            if(page){
                page.parentNode.removeChild(page);
            }
            document.getElementById('warningText').innerHTML = text ? text : '<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room_end")%>';
            document.getElementById('closeWarning').style.display = 'block';
             
            
    }
     
     function send(message){
     	$('#chattext').append(message);
     	$('#chattext').scrollTop($("#chattext").height());
     }
     function texthide(){
        $('#chattext').hide();
       
     }
     function textshow(){
      $('#chattext').show();
     } 
    function livelog(msg) {
        ///<summary>
        ///日志
        ///</summary>
        console.log(msg)
    }
    function SetCookie(name, value)
    {
        var Days = 1; 
        var exp = new Date();    //new Date("December 31, 9998");
        exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
        document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
    }

    function getCookie(name)//取cookies函数        
    {
        var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
        if (arr != null) return unescape(arr[2]); return null;
    }
    </script>
</body>
</html>
