一分钟搭建影视站,支持Docker等部署方式
feat: 改进广告检测逻辑并优化HLS播放器配置
developer29e8f01066df
diff --git a/player.html b/player.htmlindex 14091de..77db07d 100644--- a/player.html+++ b/player.html@@ -130,16 +130,21 @@let isAdSegment = false;let adSegmentStartIndex = -1;+ let lastNonAdLine = -1;for (let i = 0; i < lines.length; i++) {const line = lines[i];// 检测广告标记 - 更精确的检测逻辑- if (line.includes('#EXT-X-DISCONTINUITY') ||+ const isPotentialAd = line.includes('#EXT-X-DISCONTINUITY') ||line.includes('#EXT-X-CUE-OUT') ||line.includes('#EXT-X-CUE-IN') ||line.includes('#EXT-X-SPLICEPOINT') ||- (strictMode && (line.includes('ad') || line.includes('AD') || line.includes('Ad')))) {+ (strictMode && (line.toLowerCase().includes('ad') ||+ line.includes('commercial') ||+ line.includes('promo')));++ if (isPotentialAd && lastNonAdLine !== i - 1) {isAdSegment = true;adSegmentStartIndex = i;continue;@@ -163,6 +168,7 @@}i++; // 跳过URL行isAdSegment = false;+ lastNonAdLine = i;} else if (line.includes('#EXT-X-DISCONTINUITY-SEQUENCE') ||line.includes('#EXT-X-ENDLIST')) {isAdSegment = false;@@ -170,6 +176,7 @@} else {// 非广告分段,直接添加到过滤后的结果中filteredLines.push(line);+ lastNonAdLine = i;}}@@ -185,7 +192,14 @@loader: CustomHlsJsLoader,enableWorker: true,lowLatencyMode: false,- backBufferLength: 90+ backBufferLength: 90,+ maxBufferLength: 600,+ maxMaxBufferLength: 600,+ maxBufferSize: 60 * 1000 * 1000,+ maxBufferHole: 0.5,+ maxFragLookUpTolerance: 0.25,+ stretchShortVideoTrack: true,+ forceKeyFrameOnDiscontinuity: true};const dp = new DPlayer({