<?php

$login = query_string('1');

$verifica_stm = @mysqli_fetch_array(@mysqli_query($conexao,"SELECT COUNT(*) as total FROM streamings where login = '".$login."'"));

if($verifica_stm["total"] == 0) {
	die('<style> body { margin:0; padding:0; background-color:#000000}</style><div style="width:100%;text-align:center;margin-top:30%;font-size: 14px;font-family: Geneva, Arial, Helvetica, sans-serif;color:#FFFFFF;padding-left: 10px; padding-right: 10px"><img width="256" height="256" src="/app/img-app-offline.png" alt="Radio Offline" title="Radio Offline"><br><br><br><br><br>Estamos atualizando nosso App, por favor volte em alguns minutos.<br><br>We are updating our App, please come back in a few minutes.<br><br>Estamos actualizando nuestro App, por favor regrese en unos pocos minutos.</div>');
}

$dados_config = @mysqli_fetch_array(@mysqli_query($conexao,"SELECT * FROM configuracoes"));
$dados_stm = @mysqli_fetch_array(@mysqli_query($conexao,"SELECT * FROM streamings where login = '".$login."'"));
$dados_servidor = @mysqli_fetch_array(@mysqli_query($conexao,"SELECT * FROM servidores where codigo = '".$dados_stm["codigo_servidor"]."'"));

$logo_webtv = (file_exists("app/logo-".$dados_stm["login"].".png")) ? "/app/logo-".$dados_stm["login"].".png" : "/app/img-app-logo.png";
$background_webtv = (file_exists("app/background-".$dados_stm["login"].".jpg")) ? "background: url('/app/background-".$dados_stm["login"].".jpg') bottom / cover no-repeat;" : "background: #000000";

$array_lang = array(
	"pt-br" => array("redes_sociais" => "Redes Sociais", "avaliar" => "Avaliar", "politica" => "Pol&iacute;tica & Privacidade", "compartilhar" => "Compartilhar", "pedir_musica" => "Pedir M&uacute;sica", "voltar" => "Voltar", "aviso_bg" => "Nosso app n&atilde;o executa o audio quando a tela esta desligada em alguns modelos de celular.<br><br>Para escutar nossa webtv seu celular deve estar com a tela ativa."),
	"en" => array("redes_sociais" => "Social Networks", "avaliar" => "Rate", "politica" => "Privacy Policy.", "compartilhar" => "Share", "pedir_musica" => "Request Song", "voltar" => "Back", "aviso_bg" => "Our app does not play audio when the screen is off on some cell phone models.<br><br>To listen to our webtv, your cell phone must have the screen active."),
	"es" => array("redes_sociais" => "Redes Sociales", "avaliar" => "Calificar", "politica" => "Pol&iacute;tica de Privacidad", "compartilhar" => "Compartir", "pedir_musica" => "Pedir Canci&oacute;n", "voltar" => "Volver", "aviso_bg" => "Nuestra aplicaci&oacute;n no reproduce audio cuando la pantalla est&aacute; apagada en algunos modelos de tel&eacute;fonos celulares.<br><br>Para escuchar nuestra webtv, su tel&eacute;fono celular debe tener la pantalla activa.")
);

