Autoplay Videos on Brooklyn theme.

Highlighted
New Member
5 0 0

Hello everyone,

Im selling some animations and I want them to autoplay as soon as the clients enters the homepage/product page. Right now im using gif, and works, but I kind lose some quality and I can't use sound. 

Is there any way to work around this situation?  Currently im using the Brooklyn theme and would like the theme to be the same if possible. 

Thank you.

0 Likes
Highlighted
New Member
4 0 0

Hi there, just wondering if you found a solution to this. Thank you

0 Likes
Highlighted
Astronaut
1082 178 213

@RafaelBJR 
@UA 

You can try something like this:

1. In your Shopify Admin go to online store > themes > actions > edit code
2. In your theme.liquid file, find the </body> (press CTRL + F or command + F on Mac)
3. paste this code right above the </body> tag:

<script>
 window.onload = function() {
var videos = document.querySelectorAll(`video`);

if (!videos) return;

for (var each of videos){
each.play();
}
            }
			
			</script>




Please let me know whether it works.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes
Highlighted
New Member
4 0 0

Thank you for your prompt reply Diego. This is for an embedded video link from youtube. Due to only being able to select link from youtube or vimeo when selecting a video to be on the main page. 

0 Likes
Highlighted
Astronaut
1082 178 213

@UA 

You can not autoplay youtube links on mobile anymore. For further technical info please refer to this link.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes
Highlighted
New Member
4 0 0

Diego! You're a champ! Don't suppose you know how to remove the Youtube title at the top of the video or even muting it? Thank you

0 Likes