File tree Expand file tree Collapse file tree 6 files changed +75
-6
lines changed Expand file tree Collapse file tree 6 files changed +75
-6
lines changed Original file line number Diff line number Diff line change 110
110
:collection-videos =" activeCollectionVideos"
111
111
:collection-audios =" activeCollectionAudios"
112
112
:collection-images =" activeCollectionImages"
113
+ :get-image-url =" generateImageUrl"
114
+ :get-audio-url =" generateAudioUrl"
113
115
@video-click =" handleVideoClick"
114
116
@delete-video =" promptDeleteVideo"
115
117
@delete-audio =" promptDeleteAudio"
@@ -436,6 +438,7 @@ const {
436
438
conversations ,
437
439
loadSession ,
438
440
generateImageUrl ,
441
+ generateAudioUrl ,
439
442
uploadMedia ,
440
443
createCollection ,
441
444
deleteCollection ,
Original file line number Diff line number Diff line change 93
93
<VideoList
94
94
v-if =" videos.length > 0"
95
95
:asset-results =" filteredAssets"
96
+ :get-image-url =" getImageUrl"
97
+ :get-audio-url =" getAudioUrl"
96
98
@video-click =" handleVideoClick"
97
99
@delete-video =" emit('delete-video', $event)"
98
100
@delete-image =" emit('delete-image', $event)"
@@ -165,6 +167,12 @@ const props = defineProps({
165
167
type: Array ,
166
168
default: null ,
167
169
},
170
+ getAudioUrl: {
171
+ type: Function ,
172
+ },
173
+ getImageUrl: {
174
+ type: Function ,
175
+ },
168
176
});
169
177
170
178
const mediaTypes = [
@@ -252,6 +260,8 @@ const emit = defineEmits([
252
260
" delete-video" ,
253
261
" delete-audio" ,
254
262
" delete-image" ,
263
+ " get-image-url" ,
264
+ " get-audio-url" ,
255
265
]);
256
266
257
267
const videos = computed (() => {
Original file line number Diff line number Diff line change 25
25
class =" thumbnail vdb-c-absolute vdb-c-bottom-0 vdb-c-left-0 vdb-c-right-0 vdb-c-top-0 vdb-c-rounded-lg vdb-c-bg-cover vdb-c-bg-center vdb-c-bg-no-repeat vdb-c-shadow-1"
26
26
/>
27
27
<div
28
+ v-if =" url"
28
29
class =" center-button transparent-button vdb-c-absolute vdb-c-left-1/2 vdb-c-top-1/2 vdb-c-flex vdb-c-h-48 vdb-c-w-48 -vdb-c-translate-x-1/2 -vdb-c-translate-y-1/2 vdb-c-transform vdb-c-items-center vdb-c-justify-center vdb-c-rounded-full lg:vdb-c-h-56 lg:vdb-c-w-56"
29
- @click =" playAudio(item. url)"
30
+ @click =" playAudio(url)"
30
31
>
31
32
<PlayIcon class =" vdb-c-h-20 vdb-c-w-20" />
32
33
</div >
63
64
</template >
64
65
65
66
<script setup>
66
- import { ref } from " vue" ;
67
+ import { onMounted , ref } from " vue" ;
67
68
import DeleteIcon from " ../icons/Delete2.vue" ;
68
69
import PlayIcon from " ../icons/play.vue" ;
69
70
@@ -72,6 +73,7 @@ import NotificationCenter from "../chat/elements/NotificationCenter.vue";
72
73
import CopyIcon from " ../icons/CopyIcon.vue" ;
73
74
74
75
const hoveredDeleteIcon = ref (null );
76
+ const url = ref (null );
75
77
76
78
const props = defineProps ({
77
79
item: {
@@ -86,6 +88,19 @@ const props = defineProps({
86
88
type: String ,
87
89
default: " default" ,
88
90
},
91
+ getAudioUrl: {
92
+ type: Function ,
93
+ },
94
+ });
95
+
96
+ onMounted (async () => {
97
+ if (props .getAudioUrl ) {
98
+ const audioUrl = await props .getAudioUrl (
99
+ props .item .collection_id ,
100
+ props .item .id ,
101
+ );
102
+ url .value = audioUrl .url ;
103
+ }
89
104
});
90
105
91
106
const notificationCenterRef = ref (null );
Original file line number Diff line number Diff line change 22
22
class =" vid-pb vdb-c-relative vdb-c-overflow-hidden vdb-c-rounded-[7px]"
23
23
>
24
24
<div
25
- v-if =" item. url"
25
+ v-if =" url"
26
26
class =" thumbnail vdb-c-absolute vdb-c-bottom-0 vdb-c-left-0 vdb-c-right-0 vdb-c-top-0 vdb-c-h-106 vdb-c-rounded-lg vdb-c-bg-cover vdb-c-bg-center vdb-c-bg-no-repeat vdb-c-shadow-1"
27
27
:style =" {
28
- backgroundImage: `url('${item. url}')`,
28
+ backgroundImage: `url('${url}')`,
29
29
backgroundColor: 'transparent',
30
30
}"
31
31
></div >
65
65
</template >
66
66
67
67
<script setup>
68
- import { ref } from " vue" ;
68
+ import { onMounted , ref } from " vue" ;
69
69
import NotificationCenter from " ../chat/elements/NotificationCenter.vue" ;
70
70
import CopyIcon from " ../icons/CopyIcon.vue" ;
71
71
import DeleteIcon from " ../icons/Delete2.vue" ;
72
72
73
73
const hoveredDeleteIcon = ref (null );
74
-
74
+ const url = ref ( null );
75
75
const props = defineProps ({
76
76
item: {
77
77
type: Object ,
@@ -85,6 +85,19 @@ const props = defineProps({
85
85
type: String ,
86
86
default: " default" ,
87
87
},
88
+ getImageUrl: {
89
+ type: Function ,
90
+ },
91
+ });
92
+
93
+ onMounted (async () => {
94
+ if (props .getImageUrl ) {
95
+ const imageUrl = await props .getImageUrl (
96
+ props .item .collection_id ,
97
+ props .item .id ,
98
+ );
99
+ url .value = imageUrl .url ;
100
+ }
88
101
});
89
102
90
103
const notificationCenterRef = ref (null );
Original file line number Diff line number Diff line change 32
32
v-else-if =" item.type === 'audio'"
33
33
:item =" item"
34
34
:index =" index"
35
+ :get-audio-url =" getAudioUrl"
35
36
@delete-audio =" $emit('delete-audio', $event)"
36
37
/>
37
38
38
39
<ImageCard
39
40
v-else-if =" item.type === 'image'"
40
41
:item =" item"
41
42
:index =" index"
43
+ :get-image-url =" getImageUrl"
42
44
@delete-image =" $emit('delete-image', $event)"
43
45
/>
44
46
</div >
@@ -102,6 +104,12 @@ const props = defineProps({
102
104
default: 4 ,
103
105
validator : (value ) => value >= 1 && value <= 4 ,
104
106
},
107
+ getImageUrl: {
108
+ type: Function ,
109
+ },
110
+ getAudioUrl: {
111
+ type: Function ,
112
+ },
105
113
});
106
114
107
115
const currentPage = ref (1 );
Original file line number Diff line number Diff line change @@ -99,6 +99,25 @@ export function useVideoDBAgent(config) {
99
99
}
100
100
} ;
101
101
102
+ const generateAudioUrl = async ( collectionId , audioId ) => {
103
+ const res = { } ;
104
+ try {
105
+ const response = await fetch (
106
+ `${ httpUrl } /videodb/collection/${ collectionId } /audio/${ audioId } /generate_url` ,
107
+ ) ;
108
+ if ( ! response . ok ) {
109
+ throw new Error ( "Network response was not ok" ) ;
110
+ }
111
+ const url = await response . text ( ) ;
112
+ res . status = "success" ;
113
+ res . url = url ;
114
+ } catch ( error ) {
115
+ res . status = "error" ;
116
+ res . error = error ;
117
+ }
118
+ return res ;
119
+ } ;
120
+
102
121
const generateImageUrl = async ( collectionId , imageId ) => {
103
122
const res = { } ;
104
123
try {
@@ -618,5 +637,6 @@ export function useVideoDBAgent(config) {
618
637
deleteImage,
619
638
uploadMedia,
620
639
generateImageUrl,
640
+ generateAudioUrl,
621
641
} ;
622
642
}
You can’t perform that action at this time.
0 commit comments