release: bump version to 0.26.1

This commit is contained in:
rayd1o
2026-04-12 05:20:23 +08:00
parent 812c825dc6
commit b1d0624061
10 changed files with 547 additions and 77 deletions

View File

@@ -371,6 +371,10 @@ function findSourceById(sourceId) {
return tvPayload?.sources?.find((source) => source.id === sourceId) || null;
}
function getCurrentSource() {
return findSourceById(currentSourceId);
}
function setPanelMessage(message) {
const { status } = getElements();
if (status) {
@@ -378,6 +382,50 @@ function setPanelMessage(message) {
}
}
function resetIframe(iframe) {
if (!(iframe instanceof HTMLIFrameElement)) return;
iframe.removeAttribute("src");
iframe.hidden = true;
}
function resetVideo(video) {
if (!(video instanceof HTMLVideoElement)) return;
video.removeAttribute("src");
video.hidden = true;
video.load();
}
function showEmptyState(empty, message) {
if (!(empty instanceof HTMLElement)) return;
empty.hidden = false;
empty.textContent = message;
}
function hideEmptyState(empty) {
if (empty instanceof HTMLElement) {
empty.hidden = true;
}
}
function renderVideoSource(video, iframe, source) {
resetIframe(iframe);
if (video instanceof HTMLVideoElement) {
video.hidden = false;
attachVideoSource(video, source);
}
}
function renderEmbeddedSource(iframe, video, embeddedUrl) {
destroyHlsPlayer();
resetVideo(video);
if (iframe instanceof HTMLIFrameElement) {
iframe.hidden = false;
if (iframe.src !== embeddedUrl) {
iframe.src = embeddedUrl;
}
}
}
function renderSourceOptions() {
const { select } = getElements();
if (!select) return;
@@ -429,53 +477,26 @@ function renderSource(source) {
if (!source || (!embeddedUrl && !videoUrl)) {
destroyHlsPlayer();
if (iframe) {
iframe.removeAttribute("src");
iframe.hidden = true;
}
if (video) {
video.removeAttribute("src");
video.hidden = true;
video.load();
}
if (empty) {
empty.hidden = false;
empty.textContent = isExternalOnly
resetIframe(iframe);
resetVideo(video);
showEmptyState(
empty,
isExternalOnly
? "当前频道仅支持跳转官网或外部播放器打开。"
: "暂无可播放直播源,请先在系统配置中添加频道。";
}
: "暂无可播放直播源,请先在系统配置中添加频道。",
);
setPanelMessage(isExternalOnly ? TV_STATUS_MESSAGE.externalOnly : TV_STATUS_MESSAGE.empty);
updateOpenButton(source);
return;
}
if (isVideo && videoUrl) {
if (iframe) {
iframe.removeAttribute("src");
iframe.hidden = true;
}
if (video) {
video.hidden = false;
attachVideoSource(video, source);
}
renderVideoSource(video, iframe, source);
} else {
destroyHlsPlayer();
if (video) {
video.removeAttribute("src");
video.hidden = true;
video.load();
}
if (iframe) {
iframe.hidden = false;
if (iframe.src !== embeddedUrl) {
iframe.src = embeddedUrl;
}
}
renderEmbeddedSource(iframe, video, embeddedUrl);
}
if (empty) {
empty.hidden = true;
}
hideEmptyState(empty);
setPanelMessage(
source.id === tvPayload?.default_source_id ? "当前正在播放默认源" : "当前正在播放已选频道",
@@ -586,7 +607,7 @@ export function initTVPanel() {
});
video?.addEventListener("error", () => {
const currentSource = findSourceById(currentSourceId);
const currentSource = getCurrentSource();
if (!showEmbeddedFallback(currentSource)) {
setPanelMessage(TV_STATUS_MESSAGE.videoError);
}