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 URL pool from selected media IDs
72
- const urlPool = [];
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
- const url = getMediaUrl(file);
77
- if (url)
78
- urlPool.push(url);
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
- // Wrap URL in the appropriate PortValue type based on output port type
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 === 'image') {
96
- result[output.id] = { url: selected };
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 === 'video') {
115
+ else if (portType === 'image') {
99
116
  result[output.id] = { url: selected };
100
117
  }
101
118
  else if (portType === 'audio') {
@@ -91,6 +91,7 @@ export interface ImageValue {
91
91
  */
92
92
  export interface VideoValue {
93
93
  url: string;
94
+ thumbnailUrl?: string;
94
95
  width?: number;
95
96
  height?: number;
96
97
  duration?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "4.5.6",
3
+ "version": "4.5.7",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",