react-native-skia 3.0.4 → 3.0.5

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 (204) hide show
  1. package/android/CMakeLists.txt +0 -2
  2. package/android/cpp/jni/JniPlatformContext.cpp +0 -24
  3. package/android/cpp/jni/include/JniPlatformContext.h +0 -2
  4. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +0 -140
  5. package/android/src/main/java/com/reactnative/skia/PlatformContext.java +0 -5
  6. package/apple/RNSkApplePlatformContext.h +0 -10
  7. package/apple/RNSkApplePlatformContext.mm +0 -182
  8. package/cpp/api/JsiGPUTexture.h +48 -0
  9. package/cpp/api/JsiSkApi.h +1 -16
  10. package/cpp/api/JsiSkImage.h +0 -12
  11. package/cpp/api/JsiSkImageFactory.h +36 -57
  12. package/cpp/api/JsiSkSurface.h +3 -10
  13. package/cpp/api/JsiSkSurfaceFactory.h +13 -18
  14. package/cpp/rnskia/RNDawnContext.h +5 -113
  15. package/cpp/rnskia/RNDawnUtils.h +33 -0
  16. package/cpp/rnskia/RNSkPlatformContext.h +0 -54
  17. package/lib/commonjs/external/reanimated/index.d.ts +0 -1
  18. package/lib/commonjs/external/reanimated/index.js +0 -11
  19. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  20. package/lib/commonjs/mock/index.js +1 -2
  21. package/lib/commonjs/mock/index.js.map +1 -1
  22. package/lib/commonjs/skia/types/GPUTexture.d.ts +11 -0
  23. package/lib/commonjs/skia/types/GPUTexture.js +2 -0
  24. package/lib/commonjs/skia/types/GPUTexture.js.map +1 -0
  25. package/lib/commonjs/skia/types/Image/Image.d.ts +0 -10
  26. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  27. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +25 -48
  28. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  29. package/lib/commonjs/skia/types/Skia.d.ts +0 -4
  30. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  31. package/lib/commonjs/skia/types/Surface/Surface.d.ts +3 -14
  32. package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
  33. package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +10 -9
  34. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  35. package/lib/commonjs/skia/types/index.d.ts +1 -2
  36. package/lib/commonjs/skia/types/index.js +11 -22
  37. package/lib/commonjs/skia/types/index.js.map +1 -1
  38. package/lib/commonjs/skia/web/JsiSkImage.d.ts +0 -1
  39. package/lib/commonjs/skia/web/JsiSkImage.js +0 -4
  40. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  41. package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +4 -5
  42. package/lib/commonjs/skia/web/JsiSkImageFactory.js +6 -10
  43. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  44. package/lib/commonjs/skia/web/JsiSkSurface.d.ts +0 -1
  45. package/lib/commonjs/skia/web/JsiSkSurface.js +0 -4
  46. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  47. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -2
  48. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +1 -1
  49. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  50. package/lib/commonjs/skia/web/JsiSkia.js +0 -4
  51. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  52. package/lib/module/external/reanimated/index.d.ts +0 -1
  53. package/lib/module/external/reanimated/index.js +0 -1
  54. package/lib/module/external/reanimated/index.js.map +1 -1
  55. package/lib/module/mock/index.js +1 -2
  56. package/lib/module/mock/index.js.map +1 -1
  57. package/lib/module/skia/types/GPUTexture.d.ts +11 -0
  58. package/lib/module/skia/types/GPUTexture.js +2 -0
  59. package/lib/module/skia/types/GPUTexture.js.map +1 -0
  60. package/lib/module/skia/types/Image/Image.d.ts +0 -10
  61. package/lib/module/skia/types/Image/Image.js.map +1 -1
  62. package/lib/module/skia/types/Image/ImageFactory.d.ts +25 -48
  63. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  64. package/lib/module/skia/types/Skia.d.ts +0 -4
  65. package/lib/module/skia/types/Skia.js.map +1 -1
  66. package/lib/module/skia/types/Surface/Surface.d.ts +3 -14
  67. package/lib/module/skia/types/Surface/Surface.js.map +1 -1
  68. package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +10 -9
  69. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  70. package/lib/module/skia/types/index.d.ts +1 -2
  71. package/lib/module/skia/types/index.js +1 -2
  72. package/lib/module/skia/types/index.js.map +1 -1
  73. package/lib/module/skia/web/JsiSkImage.d.ts +0 -1
  74. package/lib/module/skia/web/JsiSkImage.js +0 -4
  75. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  76. package/lib/module/skia/web/JsiSkImageFactory.d.ts +4 -5
  77. package/lib/module/skia/web/JsiSkImageFactory.js +6 -10
  78. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  79. package/lib/module/skia/web/JsiSkSurface.d.ts +0 -1
  80. package/lib/module/skia/web/JsiSkSurface.js +0 -4
  81. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  82. package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -2
  83. package/lib/module/skia/web/JsiSkSurfaceFactory.js +1 -1
  84. package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  85. package/lib/module/skia/web/JsiSkia.js +0 -4
  86. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  87. package/lib/typescript/src/external/reanimated/index.d.ts +0 -1
  88. package/lib/typescript/src/skia/types/GPUTexture.d.ts +11 -0
  89. package/lib/typescript/src/skia/types/Image/Image.d.ts +0 -10
  90. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +25 -48
  91. package/lib/typescript/src/skia/types/Skia.d.ts +0 -4
  92. package/lib/typescript/src/skia/types/Surface/Surface.d.ts +3 -14
  93. package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +10 -9
  94. package/lib/typescript/src/skia/types/index.d.ts +1 -2
  95. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +0 -1
  96. package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +4 -5
  97. package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +0 -1
  98. package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -2
  99. package/package.json +1 -1
  100. package/src/external/reanimated/index.ts +0 -1
  101. package/src/mock/index.ts +0 -1
  102. package/src/skia/types/GPUTexture.ts +9 -0
  103. package/src/skia/types/Image/Image.ts +0 -11
  104. package/src/skia/types/Image/ImageFactory.ts +25 -55
  105. package/src/skia/types/Skia.ts +0 -4
  106. package/src/skia/types/Surface/Surface.ts +3 -15
  107. package/src/skia/types/Surface/SurfaceFactory.ts +11 -9
  108. package/src/skia/types/index.ts +1 -2
  109. package/src/skia/web/JsiSkImage.ts +0 -5
  110. package/src/skia/web/JsiSkImageFactory.ts +16 -16
  111. package/src/skia/web/JsiSkSurface.ts +0 -5
  112. package/src/skia/web/JsiSkSurfaceFactory.ts +2 -2
  113. package/src/skia/web/JsiSkia.ts +0 -4
  114. package/android/cpp/rnskia-android/AHardwareBufferUtils.cpp +0 -31
  115. package/android/cpp/rnskia-android/AHardwareBufferUtils.h +0 -13
  116. package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +0 -200
  117. package/android/cpp/rnskia-android/RNSkAndroidVideo.h +0 -44
  118. package/android/src/main/java/com/reactnative/skia/RNSkVideo.java +0 -320
  119. package/apple/RNSkAppleVideo.h +0 -78
  120. package/apple/RNSkAppleVideo.mm +0 -292
  121. package/cpp/api/JsiNativeBuffer.h +0 -56
  122. package/cpp/api/JsiTextureInfo.h +0 -53
  123. package/cpp/api/JsiVideo.h +0 -101
  124. package/cpp/rnskia/RNSkVideo.h +0 -31
  125. package/lib/commonjs/external/reanimated/useVideo.d.ts +0 -21
  126. package/lib/commonjs/external/reanimated/useVideo.js +0 -150
  127. package/lib/commonjs/external/reanimated/useVideo.js.map +0 -1
  128. package/lib/commonjs/external/reanimated/useVideoLoading.d.ts +0 -4
  129. package/lib/commonjs/external/reanimated/useVideoLoading.js +0 -40
  130. package/lib/commonjs/external/reanimated/useVideoLoading.js.map +0 -1
  131. package/lib/commonjs/external/reanimated/useVideoLoading.web.d.ts +0 -4
  132. package/lib/commonjs/external/reanimated/useVideoLoading.web.js +0 -20
  133. package/lib/commonjs/external/reanimated/useVideoLoading.web.js.map +0 -1
  134. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +0 -29
  135. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js +0 -15
  136. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +0 -1
  137. package/lib/commonjs/skia/types/NativeBuffer/index.d.ts +0 -1
  138. package/lib/commonjs/skia/types/NativeBuffer/index.js +0 -17
  139. package/lib/commonjs/skia/types/NativeBuffer/index.js.map +0 -1
  140. package/lib/commonjs/skia/types/Video/Video.d.ts +0 -20
  141. package/lib/commonjs/skia/types/Video/Video.js +0 -6
  142. package/lib/commonjs/skia/types/Video/Video.js.map +0 -1
  143. package/lib/commonjs/skia/types/Video/index.d.ts +0 -1
  144. package/lib/commonjs/skia/types/Video/index.js +0 -17
  145. package/lib/commonjs/skia/types/Video/index.js.map +0 -1
  146. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.d.ts +0 -9
  147. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.js +0 -30
  148. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.js.map +0 -1
  149. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.d.ts +0 -9
  150. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js +0 -48
  151. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js.map +0 -1
  152. package/lib/commonjs/skia/web/JsiVideo.d.ts +0 -28
  153. package/lib/commonjs/skia/web/JsiVideo.js +0 -96
  154. package/lib/commonjs/skia/web/JsiVideo.js.map +0 -1
  155. package/lib/module/external/reanimated/useVideo.d.ts +0 -21
  156. package/lib/module/external/reanimated/useVideo.js +0 -142
  157. package/lib/module/external/reanimated/useVideo.js.map +0 -1
  158. package/lib/module/external/reanimated/useVideoLoading.d.ts +0 -4
  159. package/lib/module/external/reanimated/useVideoLoading.js +0 -33
  160. package/lib/module/external/reanimated/useVideoLoading.js.map +0 -1
  161. package/lib/module/external/reanimated/useVideoLoading.web.d.ts +0 -4
  162. package/lib/module/external/reanimated/useVideoLoading.web.js +0 -13
  163. package/lib/module/external/reanimated/useVideoLoading.web.js.map +0 -1
  164. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +0 -29
  165. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js +0 -5
  166. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +0 -1
  167. package/lib/module/skia/types/NativeBuffer/index.d.ts +0 -1
  168. package/lib/module/skia/types/NativeBuffer/index.js +0 -2
  169. package/lib/module/skia/types/NativeBuffer/index.js.map +0 -1
  170. package/lib/module/skia/types/Video/Video.d.ts +0 -20
  171. package/lib/module/skia/types/Video/Video.js +0 -2
  172. package/lib/module/skia/types/Video/Video.js.map +0 -1
  173. package/lib/module/skia/types/Video/index.d.ts +0 -1
  174. package/lib/module/skia/types/Video/index.js +0 -2
  175. package/lib/module/skia/types/Video/index.js.map +0 -1
  176. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.d.ts +0 -9
  177. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js +0 -23
  178. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js.map +0 -1
  179. package/lib/module/skia/web/JsiSkNativeBufferFactory.d.ts +0 -9
  180. package/lib/module/skia/web/JsiSkNativeBufferFactory.js +0 -41
  181. package/lib/module/skia/web/JsiSkNativeBufferFactory.js.map +0 -1
  182. package/lib/module/skia/web/JsiVideo.d.ts +0 -28
  183. package/lib/module/skia/web/JsiVideo.js +0 -88
  184. package/lib/module/skia/web/JsiVideo.js.map +0 -1
  185. package/lib/typescript/src/external/reanimated/useVideo.d.ts +0 -21
  186. package/lib/typescript/src/external/reanimated/useVideoLoading.d.ts +0 -4
  187. package/lib/typescript/src/external/reanimated/useVideoLoading.web.d.ts +0 -4
  188. package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +0 -29
  189. package/lib/typescript/src/skia/types/NativeBuffer/index.d.ts +0 -1
  190. package/lib/typescript/src/skia/types/Video/Video.d.ts +0 -20
  191. package/lib/typescript/src/skia/types/Video/index.d.ts +0 -1
  192. package/lib/typescript/src/skia/web/CanvasKitWebGLBufferImpl.d.ts +0 -9
  193. package/lib/typescript/src/skia/web/JsiSkNativeBufferFactory.d.ts +0 -9
  194. package/lib/typescript/src/skia/web/JsiVideo.d.ts +0 -28
  195. package/src/external/reanimated/useVideo.ts +0 -161
  196. package/src/external/reanimated/useVideoLoading.ts +0 -39
  197. package/src/external/reanimated/useVideoLoading.web.ts +0 -17
  198. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +0 -52
  199. package/src/skia/types/NativeBuffer/index.ts +0 -1
  200. package/src/skia/types/Video/Video.ts +0 -19
  201. package/src/skia/types/Video/index.ts +0 -1
  202. package/src/skia/web/CanvasKitWebGLBufferImpl.ts +0 -25
  203. package/src/skia/web/JsiSkNativeBufferFactory.ts +0 -51
  204. package/src/skia/web/JsiVideo.ts +0 -113
