Changeset 976d36d in Klonkt for src/assets/js/audio-player.js


Ignore:
Timestamp:
06/20/2026 04:03:58 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
b56afa7
Parents:
9e6b54f
Message:

fix(embed): bar-free square cover for YouTube audio

hqdefault is 4:3 with baked-in black bars → doesn't fill a square cover.
Now mqdefault (16:9, no bars) as the direct cover, and async upgrade to the
sharp maxresdefault (also no bars) when available. Applies to the launcher
card and the mini/sheet cover. busters audio-player.js?v=22,
embed-player.js?v=10.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/assets/js/audio-player.js

    r9e6b54f r976d36d  
    924924      postUrl: opts.postUrl || '',
    925925    }], 0);
     926    // Upgrade de cover async naar de scherpe maxresdefault (ook 16:9, geen balken)
     927    // als die bestaat. Async → de user-gesture voor afspelen blijft intact; de
     928    // direct gezette mqdefault toont al meteen een balkloze cover.
     929    try {
     930      const maxres = 'https://i.ytimg.com/vi/' + opts.id + '/maxresdefault.jpg';
     931      const im = new Image();
     932      im.onload = () => {
     933        if (im.naturalWidth <= 120) return;  // 120x90 = YouTube-placeholder (geen maxres)
     934        const t = queue[currentIndex];
     935        if (t && t.yt === opts.id) { t.cover = maxres; setCoverImage(cover, maxres); setCoverImage(sheetCover, maxres); }
     936      };
     937      im.src = maxres;
     938    } catch (e) {}
    926939  }
    927940
Note: See TracChangeset for help on using the changeset viewer.