@umituz/react-native-ai-generation-content 1.17.176 → 1.17.177
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/package.json
CHANGED
|
@@ -45,17 +45,51 @@ export interface VideoFeatureRequest {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Default result extractor - handles common response formats
|
|
48
|
+
* Supports FAL data wrapper and nested object formats
|
|
48
49
|
*/
|
|
49
50
|
function defaultExtractVideoResult(result: unknown): string | undefined {
|
|
50
51
|
if (typeof result !== "object" || result === null) return undefined;
|
|
51
52
|
|
|
52
53
|
const r = result as Record<string, unknown>;
|
|
53
54
|
|
|
54
|
-
if (typeof
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
56
|
+
console.log("[VideoExtractor] Result keys:", Object.keys(r));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Handle fal.ai data wrapper
|
|
60
|
+
const data = (r.data as Record<string, unknown>) ?? r;
|
|
61
|
+
|
|
62
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
63
|
+
console.log("[VideoExtractor] Data keys:", Object.keys(data));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Direct string values
|
|
67
|
+
if (typeof data.video === "string") return data.video;
|
|
68
|
+
if (typeof data.videoUrl === "string") return data.videoUrl;
|
|
69
|
+
if (typeof data.video_url === "string") return data.video_url;
|
|
70
|
+
if (typeof data.output === "string") return data.output;
|
|
71
|
+
if (typeof data.url === "string") return data.url;
|
|
72
|
+
|
|
73
|
+
// Object with url property (e.g., { video: { url: "..." } })
|
|
74
|
+
const videoObj = data.video as Record<string, unknown> | undefined;
|
|
75
|
+
if (videoObj && typeof videoObj === "object" && typeof videoObj.url === "string") {
|
|
76
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
77
|
+
console.log("[VideoExtractor] Found data.video.url:", videoObj.url);
|
|
78
|
+
}
|
|
79
|
+
return videoObj.url;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Array format (e.g., { videos: [{ url: "..." }] })
|
|
83
|
+
if (Array.isArray(data.videos) && typeof data.videos[0]?.url === "string") {
|
|
84
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
85
|
+
console.log("[VideoExtractor] Found videos[0].url:", data.videos[0].url);
|
|
86
|
+
}
|
|
87
|
+
return data.videos[0].url;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
91
|
+
console.log("[VideoExtractor] No video URL found in result");
|
|
92
|
+
}
|
|
59
93
|
|
|
60
94
|
return undefined;
|
|
61
95
|
}
|