From 1317ff44ec33e49e42a8d4dfd810b6577ed0c2aa Mon Sep 17 00:00:00 2001 From: make Date: Sun, 30 Nov 2025 00:48:10 +0800 Subject: [PATCH] debug --- code/public/public/video/common.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/code/public/public/video/common.js b/code/public/public/video/common.js index 6555f97..7eb0333 100644 --- a/code/public/public/video/common.js +++ b/code/public/public/video/common.js @@ -626,9 +626,20 @@ document.addEventListener("DOMContentLoaded", function () { } - // 获取第一个线路 key + // 获取第一个线路 key(带容错) function getDefaultLine() { - return Object.keys(arrPlayUrl)[0]; // 后端已经排序,第一位永远是默认线路 + if (!arrPlayUrl || typeof arrPlayUrl !== "object") { + console.warn("arrPlayUrl 无效:", arrPlayUrl); + return null; + } + + const keys = Object.keys(arrPlayUrl); + if (keys.length === 0) { + console.warn("没有任何播放线路"); + return null; + } + + return keys[0]; // 后端排序,第一位为默认 } // 获取某个线路的第一个 url