react-native-skia-webgpu-video 0.0.0-stage → 0.1.0-beta.1

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 (237) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +303 -2
  3. package/android/BUILD_VALIDATION.md +62 -0
  4. package/android/CMakeLists.txt +99 -0
  5. package/android/build-validation.json +262 -0
  6. package/android/build.gradle +185 -0
  7. package/android/cpp/EncoderTargets.cpp +226 -0
  8. package/android/cpp/EncoderTargets.h +70 -0
  9. package/android/cpp/JNIHelpers.cpp +15 -0
  10. package/android/cpp/JNIHelpers.h +20 -0
  11. package/android/cpp/NativeEventDispatcher.cpp +59 -0
  12. package/android/cpp/NativeEventDispatcher.h +31 -0
  13. package/android/cpp/NativeHardwareBuffer.cpp +397 -0
  14. package/android/cpp/NativeHardwareBuffer.h +34 -0
  15. package/android/cpp/NativeRgbaBuffer.cpp +45 -0
  16. package/android/cpp/NativeRgbaBuffer.h +9 -0
  17. package/android/cpp/ReturnedVideoFrames.h +37 -0
  18. package/android/cpp/RgbaFrameLease.h +53 -0
  19. package/android/cpp/VideoCapabilities.cpp +87 -0
  20. package/android/cpp/VideoCapabilities.h +44 -0
  21. package/android/cpp/VideoComposition.cpp +170 -0
  22. package/android/cpp/VideoComposition.h +36 -0
  23. package/android/cpp/VideoCompositionFramesExtractor.cpp +82 -0
  24. package/android/cpp/VideoCompositionFramesExtractor.h +48 -0
  25. package/android/cpp/VideoCompositionFramesExtractorHostObject.cpp +230 -0
  26. package/android/cpp/VideoCompositionFramesExtractorHostObject.h +42 -0
  27. package/android/cpp/VideoCompositionFramesExtractorSyncHostObject.cpp +133 -0
  28. package/android/cpp/VideoCompositionFramesExtractorSyncHostObject.h +46 -0
  29. package/android/cpp/VideoEncoderHostObject.cpp +318 -0
  30. package/android/cpp/VideoEncoderHostObject.h +76 -0
  31. package/android/cpp/VideoFrame.cpp +293 -0
  32. package/android/cpp/VideoFrame.h +27 -0
  33. package/android/cpp/VideoPlayer.cpp +96 -0
  34. package/android/cpp/VideoPlayer.h +52 -0
  35. package/android/cpp/VideoPlayerHostObject.cpp +225 -0
  36. package/android/cpp/VideoPlayerHostObject.h +43 -0
  37. package/android/cpp/cpp-adapter.cpp +316 -0
  38. package/android/gradle.properties +5 -0
  39. package/android/instrumentation-inventory.json +178 -0
  40. package/android/proguard-rules.pro +4 -0
  41. package/android/src/main/AndroidManifest.xml +2 -0
  42. package/android/src/main/java/com/azzapp/rnskv/AudioCompositionExporter.java +537 -0
  43. package/android/src/main/java/com/azzapp/rnskv/AudioCompositionPlayer.java +321 -0
  44. package/android/src/main/java/com/azzapp/rnskv/BufferLifetime.java +55 -0
  45. package/android/src/main/java/com/azzapp/rnskv/DecodeRequests.java +100 -0
  46. package/android/src/main/java/com/azzapp/rnskv/DecoderWindow.java +55 -0
  47. package/android/src/main/java/com/azzapp/rnskv/DisplayVsyncPeriod.java +72 -0
  48. package/android/src/main/java/com/azzapp/rnskv/EGLResourcesHolder.java +132 -0
  49. package/android/src/main/java/com/azzapp/rnskv/EGLUtils.java +225 -0
  50. package/android/src/main/java/com/azzapp/rnskv/FrameSize.java +50 -0
  51. package/android/src/main/java/com/azzapp/rnskv/GLFrameExtractor.java +510 -0
  52. package/android/src/main/java/com/azzapp/rnskv/JNIHelpers.java +12 -0
  53. package/android/src/main/java/com/azzapp/rnskv/NativeEventDispatcher.java +25 -0
  54. package/android/src/main/java/com/azzapp/rnskv/NativeHardwareBuffer.java +62 -0
  55. package/android/src/main/java/com/azzapp/rnskv/NativeRgbaBuffer.java +43 -0
  56. package/android/src/main/java/com/azzapp/rnskv/ReactNativeSkiaVideoModule.java +45 -0
  57. package/android/src/main/java/com/azzapp/rnskv/ReactNativeSkiaVideoPackage.java +43 -0
  58. package/android/src/main/java/com/azzapp/rnskv/ReactNativeSkiaVideoSpec.java +9 -0
  59. package/android/src/main/java/com/azzapp/rnskv/RgbaBufferAllocator.java +114 -0
  60. package/android/src/main/java/com/azzapp/rnskv/RgbaLayout.java +33 -0
  61. package/android/src/main/java/com/azzapp/rnskv/SurfaceOutputPolicy.java +13 -0
  62. package/android/src/main/java/com/azzapp/rnskv/TextureRenderer.java +150 -0
  63. package/android/src/main/java/com/azzapp/rnskv/TimeHelpers.java +11 -0
  64. package/android/src/main/java/com/azzapp/rnskv/VideoCapabilities.java +354 -0
  65. package/android/src/main/java/com/azzapp/rnskv/VideoComposition.java +147 -0
  66. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionDecoder.java +779 -0
  67. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionFramesExtractor.java +463 -0
  68. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionFramesExtractorSync.java +241 -0
  69. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionItemDecoder.java +492 -0
  70. package/android/src/main/java/com/azzapp/rnskv/VideoEncoder.java +639 -0
  71. package/android/src/main/java/com/azzapp/rnskv/VideoFrame.java +74 -0
  72. package/android/src/main/java/com/azzapp/rnskv/VideoPlayer.java +361 -0
  73. package/cpp/RNSVCheckedSizes.h +54 -0
  74. package/cpp/RNSVEventEmitter.cpp +199 -0
  75. package/cpp/RNSVEventEmitter.h +31 -0
  76. package/cpp/RNSVHostObject.cpp +79 -0
  77. package/cpp/RNSVHostObject.h +67 -0
  78. package/cpp/RNSVMemoryBudget.cpp +68 -0
  79. package/cpp/RNSVMemoryBudget.h +100 -0
  80. package/cpp/RNSVRuntimeLifecycleMonitor.cpp +88 -0
  81. package/cpp/RNSVRuntimeLifecycleMonitor.h +33 -0
  82. package/docs/ANDROID_DEVICE_306.md +95 -0
  83. package/docs/ANDROID_EXPORT_CACHE_306.md +48 -0
  84. package/docs/ANDROID_MEMORY_RETENTION_306.md +67 -0
  85. package/docs/BENCHMARKS.md +368 -0
  86. package/docs/IOS_DEVICE_TESTS.md +115 -0
  87. package/docs/IOS_SIMULATOR_TESTS.md +74 -0
  88. package/docs/MIGRATION.md +82 -0
  89. package/docs/NATIVE_MEMORY_INVESTIGATION_306.md +88 -0
  90. package/docs/PERFORMANCE_AB_IPHONE_303.md +196 -0
  91. package/docs/PERFORMANCE_AB_SIMULATOR.md +135 -0
  92. package/docs/PERFORMANCE_AB_SOAK_SIMULATOR.md +84 -0
  93. package/docs/PERFORMANCE_IPHONE_306_OPTIMIZATION.md +76 -0
  94. package/docs/PERFORMANCE_SIMULATOR.md +89 -0
  95. package/docs/PERFORMANCE_SIMULATOR_INITIAL.md +96 -0
  96. package/docs/PERFORMANCE_SOAK_IPHONE_303.md +41 -0
  97. package/docs/UPSTREAM_NOTES.md +188 -0
  98. package/docs/assets/banner.svg +26 -0
  99. package/examples/webgpu-overlay.ts +147 -0
  100. package/ios/AVAssetTrackUtils.h +24 -0
  101. package/ios/AudioCompositionUtils.h +27 -0
  102. package/ios/AudioCompositionUtils.mm +113 -0
  103. package/ios/DecoderWindow.h +52 -0
  104. package/ios/NativeResourceStats.h +32 -0
  105. package/ios/RNSVColorSpace.h +50 -0
  106. package/ios/RNSVJSIUtils.h +46 -0
  107. package/ios/RNSVScopedPixelBuffer.h +17 -0
  108. package/ios/RNSVVideoPlayer.h +46 -0
  109. package/ios/RNSVVideoPlayer.mm +410 -0
  110. package/ios/ReactNativeSkiaVideo.h +8 -0
  111. package/ios/ReactNativeSkiaVideo.mm +310 -0
  112. package/ios/SeekPolicy.h +27 -0
  113. package/ios/VideoComposition.h +148 -0
  114. package/ios/VideoCompositionFramesExtractorHostObject.h +105 -0
  115. package/ios/VideoCompositionFramesExtractorHostObject.mm +686 -0
  116. package/ios/VideoCompositionFramesExtractorSyncHostObject.h +37 -0
  117. package/ios/VideoCompositionFramesExtractorSyncHostObject.mm +168 -0
  118. package/ios/VideoCompositionItemDecoder.h +60 -0
  119. package/ios/VideoCompositionItemDecoder.mm +480 -0
  120. package/ios/VideoEncoderHostObject.h +83 -0
  121. package/ios/VideoEncoderHostObject.mm +706 -0
  122. package/ios/VideoFrame.h +66 -0
  123. package/ios/VideoFrame.mm +108 -0
  124. package/ios/VideoPlayerHostObject.h +52 -0
  125. package/ios/VideoPlayerHostObject.mm +332 -0
  126. package/lib/module/NativeReactNativeSkiaVideo.js +5 -0
  127. package/lib/module/NativeReactNativeSkiaVideo.js.map +1 -0
  128. package/lib/module/RNSkiaVideoModule.js +20 -0
  129. package/lib/module/RNSkiaVideoModule.js.map +1 -0
  130. package/lib/module/canvas.js +18 -0
  131. package/lib/module/canvas.js.map +1 -0
  132. package/lib/module/exportCache.js +22 -0
  133. package/lib/module/exportCache.js.map +1 -0
  134. package/lib/module/exportFrames.js +338 -0
  135. package/lib/module/exportFrames.js.map +1 -0
  136. package/lib/module/exportQueue.js +52 -0
  137. package/lib/module/exportQueue.js.map +1 -0
  138. package/lib/module/exportTarget.js +137 -0
  139. package/lib/module/exportTarget.js.map +1 -0
  140. package/lib/module/exportVideoComposition.js +492 -0
  141. package/lib/module/exportVideoComposition.js.map +1 -0
  142. package/lib/module/frameInterop.js +532 -0
  143. package/lib/module/frameInterop.js.map +1 -0
  144. package/lib/module/gpu.js +222 -0
  145. package/lib/module/gpu.js.map +1 -0
  146. package/lib/module/gpuDevice.js +54 -0
  147. package/lib/module/gpuDevice.js.map +1 -0
  148. package/lib/module/index.js +36 -0
  149. package/lib/module/index.js.map +1 -0
  150. package/lib/module/memory.js +38 -0
  151. package/lib/module/memory.js.map +1 -0
  152. package/lib/module/package.json +1 -0
  153. package/lib/module/previewLifecycle.js +52 -0
  154. package/lib/module/previewLifecycle.js.map +1 -0
  155. package/lib/module/runtimeYield.js +10 -0
  156. package/lib/module/runtimeYield.js.map +1 -0
  157. package/lib/module/types.js +4 -0
  158. package/lib/module/types.js.map +1 -0
  159. package/lib/module/utils/useEventListener.js +18 -0
  160. package/lib/module/utils/useEventListener.js.map +1 -0
  161. package/lib/module/videoCompositionPlayer.js +368 -0
  162. package/lib/module/videoCompositionPlayer.js.map +1 -0
  163. package/lib/module/videoFrameImage.js +185 -0
  164. package/lib/module/videoFrameImage.js.map +1 -0
  165. package/lib/module/videoPlayer.js +172 -0
  166. package/lib/module/videoPlayer.js.map +1 -0
  167. package/lib/module/yuvBlit.js +299 -0
  168. package/lib/module/yuvBlit.js.map +1 -0
  169. package/lib/typescript/package.json +1 -0
  170. package/lib/typescript/src/NativeReactNativeSkiaVideo.d.ts +7 -0
  171. package/lib/typescript/src/NativeReactNativeSkiaVideo.d.ts.map +1 -0
  172. package/lib/typescript/src/RNSkiaVideoModule.d.ts +4 -0
  173. package/lib/typescript/src/RNSkiaVideoModule.d.ts.map +1 -0
  174. package/lib/typescript/src/canvas.d.ts +4 -0
  175. package/lib/typescript/src/canvas.d.ts.map +1 -0
  176. package/lib/typescript/src/exportCache.d.ts +6 -0
  177. package/lib/typescript/src/exportCache.d.ts.map +1 -0
  178. package/lib/typescript/src/exportFrames.d.ts +57 -0
  179. package/lib/typescript/src/exportFrames.d.ts.map +1 -0
  180. package/lib/typescript/src/exportQueue.d.ts +5 -0
  181. package/lib/typescript/src/exportQueue.d.ts.map +1 -0
  182. package/lib/typescript/src/exportTarget.d.ts +28 -0
  183. package/lib/typescript/src/exportTarget.d.ts.map +1 -0
  184. package/lib/typescript/src/exportVideoComposition.d.ts +68 -0
  185. package/lib/typescript/src/exportVideoComposition.d.ts.map +1 -0
  186. package/lib/typescript/src/frameInterop.d.ts +17 -0
  187. package/lib/typescript/src/frameInterop.d.ts.map +1 -0
  188. package/lib/typescript/src/gpu.d.ts +39 -0
  189. package/lib/typescript/src/gpu.d.ts.map +1 -0
  190. package/lib/typescript/src/gpuDevice.d.ts +11 -0
  191. package/lib/typescript/src/gpuDevice.d.ts.map +1 -0
  192. package/lib/typescript/src/index.d.ts +21 -0
  193. package/lib/typescript/src/index.d.ts.map +1 -0
  194. package/lib/typescript/src/memory.d.ts +25 -0
  195. package/lib/typescript/src/memory.d.ts.map +1 -0
  196. package/lib/typescript/src/previewLifecycle.d.ts +22 -0
  197. package/lib/typescript/src/previewLifecycle.d.ts.map +1 -0
  198. package/lib/typescript/src/runtimeYield.d.ts +4 -0
  199. package/lib/typescript/src/runtimeYield.d.ts.map +1 -0
  200. package/lib/typescript/src/types.d.ts +631 -0
  201. package/lib/typescript/src/types.d.ts.map +1 -0
  202. package/lib/typescript/src/utils/useEventListener.d.ts +5 -0
  203. package/lib/typescript/src/utils/useEventListener.d.ts.map +1 -0
  204. package/lib/typescript/src/videoCompositionPlayer.d.ts +105 -0
  205. package/lib/typescript/src/videoCompositionPlayer.d.ts.map +1 -0
  206. package/lib/typescript/src/videoFrameImage.d.ts +60 -0
  207. package/lib/typescript/src/videoFrameImage.d.ts.map +1 -0
  208. package/lib/typescript/src/videoPlayer.d.ts +99 -0
  209. package/lib/typescript/src/videoPlayer.d.ts.map +1 -0
  210. package/lib/typescript/src/yuvBlit.d.ts +50 -0
  211. package/lib/typescript/src/yuvBlit.d.ts.map +1 -0
  212. package/package.json +155 -4
  213. package/patches/react-native-skia+3.7.0.patch +502 -0
  214. package/react-native-skia-webgpu-video.podspec +35 -0
  215. package/scripts/apply-skia-canvas-patch.mjs +48 -0
  216. package/scripts/skia-canvas-patch.json +291 -0
  217. package/src/NativeReactNativeSkiaVideo.ts +8 -0
  218. package/src/RNSkiaVideoModule.ts +27 -0
  219. package/src/canvas.ts +22 -0
  220. package/src/exportCache.ts +27 -0
  221. package/src/exportFrames.ts +421 -0
  222. package/src/exportQueue.ts +65 -0
  223. package/src/exportTarget.ts +179 -0
  224. package/src/exportVideoComposition.ts +718 -0
  225. package/src/frameInterop.ts +684 -0
  226. package/src/gpu.ts +290 -0
  227. package/src/gpuDevice.ts +80 -0
  228. package/src/index.tsx +45 -0
  229. package/src/memory.ts +48 -0
  230. package/src/previewLifecycle.ts +60 -0
  231. package/src/runtimeYield.ts +6 -0
  232. package/src/types.ts +661 -0
  233. package/src/utils/useEventListener.ts +22 -0
  234. package/src/videoCompositionPlayer.ts +568 -0
  235. package/src/videoFrameImage.ts +205 -0
  236. package/src/videoPlayer.ts +318 -0
  237. package/src/yuvBlit.ts +331 -0
