Spaces:
Running
Running
Use unified stream proxy /api/proxy/stream/vtv?channel_id=xxx
Browse files- static/yt_live.js +2 -2
static/yt_live.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
| 17 |
{id:'vtvprime',name:'VTVPrime',badge:'Prime'},
|
| 18 |
];
|
| 19 |
const DEFAULT_CHANNEL = 'vtv6';
|
| 20 |
-
const NEEDS_PROXY = /fptplay\.net
|
| 21 |
const STREAMS = {};
|
| 22 |
let _currentCh = null, _hls = null, _loading = false, _blockInserted = false;
|
| 23 |
let _streamsLoaded = false, _pipActive = false, _miniActive = false, _vtvPinned = false;
|
|
@@ -762,7 +762,7 @@
|
|
| 762 |
if(_loading) return; _loading=true;
|
| 763 |
const el=document.getElementById('vtv-load'); if(el) el.innerHTML='<div class="vtv-spinner"></div>Đang tải kênh...';
|
| 764 |
let d={};
|
| 765 |
-
try{const r=await fetch('/api/vtv/streams',{signal:AbortSignal.timeout(10000)}); if(r.ok){d=await r.json(); CHANNELS.forEach(ch=>{const i=d[ch.id]; if(i&&i.stream_url){let u=
|
| 766 |
CHANNELS.forEach(ch=>{const t=document.getElementById('vtvt-'+ch.id); if(t){const data=d[ch.id]; if(STREAMS[ch.id]&&STREAMS[ch.id].length>0){t.classList.remove('off'); t.textContent=ch.name;}else if(data&&data.status==='unavailable'){t.style.opacity='0.35'; t.textContent=ch.name+' 🔒';}else{t.style.opacity='0.35'; t.textContent=ch.name+' ✕';}}});
|
| 767 |
_loading=false; _streamsLoaded=true;
|
| 768 |
}
|
|
|
|
| 17 |
{id:'vtvprime',name:'VTVPrime',badge:'Prime'},
|
| 18 |
];
|
| 19 |
const DEFAULT_CHANNEL = 'vtv6';
|
| 20 |
+
const NEEDS_PROXY = /fptplay\.net/;
|
| 21 |
const STREAMS = {};
|
| 22 |
let _currentCh = null, _hls = null, _loading = false, _blockInserted = false;
|
| 23 |
let _streamsLoaded = false, _pipActive = false, _miniActive = false, _vtvPinned = false;
|
|
|
|
| 762 |
if(_loading) return; _loading=true;
|
| 763 |
const el=document.getElementById('vtv-load'); if(el) el.innerHTML='<div class="vtv-spinner"></div>Đang tải kênh...';
|
| 764 |
let d={};
|
| 765 |
+
try{const r=await fetch('/api/vtv/streams',{signal:AbortSignal.timeout(10000)}); if(r.ok){d=await r.json(); CHANNELS.forEach(ch=>{const i=d[ch.id]; if(i&&i.stream_url){let u='/api/proxy/stream/vtv?channel_id='+ch.id; STREAMS[ch.id]=[u];} else STREAMS[ch.id]=[];});}}catch(e){}
|
| 766 |
CHANNELS.forEach(ch=>{const t=document.getElementById('vtvt-'+ch.id); if(t){const data=d[ch.id]; if(STREAMS[ch.id]&&STREAMS[ch.id].length>0){t.classList.remove('off'); t.textContent=ch.name;}else if(data&&data.status==='unavailable'){t.style.opacity='0.35'; t.textContent=ch.name+' 🔒';}else{t.style.opacity='0.35'; t.textContent=ch.name+' ✕';}}});
|
| 767 |
_loading=false; _streamsLoaded=true;
|
| 768 |
}
|