<?php
ob_start(function($b){if(strpos($b, "<html")!==false) {return str_replace(PHP_EOL,"",$b);} else {return $b;}});
function status_ao_vivo($ip,$porta,$senha){$ch=curl_init();curl_setopt($ch,CURLOPT_URL,"http://".$ip.":".$porta."/admin.cgi?sid=1&mode=viewxml&pass=".$senha."");curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);curl_setopt($ch,CURLOPT_TIMEOUT,2);curl_setopt($ch,CURLOPT_USERAGENT,'Painel de Streaming 3.0.0');$resultado=curl_exec($ch);$status_http=curl_getinfo($ch,CURLINFO_HTTP_CODE);curl_close($ch);if($status_http==200){$xml=@simplexml_load_string(utf8_encode($resultado));if(filter_var($xml->STREAMSOURCE,FILTER_VALIDATE_IP)&&($xml->STREAMSOURCE!="127.0.0.1"&&$xml->STREAMSOURCE!=$ip)){return "aovivo";}}}

$porta = query_string('1');

if(!is_numeric($porta)) {
die ("Error! Missing data.");
}

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

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 porta = '".$porta."'"));
$dados_servidor = @mysqli_fetch_array(@mysqli_query($conexao,"SELECT * FROM servidores where codigo = '".$dados_stm["codigo_servidor"]."'"));

$total_pontos = mysqli_num_rows(mysqli_query($conexao,"SELECT * FROM multipoint where codigo_stm = '".$dados_stm["codigo"]."'"));

if($total_pontos > 0) {
$ponto = "/1";
} else {
$ponto = "/stream";
}

if(query_string('2') == "cover") {

if($dados_stm["tipo_servidor"] == "icecast") {

	$porta_admin_icecast = $dados_stm["porta"]+1;

	$dados_icecast = @file_get_contents("http://".$dados_servidor["ip"].":".$porta_admin_icecast."/status-json.xsl?mount=".$ponto);

	$dados_json_icecast = json_decode($dados_icecast, true);

	$musica_completa = ($dados_json_icecast["icestats"]["source"]["artist"]) ? $dados_json_icecast["icestats"]["source"]["artist"]." - ".$dados_json_icecast["icestats"]["source"]["title"] : $dados_json_icecast["icestats"]["source"]["title"];

} else {
	$musica_completa = @file_get_contents("http://".$dados_servidor["ip"].":".$dados_stm["porta"]."/currentsong?sid=1");
}

$musica_completa = utf8_decode($musica_completa);
$musica_completa = str_replace("_"," ",$musica_completa);
$musica_completa = ucwords(strtolower($musica_completa));
$musica_completa = utf8_decode($musica_completa);
	
$musica_completa = str_replace(" e "," & ",$musica_completa);
$musica_completa = str_replace(" E "," & ",$musica_completa);
$musica_completa = str_replace(".","",$musica_completa);

$musica_partes = explode("-",$musica_completa);

$artista = str_replace("_"," ",$musica_partes[0]);
$artista = rtrim($artista, " \t.");
	
$artista = str_replace(" ","-",$artista);

$artista = ($artista) ? $artista : $musica_completa;

$dados_api_itunes_json = json_decode(@file_get_contents("https://itunes.apple.com/search?term=".$artista."&media=music&limit=1"),true);

if($dados_api_itunes_json["results"][0]["artworkUrl100"]) {
echo str_replace("100x100bb", "600x600bb", $dados_api_itunes_json["results"][0]["artworkUrl100"]);
exit();
}

echo $dados_stm["app_url_logo"];

exit();
}

if(query_string('2') == "musica") {

if($dados_stm["tipo_servidor"] == "icecast") {

	$porta_admin_icecast = $dados_stm["porta"]+1;

	$dados_icecast = @file_get_contents("http://".$dados_servidor["ip"].":".$porta_admin_icecast."/status-json.xsl?mount=".$ponto);

	$dados_json_icecast = json_decode($dados_icecast, true);

	$musica_completa = ($dados_json_icecast["icestats"]["source"]["artist"]) ? $dados_json_icecast["icestats"]["source"]["artist"]." - ".$dados_json_icecast["icestats"]["source"]["title"] : $dados_json_icecast["icestats"]["source"]["title"];

} else {
	$musica_completa = @file_get_contents("http://".$dados_servidor["ip"].":".$dados_stm["porta"]."/currentsong?sid=1");
}

$musica_completa = utf8_decode($musica_completa);

echo str_replace("_"," ",$musica_completa);

exit();
}

