Skip to content

一分钟搭建影视站,支持Docker等部署方式

fix(播放器): 清除播放位置记录以确保切换选集后从头开始播放

shinya6c89a41a0186
diff --git a/js/player.js b/js/player.js
index 8c93db4..eb58891 100644
--- a/js/player.js
+++ b/js/player.js
@@ -893,6 +893,9 @@ function playEpisode(index) {
currentEpisodeIndex = index;
videoHasEnded = false; // 重置视频结束标志
+ // 新增:清除之前的播放位置记录,确保切换选集后从头开始播放
+ clearVideoProgress();
+
// 获取当前URL的所有参数
const currentUrl = new URL(window.location.href);
const urlParams = currentUrl.searchParams;
@@ -910,6 +913,8 @@ function playEpisode(index) {
// 更新需要变更的参数
newUrl.searchParams.set('index', index);
newUrl.searchParams.set('url', url);
+ // 移除position参数,确保不会从记录的位置开始播放
+ newUrl.searchParams.delete('position');
// 使用replaceState更新URL,这样不会增加浏览历史记录
window.history.replaceState({}, '', newUrl);