Repository navigation
Conversation
Restore the ability to hide native download, playback-rate, and picture-in-picture controls on HTML video sources (fixes cookpete#2007). These attributes are already typed on ReactPlayer but were omitted from the explicit prop list in Player.
ryscript9
force-pushed
the
fix/forward-control-attrs
branch
2 times, most recently
from
October 19, 2026 10:04
2ce42aa to
2d84ee8
Compare
HtmlPlayer spread its whole props object onto <video>/<audio>, so config.html.attributes (the v3 home of v2's config.file.attributes) rendered as config="[object Object]" instead of applying the attributes. Spread config.html.attributes onto the element, then the player props that are defined, so an explicit prop (including false) wins and an omitted prop no longer clears the config value. Document controlsList, disablePictureInPicture and config.html, and add a demo checkbox.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2007
Problem
In v3, hiding the native download, playback-speed, and picture-in-picture controls stopped working.
controlsListanddisablePictureInPictureare already valid props, butPlayercopies an explicit attribute list onto the active player and these two were missing.pip={false}does not hide that button. It requests picture-in-picture mode.The v2 path broke as well.
config.file.attributesis nowconfig.html.attributes, andHtmlPlayerspread that object onto the<video>/<audio>element, which renderedconfig="[object Object]"instead of applying the attributes.Changes
controlsListanddisablePictureInPicture, the same wayplaysInlineanddisableRemotePlaybackalready are.config.html.attributeson the underlying media element. An explicit prop wins, including an explicitfalse. An omitted prop no longer wipes the same key.configobject itself off the element.config.file.attributes→config.html.attributespath.Video
before/after, 32s
The same
<ReactPlayer controls config={{ html: { attributes: { controlsList: "nodownload noplaybackrate", disablePictureInPicture: true } } }} />on v3.4.0 and on this branch. On v3.4.0 the rendered<video>has nocontrolsListordisablePictureInPicture, getsconfig="[object Object]", and the overflow menu (download, playback speed, picture-in-picture) stays. With this PR both attributes are set, theconfigattribute is gone, and the overflow button disappears.How I tested it
controlsListanddisablePictureInPictureon the<video>and removes those overflow menu items. Unticking it removes them again. On v3.4.0 the same checkbox has no effect.ReactPlayer. The props land on<video>.config.html.attributeslands on<video>and<audio>.configis not a DOM prop. An explicit prop, includingfalse, overrides config. These tests fail on master.npm run typesandnpx biome lint ./srcare clean.On Windows,
npm testdoes not run as-is. The script globs are not expanded by cmd.exe, andecho '{"type": "module"}'writes quotes intodisttest/package.json. I ran the sametesterfiles from bash and fixed that file by hand. I left the test script alone because it is unrelated to this PR.Not in this PR
dist/changes, per CONTRIBUTING.md.posterforwarding. fix: pass poster prop to internal component #2027 and fix: forward poster to video element #2045 already cover it.