Use poster in VideoPresenter component

This commit is contained in:
Daniel Supernault 2022-08-03 22:48:19 -06:00
parent 47571887fe
commit a3cc90b0c5
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -22,7 +22,7 @@
:alt="altText(status)"/> :alt="altText(status)"/>
</div> </div>
<div v-else class="embed-responsive embed-responsive-16by9"> <div v-else class="embed-responsive embed-responsive-16by9">
<video class="video" controls playsinline preload="metadata" loop :data-id="status.id"> <video class="video" controls playsinline preload="metadata" loop :data-id="status.id" :poster="poster()">
<source :src="status.media_attachments[0].url" :type="status.media_attachments[0].mime"> <source :src="status.media_attachments[0].url" :type="status.media_attachments[0].mime">
</video> </video>
</div> </div>
@ -76,7 +76,15 @@
toggleContentWarning(status) { toggleContentWarning(status) {
this.$emit('togglecw'); this.$emit('togglecw');
} },
poster() {
let url = this.status.media_attachments[0].preview_url;
if(url.endsWith('no-preview.jpg') || url.endsWith('no-preview.png')) {
return;
}
return url;
}
} }
} }
</script> </script>