I am using the Atelier theme and Safari is displaying the video controls during the page load and I want to hide them. I tried addressing this through the css webkit with no affect.
One option I want to approach is through the liquid and replicating the way the hero.liquid conceals the controls from the start.
The code for the Hero.liquid section is:
{%- if media_1 == 'video' -%}
<div class="{{ video_wrapper_desktop_class }}">
{{
section.settings.video_1
| video_tag:
poster: nil,
autoplay: true,
loop: true,
controls: false,
muted: true,
class: media_video_desktop_class,
data-testid: 'hero-desktop-video-1'
}}
</div>
{%- endif -%}
I have tried to replicate this in the media-with-content.liquid but I’m probably getting the class and testid variables wrong. Also, I’m not totally sure this would work anyways. If someone could please advise towards a solution that would be much appreciated.
Thanks in advance!
1 Like
The `controls: false` attribute on the `video_tag` filter is definitely the correct way to hide the video controls, as you’ve seen in the `hero.liquid` section. Safari can be particular, but this attribute should override the default browser controls.
You’ll want to make sure that the `video_tag` filter in your `media-with-content.liquid` section also explicitly includes `controls: false`. The `class` and `data-testid` attributes won’t affect the visibility of the controls themselves, only `controls: false` does that.
Find where you’re rendering the video in `media-with-content.liquid` and ensure your `video_tag` looks something like this:
{{
section.settings.your_video_setting_name
| video_tag:
poster: nil,
autoplay: true,
loop: true,
controls: false,
muted: true,
class: 'your-video-class',
data-testid: 'your-video-testid'
}}
The `autoplay: true`, `loop: true`, and `muted: true` attributes are also important, especially `muted: true`, as many browsers (including Safari) will prevent autoplaying videos with sound unless they are muted or the user has interacted with the page. If `controls: false` is present and it’s still showing, sometimes it’s because the browser is forcing controls if autoplay fails or if there’s an issue with the video source itself.
If `controls: false` is already there, double-check that there isn’t any JavaScript on the page that might be re-enabling controls, or CSS that’s overriding `display: none` for the controls. However, the Liquid attribute is the most robust way to handle this.
Hope that helps!
@teelstudio hello, did you try css for safari?