Skip to content

Commit 10a6118

Browse files
authored
fix: Youtube mute and other options (#5115)
## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent 3b8c58b commit 10a6118

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/sdk-components-react/src/youtube.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,15 @@ const getVideoUrl = (
217217
)[];
218218

219219
const parameters: Record<string, string | undefined> = {};
220+
parameters.autoplay = "1";
220221

221222
for (const optionsKey of optionsKeys) {
223+
if (options[optionsKey] === undefined) {
224+
continue;
225+
}
222226
switch (optionsKey) {
223227
case "autoplay":
224-
parameters.autoplay = options.autoplay ? "1" : "0";
228+
// parameters.autoplay = options.autoplay ? "1" : "0";
225229
// Mute video if autoplay is enabled and muted is not touched
226230
if (options.autoplay && options.muted === undefined) {
227231
parameters.mute = "1";
@@ -507,7 +511,7 @@ export const YouTube = forwardRef<Ref, Props>(
507511
showCaptions,
508512
allowFullscreen,
509513
showControls,
510-
autoplay: true,
514+
autoplay,
511515
enablejsapi: false,
512516
},
513517
videoUrlOrigin

0 commit comments

Comments
 (0)