@movementinfra/expo-twostep-video 0.1.0

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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +420 -0
  3. package/build/ExpoTwostepVideo.types.d.ts +65 -0
  4. package/build/ExpoTwostepVideo.types.d.ts.map +1 -0
  5. package/build/ExpoTwostepVideo.types.js +2 -0
  6. package/build/ExpoTwostepVideo.types.js.map +1 -0
  7. package/build/ExpoTwostepVideoModule.d.ts +70 -0
  8. package/build/ExpoTwostepVideoModule.d.ts.map +1 -0
  9. package/build/ExpoTwostepVideoModule.js +5 -0
  10. package/build/ExpoTwostepVideoModule.js.map +1 -0
  11. package/build/ExpoTwostepVideoModule.web.d.ts +14 -0
  12. package/build/ExpoTwostepVideoModule.web.d.ts.map +1 -0
  13. package/build/ExpoTwostepVideoModule.web.js +12 -0
  14. package/build/ExpoTwostepVideoModule.web.js.map +1 -0
  15. package/build/ExpoTwostepVideoView.d.ts +27 -0
  16. package/build/ExpoTwostepVideoView.d.ts.map +1 -0
  17. package/build/ExpoTwostepVideoView.js +47 -0
  18. package/build/ExpoTwostepVideoView.js.map +1 -0
  19. package/build/ExpoTwostepVideoView.web.d.ts +4 -0
  20. package/build/ExpoTwostepVideoView.web.d.ts.map +1 -0
  21. package/build/ExpoTwostepVideoView.web.js +8 -0
  22. package/build/ExpoTwostepVideoView.web.js.map +1 -0
  23. package/build/index.d.ts +569 -0
  24. package/build/index.d.ts.map +1 -0
  25. package/build/index.js +430 -0
  26. package/build/index.js.map +1 -0
  27. package/expo-module.config.json +10 -0
  28. package/ios/ExpoTwostepVideo.podspec +30 -0
  29. package/ios/ExpoTwostepVideoModule.swift +739 -0
  30. package/ios/ExpoTwostepVideoView.swift +223 -0
  31. package/ios/Package.swift +32 -0
  32. package/ios/TwoStepVideo/Core/AssetLoader.swift +175 -0
  33. package/ios/TwoStepVideo/Core/VideoExporter.swift +353 -0
  34. package/ios/TwoStepVideo/Core/VideoTransformer.swift +365 -0
  35. package/ios/TwoStepVideo/Core/VideoTrimmer.swift +300 -0
  36. package/ios/TwoStepVideo/Models/ExportConfiguration.swift +104 -0
  37. package/ios/TwoStepVideo/Models/LoopConfiguration.swift +101 -0
  38. package/ios/TwoStepVideo/Models/TimeRange.swift +98 -0
  39. package/ios/TwoStepVideo/Models/VideoAsset.swift +126 -0
  40. package/ios/TwoStepVideo/Models/VideoEditingError.swift +82 -0
  41. package/ios/TwoStepVideo/TwoStepVideo.swift +30 -0
  42. package/package.json +57 -0
