Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Youtube mute and other options (#5115)

Ivan Starkov10a611866074
diff --git a/packages/sdk-components-react/src/youtube.tsx b/packages/sdk-components-react/src/youtube.tsx
index 520f493d37..65ae5e3537 100644
--- a/packages/sdk-components-react/src/youtube.tsx
+++ b/packages/sdk-components-react/src/youtube.tsx
@@ -217,11 +217,15 @@ const getVideoUrl = (
)[];
const parameters: Record<string, string | undefined> = {};
+ parameters.autoplay = "1";
for (const optionsKey of optionsKeys) {
+ if (options[optionsKey] === undefined) {
+ continue;
+ }
switch (optionsKey) {
case "autoplay":
- parameters.autoplay = options.autoplay ? "1" : "0";
+ // parameters.autoplay = options.autoplay ? "1" : "0";
// Mute video if autoplay is enabled and muted is not touched
if (options.autoplay && options.muted === undefined) {
parameters.mute = "1";
@@ -507,7 +511,7 @@ export const YouTube = forwardRef<Ref, Props>(
showCaptions,
allowFullscreen,
showControls,
- autoplay: true,
+ autoplay,
enablejsapi: false,
},
videoUrlOrigin