Skip to content

Fix video clips failing to play with KDE Plasma Integration (#2) - #3

Merged
iamvinbas merged 1 commit into
mainfrom
fix/clip-playback-extensions
Nov 4, 2026
Merged

iamvinbas merged 1 commit into
mainfrom
fix/clip-playback-extensions

Conversation

@iamvinbas

Copy link
Copy Markdown
Owner

Fixes #2.

Cause

Video clips are played by a <video> element that was never added to the page. The KDE Plasma Integration browser extension (installed by default on many Linux desktops through a system-wide browser policy, Brave and Chrome alike) wraps document.createElement and new Audio(). When a detached media element starts playing, the extension inserts it into the page and immediately removes it again, so it can pick it up for its media controls (page-script.js, "addPlayerToDomEvadingAutoPlayBlocking"). Chromium pauses a media element that is removed from the page, so play() rejected with:

The play() request was interrupted because the media was removed from the document.

…and the clip never went on air. This also explains the reporter's workaround: the policy installs the extension into a fresh profile in the background, so only the first launch of a new ~/.local/share/streamFree/browser profile ran without it.

Reproduced in Chrome by injecting the extension's real page script at document start: the exact error, goo.gl link included, appears without this change and disappears with it.

Fix

keepInPage() (in util.js) puts media elements that are used only for their sound or frames into an invisible 1 px container in the page before play(). The extension leaves elements that are already in the page alone. Used for:

  • the clip player (playMedia), removed from the page when the clip stops;
  • the muted <audio> element that Chrome needs to deliver a WebRTC guest's audio to Web Audio. The extension paused and restarted it, which could cause a brief audio drop.

Tests

  • New browser test: a video clip plays even with an extension that moves detached media. It mimics the extension's behaviour with a small page script of our own (the extension's code is GPL). It fails without this change (the clip never goes on air) and passes with it.
  • Full browser suite: 18/18 passing locally.

Not tested

  • Brave on Linux with the real extension. The reporter's environment was reproduced with the extension's actual page script in Chrome on macOS.

🤖 Generated with Claude Code

Clips are played by a <video> element that was never added to the page.
The KDE Plasma Integration browser extension, installed by default on many
Linux desktops through a system policy, wraps document.createElement and
new Audio(): when a detached media element starts playing, it inserts it
into the page and removes it again. Chromium pauses a media element that is
removed from the page, so play() rejected with "The play() request was
interrupted because the media was removed from the document" and the clip
never went on air.

That also explains why deleting streamFree's browser profile helped: the
policy installs the extension into a fresh profile in the background, so
only the first launch of a new profile ran without it.

Media elements used only for their sound or frames (the clip player and
the element Chrome needs to deliver a WebRTC guest's audio to Web Audio)
now live in an invisible container in the page before play() is called,
so the extension leaves them alone.

The new browser test reproduces the extension's behaviour with a small
page script; it fails without this change.

Fixes #2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iamvinbas
iamvinbas merged commit 4f5fb5a into main Nov 4, 2026
4 checks passed
@iamvinbas
iamvinbas deleted the fix/clip-playback-extensions branch November 4, 2026 14:37
@iamvinbas iamvinbas mentioned this pull request Nov 4, 2026
iamvinbas added a commit that referenced this pull request Nov 4, 2026
On browsers without MediaStreamTrackProcessor (Safari, Firefox) the relay
reads the camera through a <video> element. Like the clip player fixed in
#3, a detached element can be paused by extensions such as KDE Plasma
Integration, which Firefox users on Linux often have too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Video Clip not Sharing

1 participant