{"id":98,"date":"2025-09-15T20:23:25","date_gmt":"2025-09-15T20:23:25","guid":{"rendered":"https:\/\/jamacarufm.com\/?page_id=98"},"modified":"2025-09-15T21:53:39","modified_gmt":"2025-09-15T21:53:39","slug":"player-new","status":"publish","type":"page","link":"https:\/\/jamacarufm.com\/index.php\/player-new\/","title":{"rendered":"player new"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"98\" class=\"elementor elementor-98\">\n\t\t\t\t<div class=\"elementor-element elementor-element-9f487aa e-flex e-con-boxed e-con e-parent\" data-id=\"9f487aa\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8098c23 elementor-widget elementor-widget-html\" data-id=\"8098c23\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<!DOCTYPE html>\n<html lang=\"pt-BR\">\n<head>\n  <meta charset=\"UTF-8\" \/>\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/>\n  <title>Jamacaru FM<\/title>\n  <link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/4.5.2\/css\/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/5.10.0\/css\/all.min.css\">\n  <style>\n    :root{\n      --brand:#17a2b8;         \/* ciano do tema *\/\n      --ink:#171717;\n      --muted:#cccaca;\n      --bg:#ffffff;\n    }\n    *{box-sizing:border-box}\n    html,body{height:100%}\n    body{margin:0;background:rgba(255,255,255,.5);font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;color:var(--ink)}\n\n    main{width:100vw;height:100vh;display:flex;justify-content:center;align-items:center}\n\n    .music_container{background:var(--bg);width:360px;height:550px;box-shadow:0 1.2rem 3rem 0.5rem rgba(0,0,0,.2);padding:3rem 2rem 2rem;border-radius:2rem;text-align:center;position:relative;overflow:hidden}\n\n    #title{text-transform:capitalize;letter-spacing:.2rem;word-spacing:.5rem;color:var(--ink);font-weight:600;margin-bottom:.25rem}\n    #artist{color:var(--muted);font-weight:500;min-height:1.4em}\n\n    .img_container{width:15rem;height:15rem;margin:1rem auto 0;position:relative}\n    .img_container img{width:100%;height:100%;border-radius:0;object-fit:cover;display:block;opacity:1;transition:opacity .35s ease}\n    .img_container img.fading{opacity:0}\n\n    .slider_container{position:absolute;width:100%;top:-25px;display:flex;align-items:center;justify-content:center;gap:.5rem}\n    .slider_container .fa{color:var(--brand);font-weight:bold;cursor:pointer}\n    #volume_slider{cursor:pointer;width:70%}\n\n    .music_controls{display:flex;justify-content:center;align-items:center;gap:2rem;margin-top:1rem}\n    .main_btn{width:4rem;height:4rem;border-radius:50%;color:var(--brand);background:#212529;display:flex;justify-content:center;align-items:center;box-shadow:0 .5rem 1.2rem rgba(0,0,0,.25);transition:transform .12s ease}\n    .main_btn:active{transform:scale(.96)}\n\n    .progressbar_container{width:100%;padding:1rem 0;margin-top:.5rem}\n    .progress_div{width:100%;height:8px;border-radius:4rem;position:relative;appearance:none;cursor:pointer;box-shadow:0 1rem 1.4rem .1rem rgba(0,0,0,.15);background:linear-gradient(90deg,#d5d5d5,#bfbfbf)}\n    .progress{position:absolute;top:0;left:0;width:0%;height:100%;background:var(--brand);border-radius:3rem}\n\n    \/* R\u00f3tulo AO VIVO para stream *\/\n    .live-pill{position:absolute;top:12px;left:12px;background:#e11d48;color:#fff;font-weight:700;font-size:.72rem;padding:.25rem .5rem;border-radius:999px;letter-spacing:.04em}\n  <\/style>\n<\/head>\n<body>\n  <main>\n    <div class=\"music_container\">\n      <span class=\"live-pill\">AO VIVO<\/span>\n\n      <h3 id=\"title\">Jamacaru FM<\/h3>\n      <h5 id=\"artist\">D\u00ca UM PLAYER NA SUA VIDA<\/h5>\n\n      <div class=\"img_container\">\n        <img decoding=\"async\" id=\"cover\" src=\"https:\/\/jamacarufm.com\/wp-content\/uploads\/2025\/09\/logo-new-1.png\" alt=\"Capa\/Logo Jamacaru FM\" \/>\n        <div class=\"slider_container\"> \n          <i class=\"fa fa-volume-down\" onclick=\"muteVol()\" aria-label=\"Silenciar\"><\/i>\n          <input type=\"range\" min=\"0\" max=\"100\" value=\"30\" id=\"volume_slider\" onchange=\"setVolume()\" aria-label=\"Volume\"> \n          <i class=\"fa fa-volume-up\" onclick=\"fullVol()\" aria-label=\"Volume m\u00e1ximo\"><\/i> \n        <\/div>\n      <\/div>\n\n      <audio id=\"player\" src=\"https:\/\/stm1.glaudiotecnology.uk:7004\/stream\" preload=\"none\" crossorigin=\"anonymous\"><\/audio>\n  \n      <div class=\"progressbar_container\" id=\"progress_container\" aria-hidden=\"true\">\n        <div class=\"progress_div\" id=\"progress_div\">\n          <div class=\"progress\" id=\"progress\"><\/div>\n        <\/div>\n      <\/div>\n  \n      <div class=\"music_controls\">\n        <i class=\"fas fa-play main_btn\" aria-hidden=\"true\" id=\"play_pause\" title=\"Reproduzir\/Pausar\"><\/i>\n      <\/div>\n    <\/div>\n  <\/main>\n\n  <script>\n    \/\/ ======= Elementos =======\n    const audio = document.getElementById('player');\n    const coverImg = document.getElementById('cover');\n    const artistEl = document.getElementById('artist');\n    const playBtn = document.getElementById('play_pause');\n    const vol = document.getElementById('volume_slider');\n    const progress = document.getElementById('progress');\n    const progressDiv = document.getElementById('progress_div');\n\n    let isPlaying = false;\n\n    \/\/ ======= Player b\u00e1sico =======\n    function playMusic(){\n      isPlaying = true;\n      audio.play().catch(()=>{});\n      playBtn.classList.remove('fa-play');\n      playBtn.classList.add('fa-pause');\n    }\n    function pauseMusic(){\n      isPlaying = false;\n      audio.pause();\n      playBtn.classList.remove('fa-pause');\n      playBtn.classList.add('fa-play');\n    }\n    playBtn.addEventListener('click',()=>{ isPlaying ? pauseMusic() : playMusic(); });\n\n    function setVolume(){ audio.volume = vol.value\/100; }\n    function muteVol(){ audio.volume = 0.0; vol.value = 0; }\n    function fullVol(){ audio.volume = 1.0; vol.value = 100; }\n\n    \/\/ Atualiza barra (resistente a streaming ao vivo \u2013 dura\u00e7\u00e3o pode ser Infinity\/NaN)\n    audio.addEventListener('timeupdate', (e)=>{\n      const { currentTime, duration } = e.srcElement;\n      if (!isFinite(duration) || duration <= 0) return; \/\/ stream ao vivo\n      const pct = (currentTime \/ duration) * 100;\n      progress.style.width = pct + '%';\n    });\n    progressDiv.addEventListener('click',(e)=>{\n      const duration = audio.duration;\n      if (!isFinite(duration) || duration <= 0) return; \/\/ n\u00e3o buscar em stream ao vivo\n      const move = (e.offsetX \/ e.srcElement.clientWidth) * duration;\n      audio.currentTime = move;\n    });\n\n    \/\/ ======= Metadados do streaming (XML) =======\n    const META_URL = 'https:\/\/glaudiotecnology.uk\/api\/NzAwNCsx';\n    const DEFAULT_COVER = 'https:\/\/jamacarufm.com\/wp-content\/uploads\/2025\/09\/logo-new-1.png';\n\n    async function atualizarMusica(){\n      try{\n        const resp = await fetch(META_URL, { cache: 'no-store' });\n        const xmlText = await resp.text();\n        const parser = new DOMParser();\n        const xmlDoc = parser.parseFromString(xmlText, 'text\/xml');\n\n        const musicaNode = xmlDoc.getElementsByTagName('musica_atual')[0];\n        const capaNode = xmlDoc.getElementsByTagName('capa_musica')[0];\n\n        const musicaAtual = (musicaNode?.textContent || '').trim();\n        const capaMusica = (capaNode?.textContent || '').trim();\n\n        \/\/ Atualiza t\u00edtulo\/subt\u00edtulo do player\n        if (musicaAtual){\n          artistEl.textContent = musicaAtual.toUpperCase();\n          document.title = 'Jamacaru FM \u2014 ' + musicaAtual;\n        }\n\n        \/\/ Atualiza a capa com transi\u00e7\u00e3o suave\n        const novaCapa = capaMusica || DEFAULT_COVER;\n        if (coverImg.getAttribute('src') !== novaCapa){\n          coverImg.classList.add('fading');\n          const tmp = new Image();\n          tmp.onload = ()=>{\n            coverImg.src = novaCapa;\n            requestAnimationFrame(()=>{\n              coverImg.classList.remove('fading');\n            });\n          };\n          tmp.onerror = ()=>{\n            coverImg.classList.remove('fading');\n            if (coverImg.src !== DEFAULT_COVER) coverImg.src = DEFAULT_COVER;\n          };\n          tmp.crossOrigin = 'anonymous';\n          tmp.src = novaCapa;\n        }\n      }catch(err){\n        console.error('Erro ao buscar m\u00fasica atual:', err);\n        if (!coverImg.src) coverImg.src = DEFAULT_COVER;\n      }\n    }\n\n    \/\/ Atualiza ao carregar e a cada 20s\n    atualizarMusica();\n    setInterval(atualizarMusica, 20000);\n\n    \/\/ Ajuste inicial de volume\n    setVolume();\n  <\/script>\n<\/body>\n<\/html>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Jamacaru FM AO VIVO Jamacaru FM D\u00ca UM PLAYER NA SUA VIDA<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_canvas","meta":{"footnotes":""},"class_list":["post-98","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/jamacarufm.com\/index.php\/wp-json\/wp\/v2\/pages\/98","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jamacarufm.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/jamacarufm.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/jamacarufm.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jamacarufm.com\/index.php\/wp-json\/wp\/v2\/comments?post=98"}],"version-history":[{"count":22,"href":"https:\/\/jamacarufm.com\/index.php\/wp-json\/wp\/v2\/pages\/98\/revisions"}],"predecessor-version":[{"id":124,"href":"https:\/\/jamacarufm.com\/index.php\/wp-json\/wp\/v2\/pages\/98\/revisions\/124"}],"wp:attachment":[{"href":"https:\/\/jamacarufm.com\/index.php\/wp-json\/wp\/v2\/media?parent=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}