Skip to content

Commit 6e2ce55

Browse files
committed
fix: Youtube mute and other options
1 parent b0e7bfd commit 6e2ce55

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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)