Hi @Cherry3427 Please use the below code -
##
{{ section.settings.title }}
{{ section.settings.subheading }}
{% for block in section.blocks %}
{% if block.settings.video_url contains 'youtube' %}
<iframe width="{{ block.settings.width }}px" height="{{ block.settings.height }}px" src="{{ block.settings.video_url | replace: 'watch?v=', 'embed/' }}?autoplay={{ block.settings.autoplay }}&muted={{ block.settings.autoplay }}" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>
{% elsif block.settings.video_url contains 'vimeo' %}
<iframe src="https://player.vimeo.com/video/{{ block.settings.video_url }}" width="{{ block.settings.width }}px" height="{{ block.settings.height }}px" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
{% endif %}
{% endfor %}
{% schema %}
{
"name": "Video Section",
"settings": [
{
"type": "text",
"id": "title",
"label": "Enter Title"
},
{
"type": "range",
"id": "title-font-size",
"label": "Title Font Size",
"min": 22,
"max": 72,
"default": 22,
"step": 2,
"unit": "px"
},
{
"type": "richtext",
"id": "subheading",
"label": "Enter Sub Title or Description"
},
{
"type": "range",
"id": "subheading-font-size",
"label": "Subheading Font Size",
"min": 16,
"max": 22,
"default": 16,
"step": 2,
"unit": "px"
},
{
"type": "select",
"id": "alignment",
"label": "Select Text Alignment",
"options": [
{
"value": "left",
"label": "Left"
},
{
"value": "center",
"label": "Center"
},
{
"value": "right",
"label": "Right"
}
]
},
{
"type": "header",
"content": "Desktop Settings"
},
{
"type": "range",
"id": "desktop_video_row",
"label": "Show Videos Per Row",
"min": 2,
"max": 6,
"default": 3,
"step": 1
},
{
"type": "range",
"id": "gap-video",
"label": "Gap Between Videos",
"min": 10,
"max": 50,
"default": 10,
"step": 1,
"unit": "px"
}
],
"blocks":[
{
"name": "Add Video",
"type": "video",
"settings": [
{
"type": "video_url",
"id": "video_url",
"label": "Add Video to Gallery",
"accept": [
"vimeo",
"youtube"
]
},
{
"type": "checkbox",
"id": "autoplay",
"label": "Autoplay & Muted"
},
{
"type": "text",
"id": "width",
"label": "Video Width"
},
{
"type": "text",
"id": "height",
"label": "Video Height"
}
]
}
],
"presets": [
{
"name": "In Video Gallery"
}
]
}
{% endschema %}
Please let me know and mark as solution!