Skip to content

Commit

Permalink
改善反复时的播放体验
Browse files Browse the repository at this point in the history
  • Loading branch information
Izumiko committed Nov 21, 2023
1 parent 3005671 commit f4f8a73
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions ede.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @description Jellyfin弹幕插件
// @namespace https://github.com/RyoLee
// @author RyoLee
// @version 1.15
// @version 1.16
// @copyright 2022, RyoLee (https://github.com/RyoLee)
// @license MIT; https://raw.githubusercontent.com/Izumiko/jellyfin-danmaku/jellyfin/LICENSE
// @icon https://github.githubassets.com/pinned-octocat.svg
Expand Down Expand Up @@ -737,12 +737,29 @@
window.ede.obMutation.disconnect();
}
window.ede.obMutation = new MutationObserver(() => {
if (window.ede.danmaku) {
if (window.ede.danmaku && document.querySelector(mediaQueryStr)) {
showDebugInfo('Video Changed');
reloadDanmaku('reload');
}
});
window.ede.obMutation.observe(_media, { attributes: true });

if (!window.obVideo) {
window.obVideo = new MutationObserver((mutationList, observer) => {
for (let mutationRecord of mutationList) {
if (mutationRecord.removedNodes) {
for (let removedNode of mutationRecord.removedNodes) {
if (removedNode.className && removedNode.classList.contains('videoPlayerContainer')) {
console.log('Video Removed');
window.ede.loading = false;
return;
}
}
}
}
});
window.obVideo.observe(document.body, { childList: true });
}
}

function reloadDanmaku(type = 'check') {
Expand Down

0 comments on commit f4f8a73

Please sign in to comment.