{% set videoThumbnail = videoThumbnail|default(false) %}
{% set video = video|default(false) %}
{% set videoDescription = videoDescription|default('') %}
{% set imageThumbnail = imageThumbnail|default(false) %}
{% set image = image|default(false) %}
{% set aspectRatio = aspectRatio|default('16x9') %}
{% set className = className|default('video__container js-video') %}
{% set videoClass = videoClass|default('') %}
{% set attributes = attributes|default([]) %}
{% set removeAttributes = removeAttributes|default([]) %}
{% set isLightbox = isLightbox|default(false) %}
{% if editmode and not video|default('') %}
{{ pimcore_video('video', {
'height': 500,
'allowedTypes': ['asset', 'youtube'],
'youtube': {
'modestbranding': true,
},
}) }}
Vorschaubild Youtube-Video:
{{ pimcore_image('video-preview') }}
{% endif %}
{% if not editmode %}
{% if not pimcore_video('video').isEmpty() or video != '' %}
{% set displayVideo = pimcore_video('video').isEmpty() ? video : pimcore_video('video') %}
{% if displayVideo.getType() != 'asset' %}
{% set config = {
'thumbnail': videoThumbnail,
'imagethumbnail': imageThumbnail,
'width': '100%',
'height': '100%',
'attributes': {'class': 'asset-video js-video__video' ~ videoClass}|merge (attributes),
'removeAttributes': removeAttributes
} %}
{% else %}
{% set config = {
'thumbnail': videoThumbnail,
'imagethumbnail': imageThumbnail,
'width': '100%',
'height': '100%',
'attributes': {'class': 'ratio-item'},
'removeAttributes': removeAttributes
} %}
{% endif %}
{% if image %}
{% do displayVideo.setPoster(image) %}
{% endif %}
{% if displayVideo is instanceof ('\\Pimcore\\Model\\Asset\\Video') %}
{% set displayVideo = elements_videoHelper().getVideoTag(displayVideo, config) %}
{% elseif displayVideo is instanceof ('\\Pimcore\\Model\\DataObject\\Data\\Video') %}
{% set displayVideo = elements_videoHelper().getVideoTag(displayVideo, config) %}
{% else %}
{% do displayVideo.setConfig(config) %}
{% endif %}
{% if isLightbox == true %}
{% do jsConfig().add('lightbox', true) %}
<div class="js-lightbox {{ className }} ratio ratio-{{ aspectRatio }}" data-lightbox-video="true">
{% if displayVideo.getVideoType() == 'asset' %}
{% set source = pimcore_asset(elements_videoHelper().getVideoUrl(displayVideo)) %}
<a href="" data-video='{"source": [{"src":"{{ source.fullpath }}", "type":"{{ source.mimeType }}"}], "attributes": {"preload": false, "controls": true}}'
class="ratio-item js-lightbox__item lg-html5 d-block" aria-label="{{ 'lightbox.video.Open'|trans }}" data-sub-html="{{ videoDescription }}">
{% if image %}
{% set image = image %}
{% else %}
{% set image = displayVideo.getPosterAsset() %}
{% endif %}
{% if image %}
{{ image.getThumbnail('media-area').getHtml({
imgAttributes: {
class: 'js-lazy-img ratio-item media-video shadow'
},
lowQualityPlaceholder: true
})|raw }}
<button type="button" class="box-shadow-hover btn-play">
<span class="btn-play__icon icon icon-play" aria-label="{{ 'global.openVideoPlayer'|trans }}"></span>
<span class="btn-play__text">{{ 'global.playVideo'|trans }}</span>
</button>
{% endif %}
</a>
{% else %}
{% set sourceExternalVideo = elements_videoHelper().getVideoUrl(displayVideo) %}
{% set videoUrl = elements_videoHelper().getVideoUrl(displayVideo) %}
{% set src = elements_videoHelper().getYoutubePoster(videoUrl|split('/')|last) %}
{% if not pimcore_image('video-preview').isEmpty() %}
{% set src = pimcore_image('video-preview').getThumbnail('media-area') %}
{% endif %}
{% embed('@ElementsCmsTools/consent-overlay.html.twig') with {
'classNames': {
'wrapper': 'consent ratio-item',
'overlay': 'consent__overlay ratio-item',
'template': 'ratio-item',
},
'service': 'marketing',
'buttonText': 'cookies.Marketingcookies akzeptieren'|trans,
'overlayText': 'cookies.Um das Video anzusehen, müssen Sie die Cookies akzeptieren'|trans
} %}
{% block consentIframe %}
<a href="" data-src="{{ sourceExternalVideo }}" class="js-lightbox__item ratio-item">
<img src="{{ src }}" class="ratio-item media-video shadow" alt="{{ videoDescription }}"/>
<button type="button" class="box-shadow-hover btn-play">
<span class="btn-play__icon icon icon-play" aria-label="{{ 'global.openVideoPlayer'|trans }}"></span>
<span class="btn-play__text">{{ 'global.playVideo'|trans }}</span>
</button>
</a>
{% endblock %}
{% endembed %}
{% endif %}
</div>
{% else %}
<div class="d-block {{ className }} {{ aspectRatio ? 'ratio ratio-' ~ aspectRatio }}">
{% if displayVideo.getVideoType()|default(displayVideo.getType()) == 'asset' %}
{{ displayVideo|raw }}
<button type="button" class="box-shadow-hover btn-play">
<span class="btn-play__icon icon icon-play" aria-label="{{ 'global.openVideoPlayer'|trans }}"></span>
<span class="btn-play__text">{{ 'global.playVideo'|trans }}</span>
</button>
{% else %}
{% embed('@ElementsCmsTools/consent-overlay.html.twig') with {
'service': 'marketing',
'buttonText': 'cookies.Marketingcookies akzeptieren'|trans,
'overlayText': 'cookies.Um das Video anzusehen, müssen Sie die Cookies akzeptieren'|trans
} %}
{% block consentIframe %}
{{ displayVideo|raw }}
{% endblock %}
{% endembed %}
{% endif %}
</div>
{% endif %}
{% endif %}
{% endif %}