@@ -1,96 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createVideo = exports.JsiVideo = void 0;
7
- var _CanvasKitWebGLBufferImpl = require("./CanvasKitWebGLBufferImpl");
8
- var _JsiSkImageFactory = require("./JsiSkImageFactory");
9
- var _Host = require("./Host");
10
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
11
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
12
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
- const createVideo = async (CanvasKit, url) => {
14
- const video = document.createElement("video");
15
- return new Promise((resolve, reject) => {
16
- video.src = url;
17
- video.style.display = "none";
18
- video.crossOrigin = "anonymous";
19
- video.volume = 0;
20
- video.addEventListener("loadedmetadata", () => {
21
- document.body.appendChild(video);
22
- resolve(new JsiVideo(new _JsiSkImageFactory.JsiSkImageFactory(CanvasKit), video));
23
- });
24
- video.addEventListener("error", () => {
25
- reject(new Error(`Failed to load video from URL: ${url}`));
26
- });
27
- });
28
- };
29
- exports.createVideo = createVideo;
30
- class JsiVideo {
31
- constructor(ImageFactory, videoElement) {
32
- this.ImageFactory = ImageFactory;
33
- this.videoElement = videoElement;
34
- _defineProperty(this, "__typename__", "Video");
35
- _defineProperty(this, "webglBuffer", null);
36
- document.body.appendChild(this.videoElement);
37
- }
38
- duration() {
39
- return this.videoElement.duration * 1000;
40
- }
41
- framerate() {
42
- return (0, _Host.throwNotImplementedOnRNWeb)();
43
- }
44
- currentTime() {
45
- return this.videoElement.currentTime * 1000;
46
- }
47
- setSurface(surface) {
48
- // If we have the surface, we can use the WebGL buffer which is slightly faster
49
- // This is because WebGL cannot be shared across contextes.
50
- // This can be removed with WebGPU
51
- this.webglBuffer = new _CanvasKitWebGLBufferImpl.CanvasKitWebGLBufferImpl(surface, this.videoElement);
52
- }
53
- nextImage() {
54
- return this.ImageFactory.MakeImageFromNativeBuffer(this.webglBuffer ? this.webglBuffer : this.videoElement);
55
- }
56
- seek(time) {
57
- if (isNaN(time)) {
58
- throw new Error(`Invalid time: ${time}`);
59
- }
60
- this.videoElement.currentTime = time / 1000;
61
- }
62
- rotation() {
63
- return 0;
64
- }
65
- size() {
66
- return {
67
- width: this.videoElement.videoWidth,
68
- height: this.videoElement.videoHeight
69
- };
70
- }
71
- pause() {
72
- this.videoElement.pause();
73
- }
74
- play() {
75
- this.videoElement.play();
76
- }
77
- setVolume(volume) {
78
- this.videoElement.volume = volume;
79
- }
80
- setLooping(looping) {
81
- this.videoElement.loop = looping;
82
- }
83
- isPlaying() {
84
- return !this.videoElement.paused && !this.videoElement.ended;
85
- }
86
- [Symbol.dispose]() {
87
- if (this.videoElement.parentNode) {
88
- this.videoElement.parentNode.removeChild(this.videoElement);
89
- }
90
- }
91
- dispose() {
92
- this[Symbol.dispose]();
93
- }
94
- }
95
- exports.JsiVideo = JsiVideo;
96
- //# sourceMappingURL=JsiVideo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_CanvasKitWebGLBufferImpl","require","_JsiSkImageFactory","_Host","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","createVideo","CanvasKit","url","video","document","createElement","Promise","resolve","reject","src","style","display","crossOrigin","volume","addEventListener","body","appendChild","JsiVideo","JsiSkImageFactory","Error","exports","constructor","ImageFactory","videoElement","duration","framerate","throwNotImplementedOnRNWeb","currentTime","setSurface","surface","webglBuffer","CanvasKitWebGLBufferImpl","nextImage","MakeImageFromNativeBuffer","seek","time","isNaN","rotation","size","width","videoWidth","height","videoHeight","pause","play","setVolume","setLooping","looping","loop","isPlaying","paused","ended","dispose","parentNode","removeChild"],"sources":["JsiVideo.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { CanvasKitWebGLBuffer, Video, ImageFactory } from \"../types\";\n\nimport { CanvasKitWebGLBufferImpl } from \"./CanvasKitWebGLBufferImpl\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { throwNotImplementedOnRNWeb } from \"./Host\";\n\nexport const createVideo = async (\n CanvasKit: CanvasKit,\n url: string\n): Promise<Video> => {\n const video = document.createElement(\"video\");\n return new Promise((resolve, reject) => {\n video.src = url;\n video.style.display = \"none\";\n video.crossOrigin = \"anonymous\";\n video.volume = 0;\n video.addEventListener(\"loadedmetadata\", () => {\n document.body.appendChild(video);\n resolve(new JsiVideo(new JsiSkImageFactory(CanvasKit), video));\n });\n video.addEventListener(\"error\", () => {\n reject(new Error(`Failed to load video from URL: ${url}`));\n });\n });\n};\n\nexport class JsiVideo implements Video {\n __typename__ = \"Video\" as const;\n\n private webglBuffer: CanvasKitWebGLBuffer | null = null;\n\n constructor(\n private ImageFactory: ImageFactory,\n private videoElement: HTMLVideoElement\n ) {\n document.body.appendChild(this.videoElement);\n }\n\n duration() {\n return this.videoElement.duration * 1000;\n }\n\n framerate(): number {\n return throwNotImplementedOnRNWeb<number>();\n }\n\n currentTime() {\n return this.videoElement.currentTime * 1000;\n }\n\n setSurface(surface: Surface) {\n // If we have the surface, we can use the WebGL buffer which is slightly faster\n // This is because WebGL cannot be shared across contextes.\n // This can be removed with WebGPU\n this.webglBuffer = new CanvasKitWebGLBufferImpl(surface, this.videoElement);\n }\n\n nextImage() {\n return this.ImageFactory.MakeImageFromNativeBuffer(\n this.webglBuffer ? this.webglBuffer : this.videoElement\n );\n }\n\n seek(time: number) {\n if (isNaN(time)) {\n throw new Error(`Invalid time: ${time}`);\n }\n this.videoElement.currentTime = time / 1000;\n }\n\n rotation() {\n return 0 as const;\n }\n\n size() {\n return {\n width: this.videoElement.videoWidth,\n height: this.videoElement.videoHeight,\n };\n }\n\n pause() {\n this.videoElement.pause();\n }\n\n play() {\n this.videoElement.play();\n }\n\n setVolume(volume: number) {\n this.videoElement.volume = volume;\n }\n\n setLooping(looping: boolean) {\n this.videoElement.loop = looping;\n }\n\n isPlaying() {\n return !this.videoElement.paused && !this.videoElement.ended;\n }\n\n [Symbol.dispose]() {\n if (this.videoElement.parentNode) {\n this.videoElement.parentN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OAAA,CAAAH,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- import type { SharedValue } from "react-native-reanimated";
2
- import type { SkImage } from "../../skia/types";
3
- type MaybeAnimated<T> = SharedValue<T> | T;
4
- interface PlaybackOptions {
5
- looping: MaybeAnimated<boolean>;
6
- paused: MaybeAnimated<boolean>;
7
- seek: MaybeAnimated<number | null>;
8
- volume: MaybeAnimated<number>;
9
- }
10
- export declare const useVideo: (source: string | null, userOptions?: Partial<PlaybackOptions>) => {
11
- currentFrame: SharedValue<SkImage | null>;
12
- currentTime: SharedValue<number>;
13
- duration: number;
14
- framerate: number;
15
- rotation: import("../../skia/types").VideoRotation;
16
- size: {
17
- width: number;
18
- height: number;
19
- };
20
- };
21
- export {};
@@ -1,142 +0,0 @@
1
- import { useEffect, useMemo } from "react";
2
- import { Platform } from "../../Platform";
3
- import Rea from "./ReanimatedProxy";
4
- import { useVideoLoading } from "./useVideoLoading";
5
- const copyFrameOnAndroid = currentFrame => {
6
- "worklet";
7
-
8
- // on android we need to copy the texture before it's invalidated
9
- if (Platform.OS === "android") {
10
- const tex = currentFrame.value;
11
- if (tex) {
12
- const copy = tex.makeNonTextureImage();
13
- if (copy) {
14
- currentFrame.value = copy;
15
- tex.dispose();
16
- }
17
- // If copy fails, keep the original frame rather than showing black
18
- }
19
- }
20
- };
21
- const setFrame = (video, currentFrame) => {
22
- "worklet";
23
-
24
- const img = video.nextImage();
25
- if (img) {
26
- var _currentFrame$value;
27
- (_currentFrame$value = currentFrame.value) === null || _currentFrame$value === void 0 || _currentFrame$value.dispose();
28
- currentFrame.value = img;
29
- copyFrameOnAndroid(currentFrame);
30
- }
31
- };
32
- const defaultOptions = {
33
- looping: true,
34
- paused: false,
35
- seek: null,
36
- volume: 0
37
- };
38
- const useOption = value => {
39
- "worklet";
40
-
41
- const defaultValue = Rea.useSharedValue(Rea.isSharedValue(value) ? value.value : value);
42
- return Rea.isSharedValue(value) ? value : defaultValue;
43
- };
44
- const disposeVideo = video => {
45
- "worklet";
46
-
47
- video === null || video === void 0 || video.dispose();
48
- };
49
- export const useVideo = (source, userOptions) => {
50
- var _userOptions$paused, _userOptions$looping, _userOptions$seek, _userOptions$volume;
51
- const video = useVideoLoading(source);
52
- const isPaused = useOption((_userOptions$paused = userOptions === null || userOptions === void 0 ? void 0 : userOptions.paused) !== null && _userOptions$paused !== void 0 ? _userOptions$paused : defaultOptions.paused);
53
- const looping = useOption((_userOptions$looping = userOptions === null || userOptions === void 0 ? void 0 : userOptions.looping) !== null && _userOptions$looping !== void 0 ? _userOptions$looping : defaultOptions.looping);
54
- const seek = useOption((_userOptions$seek = userOptions === null || userOptions === void 0 ? void 0 : userOptions.seek) !== null && _userOptions$seek !== void 0 ? _userOptions$seek : defaultOptions.seek);
55
- const volume = useOption((_userOptions$volume = userOptions === null || userOptions === void 0 ? void 0 : userOptions.volume) !== null && _userOptions$volume !== void 0 ? _userOptions$volume : defaultOptions.volume);
56
- const currentFrame = Rea.useSharedValue(null);
57
- const currentTime = Rea.useSharedValue(0);
58
- const duration = useMemo(() => {
59
- var _video$duration;
60
- return (_video$duration = video === null || video === void 0 ? void 0 : video.duration()) !== null && _video$duration !== void 0 ? _video$duration : 0;
61
- }, [video]);
62
- const framerate = useMemo(() => {
63
- var _video$framerate;
64
- return Platform.OS === "web" ? -1 : (_video$framerate = video === null || video === void 0 ? void 0 : video.framerate()) !== null && _video$framerate !== void 0 ? _video$framerate : 0;
65
- }, [video]);
66
- const size = useMemo(() => {
67
- var _video$size;
68
- return (_video$size = video === null || video === void 0 ? void 0 : video.size()) !== null && _video$size !== void 0 ? _video$size : {
69
- width: 0,
70
- height: 0
71
- };
72
- }, [video]);
73
- const rotation = useMemo(() => {
74
- var _video$rotation;
75
- return (_video$rotation = video === null || video === void 0 ? void 0 : video.rotation()) !== null && _video$rotation !== void 0 ? _video$rotation : 0;
76
- }, [video]);
77
-
78
- // Handle pause/play state changes
79
- Rea.useAnimatedReaction(() => isPaused.value, paused => {
80
- if (paused) {
81
- video === null || video === void 0 || video.pause();
82
- } else {
83
- video === null || video === void 0 || video.play();
84
- }
85
- });
86
-
87
- // Handle seek
88
- Rea.useAnimatedReaction(() => seek.value, value => {
89
- if (value !== null) {
90
- video === null || video === void 0 || video.seek(value);
91
- seek.value = null;
92
- }
93
- });
94
-
95
- // Handle volume changes
96
- Rea.useAnimatedReaction(() => volume.value, value => {
97
- video === null || video === void 0 || video.setVolume(value);
98
- });
99
-
100
- // Handle looping changes
101
- Rea.useAnimatedReaction(() => looping.value, value => {
102
- video === null || video === void 0 || video.setLooping(value);
103
- });
104
-
105
- // Frame callback - simplified since native handles frame timing
106
- Rea.useFrameCallback(_frameInfo => {
107
- "worklet";
108
-
109
- if (!video) {
110
- return;
111
- }
112
- // Update current time from native player
113
- currentTime.value = video.currentTime();
114
- // Get the latest frame (native handles timing via CADisplayLink/etc)
115
- setFrame(video, currentFrame);
116
- });
117
-
118
- // Apply initial state when video becomes available
119
- useEffect(() => {
120
- if (video) {
121
- video.setLooping(looping.value);
122
- video.setVolume(volume.value);
123
- if (isPaused.value) {
124
- video.pause();
125
- } else {
126
- video.play();
127
- }
128
- }
129
- return () => {
130
- Rea.runOnUI(disposeVideo)(video);
131
- };
132
- }, [video, isPaused, looping, volume]);
133
- return {
134
- currentFrame,
135
- currentTime,
136
- duration,
137
- framerate,
138
- rotation,
139
- size
140
- };
141
- };
142
- //# sourceMappingURL=useVideo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useEffect","useMemo","Platform","Rea","useVideoLoading","copyFrameOnAndroid","currentFrame","OS","tex","value","copy","makeNonTextureImage","dispose","setFrame","video","img","nextImage","_currentFrame$value","defaultOptions","looping","paused","seek","volume","useOption","defaultValue","useSharedValue","isSharedValue","disposeVideo","useVideo","source","userOptions","_userOptions$paused","_userOptions$looping","_userOptions$seek","_userOptions$volume","isPaused","currentTime","duration","_video$duration","framerate","_video$framerate","size","_video$size","width","height","rotation","_video$rotation","useAnimatedReaction","pause","play","setVolume","setLooping","useFrameCallback","_frameInfo","runOnUI"],"sources":["useVideo.ts"],"sourcesContent":["import type { SharedValue, FrameInfo } from \"react-native-reanimated\";\nimport { useEffect, useMemo } from \"react\";\n\nimport type { SkImage, Video } from \"../../skia/types\";\nimport { Platform } from \"../../Platform\";\n\nimport Rea from \"./ReanimatedProxy\";\nimport { useVideoLoading } from \"./useVideoLoading\";\n\ntype MaybeAnimated<T> = SharedValue<T> | T;\n\ninterface PlaybackOptions {\n looping: MaybeAnimated<boolean>;\n paused: MaybeAnimated<boolean>;\n seek: MaybeAnimated<number | null>;\n volume: MaybeAnimated<number>;\n}\n\nconst copyFrameOnAndroid = (currentFrame: SharedValue<SkImage | null>) => {\n \"worklet\";\n // on android we need to copy the texture before it's invalidated\n if (Platform.OS === \"android\") {\n const tex = currentFrame.value;\n if (tex) {\n const copy = tex.makeNonTextureImage();\n if (copy) {\n currentFrame.value = copy;\n tex.dispose();\n }\n // If copy fails, keep the original frame rather than showing black\n }\n }\n};\n\nconst setFrame = (video: Video, currentFrame: SharedValue<SkImage | null>) => {\n \"worklet\";\n const img = video.nextImage();\n if (img) {\n currentFrame.value?.dispose();\n currentFrame.value = img;\n copyFrameOnAndroid(currentFrame);\n }\n};\n\nconst defaultOptions = {\n looping: true,\n paused: false,\n seek: null,\n volume: 0,\n};\n\nconst useOption = <T>(value: MaybeAnimated<T>) => {\n \"worklet\";\n const defaultValue = Rea.useSharedValue(\n Rea.isSharedValue(value) ? value.value : value\n );\n return Rea.isSharedValue(value)\n ? (value as SharedValue<T>)\n : (defaultValue as SharedValue<T>);\n};\n\nconst disposeVideo = (video: Video | null) => {\n \"worklet\";\n video?.dispose();\n};\n\nexport const useVideo = (\n source: string | null,\n userOptions?: Partial<PlaybackOptions>\n) => {\n const video = useVideoLoading(source);\n const isPaused = useOption(userOptions?.paused ?? defaultOptions.paused);\n const looping = useOption(userOptions?.looping ?? defaultOptions.looping);\n const seek = useOption(userOptions?.seek ?? defaultOptions.seek);\n const volume = useOption(userOptions?.volume ?? defaultOptions.volume);\n const currentFrame = Rea.useSharedValue<null | SkImage>(null);\n const currentTime = Rea.useSharedValue(0);\n const duration = useMemo(() => video?.duration() ?? 0, [video]);\n const framerate = useMemo(\n () => (Platform.OS === \"web\" ? -1 : (video?.framerate() ?? 0)),\n [video]\n );\n const size = useMemo(() => video?.size() ?? { width: 0, height: 0 }, [video]);\n const rotation = useMemo(() => video?.rotation() ?? 0, [video]);\n\n // Handle pause/play state changes\n Rea.useAnimatedReaction(\n () => isPaused.value,\n (paused) => {\n if (paused) {\n video?.pause();\n } else {\n video?.play();\n }\n }\n );\n\n // Handle seek\n Rea.useAnimatedReaction(\n () => seek.value,\n (value) => {\n if (value !== null) {\n video?.seek(value);\n seek.value = null;\n }\n }\n );\n\n // Handle volume changes\n Rea.useAnimatedReaction(\n () => volume.value,\n (value) => {\n video?.setVolume(value);\n }\n );\n\n // Handle looping changes\n Rea.useAnimatedReaction(\n () => looping.value,\n (value) => {\n video?.setLooping(value);\n }\n );\n\n // Frame callback - simplified since native handles frame timing\n Rea.useFrameCallback((_frameInfo: FrameInfo) => {\n \"worklet\";\n if (!video) {\n return;\n }\n // Update current time from native player\n currentTime.value = video.currentTime();\n // Get the latest frame (native handles timing via CADisplayLink/etc)\n setFrame(video, currentFrame);\n });\n\n // Apply initial state when video becomes available\n useEffect(() => {\n if (video) {\n video.setLooping(looping.value);\n video.setVolume(volume.value);\n if (isPaused.value) {\n video.pause();\n } else {\n video.play();\n }\n }\n return () => {\n Rea.runOnUI(disposeVideo)(video);\n };\n }, [video, isPaused, looping, volume]);\n\n return {\n currentFrame,\n currentTime,\n duration,\n framerate,\n rotation,\n size,\n };\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAG1C,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,OAAOC,GAAG,MAAM,mBAAmB;AACnC,SAASC,eAAe,QAAQ,mBAAmB;AAWnD,MAAMC,kBAAkB,G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IACRJ;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import type { Video } from "../../skia/types";
2
- type VideoSource = string | null;
3
- export declare const useVideoLoading: (source: VideoSource) => Video | null;
4
- export {};
@@ -1,33 +0,0 @@
1
- import { useCallback, useEffect, useState } from "react";
2
- import { Skia } from "../../skia";
3
- import Rea from "./ReanimatedProxy";
4
-
5
- // Created lazily: accessing the proxy at module scope would require
6
- // react-native-reanimated as soon as the package is imported, and would spawn
7
- // the runtime even for apps that never load a video.
8
- let runtime;
9
- const getRuntime = () => {
10
- if (runtime === undefined) {
11
- runtime = Rea.createWorkletRuntime("video-metadata-runtime");
12
- }
13
- return runtime;
14
- };
15
- export const useVideoLoading = source => {
16
- const {
17
- runOnJS
18
- } = Rea;
19
- const [video, setVideo] = useState(null);
20
- const cb = useCallback(src => {
21
- "worklet";
22
-
23
- const vid = Skia.Video(src);
24
- runOnJS(setVideo)(vid);
25
- }, [runOnJS]);
26
- useEffect(() => {
27
- if (source) {
28
- Rea.runOnRuntime(getRuntime(), cb)(source);
29
- }
30
- }, [cb, source]);
31
- return video;
32
- };
33
- //# sourceMappingURL=useVideoLoading.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useCallback","useEffect","useState","Skia","Rea","runtime","getRuntime","undefined","createWorkletRuntime","useVideoLoading","source","runOnJS","video","setVideo","cb","src","vid","Video","runOnRuntime"],"sources":["useVideoLoading.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from \"react\";\nimport type { WorkletRuntime } from \"react-native-reanimated\";\n\nimport type { Video } from \"../../skia/types\";\nimport { Skia } from \"../../skia\";\n\nimport Rea from \"./ReanimatedProxy\";\n\n// Created lazily: accessing the proxy at module scope would require\n// react-native-reanimated as soon as the package is imported, and would spawn\n// the runtime even for apps that never load a video.\nlet runtime: WorkletRuntime | undefined;\nconst getRuntime = () => {\n if (runtime === undefined) {\n runtime = Rea.createWorkletRuntime(\"video-metadata-runtime\");\n }\n return runtime;\n};\n\ntype VideoSource = string | null;\n\nexport const useVideoLoading = (source: VideoSource) => {\n const { runOnJS } = Rea;\n const [video, setVideo] = useState<Video | null>(null);\n const cb = useCallback(\n (src: string) => {\n \"worklet\";\n const vid = Skia.Video(src) as Video;\n runOnJS(setVideo)(vid);\n },\n [runOnJS]\n );\n useEffect(() => {\n if (source) {\n Rea.runOnRuntime(getRuntime(), cb)(source);\n }\n }, [cb, source]);\n return video;\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAIxD,SAASC,IAAI,QAAQ,YAAY;AAEjC,OAAOC,GAAG,MAAM,mBAAmB;;AAEnC;AACA;AACA;AACA,IAAIC,OAAmC;AACvC,MAAMC,UAAU,GAAGA,CAAA,KAAM;EACvB,IAAID,OAAO,KAAKE,SAAS,EAAE;IACzBF,OAAO,GAAGD,GAAG,CAACI,oBAAoB,CAAC,wBAAwB,CAAC;EAC9D;EACA,OAAOH,OAAO;AAChB,CAAC;AAID,OAAO,MAAMI,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAM;IAAEC;EAAQ,CAAC,GAAGP,GAAG;EACvB,MAAM,CAACQ,KAAK,EAAEC,QAAQ,CAAC,GAAGX,QAAQ,CAAe,IAAI,CAAC;EACtD,MAAMY,EAAE,GAAGd,WAAW,CACnBe,GAAW,IAAK;IACf,SAAS;;IACT,MAAMC,GAAG,GAAGb,IAAI,CAACc,KAAK,CAACF,GAAG,CAAU;IACpCJ,OAAO,CAACE,QAAQ,CAAC,CAACG,GAAG,CAAC;EACxB,CAAC,EACD,CAACL,OAAO,CACV,CAAC;EACDV,SAAS,CAAC,MAAM;IACd,IAAIS,MAAM,EAAE;MACVN,GAAG,CAACc,YAAY,CAACZ,UAAU,CAAC,CAAC,EAAEQ,EAAE,CAAC,CAACJ,MAAM,CAAC;IAC5C;EACF,CAAC,EAAE,CAACI,EAAE,EAAEJ,MAAM,CAAC,CAAC;EAChB,OAAOE,KAAK;AACd,CAAC","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import type { Video } from "../../skia/types";
2
- type VideoSource = string | null;
3
- export declare const useVideoLoading: (source: VideoSource) => Video | null;
4
- export {};
@@ -1,13 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { Skia } from "../../skia";
3
- export const useVideoLoading = source => {
4
- const [video, setVideo] = useState(null);
5
- useEffect(() => {
6
- if (source) {
7
- const vid = Skia.Video(source);
8
- vid.then(v => setVideo(v));
9
- }
10
- }, [source]);
11
- return video;
12
- };
13
- //# sourceMappingURL=useVideoLoading.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useEffect","useState","Skia","useVideoLoading","source","video","setVideo","vid","Video","then","v"],"sources":["useVideoLoading.web.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport type { Video } from \"../../skia/types\";\nimport { Skia } from \"../../skia\";\n\ntype VideoSource = string | null;\n\nexport const useVideoLoading = (source: VideoSource) => {\n const [video, setVideo] = useState<Video | null>(null);\n useEffect(() => {\n if (source) {\n const vid = Skia.Video(source) as Promise<Video>;\n vid.then((v) => setVideo(v));\n }\n }, [source]);\n return video;\n};\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAG3C,SAASC,IAAI,QAAQ,YAAY;AAIjC,OAAO,MAAMC,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGL,QAAQ,CAAe,IAAI,CAAC;EACtDD,SAAS,CAAC,MAAM;IACd,IAAII,MAAM,EAAE;MACV,MAAMG,GAAG,GAAGL,IAAI,CAACM,KAAK,CAACJ,MAAM,CAAmB;MAChDG,GAAG,CAACE,IAAI,CAAEC,CAAC,IAAKJ,QAAQ,CAACI,CAAC,CAAC,CAAC;IAC9B;EACF,CAAC,EAAE,CAACN,MAAM,CAAC,CAAC;EACZ,OAAOC,KAAK;AACd,CAAC","ignoreList":[]}
@@ -1,29 +0,0 @@
1
- import type { SkImage } from "../Image";
2
- export declare abstract class CanvasKitWebGLBuffer {
3
- }
4
- export type NativeBuffer<T extends bigint | ArrayBuffer | CanvasImageSource | CanvasKitWebGLBuffer | unknown = unknown> = T;
5
- export type NativeBufferAddr = NativeBuffer<bigint>;
6
- export type NativeBufferWeb = NativeBuffer<CanvasImageSource>;
7
- export type NativeBufferNode = NativeBuffer<ArrayBuffer>;
8
- export declare const isNativeBufferAddr: (buffer: NativeBuffer) => buffer is NativeBufferAddr;
9
- export declare const isNativeBufferWeb: (buffer: NativeBuffer) => buffer is NativeBufferWeb;
10
- export declare const isNativeBufferNode: (buffer: NativeBuffer) => buffer is NativeBufferNode;
11
- export interface NativeBufferFactory {
12
- /**
13
- * Copy pixels to a native buffer.
14
- */
15
- MakeFromImage: (image: SkImage) => NativeBuffer;
16
- /**
17
- * Create a native buffer of the given size filled with a procedural test
18
- * pattern (RGB gradient + diagonal stripes), entirely on the CPU. Useful for
19
- * examples and tests that need a buffer to feed into
20
- * `GPUDevice.importExternalTexture` without a camera/video source. Release it
21
- * with `Release`.
22
- */
23
- MakeTestBuffer: (width: number, height: number) => NativeBuffer;
24
- /**
25
- * Release a native buffer that was created with `MakeFromImage` or
26
- * `MakeTestBuffer`.
27
- */
28
- Release: (nativeBuffer: NativeBuffer) => void;
29
- }
@@ -1,5 +0,0 @@
1
- export class CanvasKitWebGLBuffer {}
2
- export const isNativeBufferAddr = buffer => buffer instanceof BigInt;
3
- export const isNativeBufferWeb = buffer => buffer instanceof HTMLVideoElement || buffer instanceof HTMLCanvasElement || buffer instanceof ImageBitmap || buffer instanceof OffscreenCanvas || typeof VideoFrame !== "undefined" && buffer instanceof VideoFrame || buffer instanceof HTMLImageElement || buffer instanceof SVGImageElement || buffer instanceof CanvasKitWebGLBuffer;
4
- export const isNativeBufferNode = buffer => buffer instanceof ArrayBuffer;
5
- //# sourceMappingURL=NativeBufferFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["CanvasKitWebGLBuffer","isNativeBufferAddr","buffer","BigInt","isNativeBufferWeb","HTMLVideoElement","HTMLCanvasElement","ImageBitmap","OffscreenCanvas","VideoFrame","HTMLImageElement","SVGImageElement","isNativeBufferNode","ArrayBuffer"],"sources":["NativeBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport abstract class CanvasKitWebGLBuffer {}\n\nexport type NativeBuffer<\n T extends\n bigint | ArrayBuffer | CanvasImageSource | CanvasKitWebGLBuffer | unknown =\n unknown,\n> = T;\n\nexport type NativeBufferAddr = NativeBuffer<bigint>;\nexport type NativeBufferWeb = NativeBuffer<CanvasImageSource>;\nexport type NativeBufferNode = NativeBuffer<ArrayBuffer>;\n\nexport const isNativeBufferAddr = (\n buffer: NativeBuffer\n): buffer is NativeBufferAddr => buffer instanceof BigInt;\nexport const isNativeBufferWeb = (\n buffer: NativeBuffer\n): buffer is NativeBufferWeb =>\n buffer instanceof HTMLVideoElement ||\n buffer instanceof HTMLCanvasElement ||\n buffer instanceof ImageBitmap ||\n buffer instanceof OffscreenCanvas ||\n (typeof VideoFrame !== \"undefined\" && buffer instanceof VideoFrame) ||\n buffer instanceof HTMLImageElement ||\n buffer instanceof SVGImageElement ||\n buffer instanceof CanvasKitWebGLBuffer;\n\nexport const isNativeBufferNode = (\n buffer: NativeBuffer\n): buffer is NativeBufferNode => buffer instanceof ArrayBuffer;\n\nexport interface NativeBufferFactory {\n /**\n * Copy pixels to a native buffer.\n */\n MakeFromImage: (image: SkImage) => NativeBuffer;\n /**\n * Create a native buffer of the given size filled with a procedural test\n * pattern (RGB gradient + diagonal stripes), entirely on the CPU. Useful for\n * examples and tests that need a buffer to feed into\n * `GPUDevice.importExternalTexture` without a camera/video source. Release it\n * with `Release`.\n */\n MakeTestBuffer: (width: number, height: number) => NativeBuffer;\n /**\n * Release a native buffer that was created with `MakeFromImage` or\n * `MakeTestBuffer`.\n */\n Release: (nativeBuffer: NativeBuffer) => void;\n}\n"],"mappings":"AAEA,OAAO,MAAeA,oBAAoB,CAAC;AAY3C,OAAO,MAAMC,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AACzD,OAAO,MAAMC,iBAAiB,GAC5BF,MAAoB,IAEpBA,MAAM,YAAYG,gBAAgB,IAClCH,MAAM,YAAYI,iBAAiB,IACnCJ,MAAM,YAAYK,WAAW,IAC7BL,MAAM,YAAYM,eAAe,IAChC,OAAOC,UAAU,KAAK,WAAW,IAAIP,MAAM,YAAYO,UAAW,IACnEP,MAAM,YAAYQ,gBAAgB,IAClCR,MAAM,YAAYS,eAAe,IACjCT,MAAM,YAAYF,oBAAoB;AAExC,OAAO,MAAMY,kBAAkB,GAC7BV,MAAoB,IACWA,MAAM,YAAYW,WAAW","ignoreList":[]}
@@ -1 +0,0 @@
1
- export * from "./NativeBufferFactory";
@@ -1,2 +0,0 @@
1
- export * from "./NativeBufferFactory";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./NativeBufferFactory\";\n"],"mappings":"AAAA,cAAc,uBAAuB","ignoreList":[]}
@@ -1,20 +0,0 @@
1
- import type { SkImage } from "../Image";
2
- import type { SkJSIInstance } from "../JsiInstance";
3
- export type VideoRotation = 0 | 90 | 180 | 270;
4
- export interface Video extends SkJSIInstance<"Video"> {
5
- duration(): number;
6
- framerate(): number;
7
- currentTime(): number;
8
- nextImage(): SkImage | null;
9
- seek(time: number): void;
10
- rotation(): VideoRotation;
11
- size(): {
12
- width: number;
13
- height: number;
14
- };
15
- pause(): void;
16
- play(): void;
17
- setVolume(volume: number): void;
18
- setLooping(looping: boolean): void;
19
- isPlaying(): boolean;
20
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Video.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["Video.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\nexport type VideoRotation = 0 | 90 | 180 | 270;\n\nexport interface Video extends SkJSIInstance<\"Video\"> {\n duration(): number;\n framerate(): number;\n currentTime(): number;\n nextImage(): SkImage | null;\n seek(time: number): void;\n rotation(): VideoRotation;\n size(): { width: number; height: number };\n pause(): void;\n play(): void;\n setVolume(volume: number): void;\n setLooping(looping: boolean): void;\n isPlaying(): boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- export * from "./Video";
@@ -1,2 +0,0 @@
1
- export * from "./Video";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Video\";\n"],"mappings":"AAAA,cAAc,SAAS","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import type { Surface, TextureSource, Image } from "canvaskit-wasm";
2
- import { CanvasKitWebGLBuffer } from "../types";
3
- export declare class CanvasKitWebGLBufferImpl extends CanvasKitWebGLBuffer {
4
- surface: Surface;
5
- private source;
6
- image: Image | null;
7
- constructor(surface: Surface, source: TextureSource);
8
- toImage(): Image;
9
- }
@@ -1,23 +0,0 @@
1
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
- import { CanvasKitWebGLBuffer } from "../types";
5
- export class CanvasKitWebGLBufferImpl extends CanvasKitWebGLBuffer {
6
- constructor(surface, source) {
7
- super();
8
- this.surface = surface;
9
- this.source = source;
10
- _defineProperty(this, "image", null);
11
- }
12
- toImage() {
13
- if (this.image === null) {
14
- this.image = this.surface.makeImageFromTextureSource(this.source);
15
- }
16
- if (this.image === null) {
17
- throw new Error("Failed to create image from texture source");
18
- }
19
- this.surface.updateTextureFromSource(this.image, this.source);
20
- return this.image;
21
- }
22
- }
23
- //# sourceMappingURL=CanvasKitWebGLBufferImpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["CanvasKitWebGLBuffer","CanvasKitWebGLBufferImpl","constructor","surface","source","_defineProperty","toImage","image","makeImageFromTextureSource","Error","updateTextureFromSource"],"sources":["CanvasKitWebGLBufferImpl.ts"],"sourcesContent":["import type { Surface, TextureSource, Image } from \"canvaskit-wasm\";\n\nimport { CanvasKitWebGLBuffer } from \"../types\";\n\nexport class CanvasKitWebGLBufferImpl extends CanvasKitWebGLBuffer {\n public image: Image | null = null;\n\n constructor(\n public surface: Surface,\n private source: TextureSource\n ) {\n super();\n }\n\n toImage() {\n if (this.image === null) {\n this.image = this.surface.makeImageFromTextureSource(this.source);\n }\n if (this.image === null) {\n throw new Error(\"Failed to create image from texture source\");\n }\n this.surface.updateTextureFromSource(this.image, this.source);\n return this.image;\n }\n}\n"],"mappings":";;;AAEA,SAASA,oBAAoB,QAAQ,UAAU;AAE/C,OAAO,MAAMC,wBAAwB,SAASD,oBAAoB,CAAC;EAGjEE,WAAWA,CACFC,OAAgB,EACfC,MAAqB,EAC7B;IACA,KAAK,CAAC,CAAC;IAAC,KAHDD,OAAgB,GAAhBA,OAAgB;IAAA,KACfC,MAAqB,GAArBA,MAAqB;IAAAC,eAAA,gBAJF,IAAI;EAOjC;EAEAC,OAAOA,CAAA,EAAG;IACR,IAAI,IAAI,CAACC,KAAK,KAAK,IAAI,EAAE;MACvB,IAAI,CAACA,KAAK,GAAG,IAAI,CAACJ,OAAO,CAACK,0BAA0B,CAAC,IAAI,CAACJ,MAAM,CAAC;IACnE;IACA,IAAI,IAAI,CAACG,KAAK,KAAK,IAAI,EAAE;MACvB,MAAM,IAAIE,KAAK,CAAC,4CAA4C,CAAC;IAC/D;IACA,IAAI,CAACN,OAAO,CAACO,uBAAuB,CAAC,IAAI,CAACH,KAAK,EAAE,IAAI,CAACH,MAAM,CAAC;IAC7D,OAAO,IAAI,CAACG,KAAK;EACnB;AACF","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import type { CanvasKit } from "canvaskit-wasm";
2
- import type { NativeBuffer, NativeBufferFactory, SkImage } from "../types";
3
- import { Host } from "./Host";
4
- export declare class JsiSkNativeBufferFactory extends Host implements NativeBufferFactory {
5
- constructor(CanvasKit: CanvasKit);
6
- MakeFromImage(image: SkImage): NativeBuffer;
7
- MakeTestBuffer(width: number, height: number): NativeBuffer;
8
- Release(_nativeBuffer: NativeBuffer): void;
9
- }
@@ -1,41 +0,0 @@
1
- import { Host } from "./Host";
2
- export class JsiSkNativeBufferFactory extends Host {
3
- constructor(CanvasKit) {
4
- super(CanvasKit);
5
- }
6
- MakeFromImage(image) {
7
- const info = image.getImageInfo();
8
- const uint8ClampedArray = new Uint8ClampedArray(image.readPixels());
9
- const imageData = new ImageData(uint8ClampedArray, info.width, info.height);
10
- const canvas = new OffscreenCanvas(info.width, info.height);
11
- const ctx = canvas.getContext("2d");
12
- if (!ctx) {
13
- throw new Error("Failed to get 2d context from canvas");
14
- }
15
- ctx.putImageData(imageData, 0, 0);
16
- return canvas;
17
- }
18
- MakeTestBuffer(width, height) {
19
- const pixels = new Uint8ClampedArray(width * height * 4);
20
- for (let y = 0; y < height; y++) {
21
- for (let x = 0; x < width; x++) {
22
- const i = (y * width + x) * 4;
23
- pixels[i + 0] = Math.floor(x * 255 / Math.max(width - 1, 1));
24
- pixels[i + 1] = Math.floor(y * 255 / Math.max(height - 1, 1));
25
- pixels[i + 2] = x + y & 0x20 ? 220 : 30;
26
- pixels[i + 3] = 0xff;
27
- }
28
- }
29
- const canvas = new OffscreenCanvas(width, height);
30
- const ctx = canvas.getContext("2d");
31
- if (!ctx) {
32
- throw new Error("Failed to get 2d context from canvas");
33
- }
34
- ctx.putImageData(new ImageData(pixels, width, height), 0, 0);
35
- return canvas;
36
- }
37
- Release(_nativeBuffer) {
38
- // it's a noop on Web
39
- }
40
- }
41
- //# sourceMappingURL=JsiSkNativeBufferFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Host","JsiSkNativeBufferFactory","constructor","CanvasKit","MakeFromImage","image","info","getImageInfo","uint8ClampedArray","Uint8ClampedArray","readPixels","imageData","ImageData","width","height","canvas","OffscreenCanvas","ctx","getContext","Error","putImageData","MakeTestBuffer","pixels","y","x","i","Math","floor","max","Release","_nativeBuffer"],"sources":["JsiSkNativeBufferFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { NativeBuffer, NativeBufferFactory, SkImage } from \"../types\";\n\nimport { Host } from \"./Host\";\n\nexport class JsiSkNativeBufferFactory\n extends Host\n implements NativeBufferFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromImage(image: SkImage): NativeBuffer {\n const info = image.getImageInfo();\n const uint8ClampedArray = new Uint8ClampedArray(image.readPixels()!);\n const imageData = new ImageData(uint8ClampedArray, info.width, info.height);\n const canvas = new OffscreenCanvas(info.width, info.height);\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) {\n throw new Error(\"Failed to get 2d context from canvas\");\n }\n ctx.putImageData(imageData, 0, 0);\n return canvas;\n }\n\n MakeTestBuffer(width: number, height: number): NativeBuffer {\n const pixels = new Uint8ClampedArray(width * height * 4);\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const i = (y * width + x) * 4;\n pixels[i + 0] = Math.floor((x * 255) / Math.max(width - 1, 1));\n pixels[i + 1] = Math.floor((y * 255) / Math.max(height - 1, 1));\n pixels[i + 2] = (x + y) & 0x20 ? 220 : 30;\n pixels[i + 3] = 0xff;\n }\n }\n const canvas = new OffscreenCanvas(width, height);\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) {\n throw new Error(\"Failed to get 2d context from canvas\");\n }\n ctx.putImageData(new ImageData(pixels, width, height), 0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,CAAC;QAC7BF,MAAM,CAACG,CAAC,GAAG,CAAC,CAAC,GAAGC,IAAI,CAACC,KAAK,CAAEH,CAAC,GAAG,GAAG,GAAIE,IAAI,CAACE,GAAG,CAACf,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9DS,MAAM,CAACG,CAAC,GAAG,CAAC,CAAC,GAAGC,IAAI,CAACC,KAAK,CAAEJ,CAAC,GAAG,GAAG,GAAIG,IAAI,CAACE,GAAG,CAACd,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/DQ,MAAM,CAACG,CAAC,GAAG,CAAC,CAAC,GAAID,CAAC,GAAGD,CAAC,GAAI,IAAI,GAAG,GAAG,GAAG,EAAE;QACzCD,MAAM,CAACG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI;MACtB;IACF;IACA,MAAMV,MAAM,GAAG,IAAIC,eAAe,CAACH,KAAK,EAAEC,MAAM,CAAC;IACjD,MAAMG,GAAG,GAAGF,MAAM,CAACG,UAAU,CAAC,IAAI,CAAC;IACnC,IAAI,CAACD,GAAG,EAAE;MACR,MAAM,IAAIE,KAAK,CAAC,sCAAsC,CAAC;IACzD;IACAF,GAAG,CAACG,YAAY,CAAC,IAAIR,SAAS,CAACU,MAAM,EAAET,KAAK,EAAEC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5D,OAAOC,MAAM;EACf;EAEAc,OAAOA,CAACC,aAA2B,EAAE;IACnC;EAAA;AAEJ","ignoreList":[]}
@@ -1,28 +0,0 @@
1
- import type { CanvasKit, Surface } from "canvaskit-wasm";
2
- import type { Video, ImageFactory } from "../types";
3
- export declare const createVideo: (CanvasKit: CanvasKit, url: string) => Promise<Video>;
4
- export declare class JsiVideo implements Video {
5
- private ImageFactory;
6
- private videoElement;
7
- __typename__: "Video";
8
- private webglBuffer;
9
- constructor(ImageFactory: ImageFactory, videoElement: HTMLVideoElement);
10
- duration(): number;
11
- framerate(): number;
12
- currentTime(): number;
13
- setSurface(surface: Surface): void;
14
- nextImage(): import("../types").SkImage;
15
- seek(time: number): void;
16
- rotation(): 0;
17
- size(): {
18
- width: number;
19
- height: number;
20
- };
21
- pause(): void;
22
- play(): void;
23
- setVolume(volume: number): void;
24
- setLooping(looping: boolean): void;
25
- isPlaying(): boolean;
26
- [Symbol.dispose](): void;
27
- dispose(): void;
28
- }