quasar-ui-danx 0.3.32 → 0.3.34
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
>
|
32
32
|
<source
|
33
33
|
:src="getPreviewUrl(file) + '#t=0.1'"
|
34
|
-
:type="file
|
34
|
+
:type="getPreviewFileMime(file)"
|
35
35
|
>
|
36
36
|
</video>
|
37
37
|
</template>
|
@@ -72,8 +72,16 @@ function isVideo(file) {
|
|
72
72
|
return file.mime?.startsWith("video");
|
73
73
|
}
|
74
74
|
|
75
|
+
function getPreviewFile(file) {
|
76
|
+
return file.transcodes?.mp4 || file.transcodes?.compress || file;
|
77
|
+
}
|
78
|
+
function getPreviewFileMime(file) {
|
79
|
+
return getPreviewFile(file).mime || (isVideo(file) ? "video/mp4" : "");
|
80
|
+
}
|
81
|
+
|
75
82
|
function getPreviewUrl(file) {
|
76
|
-
|
83
|
+
file = getPreviewFile(file);
|
84
|
+
return file.blobUrl || file.url;
|
77
85
|
}
|
78
86
|
|
79
87
|
function getThumbUrl(file) {
|
@@ -161,21 +161,20 @@ const computedImage = computed(() => {
|
|
161
161
|
}
|
162
162
|
return null;
|
163
163
|
});
|
164
|
+
const previewFile = computed(() => {
|
165
|
+
const transcodes = computedImage.value?.transcodes;
|
166
|
+
return transcodes?.mp4 || transcodes?.compress || computedImage.value;
|
167
|
+
});
|
168
|
+
|
164
169
|
const mimeType = computed(
|
165
|
-
() =>
|
170
|
+
() => previewFile.value?.type || previewFile.value?.mime || (computedImage.value?.transcodes?.mp4 ? "video/mp4" : "")
|
166
171
|
);
|
167
172
|
const isImage = computed(() => !!mimeType.value.match(/^image\//));
|
168
173
|
const isVideo = computed(() => !!mimeType.value.match(/^video\//));
|
169
174
|
const isPdf = computed(() => !!mimeType.value.match(/^application\/pdf/));
|
170
|
-
const previewUrl = computed(() => {
|
171
|
-
const transcodes = computedImage.value?.transcodes;
|
172
|
-
|
173
|
-
console.log("calc preview", transcodes, computedImage.value);
|
174
|
-
if (isVideo.value && transcodes?.mp4?.url) {
|
175
|
-
return transcodes.mp4.url;
|
176
|
-
}
|
177
175
|
|
178
|
-
|
176
|
+
const previewUrl = computed(() => {
|
177
|
+
return previewFile.value?.blobUrl || previewFile.value?.url;
|
179
178
|
});
|
180
179
|
const thumbUrl = computed(() => {
|
181
180
|
return computedImage.value?.transcodes?.thumb?.url;
|