Skip to content

Commit

Permalink
修bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Izumiko committed Nov 21, 2023
1 parent 27d5209 commit 3005671
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions ede.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@
this.danmaku = null;
this.episode_info = null;
this.episode_info_str = '';
this.ob = null;
this.obResize = null;
this.obMutation = null;
this.loading = false;
}
}
Expand Down Expand Up @@ -453,6 +454,7 @@
let serverVersion = sessionInfo[0].ApplicationVersion;
// Ref: https://gist.github.com/nielsvanvelzen/ea047d9028f676185832e51ffaf12a6f
authorization = "MediaBrowser Client=\"" + clientName + "\", Device=\"" + deviceName + "\", DeviceId=\"" + deviceId + "\", Version=\"" + serverVersion + "\", Token=\"" + token + "\"";
return deviceId;
}


Expand All @@ -475,12 +477,12 @@
"mode": "cors"
}).then(res => res.json());
playingInfo = sessionInfo[0].NowPlayingItem;
if (sessionInfo[0] && !playingInfo) {
showDebugInfo('闲置中');
return 'Idle';
}
// if (sessionInfo[0] && !playingInfo) {
// showDebugInfo('闲置中');
// return 'Idle';
// }
}
showDebugInfo('成功 ' + playingInfo.SeriesName);
showDebugInfo('成功 ' + (playingInfo.SeriesName || playingInfo.Name));
return playingInfo;
} else {
showDebugInfo('等待Config');
Expand Down Expand Up @@ -720,16 +722,27 @@
window.ede.danmaku.speed = window.ede.speed

window.ede.danmakuSwitch == 1 ? window.ede.danmaku.show() : window.ede.danmaku.hide();
if (window.ede.ob) {
window.ede.ob.disconnect();
if (window.ede.obResize) {
window.ede.obResize.disconnect();
}
window.ede.ob = new ResizeObserver(() => {
window.ede.obResize = new ResizeObserver(() => {
if (window.ede.danmaku) {
showDebugInfo('Resizing');
window.ede.danmaku.resize();
}
});
window.ede.ob.observe(_container);
window.ede.obResize.observe(_container);

if (window.ede.obMutation) {
window.ede.obMutation.disconnect();
}
window.ede.obMutation = new MutationObserver(() => {
if (window.ede.danmaku) {
showDebugInfo('Video Changed');
reloadDanmaku('reload');
}
});
window.ede.obMutation.observe(_media, { attributes: true });
}

function reloadDanmaku(type = 'check') {
Expand Down Expand Up @@ -879,7 +892,7 @@
setInterval(() => {
initUI();
}, check_interval);
while (!(await getEmbyItemInfo())) {
while (!(await initConfig())) {
await new Promise((resolve) => setTimeout(resolve, 200));
}
reloadDanmaku('init');
Expand Down

0 comments on commit 3005671

Please sign in to comment.