fix: .avi previews as video

feat/type-attributes
Tomáš Mládek 2022-09-05 23:28:02 +02:00
parent 86b36d6619
commit 423ec7b03a
3 changed files with 14 additions and 14 deletions

View File

@ -12,12 +12,12 @@
$: mimeType = String($entity?.get("FILE_MIME"));
$: audio = ["audio", "application/x-riff"].some((p) =>
mimeType.startsWith(p)
);
$: video = ["video", "application/x-matroska"].some((p) =>
mimeType.startsWith(p)
);
$: audio =
["audio", "application/x-riff"].some((p) => mimeType.startsWith(p)) &&
!video;
$: video =
["video", "application/x-matroska"].some((p) => mimeType.startsWith(p)) ||
$entity?.identify().some((l) => l.endsWith(".avi"));
$: image = mimeType.startsWith("image");
$: text = mimeType.startsWith("text");
$: pdf = mimeType.startsWith("application/pdf");

View File

@ -19,12 +19,12 @@
$: mimeType = String($entity?.get("FILE_MIME"));
$: audio = ["audio", "application/x-riff"].some((p) =>
mimeType.startsWith(p)
);
$: video = ["video", "application/x-matroska"].some((p) =>
mimeType.startsWith(p)
);
$: audio =
["audio", "application/x-riff"].some((p) => mimeType.startsWith(p)) &&
!video;
$: video =
["video", "application/x-matroska"].some((p) => mimeType.startsWith(p)) ||
$entity?.identify().some((l) => l.endsWith(".avi"));
$: image = mimeType.startsWith("image");
$: text = mimeType.startsWith("text");
$: pdf = mimeType.startsWith("application/pdf");

View File

@ -53,7 +53,7 @@
<Spinner />
<img
class="thumb"
src="api/thumb/{address}"
src="api/thumb/{address}?mime=video"
alt="Preview for {address}"
on:load={() => (state = State.PREVIEW)}
on:error={() => (state = State.ERRORED)}
@ -63,7 +63,7 @@
<video
preload={detail ? "auto" : "metadata"}
src="api/raw/{address}"
poster="api/thumb/{address}"
poster="api/thumb/{address}?mime=video"
on:mousemove={updatePreviewPosition}
on:mouseleave={resetPreview}
on:click={startPlaying}