Skip to content

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

refactor(player.js): 移除重复的播放器初始化逻辑

shinyab2609bc53320
diff --git a/js/player.js b/js/player.js
index 511822a..b8f8dbd 100644
--- a/js/player.js
+++ b/js/player.js
@@ -947,17 +947,6 @@ function playEpisode(index) {
setTimeout(() => {
window.isSwitchingVideo = false;
}, 1000);
-
- if (dp) {
- const playPromise = dp.play();
- if (playPromise !== undefined) {
- playPromise.catch(error => {
- console.warn('播放失败,尝试重新初始化:', error);
- // 如果切换视频失败,重新初始化播放器
- initPlayer(url, sourceCode);
- });
- }
- }
} else {
// 其他浏览器使用正常的switchVideo方法
if (dp.video) {
@@ -970,8 +959,10 @@ function playEpisode(index) {
url: url,
type: 'hls'
});
-
- // 确保播放开始
+ }
+
+ // 确保播放开始
+ if (dp) {
const playPromise = dp.play();
if (playPromise !== undefined) {
playPromise.catch(error => {