<?php
require_once("admin/inc/protecao-final.php");

$total_avisos_ativos = mysqli_num_rows(mysqli_query($conexao,"SELECT * FROM avisos WHERE area = 'streaming'"));
$checar_status_aviso = mysqli_num_rows(mysqli_query($conexao,"SELECT * FROM avisos_desativados WHERE area = 'streaming' AND login = '".$dados_stm["login"]."'"));
$total_avisos_exibir = ($total_avisos_ativos > $checar_status_aviso) ? $total_avisos_ativos-$checar_status_aviso : 0;

$total_ip_cameras = mysqli_num_rows(mysqli_query($conexao,"SELECT * FROM ip_cameras WHERE codigo_stm = '".$dados_stm["codigo"]."'"));

$dados_wowza = total_espectadores_conectados($dados_servidor["ip"],$dados_servidor["senha"],$dados_stm["login"]);

$porcentagem_uso_espectadores = ($dados_stm["espectadores"] == 0 || $dados_stm["espectadores"] > 999998) ? "0" : $total_espectadores*100/$dados_stm["espectadores"];
$porcentagem_uso_espaco_ftp = ($dados_stm["espaco"] == 0 || $dados_stm["espaco"] > 999998) ? "0" : $dados_stm["espaco_usado"]*100/$dados_stm["espaco"];

$limite_espectadores = ($dados_stm["espectadores"] == 999999) ? '<small>'.lang_info_ilimitado.'</small>' : $dados_stm["espectadores"];

// Transmissao atual
$total_espectadores = ($dados_wowza["espectadores"] > 0) ? $dados_wowza["espectadores"] : "0";
$bitrate = $dados_stm["bitrate"] ;

if($dados_servidor["nome_principal"]) {
$servidor = $dados_servidor["nome_principal"].".".$dados_config["dominio_padrao"];
$url_source_http = "https://".$dados_servidor["nome_principal"].".".$dados_config["dominio_padrao"]."/".$dados_stm["login"]."/".$dados_stm["login"]."/playlist.m3u8";
} else {
$servidor = $dados_servidor["nome"].".".$dados_config["dominio_padrao"];
$url_source_http = "https://".$dados_servidor["nome"].".".$dados_config["dominio_padrao"]."/".$dados_stm["login"]."/".$dados_stm["login"]."/playlist.m3u8";
}

