gallery video support

This commit is contained in:
Vladimir Mandic
2024-03-24 13:18:39 -04:00
parent 0862b80377
commit fb5ef75f5a
6 changed files with 113 additions and 53 deletions
+4 -4
View File
@@ -100,8 +100,8 @@ async function delayFetchThumb(fn) {
}
const json = await res.json();
outstanding--;
if (!res || !json || json.error) {
console.error(json.error);
if (!res || !json || json.error || Object.keys(json).length === 0) {
if (json.error) console.error(json.error);
return undefined;
}
return json;
@@ -125,7 +125,7 @@ class GalleryFile extends HTMLElement {
async connectedCallback() {
if (this.shadow.children.length > 0) return;
const ext = this.name.split('.').pop().toLowerCase();
if (!['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg'].includes(ext)) return;
if (!['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'mp4'].includes(ext)) return;
this.hash = await getHash(`${this.folder}/${this.name}/${this.size}/${this.mtime}`); // eslint-disable-line no-use-before-define
const style = document.createElement('style');
const width = opts.browser_fixed_width ? `${opts.extra_networks_card_size}px` : 'unset';
@@ -158,7 +158,7 @@ class GalleryFile extends HTMLElement {
}
};
let ok = true;
if (cache) {
if (cache && cache.img) {
img.src = cache.img;
this.exif = cache.exif;
this.width = cache.width;