From 811337fba74b620d60e6032313c4c36eb98958d3 Mon Sep 17 00:00:00 2001 From: jinghui Date: Mon, 26 Oct 2026 11:57:04 +0800 Subject: [PATCH] =?UTF-8?q?v-fixed27=EF=BC=9A=E7=83=AD=E9=97=A8=E9=A2=91?= =?UTF-8?q?=E9=81=93=E5=90=8E=E5=8F=B0=E9=A2=84=E7=83=AD=EF=BC=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB1.6s=E6=9C=89=E5=A3=B0=E5=8D=B3=E6=92=AD=EF=BC=885s?= =?UTF-8?q?=E6=89=8B=E5=8A=BF=E7=AA=97=E5=8F=A3=E5=86=85=EF=BC=89=EF=BC=9B?= =?UTF-8?q?=E6=B5=81=E5=9C=B0=E5=9D=80=E7=BC=93=E5=AD=98=E5=BB=B6=E9=95=BF?= =?UTF-8?q?5=E5=88=86=E9=92=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ docker-compose.redis.yml | 2 +- patches/live-inject.js | 14 +++++++++++--- 缺失 | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b726a0..404a0f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 大标题 + 「极致影视体验,尽在指尖」副标题 + 粒子动效),页面从导航/「首页·收藏夹」切换直接开始,内容更紧凑 diff --git a/docker-compose.redis.yml b/docker-compose.redis.yml index 56e9ce7..f32f11c 100644 --- a/docker-compose.redis.yml +++ b/docker-compose.redis.yml @@ -3,7 +3,7 @@ version: '3.8' services: # KatelyaTV 应用服务 katelyatv: - image: katelyatv:fixed26 + image: katelyatv:fixed27 container_name: katelyatv ports: - "3030:3000" diff --git a/patches/live-inject.js b/patches/live-inject.js index 9fd6d90..e2f20c7 100644 --- a/patches/live-inject.js +++ b/patches/live-inject.js @@ -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); `; 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}))})} diff --git a/缺失 b/缺失 index de76e2b..43ebf59 100644 --- a/缺失 +++ b/缺失 @@ -1 +1 @@ -菜单项: 1 +预热代码: 2