Merge branch 'media-control' into media-control

This commit is contained in:
mr. m
2025-03-13 01:12:57 +01:00
committed by GitHub
4 changed files with 118 additions and 73 deletions

View File

@@ -53,6 +53,8 @@ class ZenMediaController {
this.mediaControlBar.setAttribute('hidden', 'true');
this.mediaControlBar.removeAttribute('muted');
this.mediaControlBar.classList.remove('playing');
gZenUIManager.updateTabsToolbar();
}
/**
@@ -65,7 +67,14 @@ class ZenMediaController {
this.mediaControlBar.classList.add('playing');
}
this.mediaServiceTitle.textContent = this._currentBrowser._originalURI.displayHost;
// Have it displayed as e.g. <white>youtube</white><grey>.com</grey>
let host = this._currentBrowser._originalURI.displayHost;
if (host.startsWith('www.')) host = host.slice(4);
// note: we might have subdomains, so we need to split the host
const [service, ...tld] = host.split('.');
this.mediaServiceTitle.querySelector('.service').textContent = service;
this.mediaServiceTitle.querySelector('.tld').textContent = '.' + tld.join('.');
this.mediaServiceIcon.src = this._currentBrowser.mIconURL;
this.mediaFocusButton.style.listStyleImage = `url(${this._currentBrowser.mIconURL})`;
@@ -73,6 +82,8 @@ class ZenMediaController {
this.mediaTitle.textContent = metadata.title || '';
this.mediaArtist.textContent = metadata.artist || '';
gZenUIManager.updateTabsToolbar();
this._currentPosition = positionState.position;
this._currentDuration = positionState.duration;
this.updateMediaPosition();