if(query_string('2') == "anuncio") {

$dados_anuncio = mysqli_fetch_array(mysqli_query($conexao,"SELECT * FROM app_web_anuncios WHERE codigo_stm = '".$dados_stm["codigo"]."' ORDER BY RAND() LIMIT 1"));

$anuncio_link = (empty($dados_anuncio["link"])) ? "#" : "https://player.".$dados_config["dominio_padrao"]."/player-app-anuncio/".$dados_stm["porta"]."/abrir-anuncio/".$dados_anuncio["codigo"]."";

if($dados_anuncio["codigo"] > 0) {
mysqli_query($conexao,"UPDATE app_web_anuncios SET exibicoes = exibicoes+1 WHERE codigo = '".$dados_anuncio["codigo"]."'");

echo $dados_anuncio["banner"]."|".$anuncio_link;
}
exit();
}

if(query_string('2') == "abrir-anuncio") {

$dados_anuncio = mysqli_fetch_array(mysqli_query($conexao,"SELECT * FROM app_web_anuncios WHERE codigo = '".query_string('3')."'"));

mysqli_query($conexao,"UPDATE app_web_anuncios SET cliques = cliques+1 WHERE codigo = '".$dados_anuncio["codigo"]."'");

header("Location: ".$dados_anuncio["link"]."");
exit();
}

$status_conexao_transmissao = status_ao_vivo($dados_servidor["ip"],$dados_stm["porta"],$dados_stm["senha_admin"]);

$logo_radio = ($dados_stm["app_url_logo"]) ? $dados_stm["app_url_logo"] : "/app/img-app-logo.png";
$background_radio = ($dados_stm["app_url_background"]) ? "background: url('".$dados_stm["app_url_background"]."') bottom / cover no-repeat;" : "background: #000000";

$url_proxy_musica_atual = "https://player.".$dados_config["dominio_padrao"]."/musica-atual/".$dados_stm["porta"]."?";
$url_source_streaming = "https://".strtolower($dados_servidor["nome"]).".".$dados_config["dominio_padrao"].":".$dados_stm["porta"]."";

