diff --git a/dashboard/package.json b/dashboard/package.json index afde6b2..0158fa6 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -24,6 +24,7 @@ "flv.js": "^1.6.2", "hls.js": "^1.6.13", "json-server": "^0.17.4", + "mpegts.js": "^1.8.0", "pinia": "^2.2.6", "shaka-player": "^4.16.3", "v-viewer": "^3.0.22", diff --git a/dashboard/src/api/services/live.js b/dashboard/src/api/services/live.js index 2fa089a..5dd5e20 100644 --- a/dashboard/src/api/services/live.js +++ b/dashboard/src/api/services/live.js @@ -126,10 +126,12 @@ class LiveService { for (let i = 0; i < lines.length; i++) { const line = lines[i] - + // 跳过空行 + if (!line) continue; + if (line.startsWith('#EXTINF:')) { // 解析频道信息 - 修复正则表达式来正确处理属性和频道名称 - const match = line.match(/#EXTINF:(-?\d+),(.*)$/) + const match = line.match(/^#EXTINF:([-\.\d]+)\s*(.*)$/); if (match) { const duration = match[1] const fullStr = match[2].trim() @@ -483,4 +485,4 @@ class LiveService { // 创建单例实例 const liveService = new LiveService() -export default liveService \ No newline at end of file +export default liveService diff --git a/dashboard/src/views/Live.vue b/dashboard/src/views/Live.vue index e9e6d44..6d5ba1f 100644 --- a/dashboard/src/views/Live.vue +++ b/dashboard/src/views/Live.vue @@ -220,7 +220,8 @@