if(query_string('2') == "checar-chave") {

$webrtc_chave = query_string('3');

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

exit();
}
if($dados_stm["aplicacao"] == 'tvstation') {
$classe_quadros = "col-12 col-sm-6 col-md-3";
} else {
$classe_quadros = "col-12 col-sm-6 col-md-4";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Streaming <?php echo $dados_stm["login"]; ?></title>
  <link rel="stylesheet" href="/inc/materialdesignicons.min.css">
  <link rel="stylesheet" href="/inc/font-awesome.min.css">
  <link rel="stylesheet" href="/inc/vendor.bundle.base.css">
  <link rel="stylesheet" href="/inc/vendor.bundle.addons.css">  
        <link href="//vjs.zencdn.net/6.0.0/video-js.css" rel="stylesheet">
  <?php if($dados_stm["tema_dark"] == "sim") { ?>
  <link rel="stylesheet" href="/inc/theme-dark.css">
  <?php } else { ?>
  <link rel="stylesheet" href="/inc/theme.css">
  <?php } ?>
  <link rel="shortcut icon" href="/img/favicon.ico" />
  <script type="text/javascript" src="/inc/ajax-streaming.js"></script>
  <script type="text/javascript" src="/inc/javascript.js"></script>
  <link  href="/player/inc-webrtc/plyr.css" rel="stylesheet" />
<style type="text/css">#play-video-container{display:flex;justify-content:center;align-items:center;}#play-video-container, #player-video { height: 388px; width: 100%;border-radius: 10px;}.plyr{display: none;border-radius: 10px;} .plyr__time, .plyr__progress, .plyr__control--overlaid{display: none!important;}</style>
</head>
<body>
  <div class="container-scroller">
    <nav class="navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
      <div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
        <?php if($dados_revenda["url_logo"]) { ?>
        <a class="navbar-brand brand-logo" href="/dashboard"><img id="logo" src="<?php echo $dados_revenda["url_logo"]; ?>" title="Painel" height="60" border="0"></a>
        <?php } else { ?>
        <a class="navbar-brand brand-logo" href="/dashboard"><span>Painel Streaming</span></a>
        <?php } ?>
        <a class="navbar-brand brand-logo-mini" href="/dashboard"><i class="fa fa-video-camera text-muted"></i></a>
      </div>
      <div class="navbar-menu-wrapper d-flex align-items-center justify-content-end justify-content-lg-start">
        <button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
          <span class="mdi mdi-menu text-icones"></span>
        </button>
        <ul class="navbar-nav navbar-nav-right">
          <li class="nav-item nav-profile dropdown show">
            <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" id="profileDropdown" aria-expanded="true">
              <i class="fa fa-power-off f-18 text-icones" data-toggle="tooltip" data-placement="bottom" title="<?php echo $lang['lang_botao_titulo_ligar']; ?>/<?php echo $lang['lang_botao_titulo_desligar']; ?>"></i>
            </a>
            <div class="dropdown-menu dropdown-menu-right navbar-dropdown" aria-labelledby="profileDropdown">
              <a class="dropdown-item text-success" href="javascript:ligar_streaming('<?php echo $login_code; ?>');"> <?php echo $lang['lang_botao_titulo_ligar']; ?> Streaming</a>
              <a class="dropdown-item text-warning" href="javascript:reiniciar_streaming('<?php echo $login_code; ?>');"> <?php echo $lang['lang_botao_titulo_reiniciar']; ?> Streaming</a>
            </div>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link count-indicator dropdown-toggle d-flex align-items-center justify-content-center" id="notificationDropdown" href="#" data-toggle="dropdown" aria-expanded="false">
              <i class="mdi mdi-bell f-22 text-icones" data-toggle="tooltip" data-placement="bottom" title="<?php echo $lang['lang_info_pagina_informacoes_tab_avisos']; ?>"></i>
              <?php if($total_avisos_exibir > 0) { ?><span class="count bg-success"><?php echo $total_avisos_exibir; ?></span><?php } ?>           
            </a>
            <div class="dropdown-menu dropdown-menu-right navbar-dropdown preview-list" aria-labelledby="notificationDropdown">
              <a class="dropdown-item">
                <p class="mb-0 font-weight-normal float-left"><?php echo $lang['lang_info_pagina_informacoes_tab_avisos']; ?></p>
              </a>
              <div class="dropdown-divider"></div>
              <?php carregar_avisos_streaming($conexao,$dados_stm["porta"],$dados_servidor["codigo"]); ?>
            </div>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="/sair"><i class="mdi mdi-logout f-22 text-icones" data-toggle="tooltip" data-placement="bottom" title="Sair/logout"></i></a>
          </li>
          <li>
            <button type="button" class="btn btn-info" id="status-streaming" onClick="status_streaming('<?php echo $login_code; ?>');" style="margin: 10px;min-width: 150px; min-height: 40px"><i class="fa fa-refresh"></i></button>
          </li>
        </ul>
        <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas">
          <span class="mdi mdi-menu text-icones"></span>
        </button>
      </div>
    </nav>
    <div class="container-fluid page-body-wrapper">
      <?php require_once("menu.php"); ?>
      <!-- partial -->
      <div class="main-panel">
        <div class="content-wrapper">
          <div id="local-status-acoes"><?php echo $_SESSION['status_acao'];unset($_SESSION['status_acao']); ?></div>
          <?php if($_SESSION["code_user_logged"] && $dados_stm["codigo_cliente"] == $_SESSION["code_user_logged"]) { ?><div class="alert alert-warning text-center" role="alert"><i class="ik ik-alert-triangle"></i>&nbsp;<?php echo $lang['lang_info_acessar_painel_revenda_logado']; ?></div><?php } ?>
          <div class="row">            

          <?php if($dados_stm["aplicacao"] != 'webrtc') { ?>
            <div class="col-12">
              <div class="row">
                <div class="<?php echo $classe_quadros; ?>">
                  <div class="card">
                    <div class="card-body">
                      <h2 class="card-title" style="font-size: 30px"><?php echo $dados_stm["login"]; ?></h2>
                      <div class="d-flex justify-content-between">
                        <p class="text-muted"><small><?php echo ucfirst($dados_stm["aplicacao"]); ?></small></p>
                      </div>
                      <div style="min-height: 2px"></div>
                    </div>
                  </div>
                </div>
                <?php if($dados_stm["aplicacao"] == 'tvstation' || $dados_stm["aplicacao"] == 'live') { ?>
                <div class="<?php echo $classe_quadros; ?>">
                  <div class="card">
                    <div class="card-body">
                      <h4 class="card-title"><?php echo $lang['lang_info_pagina_informacoes_streaming_tab_plano_espectadores']; ?></h4>                      
                      <div class="d-flex justify-content-between">
                        <p class="text-muted"><i class="fa fa-users f-32"></i></p>
                        <p class="text-muted" id="total_espectadores"><?php echo $total_espectadores; ?> / <?php echo $dados_stm["espectadores"]; ?></p>
                      </div>
                      <div class="progress progress-md">
                        <div class="progress-bar bg-success" role="progressbar" aria-valuenow="<?php echo $porcentagem_uso_espectadores; ?>" aria-valuemin="0" aria-valuemax="100" id="porcentagem_uso_espectadores" style="width: <?php echo $porcentagem_uso_espectadores; ?>%;"></div>
                      </div>
                    </div>
                  </div>
                </div>
                <?php } ?>
                <?php if($dados_stm["aplicacao"] == 'tvstation' || $dados_stm["aplicacao"] == 'vod') { ?>
                <div class="<?php echo $classe_quadros; ?>">
                  <div class="card">
                    <div class="card-body">
                      <h4 class="card-title"><?php echo $lang['lang_info_pagina_informacoes_streaming_tab_ftp_espaco']; ?></h4>
                      <div class="d-flex justify-content-between">
                        <p class="text-muted"><i class="fa fa-hdd-o f-32"></i></p>
                        <p class="text-muted"><?php echo tamanho($dados_stm["espaco_usado"]); ?> / <?php echo tamanho($dados_stm["espaco"]); ?></p>
                      </div>
                      <div class="progress progress-md">
                        <div class="progress-bar bg-danger" role="progressbar" aria-valuenow="<?php echo $porcentagem_uso_espaco_ftp; ?>" aria-valuemin="0" aria-valuemax="100" id="porcentagem_uso_espaco_ftp" style="width: <?php echo $porcentagem_uso_espaco_ftp; ?>%;"></div>
                      </div>
                    </div>
                  </div>
                </div>
                <?php } ?>
                <?php if($dados_stm["aplicacao"] == 'ipcamera') { ?>
                <div class="<?php echo $classe_quadros; ?>">
                  <div class="card">
                    <div class="card-body">
                      <h4 class="card-title"><?php echo $lang['lang_info_pagina_informacoes_streaming_tab_stm_cameras']; ?></h4>
                      <div class="d-flex justify-content-between">
                        <p class="text-muted"><i class="fa fa-signal f-32"></i></p>
                        <p class="text-muted"><?php echo $total_ip_cameras; ?></p>
                      </div>
                      <div class="progress progress-md">
                        <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="<?php echo $porcentagem_uso_bitrate; ?>" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
                      </div>
                    </div>
                  </div>
                </div>
                <?php } ?>
                <div class="<?php echo $classe_quadros; ?>">
                  <div class="card">
                    <div class="card-body">
                      <h4 class="card-title">Bitrate</h4>
                      <div class="d-flex justify-content-between">
                        <p class="text-muted"><i class="fa fa-signal f-32"></i></p>
                        <p class="text-muted"><?php echo $bitrate; ?> <small>Kbps</small></p>
                      </div>
                      <div class="progress progress-md">
                        <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="<?php echo $porcentagem_uso_bitrate; ?>" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
                <?php } ?>
            </div>   
            <?php if($dados_stm["aplicacao"] == "tvstation" || $dados_stm["aplicacao"] == "live") { ?>
                            <div class="<?php if($dados_stm["aplicacao"] == "live") { ?>col-md-12<?php } else { ?>col-xl-8 col-md-6<?php } ?>">
                                <div class="card">
                                    <div class="card-header">
                                        <header>Player</header>
                                    </div>
                                        <style>.video-js .vjs-time-control{display: none;}.video-js .vjs-progress-control{display: none;}</style>
<video id="player_webtv" class="video-js vjs-big-play-centered" controls preload="auto" width="696" height="auto" data-setup="{ 'fluid':true,'aspectRatio':'16:9' }" >
   <source src="<?php echo $url_source_http; ?>" type="application/x-mpegURL">
</video>
<script src="//vjs.zencdn.net/6.0.0/video.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.9.0/videojs-contrib-hls.min.js"></script>
<script>var myPlayer=videojs('player_webtv',{},function(){var player=this;player.on("pause",function(){player.one("play",function(){player.load();player.play();});});})</script>
                                </div>
                            </div>
<?php if($dados_stm["aplicacao"] == "tvstation") { ?>
                            <div class="col-xl-4 col-md-6">
                                <div class="card">
                                    <div class="card-header">
                                        <header><?php echo $lang['lang_info_pagina_informacoes_streaming_tab_atalhos']; ?></header>
                                    </div>
                                    <div class="card-body">
                                        <table width="80%" border="0" cellspacing="0" cellpadding="0" align="center">
                                          <tr>
                                            <td height="69" align="center"><button type="button" class="btn btn-info btn-block" onClick="menu_iniciar_playlist();"><i class="ik ik-link-2"></i><?php echo $lang['lang_info_pagina_informacoes_streaming_atalho_botao_iniciar_playlist']; ?></button></td>
                                          </tr>
                                          <tr>
                                            <td height="70" align="center"><button type="button" class="btn btn-info btn-block" onClick="window.location = '/gerenciar-videos';"><i class="ik ik-link-2"></i><?php echo $lang['lang_info_pagina_informacoes_streaming_atalho_botao_gerenciar_videos']; ?></button></td>
                                          </tr>
                                          <tr>
                                            <td height="70" align="center"><button type="button" class="btn btn-info btn-block" onClick="window.location = '/playlists';"><i class="ik ik-link-2"></i><?php echo $lang['lang_info_pagina_informacoes_streaming_atalho_botao_gerenciar_playlists']; ?></button></td>
                                          </tr>
                                          <tr>
                                            <td height="70" align="center"><button type="button" class="btn btn-info btn-block" onClick="window.location = '/gerenciar-agendamentos';"><i class="ik ik-link-2"></i><?php echo $lang['lang_info_pagina_informacoes_streaming_atalho_botao_gerenciar_agendamentos']; ?></button></td>
                                          </tr>
                                          <tr>
                                            <td height="70" align="center"><button type="button" class="btn btn-info btn-block" onClick="window.location = '/espectadores-conectados';"><i class="ik ik-link-2"></i><?php echo $lang['lang_info_pagina_informacoes_streaming_atalho_botao_espectadores']; ?></button></td>
                                          </tr>
                                        </table>
                                    </div>
                                </div>
                            </div>
                            <?php } ?>
                            <?php } ?>
                            <?php if($dados_stm["aplicacao"] == "webrtc") { ?>
                          <div class="row">
                            <div class="col-12 col-md-8">
                                <div class="card" style="border-radius: 10px;">
                                    <div class="card-block" style="background-color: #000000;border-radius: 10px;">
                <div id="play-video-container">
  <button id="player-btn" type="button" class="btn" style="z-index: 1000;background: transparent; border: none;cursor: pointer;"><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;color:#fff900;font-size: 14px; margin: 50px;"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512" style="fill:#fff900; 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></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"]; ?>"
};
</script>
                                </div>
                              </div>
                            </div>
                            <script type="module" crossorigin="use-credentials" src="/player/inc-webrtc/play.js"></script>
                            <div class="col-12 col-md-4">
                            <div class="col-12">
                              <div class="card">
                                <div class="card-body">
                                  <h2 class="card-title" style="font-size: 30px"><?php echo $dados_stm["login"]; ?></h2>
                                  <div class="d-flex justify-content-between">
                                    <p class="text-muted"><small><?php echo ucfirst($dados_stm["aplicacao"]); ?></small></p>
                                  </div>
                                  <div style="min-height: 2px"></div>
                                </div>
                              </div>
                            </div>

                            <div class="col-12">
                              <div class="card">
                                <div class="card-body">
                                  <h4 class="card-title"><?php echo $lang['lang_info_pagina_informacoes_streaming_tab_plano_espectadores']; ?></h4>                      
                                  <div class="d-flex justify-content-between">
                                    <p class="text-muted"><i class="fa fa-users f-32"></i></p>
                                    <p class="text-muted" id="total_espectadores"><?php echo $total_espectadores; ?> / <?php echo $dados_stm["espectadores"]; ?></p>
                                  </div>
                                  <div class="progress progress-md">
                                    <div class="progress-bar bg-success" role="progressbar" aria-valuenow="<?php echo $porcentagem_uso_espectadores; ?>" aria-valuemin="0" aria-valuemax="100" id="porcentagem_uso_espectadores" style="width: <?php echo $porcentagem_uso_espectadores; ?>%;"></div>
                                  </div>
                                </div>
                              </div>
                            </div>

                            <div class="col-12">
                              <div class="card">
                                <div class="card-body">
                                  <h4 class="card-title">Bitrate</h4>
                                  <div class="d-flex justify-content-between">
                                    <p class="text-muted"><i class="fa fa-signal f-32"></i></p>
                                    <p class="text-muted"><?php echo $bitrate; ?> <small>Kbps</small></p>
                                  </div>
                                  <div class="progress progress-md">
                                    <div class="progress-bar bg-warning" role="progressbar" aria-valuenow="<?php echo $porcentagem_uso_bitrate; ?>" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
                                  </div>
                                </div>
                              </div>
                            </div>

                          </div>
                            <?php } ?>
                            <div class="col-md-12">
                                <div class="card table-card">
                                    <div class="card-header">
                                        <header>Logs</header>
                                    </div>
                                    <div class="card-block">
                                        <div class="table-responsive">
                                            <table class="table table-hover mb-0">
                                                <thead>
                                                    <tr role="row">
                                                        <th><?php echo $lang['lang_info_streaming_logs_data']; ?></th>
                                                        <th><?php echo $lang['lang_info_streaming_logs_ip']; ?></th>
                                                        <th><?php echo $lang['lang_info_streaming_logs_navegador']; ?></th>
                                                        <th><?php echo $lang['lang_info_streaming_logs_log']; ?></th>
                                                    </tr>
                                                </thead>
                                                <tbody>
