Skip to content

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

fix(player): 调整z-index值并添加全屏状态恢复逻辑

shinya77323fc86bd5
diff --git a/js/player.js b/js/player.js
index 11ac3cf..bd606e9 100644
--- a/js/player.js
+++ b/js/player.js
@@ -88,6 +88,7 @@ let shortcutHintTimeout = null; // 用于控制快捷键提示显示时间
let adFilteringEnabled = true; // 默认开启广告过滤
let progressSaveInterval = null; // 定期保存进度的计时器
let currentVideoUrl = ''; // 记录当前实际的视频URL
+let pendingFullscreenRestore = false; // 标记是否需要恢复全屏状态
// 页面加载
document.addEventListener('DOMContentLoaded', function () {
@@ -626,6 +627,12 @@ function initPlayer(videoUrl) {
// 启动定期保存播放进度
startProgressSaveInterval();
+
+ // 检查是否需要恢复全屏状态
+ if (pendingFullscreenRestore) {
+ art.fullscreen = true;
+ pendingFullscreenRestore = false; // 重置标记
+ }
})
// 错误处理
@@ -655,6 +662,9 @@ function initPlayer(videoUrl) {
// 如果自动播放下一集开启,且确实有下一集
if (autoplayEnabled && currentEpisodeIndex < currentEpisodes.length - 1) {
+ // 记录是否需要恢复全屏状态
+ pendingFullscreenRestore = art.fullscreen;
+
// 稍长延迟以确保所有事件处理完成
setTimeout(() => {
// 确认不是因为用户拖拽导致的假结束事件
@@ -662,6 +672,7 @@ function initPlayer(videoUrl) {
videoHasEnded = false; // 重置标志
}, 1000);
} else {
+ art.fullscreen = false;
}
});
@@ -1362,4 +1373,4 @@ function closeEmbeddedPlayer() {
console.error('尝试关闭嵌入式播放器失败:', e);
}
return false;
-}
+}
\ No newline at end of file
diff --git a/js/ui.js b/js/ui.js
index 7ad0b18..1c01407 100644
--- a/js/ui.js
+++ b/js/ui.js
@@ -27,7 +27,7 @@ function showToast(message, type = 'error') {
toast = document.createElement('div');
toast.id = 'toast';
toast.className = 'fixed top-4 left-1/2 -translate-x-1/2 px-6 py-3 rounded-lg shadow-lg transform transition-all duration-300 z-50 opacity-0';
-
+ toast.style = 'z-index: 2147483647'
toastMessage = document.createElement('p');
toastMessage.id = 'toastMessage';
toast.appendChild(toastMessage);
diff --git a/player.html b/player.html
index 1c3c7dc..d14fba4 100644
--- a/player.html
+++ b/player.html
@@ -131,7 +131,7 @@
top: 0;
left: 0;
width: 100vw;
- z-index: 2147483647 !important;
+ z-index: 10000000 !important;
pointer-events: auto !important;
background: #111;
}
@@ -376,4 +376,4 @@
});
</script>
</body>
-</html>
+</html>
\ No newline at end of file