properly clean up radio hls instances

This commit is contained in:
vapormusic 2022-09-15 22:59:10 +07:00
parent 9ec60515e8
commit 43ed479de4
2 changed files with 12 additions and 3 deletions

View file

@ -58,6 +58,10 @@ const Events = {
try {
app.mk._services.mediaItemPlayback._currentPlayer.destroy();
} catch (e) {}
try {
this.radiohls.destroy()
this.radiohls = null;
} catch (_){}
try {
let searchInt = setInterval(function () {
if (document.getElementById("apple-music-player")) {

View file

@ -1021,6 +1021,11 @@ const app = new Vue({
return;
} // EVIL EMPTY OBJECTS BE GONE
try {
this.radiohls.destroy()
this.radiohls = null;
} catch (_){}
try {
if ((MusicKit.getInstance().nowPlayingItem["type"] ?? "").includes("ideo")) {
setTimeout(() => {
@ -5079,13 +5084,13 @@ const app = new Vue({
};
if (app.radiohls != null && app.radiohls.destroy != null) {
app.radiohls.destroy();
setTimeout(() => {
app.radiohls = null;
app.radiohls = new CiderHls();
app.radiohls.loadSource(e);
app.radiohls.attachMedia(app.mk._services.mediaItemPlayback._currentPlayer._targetElement);
app.mk._services.mediaItemPlayback._currentPlayer._targetElement.play();
}, 500);
} else {
app.radiohls = null;
app.radiohls = new CiderHls();
app.radiohls.loadSource(e);
app.radiohls.attachMedia(app.mk._services.mediaItemPlayback._currentPlayer._targetElement);