nuxt-media-library 0.0.52 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -1,33 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref, onMounted, watch } from "vue";
|
|
3
|
-
import { useMLResourcePolicy } from "../../composables/resourcePolicy/useMLResourcePolicy";
|
|
4
3
|
import { mediaGrantHeaders } from "../../composables/useMLMediaGrants";
|
|
5
4
|
const props = defineProps({
|
|
6
5
|
assetId: { type: String, required: true },
|
|
7
6
|
manager: { type: Object, required: true }
|
|
8
7
|
});
|
|
9
|
-
const resourcePolicy = useMLResourcePolicy();
|
|
10
|
-
const policy = ref(null);
|
|
11
|
-
const policyLoading = ref(false);
|
|
12
8
|
const videoUrl = ref(null);
|
|
13
9
|
const asset = computed(() => props.manager.selectedAsset.value);
|
|
14
|
-
const policyId = computed(
|
|
15
|
-
() => asset.value?.resourcePolicyId ?? asset.value?.resource_policy_id ?? null
|
|
16
|
-
);
|
|
17
|
-
async function loadPolicy() {
|
|
18
|
-
if (!policyId.value) {
|
|
19
|
-
policy.value = null;
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
policyLoading.value = true;
|
|
23
|
-
try {
|
|
24
|
-
policy.value = await resourcePolicy.get(policyId.value);
|
|
25
|
-
} catch {
|
|
26
|
-
policy.value = null;
|
|
27
|
-
} finally {
|
|
28
|
-
policyLoading.value = false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
10
|
async function resolveVideoUrl() {
|
|
32
11
|
if (!asset.value || asset.value.kind !== "video") {
|
|
33
12
|
videoUrl.value = null;
|
|
@@ -43,17 +22,9 @@ async function resolveVideoUrl() {
|
|
|
43
22
|
videoUrl.value = null;
|
|
44
23
|
}
|
|
45
24
|
}
|
|
46
|
-
onMounted(
|
|
47
|
-
loadPolicy();
|
|
48
|
-
resolveVideoUrl();
|
|
49
|
-
});
|
|
50
|
-
watch(policyId, loadPolicy);
|
|
25
|
+
onMounted(resolveVideoUrl);
|
|
51
26
|
watch(() => props.assetId, resolveVideoUrl);
|
|
52
|
-
const showStepper = computed(() =>
|
|
53
|
-
if (policyLoading.value) return false;
|
|
54
|
-
if (!policy.value) return !policyId.value;
|
|
55
|
-
return policy.value.processing_config?.auto_process === false;
|
|
56
|
-
});
|
|
27
|
+
const showStepper = computed(() => asset.value?.status === "uploaded");
|
|
57
28
|
function onComplete() {
|
|
58
29
|
props.manager.refresh(props.assetId);
|
|
59
30
|
}
|
|
@@ -64,10 +35,8 @@ function onFailed() {
|
|
|
64
35
|
|
|
65
36
|
<template>
|
|
66
37
|
<div>
|
|
67
|
-
<USkeleton v-if="policyLoading" class="h-40 w-full" />
|
|
68
|
-
|
|
69
38
|
<MLProcessingStepper
|
|
70
|
-
v-
|
|
39
|
+
v-if="showStepper"
|
|
71
40
|
:asset-id="assetId"
|
|
72
41
|
:asset-kind="asset?.kind"
|
|
73
42
|
:download-url="videoUrl"
|