<?php
$sql = mysqli_query($conexao,"SELECT * FROM logs_streamings WHERE codigo_stm = '".$dados_stm["codigo"]."' ORDER by codigo DESC LIMIT 5");
while ($dados_log = mysqli_fetch_array($sql)) {

$log = str_replace("<br>","",$dados_log["log"]);
$log = str_replace("<br />","",$log);

$log = (strlen($log) > 105) ? substr($log, 0, 105)."..." : $log;

echo "<tr>
<td height='25' align='left' scope='col'>&nbsp;".formatar_data($dados_stm["formato_data"], $dados_log["data"], $dados_stm["timezone"])."</td>
<td height='25' align='left' scope='col'>&nbsp;".$dados_log["ip"]."</td>
<td height='25' align='left' scope='col'>&nbsp;".$dados_log["navegador"]."</td>
<td height='25' align='left' scope='col'>&nbsp;".$log."</td>
</tr>";

}
?>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
          </div>
        </div>
      </div>
      <!-- modal -->
      <div class="modal fade" id="avisos" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><?php echo $lang['lang_info_pagina_informacoes_tab_avisos']; ?></h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                </div>
                <div class="modal-body" id="avisos-conteudo"><img src="/img/ajax-loader.gif" align="center" /></div>
            </div>
        </div>
        </div>
                
        <div class="modal fade" id="log-sistema" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-body" id="log-sistema-conteudo" style="text-align:center"><img src="/img/ajax-loader.gif" /></div>
            </div>
        </div>
      </div>
    </div>
  </div>
  <script src="/inc/vendor.bundle.base.js"></script>
  <script src="/inc/vendor.bundle.addons.js"></script>
  <script src="/inc/theme.js"></script>
<script type="text/javascript" src="/player/inc-webrtc/adapter-latest.js"></script>
<script src="/player/inc-webrtc/plyr.polyfilled.js"></script>
  <script>
  status_streaming('<?php echo $login_code; ?>');
  setInterval("status_streaming('<?php echo $login_code; ?>')",60000);
        <?php if($dados_stm["aplicacao"] == 'tvstation' || $dados_stm["aplicacao"] == 'live') { ?>
        transmissao_atual();
        setInterval("transmissao_atual()",60000);
        <?php } ?>

  <?php if($dados_stm["aplicacao"] == 'webrtc') { ?>
  function checar_chave(){
    $.ajax({
    url: "/informacoes/checar-chave/<?php echo $dados_stm["webrtc_chave"]; ?>",
    success:
      function(resposta){
        if(resposta == "reload") {
          window.location.reload();
        }
      }
    })
}
setInterval (checar_chave,15000);
const player = new Plyr("#player-video", {disableContextMenu: true});
<?php } ?>
  </script>
</body>
</html>