Skip to content

Commit

Permalink
监听play事件没有必要了
Browse files Browse the repository at this point in the history
  • Loading branch information
Izumiko committed Feb 23, 2024
1 parent 31a7d49 commit 1906cfc
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions ede.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,12 @@
}
return;
}
if (!container.getAttribute('ede_listening')) {
showDebugInfo('正在初始化Listener');
container.setAttribute('ede_listening', true);
container.addEventListener('play', reloadDanmaku);
showDebugInfo('Listener初始化完成');
}
// if (!container.getAttribute('ede_listening')) {
// showDebugInfo('正在初始化Listener');
// container.setAttribute('ede_listening', true);
// container.addEventListener('play', reloadDanmaku);
// showDebugInfo('Listener初始化完成');
// }
}

function initUI() {
Expand Down Expand Up @@ -802,17 +802,15 @@


async function getEmbyItemInfo() {
showDebugInfo('准备获取Item信息');
if (authorization.length > 0 && userId.length > 0 && deviceId.length > 0) {
showDebugInfo('正在获取Item信息');
let playingInfo = null;
while (!playingInfo) {
await new Promise((resolve) => setTimeout(resolve, 200));
let sessionUrl = baseUrl + '/Sessions?ControllableByUserId=' + userId + '&deviceId=' + deviceId;
let sessionInfo = await getSessionInfo(sessionUrl, authorization);
playingInfo = sessionInfo[0].NowPlayingItem;
}
showDebugInfo('成功 ' + (playingInfo.SeriesName || playingInfo.Name));
showDebugInfo('获取Item信息成功: ' + (playingInfo.SeriesName || playingInfo.Name));
return playingInfo;
} else {
showDebugInfo('等待Config');
Expand Down Expand Up @@ -915,7 +913,7 @@
showDebugInfo('弹幕查询无结果');
return null;
}
showDebugInfo('查询成功');
showDebugInfo('节目查询成功');

let selecAnime_id = 1;
if (anime_id != -1) {
Expand Down Expand Up @@ -945,7 +943,12 @@
const initialep = match ? parseInt(match[1]) : 1;
episode = (parseInt(episode) < initialep) ? parseInt(episode) - 1 : (parseInt(episode) - initialep);
}


if (episode + 1 > animaInfo.animes[selecAnime_id].episodes.length) {
showDebugInfo('剧集不存在');
return null;
}

const epTitlePrefix = animaInfo.animes[selecAnime_id].type === 'tvseries' ? `S${season}E${episode + 1}` : (animaInfo.animes[selecAnime_id].type);
let episodeInfo = {
episodeId: animaInfo.animes[selecAnime_id].episodes[episode].episodeId,
Expand Down Expand Up @@ -1078,7 +1081,8 @@
const mutationObserverCallback = () => {
if (window.ede.danmaku && document.querySelector(mediaQueryStr)) {
showDebugInfo('探测播放媒体变化');
reloadDanmaku('reload');
const sleep = new Promise(resolve => setTimeout(resolve, 3000));
sleep.then(() => reloadDanmaku('reload'));
}
};

Expand Down

0 comments on commit 1906cfc

Please sign in to comment.