From 8de129eb751ed1fbb166c1a60a5b5ae7d3582f23 Mon Sep 17 00:00:00 2001 From: Zach Fleeman Date: Thu, 22 Oct 2026 12:52:17 -0600 Subject: [PATCH] Show the playback notice when the browser plays a video's audio but draws no frames --- ffmpeg4discord/templates/web.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ffmpeg4discord/templates/web.html b/ffmpeg4discord/templates/web.html index 89bff88..2136d12 100644 --- a/ffmpeg4discord/templates/web.html +++ b/ffmpeg4discord/templates/web.html @@ -358,14 +358,18 @@

Audio Streams

} // Browsers can't play some formats, like HEVC or ProRes. Some fail outright, and some load only the audio. + // Others, like Firefox with an HEVC MKV, report the video's size and play its audio but never draw a frame. const playbackNotice = document.getElementById('playbackNotice'); function checkPlayable() { - if (video.error || (video.readyState >= HTMLMediaElement.HAVE_METADATA && video.videoWidth === 0)) { + const noFrames = !video.paused && video.getVideoPlaybackQuality().totalVideoFrames === 0; + if (video.error || (video.readyState >= HTMLMediaElement.HAVE_METADATA && video.videoWidth === 0) || noFrames) { playbackNotice.hidden = false; } } video.addEventListener('error', checkPlayable); video.addEventListener('loadedmetadata', checkPlayable); + // A video that can be decoded has drawn frames within a second of playing + video.addEventListener('playing', () => setTimeout(checkPlayable, 1000)); checkPlayable(); // the video may have failed before this script ran // The preview plays from the start time and stops at the end time, even after a pause or a speed change.