Now Playing: a full view of what is playing (#475)

Tapping the player bar, or Enter on it, opens a sheet over the feeds and the
list: the episode's artwork large, its podcast, its show notes and Up Next.
The bar stays below it with the controls, so there is one set of them rather
than a second kept in step. Chapters are left for #477: nothing reads them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 14:40:02 +00:00
parent 1fb1edd6b0
commit 2faca684da
10 changed files with 123 additions and 20 deletions

View File

@@ -475,6 +475,38 @@ test('the Podcasts shelf shows the feeds with episodes, as their artwork, and op
await expect(page.locator('#eps .ep', { hasText: 'First Episode' })).toBeVisible(); await expect(page.locator('#eps .ep', { hasText: 'First Episode' })).toBeVisible();
}); });
test('Now Playing opens from the player bar with the artwork, show notes and Up Next (#475)', async ({ page }) => {
await page.evaluate(() => saveUpNext([]));
await page.locator('.feed', { hasText: 'Test Show' }).click();
const first = page.locator('#eps .ep', { hasText: 'First Episode' });
await first.hover();
await first.locator('[data-a=queue]').click();
const second = page.locator('#eps .ep', { hasText: 'Second Episode' });
await second.hover();
await second.locator('[data-a=play]').click();
await expect(page.locator('#ptitle')).toHaveText('Second Episode');
const sheet = page.locator('#nowsheet');
await page.locator('#pnow').click();
await expect(sheet).toBeVisible();
await expect(page.locator('#pnow')).toHaveAttribute('aria-expanded', 'true');
await expect(sheet.locator('h2')).toHaveText('Second Episode');
await expect(sheet.locator('.dbody')).toContainText('Notes for the second.');
await expect(sheet.locator('#nowqueue .childrow')).toHaveText([/First Episode/]);
await page.keyboard.press('Escape');
await expect(sheet).toBeHidden();
// From the keyboard too, and the podcast's name opens its feed.
await page.locator('#pnow').focus();
await page.keyboard.press('Enter');
await sheet.locator('.nowshow').click();
await expect(sheet).toBeHidden();
await expect(page.locator('#eps .ep', { hasText: 'Second Episode' })).toBeVisible();
await page.locator('#pclose').click();
await page.evaluate(() => saveUpNext([]));
await page.evaluate(() => api('/api/entries/test-show/ui-2/position', { method: 'POST', body: JSON.stringify({ secs: 0 }) }));
});
test('a player nobody has played since it last saved does not save again', async ({ page }) => { test('a player nobody has played since it last saved does not save again', async ({ page }) => {
// A tab left paused at 41:15 saved that as it reloaded, over the 32:48 another had reached, // A tab left paused at 41:15 saved that as it reloaded, over the 32:48 another had reached,
// and the episode dropped out of Currently Listening. The fixture audio does not decode, so // and the episode dropped out of Currently Listening. The fixture audio does not decode, so

View File

@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Now Playing: tap the player bar to see what is playing with its artwork large, its podcast (a tap opens it), its show notes and what follows in Up Next; Esc or the bar closes it (#475).
- Podcasts: your podcasts as a shelf of their artwork, each with how many episodes are new; the search box narrows it, and a tap opens one (#474). - Podcasts: your podcasts as a shelf of their artwork, each with how many episodes are new; the search box narrows it, and a tap opens one (#474).
- Up Next: line episodes up with the list button on a row or in the reader (`q`, or `Shift Q` to play one next), move them by their handles, and each plays when the one before it ends. The player has a Next button while something is lined up, and the lock screen's next-track button does the same (#473). - Up Next: line episodes up with the list button on a row or in the reader (`q`, or `Shift Q` to play one next), move them by their handles, and each plays when the one before it ends. The player has a Next button while something is lined up, and the lock screen's next-track button does the same (#473).
- The page reads ipx's answers in protobuf, with a decoder of its own and no library, and in JSON from a server that has none; offline, a kept answer still shows what was read offline (#470). - The page reads ipx's answers in protobuf, with a decoder of its own and no library, and in JSON from a server that has none; offline, a kept answer still shows what was read offline (#470).

View File

@@ -688,14 +688,34 @@ body.scan-this .fhead [data-a=scan] .i,body.scan-any .fhead [data-a=scanall] .i,
/* Currently Listening: how far into each episode you are, as a rail along the foot of its row. /* Currently Listening: how far into each episode you are, as a rail along the foot of its row.
The one in the player is marked as it is everywhere else, by the amber EQ bars, and its rail The one in the player is marked as it is everywhere else, by the amber EQ bars, and its rail
and time left move as it plays. The rest stay neutral, so that one is what stands out. */ and time left move as it plays. The rest stay neutral, so that one is what stands out. */
#listening .childrow{position:relative;overflow:hidden;gap:12px;padding:10px 10px 13px} #listening .childrow,#nowqueue .childrow{position:relative;overflow:hidden;gap:12px;padding:10px 10px 13px}
#listening .childrow .art{width:44px;height:44px;font-size:13px} #listening .childrow .art,#nowqueue .childrow .art{width:44px;height:44px;font-size:13px}
#listening .txt b{display:flex;align-items:center;gap:7px} #listening .txt b,#nowqueue .txt b{display:flex;align-items:center;gap:7px}
#listening .txt b span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} #listening .txt b span,#nowqueue .txt b span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#listening .txt small{display:flex;gap:12px;margin-top:3px;color:var(--faint);font-size:11.5px} #listening .txt small,#nowqueue .txt small{display:flex;gap:12px;margin-top:3px;color:var(--faint);font-size:11.5px}
#listening .txt small .fd{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} #listening .txt small .fd,#nowqueue .txt small .fd{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#listening .txt small .left{flex:none;color:var(--dim)} #listening .txt small .left,#nowqueue .txt small .left{flex:none;color:var(--dim)}
#listening .childrow:not(.now) .eq{display:none} #listening .childrow:not(.now) .eq,#nowqueue .childrow:not(.now) .eq{display:none}
/* Now Playing (#475): over the feeds and the list, above the player bar, which keeps the
controls. The artwork is the one large thing on the page. */
#nowsheet{grid-row:1;grid-column:1/-1;z-index:30;overflow:auto;background:var(--bg);
padding:22px max(16px,calc((100% - 720px)/2)) 32px;position:relative}
#nowclose{position:absolute;top:14px;right:max(12px,calc((100% - 720px)/2 - 44px))}
.nowhead{display:grid;grid-template-columns:minmax(0,280px) minmax(0,1fr);gap:24px;align-items:end;margin:10px 0 26px}
.nowhead .nowart{width:100%;height:auto;aspect-ratio:1;border-radius:14px;font-size:56px}
.nowmeta{display:flex;flex-direction:column;gap:6px;min-width:0}
.nowmeta h2{margin:0;font-size:24px;line-height:1.2;text-wrap:balance}
.nowshow{align-self:flex-start;color:var(--accent);font-size:15px;font-weight:500;text-align:left}
.nowmeta small{color:var(--dim);font-size:12.5px;font-variant-numeric:tabular-nums}
#nowsheet h3{font-size:14px;font-weight:600;margin:22px 0 10px;color:var(--dim)}
#nowqueue{display:flex;flex-direction:column;gap:6px}
#pnow{cursor:pointer;border-radius:8px}
@media (max-width:820px){
.nowhead{grid-template-columns:1fr;justify-items:center;text-align:center;gap:18px}
.nowhead .nowart{max-width:300px}
.nowmeta{align-items:center}
.nowshow{align-self:center;text-align:center}
}
/* The Podcasts shelf (#474): the artwork is the podcast, as on a shelf of records, so nothing /* The Podcasts shelf (#474): the artwork is the podcast, as on a shelf of records, so nothing
frames it: no card, no shadow, the name and its new episodes under it. */ frames it: no card, no shadow, the name and its new episodes under it. */
.shelf{display:grid;grid-template-columns:repeat(auto-fill,minmax(112px,1fr));gap:20px 14px;padding:4px 2px 24px} .shelf{display:grid;grid-template-columns:repeat(auto-fill,minmax(112px,1fr));gap:20px 14px;padding:4px 2px 24px}
@@ -708,14 +728,14 @@ body.scan-this .fhead [data-a=scan] .i,body.scan-any .fhead [data-a=scanall] .i,
#listening .grip{width:22px;margin-left:-4px;color:var(--faint);cursor:grab;touch-action:none} #listening .grip{width:22px;margin-left:-4px;color:var(--faint);cursor:grab;touch-action:none}
#listening .grip svg{width:12px;height:12px} #listening .grip svg{width:12px;height:12px}
#listening .childrow.dragging{border-color:var(--accent);cursor:grabbing} #listening .childrow.dragging{border-color:var(--accent);cursor:grabbing}
#listening .rail{position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--raise)} #listening .rail,#nowqueue .rail{position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--raise)}
#listening .rail i{display:block;height:100%;width:0;background:var(--faint);transition:width .25s linear} #listening .rail i,#nowqueue .rail i{display:block;height:100%;width:0;background:var(--faint);transition:width .25s linear}
#listening .now{border-color:color-mix(in srgb,var(--accent2) 60%,var(--line))} #listening .now,#nowqueue .now{border-color:color-mix(in srgb,var(--accent2) 60%,var(--line))}
#listening .now .eq,#listening .now .left{color:var(--accent2)} #listening .now .eq,#nowqueue .now .eq,#listening .now .left,#nowqueue .now .left{color:var(--accent2)}
#listening .now .rail i{background:var(--accent2)} #listening .now .rail i,#nowqueue .now .rail i{background:var(--accent2)}
/* Quiet buttons: a filled one on every row outshouted the row that is playing. */ /* Quiet buttons: a filled one on every row outshouted the row that is playing. */
#listening [data-a=play]{color:var(--accent)} #listening [data-a=play],#nowqueue [data-a=play]{color:var(--accent)}
#listening [data-a=remove]{color:var(--faint)} #listening [data-a=remove],#nowqueue [data-a=remove]{color:var(--faint)}
/* The Directory, laid out as Apple's is: a large title, then sections. Every page carries what /* The Directory, laid out as Apple's is: a large title, then sections. Every page carries what
kind of feed (.tabs, as the item filters are) in its title row. */ kind of feed (.tabs, as the item filters are) in its title row. */
.dhead{margin-bottom:6px} .dhead{margin-bottom:6px}

View File

@@ -29,7 +29,7 @@ const WEB_VERSION = JSON.parse(fs.readFileSync(path.join(here, '..', 'package.js
// The files are one script, concatenated in this order, not modules: they share one top-level // The files are one script, concatenated in this order, not modules: they share one top-level
// scope, as the single inline script did, and code that runs at load needs what came before it. // scope, as the single inline script did, and code that runs at load needs what came before it.
const PAGES: Record<string, { script: string, src: string[] }> = { const PAGES: Record<string, { script: string, src: string[] }> = {
'index.html': { script: 'app.js', src: ['util', 'wire', 'theme', 'feeds', 'feedpage', 'items', 'player', 'upnext', 'dialogs', 'signals', 'gestures', 'offline', 'events', 'native'] }, 'index.html': { script: 'app.js', src: ['util', 'wire', 'theme', 'feeds', 'feedpage', 'items', 'player', 'upnext', 'nowplaying', 'dialogs', 'signals', 'gestures', 'offline', 'events', 'native'] },
'admin.html': { script: 'admin.js', src: ['util', 'wire', 'theme', 'admin'] }, 'admin.html': { script: 'admin.js', src: ['util', 'wire', 'theme', 'admin'] },
'login.html': { script: 'login.js', src: ['login'] }, 'login.html': { script: 'login.js', src: ['login'] },
}; };

View File

@@ -46,11 +46,12 @@
<div class="wrap" id="content"></div> <div class="wrap" id="content"></div>
</div> </div>
<div id="scrim" hidden></div> <div id="scrim" hidden></div>
<section id="nowsheet" aria-label="Now Playing" hidden></section>
</div> </div>
<div id="status"><span id="count"></span></div> <div id="status"><span id="count"></span></div>
<div id="player"> <div id="player">
<div id="pnow"> <div id="pnow" role="button" tabindex="0" aria-expanded="false" aria-controls="nowsheet" title="Now Playing">
<div id="partwrap"></div> <div id="partwrap"></div>
<div class="txt"><b><span class="eq" aria-hidden="true"><i></i><i></i><i></i></span><span id="ptitle"></span></b><small id="pfeed"></small></div> <div class="txt"><b><span class="eq" aria-hidden="true"><i></i><i></i><i></i></span><span id="ptitle"></span></b><small id="pfeed"></small></div>
</div> </div>

View File

@@ -401,7 +401,7 @@ function paintListenRow(el: HTMLElement & {entry?: Entry}){
} }
/// Keeps the list in step with the player. Only a row that is, or was, the one in it changes. /// Keeps the list in step with the player. Only a row that is, or was, the one in it changes.
function syncListening(){ function syncListening(){
for(const el of $$<HTMLElement & {entry?: Entry}>('#listening .childrow')) for(const el of $$<HTMLElement & {entry?: Entry}>('#listening .childrow, #nowqueue .childrow'))
if(el.entry&&(el.classList.contains('now')||inPlayer(el.entry))) paintListenRow(el); if(el.entry&&(el.classList.contains('now')||inPlayer(el.entry))) paintListenRow(el);
} }

View File

@@ -241,6 +241,7 @@ function installNativePlayback(){
fire(m.playing ? 'play' : 'pause'); fire(m.playing ? 'play' : 'pause');
renderEntries(); renderEntries();
syncListening(); syncListening();
drawNow();
} }
function stop(){ function stop(){

46
web/src/nowplaying.ts Normal file
View File

@@ -0,0 +1,46 @@
/* ---------------- Now Playing ---------------- */
/// Now Playing (#475): what is playing, opened from the player bar. Its artwork large, the
/// podcast it is from, its show notes and what follows in Up Next. The bar stays below it with
/// the controls, so there is one set of them, not a second to keep in step.
const nowSheet=$('#nowsheet');
const nowOpen=()=>!nowSheet.hidden;
function openNow(){
if(!player.guid) return;
nowSheet.hidden=false;
$('#pnow').setAttribute('aria-expanded','true');
drawNow();
$<HTMLButtonElement>('#nowclose').focus();
}
function closeNow(){
if(!nowOpen()) return;
nowSheet.hidden=true;
$('#pnow').setAttribute('aria-expanded','false');
$('#pnow').focus();
}
/// Drawn again whenever what plays or what follows changes, while it is open.
function drawNow(){
const e=player.entry;
if(!nowOpen()) return;
if(!e||!player.guid){ closeNow(); return; }
const name=entryName(e).text, show=feedName(e.feed_id);
nowSheet.innerHTML=`
<button class="iconbtn" id="nowclose" title="Close Now Playing (Esc)" aria-label="Close Now Playing">${ICON.close}</button>
<div class="nowhead">
${artHTML(e.image||feedArt(e.feed_id),show,'nowart')}
<div class="nowmeta">
<h2>${esc(name)}</h2>
<button type="button" class="nowshow">${esc(show)}</button>
<small>${[dateOf(e.published),e.duration?clock(e.duration):''].filter(Boolean).join(', ')}</small>
</div>
</div>
${upNext.length?`<h3>Up Next</h3><div class="childlist" id="nowqueue"></div>`:''}
<h3>Show notes</h3>
<div class="dbody">${textOf(e)}</div>`;
$<HTMLButtonElement>('#nowclose').onclick=closeNow;
$<HTMLButtonElement>('.nowshow',nowSheet).onclick=()=>{ closeNow(); selectFeed(e.feed_id); };
const q=$('#nowqueue');
for(const x of upNext) q?.appendChild(listenRow(x,'Remove from Up Next',()=>saveUpNext(upNext.filter(y=>entryKey(y)!==entryKey(x)))));
}
$('#pnow').onclick=()=>nowOpen()?closeNow():openNow();
$('#pnow').onkeydown=(ev: KeyboardEvent)=>{ if(ev.key==='Enter'||ev.key===' '){ ev.preventDefault(); $('#pnow').click(); } };

View File

@@ -87,6 +87,7 @@ function play(e: Entry,enc=e.enclosures.find(isPlayable)){
paintDead(); paintDead();
startedPlaying(e); startedPlaying(e);
hostNext(); hostNext();
drawNow();
} }
const go=()=>audio.play().catch(playFailed); const go=()=>audio.play().catch(playFailed);
if(wait) wait.then(go,playFailed); else go(); if(wait) wait.then(go,playFailed); else go();
@@ -279,7 +280,7 @@ async function switchVersion(){
if(was) (wait||Promise.resolve()).then(()=>audio.play()).catch(()=>{}); if(was) (wait||Promise.resolve()).then(()=>audio.play()).catch(()=>{});
return true; return true;
} }
$<HTMLButtonElement>('#pclose').onclick=()=>{if(sleepAt)sleepIn(0);savePos();audio.pause();dropHls();audio.removeAttribute('src');player.guid=null;$('#player').classList.remove('on');document.body.classList.remove('has-video');renderEntries(); $<HTMLButtonElement>('#pclose').onclick=()=>{closeNow();if(sleepAt)sleepIn(0);savePos();audio.pause();dropHls();audio.removeAttribute('src');player.guid=null;$('#player').classList.remove('on');document.body.classList.remove('has-video');renderEntries();
// Called here, not left to the pause event: closing a player already paused fires none. // Called here, not left to the pause event: closing a player already paused fires none.
syncListening()}; syncListening()};
(function restore(){ (function restore(){
@@ -291,7 +292,7 @@ $<HTMLButtonElement>('#pclose').onclick=()=>{if(sleepAt)sleepIn(0);savePos();aud
document.addEventListener('keydown',ev=>{ document.addEventListener('keydown',ev=>{
// Escape leaves a dialog even from inside one of its boxes. It used to sit below the check // Escape leaves a dialog even from inside one of its boxes. It used to sit below the check
// that follows, so Add feed, which opens with the cursor in its URL box, ignored it. // that follows, so Add feed, which opens with the cursor in its URL box, ignored it.
if(ev.key==='Escape'){closeModal();nav(false);return} if(ev.key==='Escape'){closeModal();nav(false);closeNow();return}
// The rest are single keys that would otherwise eat what you type. // The rest are single keys that would otherwise eat what you type.
if(/^(INPUT|TEXTAREA|SELECT)$/.test((ev.target as Element).tagName)) return; if(/^(INPUT|TEXTAREA|SELECT)$/.test((ev.target as Element).tagName)) return;
if(ev.key===' '&&player.guid){ev.preventDefault();audio.paused?audio.play():audio.pause()} if(ev.key===' '&&player.guid){ev.preventDefault();audio.paused?audio.play():audio.pause()}

View File

@@ -25,6 +25,7 @@ async function saveUpNext(list: Entry[]){
function upNextChanged(){ function upNextChanged(){
renderFeeds(); renderFeeds();
if(S.feed===':upnext') drawUpNext(); if(S.feed===':upnext') drawUpNext();
drawNow();
// The rows' and the reader's buttons say whether each is in it. // The rows' and the reader's buttons say whether each is in it.
for(const b of $$<HTMLButtonElement>('[data-a=queue]')) paintQueueButton(b); for(const b of $$<HTMLButtonElement>('[data-a=queue]')) paintQueueButton(b);
hostNext(); hostNext();