Hi there,
I currently have a landscape video auto-playing on my website landing page (Dawn theme) and I would like to use a different video (portrait version of the original video) for mobile view but I’m unsure how to adjust the code I have to make this work. Can someone help me with adjustments to this code so I can have a different video for each screen size?
Below is the code I used to create a custom liquid for the homepage video:
<div class="section-homepage-video">
<div class="posrel">
<video autoplay muted loop playsinline class="video-homepage">
<source src="LANDSCAPE VIDEO URL IS PLACED HERE" type="video/mp4">
</video>
</div>
</div>
{% schema %}
{
"name": "Homepage Video",
"class": "index-section index-section--flush",
"settings": [],
"presets": [{
"name": "Homepage Videos",
"category": "Text"
}]
}
{% endschema %}
{% stylesheet %}
.section-homepage-video{
width:100%;
}
.video-homepage{
width: 100%;
height: auto;
}
<style>
.posrel{position:relative;}
video{display: block; margin: 0 auto; width: 100%; height: 50%; z-index:1; position:relative;}
</style>
{% endstylesheet %}
{% javascript %}
{% endjavascript %}