Changeset 976d36d in Klonkt for src/assets/js/embed-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/embed-player.js

    r9e6b54f r976d36d  
    193193    const poster = provider === 'youtube'
    194194      ? `https://i.ytimg.com/vi/${ytId(ref, url)}/hqdefault.jpg` : '';
     195    // 16:9-thumbnail ZONDER zwarte balken (mqdefault) voor de vierkante cover —
     196    // hqdefault is 4:3 met letterbox en vult een vierkant niet schoon.
     197    const ytThumb = provider === 'youtube'
     198      ? `https://i.ytimg.com/vi/${ytId(ref, url)}/mqdefault.jpg` : '';
    195199
    196200    el.innerHTML = ''
     
    229233    let preMuteVol = 100;
    230234    // Audio-only YouTube: zet de thumbnail als albumhoes op de audio-kaart.
    231     if (audioOnly && poster) {
     235    if (audioOnly && ytThumb) {
    232236      const art0 = el.querySelector('.pcms-embed-art');
    233       if (art0) { art0.style.backgroundImage = `url('${poster}')`; art0.classList.add('has-art'); }
     237      if (art0) { art0.style.backgroundImage = `url('${ytThumb}')`; art0.classList.add('has-art'); }
    234238    }
    235239
     
    310314      // én doorspelen bij navigeren. De inline-kaart is enkel de launcher.
    311315      if (audioOnly && window.pcmsAudioPlayer && typeof window.pcmsAudioPlayer.playYouTube === 'function') {
    312         window.pcmsAudioPlayer.playYouTube({ id: ytId(ref, url), cover: poster, postUrl: location.pathname + location.search });
     316        window.pcmsAudioPlayer.playYouTube({ id: ytId(ref, url), cover: ytThumb, postUrl: location.pathname + location.search });
    313317        el.classList.add('pcms-embed-elsewhere');
    314318        return;
Note: See TracChangeset for help on using the changeset viewer.