diff --git a/plugin/contents/ui/dancer.html b/plugin/contents/ui/dancer.html
index 35aab65..1fbf1bd 100644
--- a/plugin/contents/ui/dancer.html
+++ b/plugin/contents/ui/dancer.html
@@ -1053,15 +1053,29 @@ function applyTheme(rgb) {
const albumArtEl = document.getElementById('albumArt');
+let lastArtUrl = '';
+
+function setAlbumArt(url) {
+ if (!url || url === lastArtUrl) return;
+ lastArtUrl = url;
+ fetch(url)
+ .then(r => r.blob())
+ .then(blob => {
+ const reader = new FileReader();
+ reader.onload = () => {
+ albumArtEl.style.backgroundImage = `url('${reader.result}')`;
+ };
+ reader.readAsDataURL(blob);
+ })
+ .catch(() => {});
+}
+
function fetchTheme() {
fetch('http://127.0.0.1:8765/current')
.then(r => r.json())
.then(d => {
if (d.rgb) applyTheme(d.rgb);
- if (d.art_url) {
- albumArtEl.style.backgroundImage = `url('${d.art_url}')`;
- albumArtEl.style.opacity = '1';
- }
+ if (d.art_url) setAlbumArt(d.art_url);
})
.catch(() => {});
}