ugcinc 4.5.6 → 4.5.7
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.
|
@@ -68,15 +68,19 @@ const definition = (0, types_1.defineNode)({
|
|
|
68
68
|
result[output.id] = null;
|
|
69
69
|
continue;
|
|
70
70
|
}
|
|
71
|
-
// Build
|
|
72
|
-
const
|
|
71
|
+
// Build media pool from selected media IDs
|
|
72
|
+
const mediaFiles = [];
|
|
73
73
|
for (const mediaId of output.selectedMediaIds) {
|
|
74
74
|
const file = ctx.media.find(m => m.id === mediaId);
|
|
75
|
-
if (file)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
if (file)
|
|
76
|
+
mediaFiles.push(file);
|
|
77
|
+
}
|
|
78
|
+
// Build URL pool using display URLs
|
|
79
|
+
const urlPool = [];
|
|
80
|
+
for (const file of mediaFiles) {
|
|
81
|
+
const url = getMediaUrl(file);
|
|
82
|
+
if (url)
|
|
83
|
+
urlPool.push(url);
|
|
80
84
|
}
|
|
81
85
|
if (urlPool.length === 0) {
|
|
82
86
|
result[output.id] = null;
|
|
@@ -90,12 +94,25 @@ const definition = (0, types_1.defineNode)({
|
|
|
90
94
|
result[output.id] = null;
|
|
91
95
|
continue;
|
|
92
96
|
}
|
|
93
|
-
//
|
|
97
|
+
// For video outputs, also build a pool of actual video URLs and thumbnails
|
|
98
|
+
// so we can return both the real video URL and a thumbnail
|
|
94
99
|
const portType = output.type;
|
|
95
|
-
if (portType === '
|
|
96
|
-
|
|
100
|
+
if (portType === 'video') {
|
|
101
|
+
// Build parallel pools of actual video URLs and thumbnails
|
|
102
|
+
const videoUrlPool = [];
|
|
103
|
+
const thumbnailPool = [];
|
|
104
|
+
for (const file of mediaFiles) {
|
|
105
|
+
if (file.media_type !== 'social_audio' && file.url) {
|
|
106
|
+
videoUrlPool.push(file.url);
|
|
107
|
+
thumbnailPool.push(file.preview_url ?? undefined);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const selectedVideoUrl = (0, selection_1.selectFromPool)(videoUrlPool, selectionMode, index, `preview-${output.id}`);
|
|
111
|
+
const selectedIdx = selectedVideoUrl ? videoUrlPool.indexOf(selectedVideoUrl) : -1;
|
|
112
|
+
const selectedThumbnail = selectedIdx >= 0 ? thumbnailPool[selectedIdx] : undefined;
|
|
113
|
+
result[output.id] = { url: selectedVideoUrl ?? selected, thumbnailUrl: selectedThumbnail };
|
|
97
114
|
}
|
|
98
|
-
else if (portType === '
|
|
115
|
+
else if (portType === 'image') {
|
|
99
116
|
result[output.id] = { url: selected };
|
|
100
117
|
}
|
|
101
118
|
else if (portType === 'audio') {
|