{% block acris_product_video_iframe_youtube_load_after %}
{% set url = image.translated.link %}
{% if '?' in url %}
{% set url = url~'&autoplay=1' %}
{% if config('AcrisProductVideoCS.config').hideRelatedVideos == true %}
{% set url = url~'&rel=0' %}
{% endif %}
{% else %}
{% set url = url~'?autoplay=1' %}
{% if config('AcrisProductVideoCS.config').hideRelatedVideos == true %}
{% set url = url~'&rel=0' %}
{% endif %}
{% endif %}
{% set previewImageLoading = config('AcrisProductVideoCS.config').previewImageLoading %}
{% set customImg = false %}
{% if previewImageLoading == 'cookie' %}
{% set customImg = true %}
{% endif %}
{% set productVideoImg = 'https://i.ytimg.com/vi/' ~ image.translated.link|split('/')|last|split('?')|first|trim ~ '/hqdefault.jpg' %}
{% set previewImageUrl = null %}
{% if image.extensions.acrisProductVideoPreviewImage and image.extensions.acrisProductVideoPreviewImage.media %}
{% set previewImageUrl = image.extensions.acrisProductVideoPreviewImage.media.url %}
{% endif %}
{% set vimeoImage = null %}
{% if image.type == 'youtube' %}
{% set type = 'youtube' %}
{% else %}
{% set type = 'vimeo' %}
{% if metaUrlData.vimeoImageUrl %}
{% set vimeoImage = metaUrlData.vimeoImageUrl %}
{% set productVideoImg = metaUrlData.vimeoImageUrl %}
{% else %}
{% set vimeoImage = 'https://vumbnail.com/' ~''~ image.translated.link|split('/')|last|split('?')|first|trim ~''~ '.jpg' %}
{% set productVideoImg = 'https://vumbnail.com/' ~''~ image.translated.link|split('/')|last|split('?')|first|trim ~''~ '.jpg' %}
{% endif %}
{% endif %}
{% set productVideoOptions = {
loadVideoAfterClick: loadVideoAfterClick,
errorCookieSource: "https://www.youtube-nocookie.com/embed/error",
noCookieVideo: noCookie|length,
name: metaUrlData['title']|replace({'"':''})|replace({'\'':''}),
thumbnailURL: metaUrlData['thumbnail_url'],
uploadDate: image.createdAt.format('Y-m-dTH:i:sZ'),
embedURL: image.translated.link,
description: metaUrlData['description']|replace({'"':''})|replace({'\'':''}),
title: image.translated.name|replace({'"':''})|replace({'\'':''}),
previewImageLoading: previewImageLoading,
previewImageUrl: previewImageUrl,
productVideoId: image.id,
link: url,
type: type,
vimeoImage: vimeoImage,
entry: 'element',
customImg: customImg,
currentPreviewImage: productVideoImg,
confirmButtonText: 'acrisProductVideo.privacyMode.button'|trans,
overlayText: 'acrisProductVideo.privacyMode.message'|trans({
'%url%': path('frontend.cms.page',{ id: config('core.basicInformation.privacyPage') }),
'%platform%': 'YouTube'
})|raw
} %}
<div class="acris-product-video-container-after{% if isImageGallery %} gallery-slider-item-container{% endif %}{% if loadVideoWithNoCookie %} d-none element-product-video-hidden-id-{{ image.id }}{% endif %}">
<div class="acris-product-video-iframe-after"
data-acris-product-video="true"
data-acris-product-video-options="{{ productVideoOptions|json_encode }}"
data-id="{{ image.translated.link|split('/')|last|split('?')|first|trim }}">
</div>
</div>
{% endblock %}