$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 radio 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 radio, 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 radio, 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";
}
?>
<!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="/app/player-anuncio.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> body {margin:0; padding:0; background-color:#000000}#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);body{font-family:Poppins,sans-serif;background:#fafafa}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}#anuncios {width: 100%; z-index: 999; position: absolute; bottom: 0;}</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 $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"] || $dados_stm["app_url_youtube"]) { ?>
      <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 } ?>
	      	<?php if($dados_stm["app_url_youtube"]) { ?>
	         <li>
	            <a href="#" onClick="abrir_link('<?php echo $dados_stm["app_url_youtube"]; ?>')"><i class="fa fa-youtube"></i> YouTube</a>
	         </li>
	        <?php } ?>
	      </ul>
      </li>
    <?php } ?>
    <?php if($dados_stm["app_url_pedir_musica"]) { ?>
      <li>
         <a href="#" onclick="abrir_link('<?php echo $dados_stm["app_url_pedir_musica"]; ?>')"><i class="fa fa-bullhorn"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["pedir_musica"]; ?></a>
      </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_url_camera_studio"]) { ?>
      <li>
         <a href="#" onclick="abrir_camera_studio('<?php echo $dados_stm["app_url_camera_studio"]; ?>')"><i class="fa fa-video-camera"></i> Camera Studio</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 } ?>
     <?php if($dados_stm["app_text_prog"]) { ?>
      <li>
         <a href="#" onClick="abrir_link('/app/texto/<?php echo $dados_stm["porta"]; ?>/programacao')"><i class="fa fa-calendar-check-o"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["prog"]; ?></a>
      </li>
     <?php } ?>
     <?php if($dados_stm["app_text_hist"]) { ?>
      <li>
         <a href="#" onClick="abrir_link('/app/texto/<?php echo $dados_stm["porta"]; ?>/historia')"><i class="fa fa-info-circle"></i> <?php echo $array_lang[$dados_stm["idioma_painel"]]["hist"]; ?></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: 999999;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%;background: #FFFFFF url('/app/app-loader.gif') center center no-repeat;margin:0;padding:0;z-index: 999999"></iframe>
</div>
<div class="overlay"></div>
<div id="player-app-" style="width:100%; height:100%;position: absolute; left:0; top:0; z-index: 300;<?php echo $background_radio; ?>"><center><img width="256" height="256" src="/app/app-loader.gif" style="margin-top: 15%" ></center></div>
<div id="anuncios"><a href="#" id="anuncio_link" target="_blank"><img id="anuncio" src="" border="0" style="width:100%; height: 100%; max-height: 60px; display: none;"></a></div>
<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);
$('#player-app-pauseplaywrapper').prop('title', 'Play/Pause');
$('#player-app-buttonplay').prop('title', 'Play/Pause');
$('#player-app-coverwrapper').prop('title', 'Album do Artista');
}
function abrir_link(link) {
$("#conteudo_externo").show();
$("#iframe_conteudo_externo").attr("src", link);
$('#sidebar').removeClass('active');
$('.overlay').removeClass('active');
}
function abrir_camera_studio(link) {
$("#conteudo_externo").show();
$("#iframe_conteudo_externo").attr("src", link);
$("#player-app-").data('lunaradio').pause();
$('#sidebar').removeClass('active');
$('.overlay').removeClass('active');
}
function load_cover() {

$.ajax({
url:"/player-app-anuncio/<?php echo $dados_stm["porta"]; ?>/cover",
type:"GET",
success: function(cover, statusText, errorThrown){
	$("#player-app-coverwrapper2").css("background", "transparent url('"+cover+"') 0% 0% / cover no-repeat");
	$("#player-app-coverwrapper2").css("opacity", "1");
	$("#player-app-coverwrapper1").css("opacity", "0");
},
error: function(xhr, statusText, errorThrown){
	$("#player-app-coverwrapper2").css("opacity", "0");
	$("#player-app-coverwrapper1").css("opacity", "1");
}
});

}
function load_anuncio() {

$.ajax({
url:"/player-app-anuncio/<?php echo $dados_stm["porta"]; ?>/anuncio",
type:"GET",
success: function(dados_anuncio, statusText, errorThrown){
	if(dados_anuncio) {
		var anuncio = dados_anuncio.split('|');
		$("#anuncio").fadeOut(500, function() {
	        $("#anuncio").attr("src",anuncio[0]);
	        if(anuncio[1] == "#") {
	    		$("#anuncio_link").attr("disabled", "disabled");
	    	} else {
	        	$("#anuncio_link").attr("href",anuncio[1]);
	        	$("#anuncio_link").removeAttr("disabled");
	    	}
	    }).fadeIn(500);
	} else {
		$("#anuncio").hide();
	}
}
});

}
$(document).ready(function () {
    $('#anuncio_link').on('click', function () {
        if ($('#anuncio_link').attr('disabled') == 'disabled') {
        return false;
      }
    });
    $('#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');
    });
	$("#player-app-").lunaradio({
		userinterface: "big", 
		backgroundcolor: "",
		fontcolor: "<?php echo $dados_stm["app_cor_texto"]; ?>",
		hightlightcolor: "#FFFFFF", 
		fontname: "Unica One", 
		googlefont: "Unica+One&display=swap", 
		fontratio: "0.7", 
		radioname: "<?php echo $dados_stm["app_nome"]; ?>", 
		scroll: "true", 
		coverimage: "<?php echo $logo_radio; ?>",
		onlycoverimage: "true",
		coverstyle: "animated",
		usevisualizer: "real", 
		visualizertype: "<?php echo $dados_stm["app_visualizer"]; ?>", 
		itunestoken: "1000lIPN", 
		metadatatechnic: "corsproxy", 
		usestreamcorsproxy: "false",
		corsproxy: "/player-app-anuncio/<?php echo $dados_stm["porta"]; ?>/musica/", 
		streamurl: "<?php echo $url_source_streaming; ?>", 
		streamtype: "shoutcast2",
		shoutcastpath: "<?php echo $ponto; ?>",
		shoutcastid: "1", 
		metadatainterval: "30000", 
		volume: "100",
		debug: "false",
		autoplay: "true"
	});

setTimeout(ajustes_navegador,3000);
setTimeout(function(){$('body').addClass('loaded');}, 1000);
<?php if($dados_stm["app_exibir_capa"] == "sim"){ ?>
setTimeout(load_cover,5000);
setInterval(load_cover,30000);
<?php } ?>
load_anuncio();
setInterval(load_anuncio,60000);
<?php if($exibir_aviso) { ?>Swal.fire({title: '',icon: 'info',html: '<?php echo $array_lang[$dados_stm["idioma_painel"]]["aviso_bg"]; ?>'})<?php } ?>
});

</script>
</body>
</html>