0

I'm using the ride theme from shopify (I know I know) and see my video in an index.json file:

 "video_url": "https:\/\/www.youtube.com\/watch?v=KlxiEKrhWIQ",

I'd like to have it start playing as soon as someone lands on the page.

I also see a section that has the follow iframe:

<template>
{%- if section.settings.video_url.type == 'youtube' -%}
<iframe src="https://www.youtube.com/embed/{{ section.settings.video_url.id }}?enablejsapi=1" class="js-youtube" allow="autoplay; encrypted-media" allowfullscreen title="{{ section.settings.description | escape }}"></iframe>
{%- else -%}
<iframe src="https://player.vimeo.com/video/{{ section.settings.video_url.id }}" class="js-vimeo" allow="autoplay; encrypted-media" allowfullscreen title="{{ section.settings.description | escape }}"></iframe>
{%- endif -%}
</template>

Would appreciate any help. I tried adding ?autoplay=1 after the ID and before ?enablejsapi=1 but it didn't work

Thanks

rahrahruby
  • 673
  • 4
  • 11
  • 28
  • 1
    Hi! please check this link if it's helpful for you https://stackoverflow.com/questions/40685142/youtube-autoplay-not-working – Jaswinder Kaur Jun 01 '22 at 04:51

1 Answers1

0

Check my video on the topic it uses the Recharge theme which is basically the same thing as Ride, I hope I helped.

https://youtu.be/IDJju-jTJmg

Here is the code anippet mentionned in the video.

{%- liquid
  assign video_handle = ''
  assign video_format = ''
-%}

<video title="Video is about this in that." autoplay loop muted playsinline style="inline-size: 100%;">
  <source src="{{ video_handle }}" 
    type="video/{{ video_format }}">
</video>
Blanklob
  • 28
  • 2