spee.ch/views/partials/asset.handlebars

29 lines
1.4 KiB
Handlebars
Raw Normal View History

2017-09-30 00:56:13 +02:00
{{#ifConditional fileInfo.fileType '===' 'video/mp4'}}
{{#ifConditional fileInfo.fileExt '===' 'gifv'}}
2017-10-10 19:14:43 +02:00
<video class="gifv-show" autoplay loop muted>
2017-10-17 23:15:02 +02:00
<source src="/{{fileInfo.claimId}}/{{fileInfo.name}}.{{fileInfo.fileExt}}">
2017-09-30 00:56:13 +02:00
{{!--fallback--}}
Your browser does not support the <code>video</code> element.
</video>
{{else}}
2017-10-20 19:54:26 +02:00
<video id="video-player" class="video-show video" controls poster="{{fileInfo.thumbnail}}">
<source src="/{{fileInfo.claimId}}/{{fileInfo.name}}.{{fileInfo.fileExt}}">
{{!--fallback--}}
Your browser does not support the <code>video</code> element.
</video>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', resizeVideoPlayer)
window.addEventListener("resize", resizeVideoPlayer);
function resizeVideoPlayer() {
const div = document.getElementById('video-player');
const width = div.offsetWidth;
div.height = (width * 9 / 16);
}
</script>
2017-09-30 00:56:13 +02:00
{{/ifConditional}}
{{else}}
<a href="/{{fileInfo.claimId}}/{{fileInfo.name}}.{{fileInfo.fileExt}}">
2017-10-17 23:15:02 +02:00
<img class="image-show" src="/{{fileInfo.claimId}}/{{fileInfo.name}}.{{fileInfo.fileExt}}" />
</a>
{{/ifConditional}}