From ceb3ca970a01fb71eaa371c719b4b52dbe812dda Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Sun, 8 Nov 2026 08:21:30 +0200 Subject: [PATCH] feat(demo): a "My file does not play" button on the player page Once something has been played, the button opens the repository's bug report form in a new tab, filled in from the load: the file's name or link, the switches, the content type, the error, the player's version and the event log. Nothing is sent from the page, the file goes only if the visitor attaches it, and every address loses its query and fragment. Closes #155 --- apps/demo/demo/player-page.css | 22 +++++++ apps/demo/demo/player-page.js | 105 +++++++++++++++++++++++++++++++++ apps/demo/index.html | 9 +++ design/demo.md | 11 ++++ 4 files changed, 147 insertions(+) diff --git a/apps/demo/demo/player-page.css b/apps/demo/demo/player-page.css index fb9e3e44..076fbcce 100644 --- a/apps/demo/demo/player-page.css +++ b/apps/demo/demo/player-page.css @@ -642,6 +642,28 @@ progress[hidden] { display: none; } .message.offer:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; } .offer button[hidden] { display: none; } +/* "My file does not play", under the player: a quiet pill, as the samples are, and what it does. */ +.report:not([hidden]) { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.4rem 0.75rem; + margin: 0.75rem 0 0; + color: var(--muted); + font-size: 0.85rem; + line-height: 1.45; +} +.report button { + flex: none; + min-height: 2rem; + padding: 0.3rem 0.75rem; + border-radius: 999px; + background: var(--surface); + font-size: 0.85rem; +} +.report button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); } +.report span { flex: 1 1 18rem; } + /* ---------------------------------------------------------------- the SCORM page's steps */ /* A step: its number in a disc before its heading, and hidden until the page can reach it. */ diff --git a/apps/demo/demo/player-page.js b/apps/demo/demo/player-page.js index 6b8b5e86..2e413006 100644 --- a/apps/demo/demo/player-page.js +++ b/apps/demo/demo/player-page.js @@ -22,6 +22,8 @@ const downgradeToggle = document.querySelector('#downgrade') const confirmBox = document.querySelector('#confirm-src') const modeNote = document.querySelector('#mode-note') const modeTag = document.querySelector('#mode-tag') +const reportRow = document.querySelector('#report-row') +const reportButton = document.querySelector('#report') const write = logInto(log) const show = messageIn(message) @@ -159,6 +161,7 @@ player.addEventListener('finished', (event) => { player.addEventListener('error', (event) => { const { code, message: detail, missingLibraries } = event.detail + lastError = { code, message: detail, mainLibrary: missingLibraries?.mainLibrary, late: code === 'runtime' && player.state === 'ready' } bar.hidden = true // Played untrusted, the package turned out to need its own copy of a library. From another // site, the visitor decides, naming the host; this site's own or a picked file was played @@ -238,6 +241,16 @@ player.setAttribute('resize-code', `