Skip to content

Commit 934fdad

Browse files
author
Thales
committed
fix(player): stop logging six audio errors on every engine-backed load
Every track that plays through the Web Audio engine logged one MEDIA_ELEMENT_ERROR "Empty src attribute" per stem, six lines, before the user had done anything. The elements really do have no source, and that is correct: when the engine owns playback the multitrack is built with url: null for every stem, because the engine streams the audio itself and the multitrack is only there for the lanes. The guard that was supposed to skip those tested stemsByName[name].url instead, which is the original descriptor and still holds the real URL. So it passed, attached an error listener to an element that was deliberately never given a src, and the element duly reported one. Adds useEngine to the test, mirroring the condition that nulls the URLs in the first place. Playback was never affected. The cost was that anyone reading a console, or attaching one to a bug report, saw six errors that had nothing to do with their problem. It showed up while verifying #600 and is unrelated to it.
1 parent 69c434b commit 934fdad

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎static/js/player.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,9 +1320,18 @@ export function wireUpAudio(jobId, stems, duration, thumbnail, mixUrl = null, ti
13201320
`[player] canplay — ${stems.length} stems, ctx=${ctx?.state}, audios:`,
13211321
mt.audios?.map((a, i) => `${orderedNames[i]}:${a?.constructor?.name}`),
13221322
);
1323-
// Log load errors only for stems that actually have a source URL
1323+
// Log load errors only for stems that actually have a source URL.
1324+
//
1325+
// `useEngine` has to be part of that test, not just the stem descriptor.
1326+
// When the engine owns playback every multitrack stem is handed url: null
1327+
// above, so all of these elements have an empty src by design, while
1328+
// stemsByName still holds the real URL the engine is streaming from. Testing
1329+
// only the descriptor therefore passed, attached an error listener to an
1330+
// element that was never given a source, and logged six MEDIA_ELEMENT_ERROR
1331+
// "Empty src attribute" lines on every engine-backed track load. Harmless to
1332+
// playback, and noisy enough to bury a real error in a bug report.
13241333
mt.audios?.forEach((a, i) => {
1325-
if (a instanceof HTMLMediaElement && stemsByName[orderedNames[i]]?.url) {
1334+
if (!useEngine && a instanceof HTMLMediaElement && stemsByName[orderedNames[i]]?.url) {
13261335
a.addEventListener("error", () =>
13271336
console.error(`[player] audio error stem[${i}] ${orderedNames[i]}:`, a.error?.message, a.error?.code),
13281337
{ once: true });

0 commit comments

Comments
 (0)