@@ -0,0 +1,47 @@
1
+ import { requireNativeView } from 'expo';
2
+ import * as React from 'react';
3
+ import { forwardRef, useImperativeHandle, useRef } from 'react';
4
+ const NativeView = requireNativeView('ExpoTwoStepVideo');
5
+ /**
6
+ * Video player view that can play compositions and assets directly
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * const playerRef = useRef<TwoStepVideoViewRef>(null);
11
+ *
12
+ * // Play a composition (from mirrorVideo, trimVideo, etc.)
13
+ * <TwoStepVideoView
14
+ * ref={playerRef}
15
+ * compositionId={composition.id}
16
+ * onPlaybackStatusChange={(e) => console.log(e.nativeEvent.status)}
17
+ * onProgress={(e) => setProgress(e.nativeEvent.progress)}
18
+ * style={{ width: '100%', height: 300 }}
19
+ * />
20
+ *
21
+ * // Control playback
22
+ * playerRef.current?.play();
23
+ * playerRef.current?.pause();
24
+ * playerRef.current?.seek(5.0);
25
+ * ```
26
+ */
27
+ const TwoStepVideoView = forwardRef((props, ref) => {
28
+ const nativeRef = useRef(null);
29
+ useImperativeHandle(ref, () => ({
30
+ play: async () => {
31
+ await nativeRef.current?.play();
32
+ },
33
+ pause: async () => {
34
+ await nativeRef.current?.pause();
35
+ },
36
+ seek: async (time) => {
37
+ await nativeRef.current?.seek(time);
38
+ },
39
+ replay: async () => {
40
+ await nativeRef.current?.replay();
41
+ },
42
+ }));
43
+ return <NativeView ref={nativeRef} {...props}/>;
44
+ });
45
+ TwoStepVideoView.displayName = 'TwoStepVideoView';
46
+ export default TwoStepVideoView;
47
+ //# sourceMappingURL=ExpoTwostepVideoView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoTwostepVideoView.js","sourceRoot":"","sources":["../src/ExpoTwostepVideoView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAiBhE,MAAM,UAAU,GAAyC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,gBAAgB,GAAG,UAAU,CACjC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,SAAS,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAE9C,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,IAAI,EAAE,KAAK,IAAI,EAAE;YACf,MAAM,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;QAClC,CAAC;QACD,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;QACnC,CAAC;QACD,IAAI,EAAE,KAAK,EAAE,IAAY,EAAE,EAAE;YAC3B,MAAM,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,EAAE,KAAK,IAAI,EAAE;YACjB,MAAM,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QACpC,CAAC;KACF,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnD,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAElD,eAAe,gBAAgB,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\nimport { forwardRef, useImperativeHandle, useRef } from 'react';\n\nimport { TwoStepVideoViewProps, TwoStepVideoViewRef } from './ExpoTwostepVideo.types';\n\n// Internal props type that includes the native ref\ntype NativeViewProps = TwoStepVideoViewProps & {\n ref?: React.Ref<NativeViewRef>;\n};\n\n// Native view ref with native methods\ntype NativeViewRef = {\n play: () => Promise<void>;\n pause: () => Promise<void>;\n seek: (time: number) => Promise<void>;\n replay: () => Promise<void>;\n};\n\nconst NativeView: React.ComponentType<NativeViewProps> = requireNativeView('ExpoTwoStepVideo');\n\n/**\n * Video player view that can play compositions and assets directly\n *\n * @example\n * ```tsx\n * const playerRef = useRef<TwoStepVideoViewRef>(null);\n *\n * // Play a composition (from mirrorVideo, trimVideo, etc.)\n * <TwoStepVideoView\n * ref={playerRef}\n * compositionId={composition.id}\n * onPlaybackStatusChange={(e) => console.log(e.nativeEvent.status)}\n * onProgress={(e) => setProgress(e.nativeEvent.progress)}\n * style={{ width: '100%', height: 300 }}\n * />\n *\n * // Control playback\n * playerRef.current?.play();\n * playerRef.current?.pause();\n * playerRef.current?.seek(5.0);\n * ```\n */\nconst TwoStepVideoView = forwardRef<TwoStepVideoViewRef, TwoStepVideoViewProps>(\n (props, ref) => {\n const nativeRef = useRef<NativeViewRef>(null);\n\n useImperativeHandle(ref, () => ({\n play: async () => {\n await nativeRef.current?.play();\n },\n pause: async () => {\n await nativeRef.current?.pause();\n },\n seek: async (time: number) => {\n await nativeRef.current?.seek(time);\n },\n replay: async () => {\n await nativeRef.current?.replay();\n },\n }));\n\n return <NativeView ref={nativeRef} {...props} />;\n }\n);\n\nTwoStepVideoView.displayName = 'TwoStepVideoView';\n\nexport default TwoStepVideoView;\n"]}
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { TwoStepVideoViewProps } from './ExpoTwostepVideo.types';
3
+ export default function TwoStepVideoView(props: TwoStepVideoViewProps): React.JSX.Element;
4
+ //# sourceMappingURL=ExpoTwostepVideoView.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoTwostepVideoView.web.d.ts","sourceRoot":"","sources":["../src/ExpoTwostepVideoView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBAMpE"}
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ // Web is not supported - this is a placeholder
3
+ export default function TwoStepVideoView(props) {
4
+ return (<div style={{ backgroundColor: '#000', display: 'flex', alignItems: 'center', justifyContent: 'center', ...props.style }}>
5
+ <span style={{ color: '#fff' }}>Video player not supported on web</span>
6
+ </div>);
7
+ }
8
+ //# sourceMappingURL=ExpoTwostepVideoView.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoTwostepVideoView.web.js","sourceRoot":"","sources":["../src/ExpoTwostepVideoView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,+CAA+C;AAC/C,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAA4B;IACnE,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,KAA4B,EAAE,CAAC,CAC9I;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,iCAAiC,EAAE,IAAI,CACzE;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { TwoStepVideoViewProps } from './ExpoTwostepVideo.types';\n\n// Web is not supported - this is a placeholder\nexport default function TwoStepVideoView(props: TwoStepVideoViewProps) {\n return (\n <div style={{ backgroundColor: '#000', display: 'flex', alignItems: 'center', justifyContent: 'center', ...props.style as React.CSSProperties }}>\n <span style={{ color: '#fff' }}>Video player not supported on web</span>\n </div>\n );\n}\n"]}
@@ -0,0 +1,569 @@
1
+ /**
2
+ * TwoStepVideo - Professional video editing for React Native
3
+ * Built on native AVFoundation with Expo Modules
4
+ */
5
+ import { type EventSubscription } from 'expo-modules-core';
6
+ /**
7
+ * Quality presets for video export
8
+ */
9
+ export type VideoQuality = 'low' | 'medium' | 'high' | 'highest';
10
+ /**
11
+ * Mirror axis options for video mirroring
12
+ */
13
+ export type MirrorAxis = 'horizontal' | 'vertical' | 'both';
14
+ /**
15
+ * Video asset metadata returned after loading
16
+ */
17
+ export interface VideoAsset {
18
+ /** Unique identifier for this asset */
19
+ id: string;
20
+ /** Duration in seconds */
21
+ duration: number;
22
+ /** Video width in pixels */
23
+ width: number;
24
+ /** Video height in pixels */
25
+ height: number;
26
+ /** Frame rate (fps) */
27
+ frameRate: number;
28
+ /** Whether the video has audio */
29
+ hasAudio: boolean;
30
+ }
31
+ /**
32
+ * Video composition metadata
33
+ */
34
+ export interface VideoComposition {
35
+ /** Unique identifier for this composition */
36
+ id: string;
37
+ /** Total duration in seconds */
38
+ duration: number;
39
+ }
40
+ /**
41
+ * Time segment for multi-segment trimming
42
+ */
43
+ export interface TimeSegment {
44
+ /** Start time in seconds */
45
+ start: number;
46
+ /** End time in seconds */
47
+ end: number;
48
+ }
49
+ /**
50
+ * Export result containing output file information
51
+ */
52
+ export interface ExportResult {
53
+ /** File URI (e.g., "file:///path/to/video.mp4") */
54
+ uri: string;
55
+ /** Absolute file path */
56
+ path: string;
57
+ }
58
+ /**
59
+ * Export progress event
60
+ */
61
+ export interface ExportProgressEvent {
62
+ /** Progress from 0.0 to 1.0 */
63
+ progress: number;
64
+ /** Asset ID if exporting asset directly */
65
+ assetId?: string;
66
+ /** Composition ID if exporting composition */
67
+ compositionId?: string;
68
+ }
69
+ /**
70
+ * Options for loading a video asset
71
+ */
72
+ export interface LoadAssetOptions {
73
+ /** File URI (e.g., "file:///path/to/video.mp4") */
74
+ uri: string;
75
+ }
76
+ /**
77
+ * Options for trimming a video
78
+ */
79
+ export interface TrimVideoOptions {
80
+ /** Asset ID to trim */
81
+ assetId: string;
82
+ /** Start time in seconds */
83
+ startTime: number;
84
+ /** End time in seconds */
85
+ endTime: number;
86
+ }
87
+ /**
88
+ * Options for multi-segment trimming
89
+ */
90
+ export interface TrimMultipleOptions {
91
+ /** Asset ID to trim */
92
+ assetId: string;
93
+ /** Array of time segments to extract and concatenate */
94
+ segments: TimeSegment[];
95
+ }
96
+ /**
97
+ * Options for generating thumbnails
98
+ */
99
+ export interface GenerateThumbnailsOptions {
100
+ /** Asset ID to generate thumbnails from */
101
+ assetId: string;
102
+ /** Array of times (in seconds) to extract thumbnails */
103
+ times: number[];
104
+ /** Optional size for thumbnails */
105
+ size?: {
106
+ width: number;
107
+ height: number;
108
+ };
109
+ }
110
+ /**
111
+ * Options for exporting a composition
112
+ */
113
+ export interface ExportCompositionOptions {
114
+ /** Composition ID to export */
115
+ compositionId: string;
116
+ /** Optional output URI (uses temp directory if not provided) */
117
+ outputUri?: string;
118
+ /** Quality preset (default: 'high') */
119
+ quality?: VideoQuality;
120
+ }
121
+ /**
122
+ * Options for exporting an asset directly
123
+ */
124
+ export interface ExportAssetOptions {
125
+ /** Asset ID to export */
126
+ assetId: string;
127
+ /** Optional output URI (uses temp directory if not provided) */
128
+ outputUri?: string;
129
+ /** Quality preset (default: 'high') */
130
+ quality?: VideoQuality;
131
+ }
132
+ /**
133
+ * Options for mirroring a video
134
+ */
135
+ export interface MirrorVideoOptions {
136
+ /** Asset ID to mirror */
137
+ assetId: string;
138
+ /** Axis to mirror on: 'horizontal', 'vertical', or 'both' */
139
+ axis: MirrorAxis;
140
+ /** Optional start time in seconds (for segment mirroring) */
141
+ startTime?: number;
142
+ /** Optional end time in seconds (for segment mirroring) */
143
+ endTime?: number;
144
+ }
145
+ /**
146
+ * Options for adjusting video speed
147
+ */
148
+ export interface AdjustSpeedOptions {
149
+ /** Asset ID to adjust */
150
+ assetId: string;
151
+ /** Speed multiplier (0.25 = 4x slower, 2.0 = 2x faster) */
152
+ speed: number;
153
+ /** Optional start time in seconds */
154
+ startTime?: number;
155
+ /** Optional end time in seconds */
156
+ endTime?: number;
157
+ }
158
+ /**
159
+ * Options for combined video transformation
160
+ */
161
+ export interface TransformVideoOptions {
162
+ /** Asset ID to transform */
163
+ assetId: string;
164
+ /** Speed multiplier (default: 1.0) */
165
+ speed?: number;
166
+ /** Optional mirror axis */
167
+ mirrorAxis?: MirrorAxis;
168
+ /** Optional start time in seconds (for trimming) */
169
+ startTime?: number;
170
+ /** Optional end time in seconds (for trimming) */
171
+ endTime?: number;
172
+ }
173
+ /**
174
+ * Options for looping a video segment
175
+ */
176
+ export interface LoopSegmentOptions {
177
+ /** Asset ID to loop */
178
+ assetId: string;
179
+ /** Start time of the segment to loop (in seconds) */
180
+ startTime: number;
181
+ /** End time of the segment to loop (in seconds) */
182
+ endTime: number;
183
+ /** Number of times to repeat (total plays = loopCount + 1) */
184
+ loopCount: number;
185
+ }
186
+ /**
187
+ * Result from looping a video segment
188
+ */
189
+ export interface LoopResult {
190
+ /** Unique identifier for this composition */
191
+ id: string;
192
+ /** Total duration in seconds */
193
+ duration: number;
194
+ /** Number of times the segment repeats */
195
+ loopCount: number;
196
+ /** Total number of times the segment plays */
197
+ totalPlays: number;
198
+ }
199
+ /**
200
+ * Quality constants
201
+ */
202
+ export declare const Quality: {
203
+ readonly LOW: string;
204
+ readonly MEDIUM: string;
205
+ readonly HIGH: string;
206
+ readonly HIGHEST: string;
207
+ };
208
+ /**
209
+ * Mirror axis constants
210
+ */
211
+ export declare const Mirror: {
212
+ readonly HORIZONTAL: string;
213
+ readonly VERTICAL: string;
214
+ readonly BOTH: string;
215
+ };
216
+ /**
217
+ * Load a video asset from a file URI
218
+ *
219
+ * @param options - Load options containing the file URI
220
+ * @returns Promise resolving to video asset metadata
221
+ *
222
+ * @example
223
+ * ```typescript
224
+ * const asset = await TwoStepVideo.loadAsset({
225
+ * uri: 'file:///path/to/video.mp4'
226
+ * });
227
+ * console.log(`Duration: ${asset.duration}s, Size: ${asset.width}x${asset.height}`);
228
+ * ```
229
+ */
230
+ export declare function loadAsset(options: LoadAssetOptions): Promise<VideoAsset>;
231
+ /**
232
+ * Load a video asset from the Photos library
233
+ *
234
+ * @param localIdentifier - PHAsset local identifier from the Photos library
235
+ * @returns Promise resolving to video asset metadata
236
+ *
237
+ * @example
238
+ * ```typescript
239
+ * // After using expo-media-library to get a photo asset
240
+ * const asset = await TwoStepVideo.loadAssetFromPhotos(photoAsset.id);
241
+ * ```
242
+ */
243
+ export declare function loadAssetFromPhotos(localIdentifier: string): Promise<VideoAsset>;
244
+ /**
245
+ * Validate a video file URI without loading the full asset
246
+ * Useful for quick validation before processing
247
+ *
248
+ * @param uri - File URI to validate
249
+ * @returns Promise resolving to true if valid video file
250
+ *
251
+ * @example
252
+ * ```typescript
253
+ * const isValid = await TwoStepVideo.validateVideoUri('file:///path/to/video.mp4');
254
+ * if (isValid) {
255
+ * const asset = await TwoStepVideo.loadAsset({ uri });
256
+ * }
257
+ * ```
258
+ */
259
+ export declare function validateVideoUri(uri: string): Promise<boolean>;
260
+ /**
261
+ * Trim a video to a single time range
262
+ *
263
+ * @param options - Trim options including asset ID and time range
264
+ * @returns Promise resolving to composition metadata
265
+ *
266
+ * @example
267
+ * ```typescript
268
+ * const asset = await TwoStepVideo.loadAsset({ uri });
269
+ * const composition = await TwoStepVideo.trimVideo({
270
+ * assetId: asset.id,
271
+ * startTime: 5.0,
272
+ * endTime: 15.0
273
+ * });
274
+ * console.log(`Trimmed to ${composition.duration}s`);
275
+ * ```
276
+ */
277
+ export declare function trimVideo(options: TrimVideoOptions): Promise<VideoComposition>;
278
+ /**
279
+ * Trim a video to multiple segments and concatenate them
280
+ *
281
+ * @param options - Trim options including asset ID and segments
282
+ * @returns Promise resolving to composition metadata
283
+ *
284
+ * @example
285
+ * ```typescript
286
+ * const composition = await TwoStepVideo.trimVideoMultiple({
287
+ * assetId: asset.id,
288
+ * segments: [
289
+ * { start: 0, end: 3 }, // First 3 seconds
290
+ * { start: 10, end: 13 }, // 3 seconds from middle
291
+ * { start: 20, end: 23 } // 3 seconds from end
292
+ * ]
293
+ * });
294
+ * ```
295
+ */
296
+ export declare function trimVideoMultiple(options: TrimMultipleOptions): Promise<VideoComposition>;
297
+ /**
298
+ * Mirror a video horizontally, vertically, or both
299
+ *
300
+ * @param options - Mirror options including asset ID and axis
301
+ * @returns Promise resolving to composition metadata
302
+ *
303
+ * @example
304
+ * ```typescript
305
+ * // Mirror horizontally (flip left-right, common for selfie videos)
306
+ * const composition = await TwoStepVideo.mirrorVideo({
307
+ * assetId: asset.id,
308
+ * axis: 'horizontal'
309
+ * });
310
+ *
311
+ * // Mirror a specific segment
312
+ * const composition = await TwoStepVideo.mirrorVideo({
313
+ * assetId: asset.id,
314
+ * axis: 'vertical',
315
+ * startTime: 5,
316
+ * endTime: 10
317
+ * });
318
+ * ```
319
+ */
320
+ export declare function mirrorVideo(options: MirrorVideoOptions): Promise<VideoComposition>;
321
+ /**
322
+ * Adjust the playback speed of a video
323
+ *
324
+ * @param options - Speed options including asset ID and speed multiplier
325
+ * @returns Promise resolving to composition metadata
326
+ *
327
+ * @example
328
+ * ```typescript
329
+ * // Slow motion (0.5x speed = 2x slower)
330
+ * const slowMo = await TwoStepVideo.adjustSpeed({
331
+ * assetId: asset.id,
332
+ * speed: 0.5
333
+ * });
334
+ *
335
+ * // Fast forward (2x speed)
336
+ * const fastForward = await TwoStepVideo.adjustSpeed({
337
+ * assetId: asset.id,
338
+ * speed: 2.0
339
+ * });
340
+ *
341
+ * // Speed up a specific segment
342
+ * const timelapse = await TwoStepVideo.adjustSpeed({
343
+ * assetId: asset.id,
344
+ * speed: 4.0,
345
+ * startTime: 10,
346
+ * endTime: 30
347
+ * });
348
+ * ```
349
+ */
350
+ export declare function adjustSpeed(options: AdjustSpeedOptions): Promise<VideoComposition>;
351
+ /**
352
+ * Transform a video with combined trimming, mirroring, and speed adjustment
353
+ * Use the player's `loop` prop for continuous playback looping
354
+ *
355
+ * @param options - Transform options including asset ID, speed, and mirror axis
356
+ * @returns Promise resolving to composition metadata
357
+ *
358
+ * @example
359
+ * ```typescript
360
+ * // Mirror and slow down
361
+ * const transformed = await TwoStepVideo.transformVideo({
362
+ * assetId: asset.id,
363
+ * speed: 0.5,
364
+ * mirrorAxis: 'horizontal'
365
+ * });
366
+ *
367
+ * // Just mirror (speed defaults to 1.0)
368
+ * const mirrored = await TwoStepVideo.transformVideo({
369
+ * assetId: asset.id,
370
+ * mirrorAxis: 'both'
371
+ * });
372
+ *
373
+ * // Transform a specific segment (trim + mirror + speed)
374
+ * const segment = await TwoStepVideo.transformVideo({
375
+ * assetId: asset.id,
376
+ * speed: 2.0,
377
+ * mirrorAxis: 'horizontal',
378
+ * startTime: 0,
379
+ * endTime: 5
380
+ * });
381
+ *
382
+ * // Play in loop mode
383
+ * <TwoStepVideoView compositionId={segment.id} loop />
384
+ * ```
385
+ */
386
+ export declare function transformVideo(options: TransformVideoOptions): Promise<VideoComposition>;
387
+ /**
388
+ * Loop a segment of a video multiple times
389
+ *
390
+ * @param options - Loop options including segment time range and repeat count
391
+ * @returns Promise resolving to loop result with duration info
392
+ *
393
+ * @example
394
+ * ```typescript
395
+ * // Loop a 2-second segment 3 times (plays 4 times total)
396
+ * const looped = await TwoStepVideo.loopSegment({
397
+ * assetId: asset.id,
398
+ * startTime: 5,
399
+ * endTime: 7,
400
+ * loopCount: 3
401
+ * });
402
+ * console.log(`Duration: ${looped.duration}s (plays ${looped.totalPlays} times)`);
403
+ *
404
+ * // Create a perfect loop for social media
405
+ * const perfectLoop = await TwoStepVideo.loopSegment({
406
+ * assetId: asset.id,
407
+ * startTime: 0,
408
+ * endTime: 3,
409
+ * loopCount: 4 // 15 seconds total (3s * 5 plays)
410
+ * });
411
+ * ```
412
+ */
413
+ export declare function loopSegment(options: LoopSegmentOptions): Promise<LoopResult>;
414
+ /**
415
+ * Generate thumbnail images from a video at specific times
416
+ *
417
+ * @param options - Thumbnail generation options
418
+ * @returns Promise resolving to array of base64 encoded PNG images
419
+ *
420
+ * @example
421
+ * ```typescript
422
+ * const thumbnails = await TwoStepVideo.generateThumbnails({
423
+ * assetId: asset.id,
424
+ * times: [1, 5, 10, 15],
425
+ * size: { width: 300, height: 300 }
426
+ * });
427
+ *
428
+ * // Use in Image component
429
+ * <Image source={{ uri: `data:image/png;base64,${thumbnails[0]}` }} />
430
+ * ```
431
+ */
432
+ export declare function generateThumbnails(options: GenerateThumbnailsOptions): Promise<string[]>;
433
+ /**
434
+ * Export a composition to a video file
435
+ *
436
+ * @param options - Export options including composition ID and quality
437
+ * @returns Promise resolving to export result with file URI
438
+ *
439
+ * @example
440
+ * ```typescript
441
+ * const result = await TwoStepVideo.exportVideo({
442
+ * compositionId: composition.id,
443
+ * quality: 'high'
444
+ * });
445
+ * console.log(`Exported to: ${result.uri}`);
446
+ * ```
447
+ */
448
+ export declare function exportVideo(options: ExportCompositionOptions): Promise<ExportResult>;
449
+ /**
450
+ * Export an asset directly without creating a composition
451
+ * Useful for re-encoding or changing quality without trimming
452
+ *
453
+ * @param options - Export options including asset ID and quality
454
+ * @returns Promise resolving to export result with file URI
455
+ *
456
+ * @example
457
+ * ```typescript
458
+ * const result = await TwoStepVideo.exportAsset({
459
+ * assetId: asset.id,
460
+ * quality: 'medium'
461
+ * });
462
+ * ```
463
+ */
464
+ export declare function exportAsset(options: ExportAssetOptions): Promise<ExportResult>;
465
+ /**
466
+ * Clean up a temporary file
467
+ * Call this after you're done with exported files in the temp directory
468
+ *
469
+ * @param uri - File URI to clean up
470
+ *
471
+ * @example
472
+ * ```typescript
473
+ * const result = await TwoStepVideo.exportVideo({ ... });
474
+ * // ... do something with result.uri
475
+ * TwoStepVideo.cleanupFile(result.uri);
476
+ * ```
477
+ */
478
+ export declare function cleanupFile(uri: string): void;
479
+ /**
480
+ * Release an asset from memory
481
+ * Call this when you're done with an asset to free up memory
482
+ *
483
+ * @param assetId - ID of the asset to release
484
+ */
485
+ export declare function releaseAsset(assetId: string): void;
486
+ /**
487
+ * Release a composition from memory
488
+ *
489
+ * @param compositionId - ID of the composition to release
490
+ */
491
+ export declare function releaseComposition(compositionId: string): void;
492
+ /**
493
+ * Release all cached assets and compositions
494
+ * Useful for cleanup when unmounting screens
495
+ */
496
+ export declare function releaseAll(): void;
497
+ /**
498
+ * Add a listener for export progress events
499
+ *
500
+ * @param listener - Callback function receiving progress events
501
+ * @returns Subscription object with remove() method
502
+ *
503
+ * @example
504
+ * ```typescript
505
+ * const subscription = TwoStepVideo.addExportProgressListener((event) => {
506
+ * console.log(`Export progress: ${Math.round(event.progress * 100)}%`);
507
+ * setProgress(event.progress);
508
+ * });
509
+ *
510
+ * // Later, remove the listener
511
+ * subscription.remove();
512
+ * ```
513
+ */
514
+ export declare function addExportProgressListener(listener: (event: ExportProgressEvent) => void): EventSubscription;
515
+ /**
516
+ * React hook for managing export progress
517
+ * Only works in React components
518
+ *
519
+ * @returns Current export progress (0.0 to 1.0)
520
+ *
521
+ * @example
522
+ * ```typescript
523
+ * function VideoEditor() {
524
+ * const progress = useExportProgress();
525
+ *
526
+ * return (
527
+ * <View>
528
+ * <Text>Export Progress: {Math.round(progress * 100)}%</Text>
529
+ * </View>
530
+ * );
531
+ * }
532
+ * ```
533
+ */
534
+ export declare function useExportProgress(): number;
535
+ declare const _default: {
536
+ Quality: {
537
+ readonly LOW: string;
538
+ readonly MEDIUM: string;
539
+ readonly HIGH: string;
540
+ readonly HIGHEST: string;
541
+ };
542
+ Mirror: {
543
+ readonly HORIZONTAL: string;
544
+ readonly VERTICAL: string;
545
+ readonly BOTH: string;
546
+ };
547
+ loadAsset: typeof loadAsset;
548
+ loadAssetFromPhotos: typeof loadAssetFromPhotos;
549
+ validateVideoUri: typeof validateVideoUri;
550
+ trimVideo: typeof trimVideo;
551
+ trimVideoMultiple: typeof trimVideoMultiple;
552
+ generateThumbnails: typeof generateThumbnails;
553
+ exportVideo: typeof exportVideo;
554
+ exportAsset: typeof exportAsset;
555
+ mirrorVideo: typeof mirrorVideo;
556
+ adjustSpeed: typeof adjustSpeed;
557
+ transformVideo: typeof transformVideo;
558
+ loopSegment: typeof loopSegment;
559
+ cleanupFile: typeof cleanupFile;
560
+ releaseAsset: typeof releaseAsset;
561
+ releaseComposition: typeof releaseComposition;
562
+ releaseAll: typeof releaseAll;
563
+ addExportProgressListener: typeof addExportProgressListener;
564
+ useExportProgress: typeof useExportProgress;
565
+ };
566
+ export default _default;
567
+ export { default as TwoStepVideoView } from './ExpoTwostepVideoView';
568
+ export type { TwoStepVideoViewProps, TwoStepVideoViewRef, PlaybackStatusEvent, ProgressEvent, ErrorEvent, } from './ExpoTwostepVideo.types';
569
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAK3D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC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