Hello I am using Ira theme and I would like to autoplay this video in my product page, however it is not playing and is showing as a static image. How do I solve this?
website: buddings.co
Hello I am using Ira theme and I would like to autoplay this video in my product page, however it is not playing and is showing as a static image. How do I solve this?
website: buddings.co
solved
Hello! How did you solve this?
Found the solution.
Add
autoplay: true,
to where line 73 is in my screenshot in the media.liquid file.
Also be sure to add:
.theme-gallery .product-media--frame .plyr.plyr__tab-focus::after, .theme-gallery .product-media--frame model-viewer.focus-visible::after {
box-shadow: none !important;
}
At the bottom of your style.css file for disabling the outline on the video.
Also want to drop here just in case it helps someone that in many/most modern browsers, they have limited autoplay to videos that are also muted by default. This is what was tripping me up just now. Any video that you want to autoplay should be muted by default in most browsers.
Is there a solution for this within the Dawn theme? Trying to upload a short video clip into the product images section and I want it to autoplay, loop and be on mute.
did you ever get a solution? i am alson trying to autoplay my product video
Hey @rfaustine and @Fourthstyles450 - just wanted to highlight like in my above post that the videos need to be muted by default. Thatâs either got to be on the element itâs self:
or, in the case of Youtube, you can also specify that parameter in the URL you are requesting itself:
âyour_url_here/videoâs_id_will_be_here?&mute=1â.
hey thanks but where do i put this code?
So, it depends on what theme you have/where you need this to happen. Are you on Dawn? @Fourthstyles450
yes we are Dawn. so here is a sample site where I have seen it done. Notice the last product image how it automatically plays as you scroll down.
So Iâve seen where this is in your base Dawn theme.
In the code editor view, you go to the snippets folder on the left hand side > then to product-media.liquid.
You will see a block like:
You need to insert the âmuted: trueâ into that list. So these:
external_video_url: autoplay: true, loop: loop, playlist: media.external_id
become this:
external_video_url: muted: true, autoplay: true, loop: loop, playlist: media.external_id
Then your videos should play automatically. Youâll have to do that for every instance in that file where there is a list that includes autoplay, loop, etc. Thereâs three in the snippet above I provided, but your file may be edited slightly depending on if youâve had custom work done or not.
Does anyone know if this is possible with the Spark Theme? I would like some product videos vs photos to display on my product page. I tried to follow the directions for the Dawn theme, to no avail. Please assist if you can. Thanks!
Unfortunately @Miss_HSC , I donât think the developers that sell the Spark theme let that codebase be public, so I canât see where it is. Youâd be better off seeking support for where to make an edit like this in the codebase from them.
Thank you - will do.
Hi, I have also been trying to do this and thank you so much for giving your amazing answer. It has worked brilliantly on desktop but not on mobile. Am I right that my block code should be..
{%- case media.media_type -%} {%- when 'external_video' -%} {%- assign video_class = 'js-' | append: media.host -%} {%- if media.host == 'youtube' -%} {{ media | external_video_url: muted: true, autoplay: true, loop: loop, playlist: media.external_id | external_video_tag: class: video_class, loading: "lazy" }} {%- else -%} {{ media | external_video_url: muted: true, autoplay: true, loop: loop, playlist: media.external_id }} {%- endif -%} {%- when 'video' -%} {{ media | media_tag: image_size: "2048x", muted: true, autoplay: true, loop: loop, controls: true, preload: "none" }} {%- when 'model' -%} {{ media | media_tag: image_size: "2048x", toggleable: true }} {%- endcase -%}I have added the muted: true three times. I would be so grateful for your help if possible and a massive thank you My product page is https://giveyourselfkindness.com/products/the-give-yourself-kindness-journal. Thank you
Hello,
It works on the desktop. But on mobile, it doesnât work. The code says: âexternal_video_urlâ how about âinternal_video_urlâ I mean upload video to Shopify File. Thank you.
Dawn theme as wellâŚthis didnât work but Iâm also hosting video on my shopify url..so Iâm thinking thus itâs not an âexternal host/urlâ
Hi, i dont have a media.liquid file in my kalles theme, did you create your own
Hello,
Iâve added the .liquid file code of my product details page below. In that, I have added certain videos that I would like to autoplay rather than having the user click on the play button. Is there any way to do that? Please guide.
Thank you.
{% comment %}
Renders a product media gallery. Should be used with âmedia-gallery.jsâ
Also see âproduct-media-modalâ
Accepts:
Usage:
{% render âproduct-media-galleryâ, is_duplicate: true %}
{% endcomment %}
{%- liquid
if section.settings.hide_variants and variant_images.size == product.media.size
assign single_media_visible = true
endif
assign media_count = product.media.size
if section.settings.hide_variants and media_count > 1 and variant_images.size > 0
assign media_count = media_count | minus: variant_images.size | plus: 1
endif
if media_count == 1 or single_media_visible
assign single_media_visible_mobile = true
endif
if media_count == 0 or single_media_visible_mobile or section.settings.mobile_thumbnails == âshowâ or section.settings.mobile_thumbnails == âcolumnsâ and media_count < 3
assign hide_mobile_slider = true
endif
if section.settings.media_size == âlargeâ
assign media_width = 0.65
elsif section.settings.media_size == âmediumâ
assign media_width = 0.55
elsif section.settings.media_size == âsmallâ
assign media_width = 0.45
endif
assign id_append = ââ
if is_duplicate
assign id_append = â-duplicateâ
endif
-%}
<media-gallery
id=âMediaGallery-{{ section.id }}{{ id_append }}â
role=âregionâ
{% if section.settings.enable_sticky_info %}
class=âproduct__column-stickyâ
{% endif %}
aria-label=â{{ âproducts.product.media.gallery_viewerâ | t }}â
data-desktop-layout=â{{ section.settings.gallery_layout }}â
{%- if featured_media != null -%}
{%- liquid
capture media_index
if featured_media.media_type == âmodelâ
increment model_index
elsif featured_media.media_type == âvideoâ or featured_media.media_type == âexternal_videoâ
increment video_index
elsif featured_media.media_type == âimageâ
increment image_index
endif
endcapture
assign media_index = media_index | plus: 1
-%}