@@ -0,0 +1,631 @@
1
+ import type { SkCanvas } from "react-native-skia";
2
+ /** A transient frame. Use makeVideoFrameImage/drawVideoFrame to obtain owned
3
+ * Skia pixels; raw Metal/GL handles are no longer supported by Graphite. */
4
+ export type VideoFrame = {
5
+ texture: unknown;
6
+ width: number;
7
+ height: number;
8
+ rotation: number;
9
+ crop?: {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ };
15
+ /** Stable identity of the native frame, including after its buffer is released. */
16
+ id?: number;
17
+ /** Stable identity of the producer, used to bound imported image caches. */
18
+ producerId?: number;
19
+ /** Release a native source after copying/rendering and waiting for GPU completion. */
20
+ dispose?: () => void;
21
+ };
22
+ /**
23
+ * Represents the dimensions of a video.
24
+ */
25
+ export type VideoDimensions = {
26
+ /**
27
+ * The width in pixels of the video.
28
+ */
29
+ width: number;
30
+ /**
31
+ * The height in pixels of the video.
32
+ */
33
+ height: number;
34
+ /**
35
+ * The rotation in degrees of the video.
36
+ */
37
+ rotation: number;
38
+ };
39
+ /**
40
+ * Represents a range of buffered data.
41
+ */
42
+ export type BufferingRange = {
43
+ start: number;
44
+ duration: number;
45
+ };
46
+ /** Compatibility preference retained from Skia Video. This reference
47
+ * Graphite backend uses bounded, owned snapshots for both values. Native
48
+ * buffers first pass through a reusable WebGPU upload texture. Neither
49
+ * value exposes the legacy Metal/OpenGL texture lifetime contract. */
50
+ export type VideoTextureMode = "copy" | "direct";
51
+ /** Compatibility preference; both values use the same transport. iOS draws
52
+ * into the encoder's pool buffers on the GPU, falling back to CPU readback
53
+ * when IOSurface interop is unavailable. Android reads pixels back. */
54
+ export type VideoEncoderMode = "copy" | "direct";
55
+ /**
56
+ * The video player interface.
57
+ */
58
+ export type VideoPlayer = {
59
+ /**
60
+ * Resumes playback of the video.
61
+ */
62
+ play(): void;
63
+ /**
64
+ * Pauses playback.
65
+ */
66
+ pause(): void;
67
+ /**
68
+ * Seeks to a position specified in seconds.
69
+ * Once the seek is complete, the `seekComplete` event will be emitted.
70
+ *
71
+ * @param time The position in seconds to seek to.
72
+ */
73
+ seekTo(time: number): void;
74
+ /**
75
+ * Decodes the next frame of the video.
76
+ * This method should only be called from the ui thread.
77
+ *
78
+ * @returns The next frame of the video.
79
+ */
80
+ decodeNextFrame(): VideoFrame | null;
81
+ /**
82
+ * The current time in seconds of the playback.
83
+ */
84
+ readonly currentTime: number;
85
+ /**
86
+ * The duration in seconds of the video.
87
+ */
88
+ readonly duration: number;
89
+ /**
90
+ * Indicates whether the video is currently playing.
91
+ */
92
+ readonly isPlaying: boolean;
93
+ /**
94
+ * Indicates whether the video is set to loop.
95
+ */
96
+ isLooping: boolean;
97
+ /**
98
+ * The volume of the video.
99
+ * The value should be between 0 and 1.
100
+ */
101
+ volume: number;
102
+ /**
103
+ * The playback speed of the video.
104
+ * The value should be greater than 0. 1.0 is normal speed, 2.0 is double speed, 0.5 is half speed.
105
+ */
106
+ playbackSpeed: number;
107
+ /**
108
+ * Disposes of the video player.
109
+ */
110
+ dispose(): void;
111
+ /**
112
+ * Events dispatched by the video player once the video is ready to play.
113
+ */
114
+ on(name: "ready", listener: (dimensions: VideoDimensions) => void): () => void;
115
+ /**
116
+ * Events dispatched by the video player when the video starts buffering.
117
+ */
118
+ on(name: "bufferingStart", listener: () => void): () => void;
119
+ /**
120
+ * Events dispatched by the video player when the video stops buffering.
121
+ */
122
+ on(name: "bufferingEnd", listener: () => void): () => void;
123
+ /**
124
+ * Events dispatched by the video player when the buffered ranges are updated.
125
+ */
126
+ on(name: "bufferingUpdate", listener: (loadedRanges: BufferingRange[]) => void): () => void;
127
+ /**
128
+ * Events dispatched by the video player when the video playback completes.
129
+ */
130
+ on(name: "complete", listener: () => void): () => void;
131
+ /**
132
+ * Events dispatched by the video player when a seek operation completes.
133
+ */
134
+ on(name: "seekComplete", listener: () => void): () => void;
135
+ /**
136
+ * Events dispatched by the video player when the playing status changes.
137
+ */
138
+ on(name: "playingStatusChange", listener: (isPlaying: boolean) => void): () => void;
139
+ /**
140
+ * Events dispatched by the video player when an error occurs.
141
+ */
142
+ on(name: "error", listener: (error: any) => void): () => void;
143
+ };
144
+ /**
145
+ * Represents a video composition.
146
+ */
147
+ export type VideoComposition = {
148
+ /**
149
+ * The items that make up the composition.
150
+ */
151
+ items: VideoCompositionItem[];
152
+ /**
153
+ * The duration in seconds of the composition.
154
+ */
155
+ duration: number;
156
+ /**
157
+ * Open each video item's decoder shortly before the item starts and close it
158
+ * shortly after it ends, instead of all of them at prepare. For compositions
159
+ * that play their items one after another: decoders and their frames are
160
+ * held for a few items at a time rather than for all of them.
161
+ *
162
+ * An item reached by a seek, rather than by playing up to it, shows no frame
163
+ * until its decoder has opened. The export always waits for it.
164
+ */
165
+ lazyDecoders?: boolean;
166
+ };
167
+ type VideoCompositionItemBase = {
168
+ /**
169
+ * The unique identifier of the item.
170
+ */
171
+ id: string;
172
+ /**
173
+ * The path to the media file.
174
+ * only support local file path
175
+ */
176
+ path: string;
177
+ /**
178
+ * The start time in seconds of the item within the composition.
179
+ */
180
+ compositionStartTime: number;
181
+ /**
182
+ * The start time in seconds of the item within the media.
183
+ */
184
+ startTime: number;
185
+ /**
186
+ * The duration in seconds of the item.
187
+ */
188
+ duration: number;
189
+ };
190
+ /**
191
+ * A video item of a composition. Produces frames passed to the `drawFrame`
192
+ * function. Video items are silent by default; set `audio` to also play
193
+ * the audio track of the video file.
194
+ */
195
+ export type VideoCompositionVideoItem = VideoCompositionItemBase & {
196
+ kind?: "video";
197
+ /**
198
+ * If provided, the resolution to scale the video to.
199
+ * If not provided, the original resolution of the video will be used.
200
+ * Downscaling the video can improve performance.
201
+ *
202
+ * Given in the file's *encoded* orientation, which for a portrait clip is
203
+ * the transpose of what it displays as — prefer `maxLongSide` unless an
204
+ * exact pixel size is needed.
205
+ */
206
+ resolution?: {
207
+ width: number;
208
+ height: number;
209
+ };
210
+ /**
211
+ * If provided, the longest side the frames are decoded at, keeping the
212
+ * file's own aspect. Ignored when `resolution` is set, and never upscales.
213
+ *
214
+ * The cap reduces decoder output/staging pixels. Android's hardware
215
+ * decoder can still allocate buffers at the encoded resolution; measure
216
+ * process/GPU memory separately from the library's explicit budget.
217
+ */
218
+ maxLongSide?: number;
219
+ /**
220
+ * How this item's frames reach Skia, see {@link VideoTextureMode}.
221
+ *
222
+ * @default 'copy'
223
+ */
224
+ textureMode?: VideoTextureMode;
225
+ /**
226
+ * If set, the audio track of the video file will be played (during
227
+ * playback) and mixed into the exported video (during export), following
228
+ * the same time mapping as the video frames.
229
+ * Defaults to false (video items are silent).
230
+ */
231
+ audio?: boolean | {
232
+ volume?: number;
233
+ };
234
+ };
235
+ /**
236
+ * An audio item of a composition. Does not produce frames; its audio track
237
+ * is played during playback and mixed into the exported video during export.
238
+ * The source file can be an audio file or a video file (in which case its
239
+ * audio track is used).
240
+ */
241
+ export type VideoCompositionAudioItem = VideoCompositionItemBase & {
242
+ kind: "audio";
243
+ /**
244
+ * The volume of the item, between 0 and 1.
245
+ * Defaults to 1.
246
+ */
247
+ volume?: number;
248
+ };
249
+ export type VideoCompositionItem = VideoCompositionVideoItem | VideoCompositionAudioItem;
250
+ /**
251
+ * Function that draws a video composition frame to a canvas.
252
+ */
253
+ export type FrameDrawer<T = undefined> = (args: {
254
+ /**
255
+ * The context created by the `before` function in video composition player.
256
+ * or in export video composition.
257
+ */
258
+ context: T;
259
+ /**
260
+ * The canvas to draw the frame to.
261
+ */
262
+ canvas: SkCanvas;
263
+ /**
264
+ * The current composition
265
+ */
266
+ videoComposition: VideoComposition;
267
+ /**
268
+ * The current time in seconds of the drawn frame.
269
+ */
270
+ currentTime: number;
271
+ /**
272
+ * The decoded video frames of the composition items.
273
+ * Only video items produce frames; audio items never appear in this map.
274
+ */
275
+ frames: Record<string, VideoFrame>;
276
+ /**
277
+ * The expected width of the frame in pixels.
278
+ */
279
+ width: number;
280
+ /**
281
+ * The expected height of the frame in pixels.
282
+ */
283
+ height: number;
284
+ }) => void;
285
+ /**
286
+ * The video composition frames extractor interface.
287
+ */
288
+ export type VideoCompositionFramesExtractor = {
289
+ /**
290
+ * Prepares the video composition frames extractor for extracting the frames.
291
+ */
292
+ prepare(): void;
293
+ /**
294
+ * Starts extracting the frames of the video composition.
295
+ */
296
+ play(): void;
297
+ /**
298
+ * Pauses the extraction of the frames.
299
+ */
300
+ pause(): void;
301
+ /**
302
+ * Seeks to a position specified in seconds.
303
+ * @param time The position in seconds to seek to.
304
+ */
305
+ seekTo(time: number): void;
306
+ /**
307
+ * Decodes the frames of the video composition items.
308
+ * This method should only be called from the ui thread.
309
+ *
310
+ * @returns The decoded video frames of the composition items.
311
+ */
312
+ decodeCompositionFrames(): Record<string, VideoFrame>;
313
+ /**
314
+ * Disposes of the video composition frames extractor.
315
+ */
316
+ dispose(): void;
317
+ /**
318
+ * The current time in seconds.
319
+ */
320
+ readonly currentTime: number;
321
+ /**
322
+ * A counter incremented every time `decodeCompositionFrames` returned a new
323
+ * frame for at least one item. Two equal values mean the frames did not
324
+ * change in between.
325
+ */
326
+ readonly framesVersion: number;
327
+ /**
328
+ * Whether the video composition frames extractor is currently playing.
329
+ */
330
+ readonly isPlaying: boolean;
331
+ /**
332
+ * Whether the video composition frames extractor is set to loop.
333
+ */
334
+ isLooping: boolean;
335
+ /**
336
+ * Events dispatched by the video composition frames extractor when the extraction is ready.
337
+ */
338
+ on(name: "ready", listener: () => void): () => void;
339
+ /**
340
+ * Events dispatched by the video composition frames extractor process completes.
341
+ */
342
+ on(name: "complete", listener: () => void): () => void;
343
+ /**
344
+ * Events dispatched by the video composition frames extractor when an error occurs.
345
+ */
346
+ on(name: "error", listener: (error: any) => void): () => void;
347
+ };
348
+ /**
349
+ * The video composition sync extractor interface.
350
+ */
351
+ export type VideoCompositionFramesExtractorSync = {
352
+ /**
353
+ * Starts extracting the frames of the video composition.
354
+ */
355
+ start(): void;
356
+ /**
357
+ * Decodes the frames until reaching the specified time.
358
+ * This method will block the current thread until the frames are decoded.
359
+ *
360
+ * The returned frames are only valid until the next call: draw them and
361
+ * flush the GPU synchronously (`surface.flush(true)`) before decoding
362
+ * further frames.
363
+ *
364
+ * @returns The decoded video frames of the composition items.
365
+ */
366
+ decodeCompositionFrames(currentTime: number): Record<string, VideoFrame>;
367
+ /**
368
+ * Disposes of the video composition frames extractor.
369
+ */
370
+ dispose(): void;
371
+ };
372
+ /**
373
+ * The video composition encoder interface.
374
+ */
375
+ export type VideoEncoder = {
376
+ /**
377
+ * Prepares the video composition encoder for writing.
378
+ */
379
+ prepare(): void;
380
+ /**
381
+ * Encodes the video frame to the video composition.
382
+ */
383
+ encodeFrame(texture: unknown, time: number): void;
384
+ /**
385
+ * Lends the next pool buffer to draw into on the GPU: a CVPixelBuffer on
386
+ * iOS, an RGBA AHardwareBuffer on Android. Pass it back as a native-buffer
387
+ * frame (on Android with the sync-fds ending its GPU access, in `fences`),
388
+ * or release it. One at a time.
389
+ */
390
+ acquireFrameBuffer?(): bigint;
391
+ /** Returns a lent buffer that will not be encoded. */
392
+ releaseFrameBuffer?(): void;
393
+ finishWriting(): void;
394
+ /**
395
+ * Disposes of the video composition encoder.
396
+ */
397
+ dispose(): void;
398
+ };
399
+ /**
400
+ * The video codec used to encode an export.
401
+ *
402
+ * `h264` is supported by every device this library runs on, and is what
403
+ * playback and upload pipelines are universally built around. `hevc` produces
404
+ * roughly the same quality at about half the bitrate, but is not available
405
+ * everywhere — see {@link RNSkiaVideoModule.isEncodingSupported}.
406
+ */
407
+ export type VideoCodec = "h264" | "hevc";
408
+ /**
409
+ * The export options for a video composition.
410
+ */
411
+ export type ExportOptions = {
412
+ /**
413
+ * The path to save the exported video.
414
+ */
415
+ outPath: string;
416
+ /**
417
+ * The width of the exported video in pixels.
418
+ */
419
+ width: number;
420
+ /**
421
+ * The height of the exported video in pixels.
422
+ */
423
+ height: number;
424
+ /**
425
+ * The frame rate of the exported video in frames per second.
426
+ */
427
+ frameRate: number;
428
+ /**
429
+ * The bit rate of the exported video in bits per second.
430
+ */
431
+ bitRate: number;
432
+ /**
433
+ * The video codec to encode with.
434
+ *
435
+ * Falls back to `h264` when the requested codec has no encoder on the
436
+ * device, so passing `hevc` can never fail an export that `h264` would have
437
+ * completed. Call {@link RNSkiaVideoModule.isEncodingSupported} first if the
438
+ * choice is surfaced to a user, so the option can be hidden rather than
439
+ * silently ignored.
440
+ *
441
+ * @default 'h264'
442
+ */
443
+ codec?: VideoCodec;
444
+ /**
445
+ * The encoder name to use for the export.
446
+ *
447
+ * Takes precedence over {@link codec}: naming an encoder selects it
448
+ * directly, whatever codec it implements.
449
+ *
450
+ * @platform android
451
+ */
452
+ encoderName?: string | null;
453
+ /**
454
+ * How rendered frames reach the encoder, see {@link VideoEncoderMode}.
455
+ *
456
+ * @default 'copy'
457
+ * @platform ios
458
+ */
459
+ encoderMode?: VideoEncoderMode;
460
+ /**
461
+ * The bit rate of the exported audio track in bits per second.
462
+ * Only used if the composition contains audio.
463
+ * @default 128000
464
+ */
465
+ audioBitRate?: number;
466
+ /**
467
+ * The sample rate of the exported audio track in Hz.
468
+ * Only used if the composition contains audio.
469
+ * @default 44100
470
+ */
471
+ audioSampleRate?: number;
472
+ /**
473
+ * The number of channels of the exported audio track (1 = mono, 2 = stereo).
474
+ * Only used if the composition contains audio.
475
+ * @default 2
476
+ */
477
+ audioChannelCount?: number;
478
+ };
479
+ export type RNSkiaVideoModule = {
480
+ frameProtocolVersion?: number;
481
+ /** Internal Android capability negotiation, before creating a decoder. */
482
+ configureNativeBufferInterop?: (enabled: boolean) => void;
483
+ reserveMemory?: (bytes: number, label: string) => number;
484
+ releaseMemory?: (reservation: number) => void;
485
+ configureMemoryBudget?: (maxBytes: number) => void;
486
+ getMemoryBudgetStats?: () => {
487
+ currentBytes: number;
488
+ peakBytes: number;
489
+ allocations: number;
490
+ maxBytes: number;
491
+ };
492
+ getResourceStats?: () => Record<string, number>;
493
+ getBackendInfo?: () => Record<string, string | number | boolean>;
494
+ /**
495
+ * Creates a video player for the specified video file.
496
+ *
497
+ * @param uri The path to the video file.
498
+ * @param resolution If provided, the resolution to scale the video to.
499
+ * If not provided, the original resolution of the video will be used.
500
+ * Downscaling the video can improve performance.
501
+ * @returns The video player.
502
+ */
503
+ createVideoPlayer: (uri: string, resolution?: {
504
+ width: number;
505
+ height: number;
506
+ } | null, options?: {
507
+ textureMode?: VideoTextureMode;
508
+ } | null) => VideoPlayer;
509
+ /**
510
+ * Creates a video composition frames extractor for the specified video composition.
511
+ * @param composition The video composition.
512
+ * @returns The video composition frames extractor.
513
+ */
514
+ createVideoCompositionFramesExtractor: (
515
+ /**
516
+ * The video composition to extract frames from.
517
+ */
518
+ composition: VideoComposition) => VideoCompositionFramesExtractor;
519
+ /**
520
+ * Creates a synchronous video composition frames extractor for the specified video composition.
521
+ * @param composition The video composition.
522
+ * @returns The video composition frames extractor.
523
+ */
524
+ createVideoCompositionFramesExtractorSync: (
525
+ /**
526
+ * The video composition to extract frames from.
527
+ */
528
+ composition: VideoComposition) => VideoCompositionFramesExtractorSync;
529
+ /**
530
+ * Creates a video composition encoder for the specified export options.
531
+ * @param options The export options for the video composition.
532
+ * @param composition The video composition being exported; used to encode
533
+ * the audio tracks of the composition items (if any).
534
+ * @returns The video composition encoder.
535
+ */
536
+ createVideoEncoder: (
537
+ /**
538
+ * The export options for the video composition.
539
+ */
540
+ options: ExportOptions,
541
+ /**
542
+ * The video composition being exported (used for audio encoding).
543
+ */
544
+ composition?: VideoComposition | null) => VideoEncoder;
545
+ /**
546
+ * Runs the given function inside an autorelease pool. Worklet runtime
547
+ * threads never drain their autorelease pool, so any per-frame native
548
+ * garbage created by code running there would otherwise accumulate for the
549
+ * lifetime of the app.
550
+ *
551
+ * @platform ios
552
+ */
553
+ runWithAutoreleasePool?: <T>(fn: () => T) => T;
554
+ /**
555
+ * Returns the decoding capabilities of the current platform for the specified mimetype.
556
+ *
557
+ * @platform android
558
+ * @param mimetype The mimetype of the video.
559
+ */
560
+ getDecodingCapabilitiesFor(mimetype: string): {
561
+ /**
562
+ * The maximum number of instances that can be decoded simultaneously.
563
+ */
564
+ maxInstances: number;
565
+ /**
566
+ * The maximum width of the frame that the decoder will produce.
567
+ */
568
+ maxWidth: number;
569
+ /**
570
+ * The maximum height of the frame that the decoder will produce.
571
+ */
572
+ maxHeight: number;
573
+ } | null;
574
+ /**
575
+ * Whether the device can encode with the given codec.
576
+ *
577
+ * `h264` is always true. `hevc` depends on the hardware: an A10 or later on
578
+ * iOS, and a device dependent answer on Android, where HEVC decoding is far
579
+ * more common than HEVC encoding.
580
+ *
581
+ * Exports fall back to `h264` on their own when this returns false, so this
582
+ * is for the UI — hiding or disabling a codec the device cannot honour is
583
+ * better than accepting the choice and quietly ignoring it.
584
+ *
585
+ * @param codec The codec to test.
586
+ */
587
+ isEncodingSupported(codec: VideoCodec): boolean;
588
+ /**
589
+ * Given a set of encoder configurations,
590
+ * returns the closest supported configurations by the platform encoders.
591
+ *
592
+ * @param width The width of the video.
593
+ * @param height The height of the video.
594
+ * @param frameRate The frame rate of the video in frames per second.
595
+ * @param bitRate The bit rate of the video in bits per second.
596
+ * @param codec The codec the export will encode with, defaulting to `h264`.
597
+ * Pass the same value here and to {@link ExportOptions.codec}: the sizes and
598
+ * frame rates an H.264 encoder accepts say nothing about what the HEVC one on
599
+ * the same chip will take. A codec the device cannot encode falls back to
600
+ * `h264`, as an export would.
601
+ */
602
+ getValidEncoderConfigurations(width: number, height: number, frameRate: number, bitRate: number, codec?: VideoCodec): {
603
+ /**
604
+ * The name of the encoder.
605
+ * can be reused in the `exportVideoComposition` method.
606
+ */
607
+ encoderName: string;
608
+ /**
609
+ * Wether the encoder supports hardware acceleration.
610
+ */
611
+ hardwareAccelerated: boolean;
612
+ /**
613
+ * The width of the video.
614
+ */
615
+ width: number;
616
+ /**
617
+ * The height of the video.
618
+ */
619
+ height: number;
620
+ /**
621
+ * The frame rate of the video in frames per second.
622
+ */
623
+ frameRate: number;
624
+ /**
625
+ * The bit rate of the video in bits per second.
626
+ */
627
+ bitRate: number;
628
+ }[] | null;
629
+ };
630
+ export {};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
1
+ declare const useEventListener: <TEvent extends string, Thandler>(emitter: {
2
+ on(event: TEvent, callback: Thandler): () => void;
3
+ } | null, eventName: TEvent, handler: any, isCurrent?: () => boolean) => void;
4
+ export default useEventListener;
5
+ //# sourceMappingURL=useEventListener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEventListener.d.ts","sourceRoot":"","sources":["../../../../src/utils/useEventListener.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,gBAAgB,GAAI,MAAM,SAAS,MAAM,EAAE,QAAQ,EACvD,SAAS;IAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAA;CAAE,GAAG,IAAI,EACrE,WAAW,MAAM,EACjB,SAAS,GAAG,EACZ,YAAY,MAAM,OAAO,SAa1B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}