v-fixed22:加载永不放弃(线路无限轮换重试+计时持续到画面播放);移除静音回退始终有声优先
This commit is contained in:
1 parent
e88cd47969
commit
24d6dda73d
3 files changed
+15
-11
No files matched your search
@@ -2,6 +2,11 @@
|
||||
|
||||
格式参考本机发版惯例:按日期分条,`🐛修复` / `✨新功能`。
|
||||
|
||||
## 2026-10-26 → v-fixed22
|
||||
|
||||
- ✨ **永不放弃加载**:加载不了一直重试、计时一直转——所有线路轮播一遍后隔 2 秒自动从线路 1 重来(无限循环),线路解析失败/为空 3 秒后重试,频道列表加载失败自动重试 3 次;任何失败路径都不再弹「所有线路暂不可用」等报错,只有画面真正播放计时才消失
|
||||
- 🔒 移除「静音自动播放」回退:始终尝试**有声**播放;仅当浏览器自动播放策略拦截(无媒体记录的新浏览器)时显示 ▶ 按钮,点击即有声播放
|
||||
|
||||
## 2026-10-26 → v-fixed21
|
||||
|
||||
- ✨ **切台加载计时**:点击频道后播放器显示「加载中… X.Xs」实时计时(0.1s 精度),线路切换/自动重试期间计时不中断,画面真正播放(playing 事件)才停止并隐藏;解析失败(无线路/全部线路不可用)时计时停止并显示原因
|
||||
|
||||
@@ -3,7 +3,7 @@ version: '3.8'
|
||||
services:
|
||||
# KatelyaTV 应用服务
|
||||
katelyatv:
|
||||
image: katelyatv:fixed21
|
||||
image: katelyatv:fixed22
|
||||
container_name: katelyatv
|
||||
ports:
|
||||
- "3030:3000"
|
||||
|
||||
+9
-10
@@ -118,15 +118,13 @@ 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(){v.muted=true;var pr2=v.play();if(pr2&&pr2.catch)pr2.catch(function(){bigplay.style.display='flex'})});
|
||||
if(pr&&pr.catch)pr.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';
|
||||
if(v.muted){tip.textContent='🔇 静音自动播放 · 点击画面开启声音';tip.style.display='flex';
|
||||
setTimeout(function(){tip.style.display='none'},4000)}};
|
||||
v.onplaying=function(){stopTick();tip.style.display='none'};
|
||||
}
|
||||
bigplay.addEventListener('click',function(){v.muted=false;bigplay.style.display='none';v.play().catch(function(){})});
|
||||
v.addEventListener('click',function(){if(v.muted){v.muted=false;bigplay.style.display='none'}});
|
||||
function nextLine(){if(sel.options.length&&+sel.value<sel.options.length-1){sel.value=+sel.value+1;playLine(sel.value)}else{stopTick();tip.textContent='所有线路暂不可用';tip.style.display='flex'}}
|
||||
function nextLine(){if(sel.options.length&&+sel.value<sel.options.length-1){sel.value=+sel.value+1;playLine(sel.value)}else if(sel.options.length){setTimeout(function(){sel.value=0;playLine(0)},2000)}}
|
||||
window.nextLine=nextLine;
|
||||
function playLine(p){
|
||||
if(!curId)return;
|
||||
@@ -145,18 +143,19 @@ function pick(id,auto){
|
||||
if(!auto&&window.innerWidth<820){var pb=document.querySelector('.player-box');if(pb)pb.scrollIntoView({behavior:'smooth',block:'center'})}
|
||||
fetch(API+'lines&id='+id).then(function(r){return r.json()}).then(function(j){
|
||||
(j.lines||[]).forEach(function(l,i){var o=document.createElement('option');o.value=i;o.textContent=l.name;sel.appendChild(o)});
|
||||
if((j.lines||[]).length){sel.value=0;playLine(0)}else{stopTick();tip.textContent='暂无可用线路'}
|
||||
}).catch(function(){tip.textContent='线路解析失败'});
|
||||
if((j.lines||[]).length){sel.value=0;playLine(0)}else{setTimeout(function(){pick(curId,1)},3000)}
|
||||
}).catch(function(){setTimeout(function(){pick(curId,1)},3000)});
|
||||
}
|
||||
fetch(API+'channels').then(function(r){return r.json()}).then(function(j){
|
||||
function loadChs(retry){fetch(API+'channels').then(function(r){return r.json()}).then(function(j){
|
||||
chs=j.list||[];
|
||||
if(!chs.length){grid.innerHTML='<div class="empty">暂无频道</div>';return}
|
||||
if(!chs.length){if(retry<3){grid.innerHTML='<div class="empty">加载中…</div>';setTimeout(function(){loadChs(retry+1)},3000)}else{grid.innerHTML='<div class="empty">暂无频道</div>'}return}
|
||||
grid.innerHTML='';
|
||||
chs.forEach(function(c){var d=document.createElement('div');d.className='ch';d.dataset.id=c.id;d.textContent=c.name;
|
||||
d.onclick=function(){pick(c.id)};grid.appendChild(d)});
|
||||
var DEF=chs.find(function(c){return c.id==='5'})||chs.find(function(c){return (c.name||'').indexOf('翡翠')>=0})||chs[0];
|
||||
if(DEF){pick(DEF.id,1)}
|
||||
}).catch(function(){grid.innerHTML='<div class="empty">加载失败,请刷新</div>'});
|
||||
}).catch(function(){if(retry<3){grid.innerHTML='<div class="empty">加载中…</div>';setTimeout(function(){loadChs(retry+1)},3000)}else{grid.innerHTML='<div class="empty">加载失败,请刷新</div>'}})}
|
||||
loadChs(0);
|
||||
</script></body></html>`;
|
||||
return new Response(html,{headers:{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}})}
|
||||
async function LIVE(action,e){
|
||||
|
||||
Reference in new issue
Block a user