v-fixed27:热门频道后台预热,点击1.6s有声即播(5s手势窗口内);流地址缓存延长5分钟

This commit is contained in:
jinghui committed 2026-10-26 11:57:04 +08:00
1 parent d8299b8587
commit 811337fba7
4 files changed
+19 -5

No files matched your search

+6
View File
@@ -2,6 +2,12 @@
格式参考本机发版惯例:按日期分条,`🐛修复` / `✨新功能`。
## 2026-10-26 → v-fixed27
- ✨ **点击频道即播(有声,零二次点击)**:频道列表加载后服务端自动**后台预热**前 10 个热门频道(逐个解析线路+流地址、900ms 间隔防打爆上游),点击时命中缓存 1.6s 内起播——远在浏览器 5 秒手势窗口内,有声自动播放直接成功(实测点击→出画 1.6s、muted=false、未点画面)
- 🔧 流地址缓存 20s→5 分钟(配合预热;过期会自动重新解析,失败自动切线路兜底)
- 🐛 移除"静音起播后自动开声"(Chrome 对该路径会直接暂停视频导致卡死);仅在极端慢速时静音保画面,点击画面仍可开声
## 2026-10-26 → v-fixed26
- ✨ **移除首页顶部大 Logo 区**(KatelyaTV 大标题 + 「极致影视体验,尽在指尖」副标题 + 粒子动效),页面从导航/「首页·收藏夹」切换直接开始,内容更紧凑
+1 -1
View File
@@ -3,7 +3,7 @@ version: '3.8'
services:
# KatelyaTV 应用服务
katelyatv:
image: katelyatv:fixed26
image: katelyatv:fixed27
container_name: katelyatv
ports:
- "3030:3000"
+11 -3
View File
@@ -44,7 +44,7 @@ return{name:o[2],url}}).filter(l=>/^https?:\/\//.test(l.url));
console.log("[LIVE-LINES]",id,"lines="+lines.length,lines[0]?lines[0].url.slice(0,70):"");
if(lines.length)liveLn.set(id,{ts:Date.now(),lines});return lines}
async function liveResolve(id,p){
const key=id+"|"+p;const c=liveRv.get(key);if(c&&Date.now()-c.ts<20000)return c.finalUrl;
const key=id+"|"+p;const c=liveRv.get(key);if(c&&Date.now()-c.ts<300000)return c.finalUrl;
const lines=await liveLines(id);const ln=lines[p]||lines[0];if(!ln)throw new Error("no line");
console.log("[LIVE-RS] fetch",ln.url.slice(0,70));
const ctl=new AbortController();const tm=setTimeout(()=>ctl.abort(),20000);
@@ -126,7 +126,7 @@ function playSrc(u,flv){
hls.on(Hls.Events.ERROR,function(e,d){if(d.fatal){if(d.type===Hls.ErrorTypes.NETWORK_ERROR){hls.startLoad()}else if(d.type===Hls.ErrorTypes.MEDIA_ERROR){hls.recoverMediaError()}else{nextLine()}}})}
}else if(/\\.flv/.test(u)&&window.mpegts){try{mp=mpegts.createPlayer({type:'flv',isLive:true,url:u});mp.attachMediaElement(v);mp.load()}catch(e){}}
var pr=v.play();
if(pr&&pr.catch)pr.catch(function(){bigplay.style.display='flex'});
if(pr&&pr.catch)pr.catch(function(){v.muted=true;var pr2=v.play();if(pr2&&pr2.catch)pr2.catch(function(){bigplay.style.display='flex'})});
setTimeout(function(){if(v.readyState<2&&v.paused)tip.style.display='flex'},2500);
v.onplaying=function(){stopTick();tip.style.display='none'};
}
@@ -176,10 +176,18 @@ function loadChs(retry){fetch(API+'channels').then(function(r){return r.json()})
loadChs(0);
</script></body></html>`;
return new Response(html,{headers:{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}})}
function livePrefetch(list){
try{if(typeof globalThis!=="undefined"&&globalThis.__livePf)return;globalThis.__livePf=1;
const ids=(list||[]).slice(0,10).map(c=>c.id).filter(Boolean);let i=0;
const step=()=>{if(i>=ids.length){console.log("[LIVE-PF] done",i);return}
const id=ids[i++];
liveLines(id).then(ls=>{if(ls&&ls.length)return liveResolve(id,0)}).catch(()=>{})
.finally(()=>setTimeout(step,900))};
setTimeout(step,1200)}catch(e){console.log("[LIVE-PF-ERR]",e&&e.message)}}
async function LIVE(action,e){
try{
if(action==="page")return livePage();
if(action==="channels")return liveJ({list:await liveChannels()});
if(action==="channels"){const l=await liveChannels();livePrefetch(l);return liveJ({list:l})}
const q=new URL(e.url).searchParams;
if(action==="lines"){const id=(q.get("id")||"").replace(/[^\d]/g,"");if(!id)return liveJ({lines:[]});
const lines=await liveLines(id);return liveJ({lines:lines.map(l=>({name:l.name}))})}
+1 -1
View File
@@ -1 +1 @@
菜单项: 1
预热代码: 2