/*
$db_player_app = @file_get_contents("app/player-app.db");
$busca_ip_db = explode("-", $db_player_app);
if(!in_array($_SERVER['REMOTE_ADDR'], $busca_ip_db)) {
@file_put_contents("app/player-app.db", $_SERVER['REMOTE_ADDR']."-", FILE_APPEND);
$exibir_aviso = "sim";
}
*/
?>
<?php if(empty(query_string('2'))) { ?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<title>Player</title>
<meta name=apple-touch-fullscreen content=yes>
<meta name=apple-mobile-web-app-capable content=yes>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.6.1/sweetalert2.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.6.1/sweetalert2.css">
<style>html { height: 100%; }body { margin:0; padding:0;font-family:Poppins,sans-serif;min-height: 100%;<?php echo $background_webtv ?>}#player-app-volumewrapper{display: none;}#player-app-buttonvolumeoff{display: none;}#player-app-buttonvolumeon{display: none;}#player-app-textvolumeend{display: none;}<?php if($status_conexao_transmissao != "aovivo") { echo '#player-app-iconlive{display: none;}'; } else { echo '#player-app-iconlive{fill: rgb(255 0 0 / 100%)!important;}'; } ?>#player-app-buttonanalyzer{display: none;}.icone-menu{position:absolute;left:0;top:0;width: 32px;height: 32px;padding-left: 5px;padding-bottom: 10px; margin: 10px; border-radius: 3px;color: #FFFFFF;font-size: 32px;text-align: center;z-index: 500;}@import url(https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700);p{font-family:Poppins,sans-serif;font-size:1.1em;font-weight:300;line-height:1.7em;color:#999}a,a:focus,a:hover{color:inherit;text-decoration:none;transition:all .3s}.navbar{padding:15px 10px;background:#fff;border:none;border-radius:0;margin-bottom:40px;box-shadow:1px 1px 3px rgba(0,0,0,.1)}.navbar-btn{box-shadow:none;outline:0!important;border:none}.line{width:100%;height:1px;border-bottom:1px dashed #ddd;margin:40px 0}#sidebar{width:250px;position:fixed;top:0;left:-250px;height:100vh;z-index:999;background:<?php echo $dados_stm["app_cor_menu_claro"]; ?>;color:#fff;transition:all .3s;overflow-y:scroll;box-shadow:3px 3px 3px rgba(0,0,0,.2);overflow: hidden}#sidebar.active{left:0}#dismiss{width:30px;height:30px;line-height:30px;text-align:center;background:<?php echo $dados_stm["app_cor_menu_claro"]; ?>;position:absolute;top:10px;right:10px;cursor:pointer;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s}#dismiss2{width:70px;height:30px;line-height:30px;text-align:center;background:<?php echo $dados_stm["app_cor_menu_claro"]; ?>;position:absolute;top:5px;left:5px;cursor:pointer;color: #FFFFFF;}#dismiss:hover{background:#fff;color:<?php echo $dados_stm["app_cor_menu_claro"]; ?>}.overlay{display:none;position:fixed;width:100vw;height:100vh;background:rgba(0,0,0,.7);z-index:998;opacity:0;transition:all .5s ease-in-out}.overlay.active{display:block;opacity:1}#sidebar .sidebar-header{padding:20px;background:<?php echo $dados_stm["app_cor_menu_escuro"]; ?>}#sidebar ul.components{padding:20px 0;}#sidebar ul p{color:#fff;padding:10px}#sidebar ul li a{padding:10px;font-size:1.1em;display:block}#sidebar ul li a:hover{color:<?php echo $dados_stm["app_cor_menu_claro"]; ?>;background:#fff}#sidebar ul li.active>a,a[aria-expanded=true]{color:#fff;background:<?php echo $dados_stm["app_cor_menu_escuro"]; ?>}a[data-toggle=collapse]{position:relative}.dropdown-toggle::after{display:block;position:absolute;top:50%;right:20px;transform:translateY(-50%)}ul ul a{font-size:.9em!important;padding-left:30px!important;background:<?php echo $dados_stm["app_cor_menu_escuro"]; ?>}ul.CTAs{padding:20px}ul.CTAs a{text-align:center;font-size:.9em!important;display:block;border-radius:5px;margin-bottom:5px}a.download{background:#fff;color:<?php echo $dados_stm["app_cor_menu_claro"]; ?>}a.article,a.article:hover{background:<?php echo $dados_stm["app_cor_menu_escuro"]; ?>!important;color:#fff!important}#content{width:100%;padding:20px;min-height:100vh;transition:all .3s;position:absolute;top:0;right:0}.chromeframe{margin:.2em 0;background:#ccc;color:#000;padding:.2em 0}#loader-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000}#loader{display:block;position:relative;left:50%;top:50%;width:150px;height:150px;margin:-75px 0 0 -75px;border-radius:50%;border:3px solid transparent;border-top-color:#3498db;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite;z-index:1001}#loader:before{content:"";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-radius:50%;border:3px solid transparent;border-top-color:#e74c3c;-webkit-animation:spin 3s linear infinite;animation:spin 3s linear infinite}#loader:after{content:"";position:absolute;top:15px;left:15px;right:15px;bottom:15px;border-radius:50%;border:3px solid transparent;border-top-color:#f9c922;-webkit-animation:spin 1.5s linear infinite;animation:spin 1.5s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}}#loader-wrapper .loader-section{position:fixed;top:0;width:51%;height:100%;background:#222;z-index:1000}#loader-wrapper .loader-section.section-left{left:0}#loader-wrapper .loader-section.section-right{right:0}.loaded #loader-wrapper .loader-section.section-left{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);-webkit-transition:all .7s .3s cubic-bezier(.645,.045,.355,1);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}.loaded #loader-wrapper .loader-section.section-right{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);-webkit-transition:all .7s .3s cubic-bezier(.645,.045,.355,1);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}.loaded #loader{opacity:0;-webkit-transition:all .3s ease-out;transition:all .3s ease-out}.loaded #loader-wrapper{visibility:hidden;-webkit-transform:translateY(-100%);-ms-transform:translateY(-100%);transform:translateY(-100%);-webkit-transition:all .3s 1s ease-out;transition:all .3s 1s ease-out}.ir{background-color:transparent;border:0;overflow:hidden}.ir:before{content:"";display:block;width:0;height:150%}.hidden{display:none!important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.clearfix:after,.clearfix:before{content:" ";display:table}.clearfix:after{clear:both}</style>
</head>
<body>
<div id="loader-wrapper"><div id="loader"></div><div class="loader-section section-left"></div><div class="loader-section section-right"></div></div>
<div class="icone-menu"><button type="button" id="sidebarCollapse" class="btn btn-sm"><i class="fa fa-bars"></i></button></div>
<nav id="sidebar">
   <div id="dismiss">
      <i class="fa fa-arrow-left"></i>
   </div>
   <div class="sidebar-header">
      <h4><?php echo utf8_encode($dados_stm["app_nome"]); ?></h3>
   </div>
   <ul class="list-unstyled components">
   	<?php if($dados_stm["app_url_facebook"] || $dados_stm["app_url_instagram"] || $dados_stm["app_url_twitter"] || $dados_stm["app_url_site"]) { ?>
      <li>
	      <a href="#redessociais" data-toggle="collapse" aria-expanded="false"><i class="fa fa-heart"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["redes_sociais"]; ?></a>
	      <ul class="collapse list-unstyled" id="redessociais">
	      	<?php if($dados_stm["app_url_facebook"]) { ?>
	         <li>
	            <a href="<?php echo $dados_stm["app_url_facebook"]; ?>" ><i class="fa fa-facebook-official"></i> Facebook</a>
	         </li>
	        <?php } ?>
	      	<?php if($dados_stm["app_url_instagram"]) { ?>
	         <li>
	            <a href="<?php echo $dados_stm["app_url_instagram"]; ?>"><i class="fa fa-instagram"></i> Instagram</a>
	         </li>
	        <?php } ?>
	      	<?php if($dados_stm["app_url_twitter"]) { ?>
	         <li>
	            <a href="<?php echo $dados_stm["app_url_twitter"]; ?>"><i class="fa fa-twitter"></i> Twitter</a>
	         </li>
	        <?php } ?>
	      	<?php if($dados_stm["app_url_site"]) { ?>
	         <li>
	            <a href="#" onclick="abrir_link('<?php echo $dados_stm["app_url_site"]; ?>')"><i class="fa fa-globe"></i> Site</a>
	         </li>
	        <?php } ?>
	      </ul>
      </li>
    <?php } ?>
     <?php if($dados_stm["app_url_chat"]) { ?>
      <li>
         <a href="#" onclick="abrir_link('<?php echo $dados_stm["app_url_chat"]; ?>')"><i class="fa fa-comments"></i> Chat</a>
      </li>
     <?php } ?>
     <?php if($dados_stm["app_whatsapp"]) { ?>
      <li>
         <a href="whatsapp://send?phone=<?php echo $dados_stm["app_whatsapp"]; ?>"><i class="fa fa-whatsapp"></i> Whatsapp</a>
      </li>
     <?php } ?>
      <li>
         <a href="#app" data-toggle="collapse" aria-expanded="false"><i class="fa fa-tablet"></i> App</a>
         <ul class="collapse list-unstyled" id="app">
            <li>
               <a href="rateapp://"><i class="fa fa-thumbs-up"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["avaliar"]; ?></a>
            </li>
            <li>
               <a href="shareapp://"><i class="fa fa-share-alt"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["compartilhar"]; ?></a>
            </li>
            <li>
               <a href="#" onclick="abrir_link('/app/politica.html')"><i class="fa fa-gavel"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["politica"]; ?></a>
            </li>
            <?php if($dados_stm["app_email"]) { ?>
            <li>
               <a href="mailto:<?php echo $dados_stm["app_email"]; ?>"><i class="fa fa-envelope"></i> E-mail</a>
            </li>
     		<?php } ?>
         </ul>
      </li>
   </ul>
</nav>
<div id="conteudo_externo" style="position: absolute;left:0px;top:0px;width:100%;height:100%;background: #FFFFFF;margin:0;padding:0;z-index: 99999;display: none;">
<div style="width: 100%;height: 40px;margin:0;padding:0px 10px;background:<?php echo $dados_stm["app_cor_menu_escuro"]; ?>"><div id="dismiss2"><i class="fa fa-arrow-left" onclick="$('#conteudo_externo').hide();$('#iframe_conteudo_externo').attr('src', '');"> <?php echo $array_lang[$dados_stm["idioma_painel"]]["voltar"]; ?></i></div></div>
<iframe target="_parent" id="iframe_conteudo_externo" frameborder="0" src="" style="position: absolute;width:100%;height:100%;z-index: 99999"></iframe>
</div>
<div class="overlay"></div>
<div id="player-app-logo-conteudo" style="overflow: hidden; background: rgba(255, 255, 255, 0.1); user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); width: 256px; height: 256px; border: 10px solid rgba(255, 255, 255, 0.2); border-radius: 50%;margin: 15% auto">
	<div id="player-app-logo" style="height: 100%; width: 100%; overflow: hidden; transition: opacity 2s ease 0s; background: url('<?php echo $logo_webtv ?>') 0% 0% / cover no-repeat; border-radius: 50%;"></div>
</div>
<div id="nome_webtv" style="margin-top:60px; margin-left: auto; margin-right: auto; width: 95%; height: 40px; font-size: 35px; line-height: 40px; color: <?php echo $dados_stm["app_cor_texto"]; ?>;text-align: center; z-index: 9999"></div>
<a href="player://">
<div id="player-app-play" style="cursor: pointer; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); width: 112px; height: 112px;margin-top:60px; margin-left: auto; margin-right: auto;" onclick="$('#player-app-play').width('100px');$('#player-app-play').height('100px');">
	<div id="player-app-buttonplay" style="width: 100%; height: 100%; transition: fill 0.5s ease 0s; fill: rgb(255, 255, 255); user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><svg x="0px" y="0px" viewBox="0 0 800 800"><path d="M713.9,400.5c1.4,171.2-137.8,314.4-313.9,314.3c-175.6,0-314.2-143-314-315c0.2-171.3,140.6-313.9,315-313.4	C574,87,715.4,228.9,713.9,400.5z M279.5,400.3c0,23.1,0,46.2,0,69.3c0,20.8-0.2,41.7,0.1,62.5c0.1,12.2,6,21.1,17,26.6	c11,5.5,21.2,3,31.2-2.9c23.3-13.6,46.8-27,70.2-40.5c49.8-28.6,99.6-57.1,149.3-85.8c18.1-10.4,18.7-38.7,1.1-49.4	c-74.5-45.4-149-90.8-223.5-136.1c-6-3.7-12.6-5.5-19.8-4.2c-15.7,2.9-25.5,14.4-25.5,30.5C279.4,313.6,279.5,357,279.5,400.3z"></path></svg></div></div></a>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>		
<script>
function ajustes_navegador() {	
var altura_tela = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
$("#conteudo_externo").height(altura_tela);
$("#iframe_conteudo_externo").height(altura_tela-35);
$("#sidebarCollapse").delay(200).fadeOut(100);
$("#sidebarCollapse").delay(200).fadeIn(100);
}
function abrir_link(link) {
$("#conteudo_externo").show();
$("#iframe_conteudo_externo").attr("src", link);
$('#sidebar').removeClass('active');
$('.overlay').removeClass('active');
}
function marquee_nome_webtv() {

var nome = "<?php echo utf8_encode($dados_stm["app_nome"]); ?>";

if(nome.length > 22) {
$('#nome_webtv').hide().html('<marquee behavior="scroll" direction="left">'+nome+'</marquee>').fadeIn('slow');
} else {
$('#nome_webtv').hide().html(nome).fadeIn('slow');
}

}
$(document).ready(function () {
    $('#dismiss, .overlay').on('click', function () {
        $('#sidebar').removeClass('active');
        $('.overlay').removeClass('active');
    });
    $('#sidebarCollapse').on('click', function () {
        $('#sidebar').addClass('active');
        $('.overlay').addClass('active');
        $('.collapse.in').toggleClass('in');
       	$('a[aria-expanded=true]').attr('aria-expanded', 'false');
    });
	

setTimeout(ajustes_navegador,3000);
setTimeout(marquee_nome_webtv,2000);
setTimeout(function(){$('body').addClass('loaded');}, 1000);

});

</script>
</body>
</html>
<?php } else { ?>

<?php
if(query_string('3') == "checar-chave") {

$webrtc_chave = query_string('4');

if($dados_stm["webrtc_chave"] != $webrtc_chave || empty($webrtc_chave)){
unset($_SESSION["webrtc_chave"]);
echo "reload";
exit();
}

exit();
}

if($dados_servidor["nome_principal"]) {
$servidor = $dados_servidor["nome_principal"].".".$dados_config["dominio_padrao"];
} else {
$servidor = $dados_servidor["nome"].".".$dados_config["dominio_padrao"];
}

?>
<!DOCTYPE html>
    <html lang="pt-BR">
    <head>
      <title>Player</title>
  <script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
  <link type="text/css" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
  <script src="https://cdn.jsdelivr.net/npm/js-cookie@2.2.1/src/js.cookie.js" integrity="sha256-P8jY+MCe6X2cjNSmF4rQvZIanL5VwUUT4MBnOMncjRU=" crossorigin="anonymous"></script>
      <script type="text/javascript" src="/inc-webrtc/adapter-latest.js"></script>
      <link  href="/inc-webrtc/plyr.css" rel="stylesheet" />
    <script src="/inc-webrtc/plyr.polyfilled.js"></script>
  <title>Player</title>
<style>*{margin:0;}html,body{height:99%; background-color:#000000;overflow: hidden;}#play-video-container{z-index: 999;position: absolute;display:flex;justify-content:center;align-items:center;}#play-video-container, #player-video { height: 100vh; width: 100%;}.plyr{display: none;} .plyr__time, .plyr__progress, .plyr__control--overlaid{display: none!important;}</style>
</head>
<body>
<div id="play-video-container">
  <button id="player-btn" type="button" class="btn" style="z-index: 1000;"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512" style="fill:#ffffff; width: 72px; height: 72px; "><path d="M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c-7.6 4.2-12.3 12.3-12.3 20.9V344c0 8.7 4.7 16.7 12.3 20.9s16.8 4.1 24.3-.5l144-88c7.1-4.4 11.5-12.1 11.5-20.5s-4.4-16.1-11.5-20.5l-144-88c-7.4-4.5-16.7-4.7-24.3-.5z"/></svg></button>
<div class="alert alert-danger text-center" id="error-panel" style="display: none"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512" style="fill:#721c24; width: 32px; height: 32px; "><path d="M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"/></svg><br>Transmiss&atilde;o n&atilde;o dispon&iacute;vel no momento, tente novamente mais tarde.</div>
</div>
<video id="player-video" playsinline controls autoplay></video>
<script type="text/javascript" charset="utf-8">
let config_stm = {
    playSdpURL: "wss://<?php echo $servidor; ?>/webrtc-session.json",
    playApplicationName: "<?php echo $dados_stm["login"]; ?>",
    playStreamName: "<?php echo $dados_stm["webrtc_chave"]; ?>"
};
const player = new Plyr("#player-video", {disableContextMenu: true});
</script>
<script type="module" crossorigin="use-credentials" src="/inc-webrtc/play.js"></script>
<script type="text/javascript" charset="utf-8">
function checar_chave(){
    $.ajax({
    url: "/webrtc-app/<?php echo $dados_stm["login"]; ?>/player/checar-chave/<?php echo $dados_stm["webrtc_chave"]; ?>",
    success:
      function(resposta){
        if(resposta == "reload") {
          window.location.reload();
        }
      }
    })
}
window.onload = function() {
  checar_chave();
  setInterval (checar_chave,20000);
}
  </script>
</body>
</html>
<?php } ?>