@shopify/react-native-skia 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. package/android/cpp/jni/JniPlatformContext.cpp +4 -3
  2. package/lib/commonjs/external/reanimated/useVideo.js +22 -9
  3. package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
  4. package/lib/commonjs/external/reanimated/useVideoLoading.d.ts +4 -0
  5. package/lib/commonjs/external/reanimated/useVideoLoading.js +27 -0
  6. package/lib/commonjs/external/reanimated/useVideoLoading.js.map +1 -0
  7. package/lib/commonjs/external/reanimated/useVideoLoading.web.d.ts +4 -0
  8. package/lib/commonjs/external/reanimated/useVideoLoading.web.js +20 -0
  9. package/lib/commonjs/external/reanimated/useVideoLoading.web.js.map +1 -0
  10. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +3 -1
  11. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js +4 -2
  12. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  13. package/lib/commonjs/skia/types/Skia.d.ts +1 -1
  14. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  15. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.d.ts +9 -0
  16. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.js +30 -0
  17. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -0
  18. package/lib/commonjs/skia/web/JsiSkImageFactory.js +8 -2
  19. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  20. package/lib/commonjs/skia/web/JsiSkia.js +2 -3
  21. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  22. package/lib/commonjs/skia/web/JsiVideo.d.ts +24 -0
  23. package/lib/commonjs/skia/web/JsiVideo.js +83 -0
  24. package/lib/commonjs/skia/web/JsiVideo.js.map +1 -0
  25. package/lib/commonjs/views/SkiaDomView.js +2 -0
  26. package/lib/commonjs/views/SkiaDomView.js.map +1 -1
  27. package/lib/commonjs/views/SkiaDomView.web.js +2 -0
  28. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  29. package/lib/commonjs/views/SkiaJSDomView.js +2 -0
  30. package/lib/commonjs/views/SkiaJSDomView.js.map +1 -1
  31. package/lib/module/external/reanimated/useVideo.js +22 -9
  32. package/lib/module/external/reanimated/useVideo.js.map +1 -1
  33. package/lib/module/external/reanimated/useVideoLoading.d.ts +4 -0
  34. package/lib/module/external/reanimated/useVideoLoading.js +20 -0
  35. package/lib/module/external/reanimated/useVideoLoading.js.map +1 -0
  36. package/lib/module/external/reanimated/useVideoLoading.web.d.ts +4 -0
  37. package/lib/module/external/reanimated/useVideoLoading.web.js +13 -0
  38. package/lib/module/external/reanimated/useVideoLoading.web.js.map +1 -0
  39. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +3 -1
  40. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js +2 -1
  41. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  42. package/lib/module/skia/types/Skia.d.ts +1 -1
  43. package/lib/module/skia/types/Skia.js.map +1 -1
  44. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.d.ts +9 -0
  45. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js +23 -0
  46. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -0
  47. package/lib/module/skia/web/JsiSkImageFactory.js +9 -3
  48. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  49. package/lib/module/skia/web/JsiSkia.js +2 -3
  50. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  51. package/lib/module/skia/web/JsiVideo.d.ts +24 -0
  52. package/lib/module/skia/web/JsiVideo.js +75 -0
  53. package/lib/module/skia/web/JsiVideo.js.map +1 -0
  54. package/lib/module/views/SkiaDomView.js +2 -0
  55. package/lib/module/views/SkiaDomView.js.map +1 -1
  56. package/lib/module/views/SkiaDomView.web.js +2 -0
  57. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  58. package/lib/module/views/SkiaJSDomView.js +2 -0
  59. package/lib/module/views/SkiaJSDomView.js.map +1 -1
  60. package/lib/typescript/src/external/reanimated/useVideoLoading.d.ts +4 -0
  61. package/lib/typescript/src/external/reanimated/useVideoLoading.web.d.ts +4 -0
  62. package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +3 -1
  63. package/lib/typescript/src/skia/types/Skia.d.ts +1 -1
  64. package/lib/typescript/src/skia/web/CanvasKitWebGLBufferImpl.d.ts +9 -0
  65. package/lib/typescript/src/skia/web/JsiVideo.d.ts +24 -0
  66. package/package.json +1 -1
  67. package/src/external/reanimated/useVideo.ts +25 -9
  68. package/src/external/reanimated/useVideoLoading.ts +28 -0
  69. package/src/external/reanimated/useVideoLoading.web.ts +17 -0
  70. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +10 -2
  71. package/src/skia/types/Skia.ts +1 -1
  72. package/src/skia/web/CanvasKitWebGLBufferImpl.ts +22 -0
  73. package/src/skia/web/JsiSkImageFactory.ts +16 -3
  74. package/src/skia/web/JsiSkia.ts +2 -3
  75. package/src/skia/web/JsiVideo.ts +96 -0
  76. package/src/views/SkiaDomView.tsx +4 -0
  77. package/src/views/SkiaDomView.web.tsx +4 -0
  78. package/src/views/SkiaJSDomView.tsx +4 -0
@@ -77,6 +77,8 @@ TSelf JniPlatformContext::initHybrid(jni::alias_ref<jhybridobject> jThis,
77
77
 
78
78
  jni::global_ref<jobject>
79
79
  JniPlatformContext::createVideo(const std::string &url) {
80
+ jni::Environment::ensureCurrentThreadIsAttached();
81
+
80
82
  jni::ThreadScope ts; // Manages JNI thread attachment/detachment
81
83
 
82
84
  // Get the JNI environment
@@ -85,14 +87,13 @@ JniPlatformContext::createVideo(const std::string &url) {
85
87
  // Convert std::string to jstring
86
88
  jstring jUrl = env->NewStringUTF(url.c_str());
87
89
 
88
- // Get the method ID for the createVideo method
89
- // Replace "Lcom/yourpackage/RNSkVideo;" with the actual return type
90
- // descriptor
91
90
  static auto method =
92
91
  javaPart_->getClass()->getMethod<jobject(jstring)>("createVideo");
93
92
 
94
93
  // Call the method and receive a local reference to the video object
95
94
  auto videoObject = method(javaPart_.get(), jUrl);
95
+ env->DeleteLocalRef(jUrl);
96
+
96
97
  // Clean up the jstring local reference
97
98
  auto result = jni::make_global(videoObject);
98
99
  return result;
@@ -5,10 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useVideo = void 0;
7
7
  var _react = require("react");
8
- var _Skia = require("../../skia/Skia");
9
8
  var _Platform = require("../../Platform");
10
9
  var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
10
+ var _useVideoLoading = require("./useVideoLoading");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ const copyFrameOnAndroid = currentFrame => {
13
+ "worklet";
14
+
15
+ // on android we need to copy the texture before it's invalidated
16
+ if (_Platform.Platform.OS === "android") {
17
+ const tex = currentFrame.value;
18
+ if (tex) {
19
+ currentFrame.value = tex.makeNonTextureImage();
20
+ tex.dispose();
21
+ }
22
+ }
23
+ };
12
24
  const setFrame = (video, currentFrame) => {
13
25
  "worklet";
14
26
 
@@ -17,11 +29,9 @@ const setFrame = (video, currentFrame) => {
17
29
  if (currentFrame.value) {
18
30
  currentFrame.value.dispose();
19
31
  }
20
- if (_Platform.Platform.OS === "android") {
21
- currentFrame.value = img.makeNonTextureImage();
22
- } else {
23
- currentFrame.value = img;
24
- }
32
+ currentFrame.value = img;
33
+ } else {
34
+ copyFrameOnAndroid(currentFrame);
25
35
  }
26
36
  };
27
37
  const defaultOptions = {
@@ -45,7 +55,7 @@ const disposeVideo = video => {
45
55
  };
46
56
  const useVideo = (source, userOptions) => {
47
57
  var _userOptions$paused, _userOptions$looping, _userOptions$seek, _userOptions$volume;
48
- const video = (0, _react.useMemo)(() => source ? _Skia.Skia.Video(source) : null, [source]);
58
+ const video = (0, _useVideoLoading.useVideoLoading)(source);
49
59
  const isPaused = useOption((_userOptions$paused = userOptions === null || userOptions === void 0 ? void 0 : userOptions.paused) !== null && _userOptions$paused !== void 0 ? _userOptions$paused : defaultOptions.paused);
50
60
  const looping = useOption((_userOptions$looping = userOptions === null || userOptions === void 0 ? void 0 : userOptions.looping) !== null && _userOptions$looping !== void 0 ? _userOptions$looping : defaultOptions.looping);
51
61
  const seek = useOption((_userOptions$seek = userOptions === null || userOptions === void 0 ? void 0 : userOptions.seek) !== null && _userOptions$seek !== void 0 ? _userOptions$seek : defaultOptions.seek);
@@ -59,7 +69,7 @@ const useVideo = (source, userOptions) => {
59
69
  }, [video]);
60
70
  const framerate = (0, _react.useMemo)(() => {
61
71
  var _video$framerate;
62
- return (_video$framerate = video === null || video === void 0 ? void 0 : video.framerate()) !== null && _video$framerate !== void 0 ? _video$framerate : 0;
72
+ return _Platform.Platform.OS === "web" ? -1 : (_video$framerate = video === null || video === void 0 ? void 0 : video.framerate()) !== null && _video$framerate !== void 0 ? _video$framerate : 0;
63
73
  }, [video]);
64
74
  const size = (0, _react.useMemo)(() => {
65
75
  var _video$size;
@@ -84,6 +94,7 @@ const useVideo = (source, userOptions) => {
84
94
  });
85
95
  _ReanimatedProxy.default.useAnimatedReaction(() => seek.value, value => {
86
96
  if (value !== null) {
97
+ copyFrameOnAndroid(currentFrame);
87
98
  video === null || video === void 0 || video.seek(value);
88
99
  currentTime.value = value;
89
100
  seek.value = null;
@@ -112,7 +123,9 @@ const useVideo = (source, userOptions) => {
112
123
  currentTime.value = seek.value;
113
124
  lastTimestamp.value = currentTimestamp;
114
125
  }
115
- if (delta >= currentFrameDuration && !isOver) {
126
+ // On Web the framerate is uknown.
127
+ // This could be optimized by using requestVideoFrameCallback (Chrome only)
128
+ if (delta >= currentFrameDuration && !isOver || _Platform.Platform.OS === "web") {
116
129
  setFrame(video, currentFrame);
117
130
  currentTime.value += delta;
118
131
  lastTimestamp.value = currentTimestamp;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_Skia","_Platform","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","setFrame","video","currentFrame","img","nextImage","value","dispose","Platform","OS","makeNonTextureImage","defaultOptions","looping","paused","seek","currentTime","volume","useOption","defaultValue","Rea","useSharedValue","isSharedValue","disposeVideo","useVideo","source","userOptions","_userOptions$paused","_userOptions$looping","_userOptions$seek","_userOptions$volume","useMemo","Skia","Video","isPaused","lastTimestamp","duration","_video$duration","framerate","_video$framerate","size","_video$size","width","height","rotation","_video$rotation","frameDuration","currentFrameDuration","Math","floor","useAnimatedReaction","pause","play","setVolume","useFrameCallback","frameInfo","currentTimestamp","timestamp","delta","isOver","useEffect","runOnUI","exports"],"sources":["useVideo.ts"],"sourcesContent":["import type { SharedValue, FrameInfo } from \"react-native-reanimated\";\nimport { useEffect, useMemo } from \"react\";\n\nimport { Skia } from \"../../skia/Skia\";\nimport type { SkImage, Video } from \"../../skia/types\";\nimport { Platform } from \"../../Platform\";\n\nimport Rea from \"./ReanimatedProxy\";\n\ntype Animated<T> = SharedValue<T> | T;\n\ninterface PlaybackOptions {\n looping: Animated<boolean>;\n paused: Animated<boolean>;\n seek: Animated<number | null>;\n volume: Animated<number>;\n}\n\nconst setFrame = (video: Video, currentFrame: SharedValue<SkImage | null>) => {\n \"worklet\";\n const img = video.nextImage();\n if (img) {\n if (currentFrame.value) {\n currentFrame.value.dispose();\n }\n if (Platform.OS === \"android\") {\n currentFrame.value = img.makeNonTextureImage();\n } else {\n currentFrame.value = img;\n }\n }\n};\n\nconst defaultOptions = {\n looping: true,\n paused: false,\n seek: null,\n currentTime: 0,\n volume: 0,\n};\n\nconst useOption = <T>(value: Animated<T>) => {\n \"worklet\";\n // TODO: only create defaultValue is needed (via makeMutable)\n const defaultValue = Rea.useSharedValue(\n Rea.isSharedValue(value) ? value.value : value\n );\n return Rea.isSharedValue(value) ? value : defaultValue;\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 = useMemo(() => (source ? Skia.Video(source) : null), [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 lastTimestamp = Rea.useSharedValue(-1);\n const duration = useMemo(() => video?.duration() ?? 0, [video]);\n const framerate = useMemo(() => video?.framerate() ?? 0, [video]);\n const size = useMemo(() => video?.size() ?? { width: 0, height: 0 }, [video]);\n const rotation = useMemo(() => video?.rotation() ?? 0, [video]);\n const frameDuration = 1000 / framerate;\n const currentFrameDuration = Math.floor(frameDuration);\n Rea.useAnimatedReaction(\n () => isPaused.value,\n (paused) => {\n if (paused) {\n video?.pause();\n } else {\n lastTimestamp.value = -1;\n video?.play();\n }\n }\n );\n Rea.useAnimatedReaction(\n () => seek.value,\n (value) => {\n if (value !== null) {\n video?.seek(value);\n currentTime.value = value;\n seek.value = null;\n }\n }\n );\n Rea.useAnimatedReaction(\n () => volume.value,\n (value) => {\n video?.setVolume(value);\n }\n );\n Rea.useFrameCallback((frameInfo: FrameInfo) => {\n \"worklet\";\n if (!video) {\n return;\n }\n if (isPaused.value) {\n return;\n }\n const currentTimestamp = frameInfo.timestamp;\n if (lastTimestamp.value === -1) {\n lastTimestamp.value = currentTimestamp;\n }\n const delta = currentTimestamp - lastTimestamp.value;\n\n const isOver = currentTime.value + delta > duration;\n if (isOver && looping.value) {\n seek.value = 0;\n currentTime.value = seek.value;\n lastTimestamp.value = currentTimestamp;\n }\n if (delta >= currentFrameDuration && !isOver) {\n setFrame(video, currentFrame);\n currentTime.value += delta;\n lastTimestamp.value = currentTimestamp;\n }\n });\n\n useEffect(() => {\n return () => {\n // TODO: should video simply be a shared value instead?\n Rea.runOnUI(disposeVideo)(video);\n };\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a,CAAC5B,KAAK,GAAGiD,gBAAgB;IACxC;IACA,IAAIE,KAAK,IAAIX,oBAAoB,IAAI,CAACY,MAAM,EAAE;MAC5CzD,QAAQ,CAACC,KAAK,EAAEC,YAAY,CAAC;MAC7BY,WAAW,CAACT,KAAK,IAAImD,KAAK;MAC1BvB,aAAa,CAAC5B,KAAK,GAAGiD,gBAAgB;IACxC;EACF,CAAC,CAAC;EAEF,IAAAI,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACX;MACAxC,wBAAG,CAACyC,OAAO,CAACtC,YAAY,CAAC,CAACpB,KAAK,CAAC;IAClC,CAAC;EACH,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,OAAO;IACLC,YAAY;IACZY,WAAW;IACXoB,QAAQ;IACRE,SAAS;IACTM,QAAQ;IACRJ;EACF,CAAC;AACH,CAAC;AAACsB,OAAA,CAAAtC,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["_react","require","_Platform","_ReanimatedProxy","_interopRequireDefault","_useVideoLoading","obj","__esModule","default","copyFrameOnAndroid","currentFrame","Platform","OS","tex","value","makeNonTextureImage","dispose","setFrame","video","img","nextImage","defaultOptions","looping","paused","seek","currentTime","volume","useOption","defaultValue","Rea","useSharedValue","isSharedValue","disposeVideo","useVideo","source","userOptions","_userOptions$paused","_userOptions$looping","_userOptions$seek","_userOptions$volume","useVideoLoading","isPaused","lastTimestamp","duration","useMemo","_video$duration","framerate","_video$framerate","size","_video$size","width","height","rotation","_video$rotation","frameDuration","currentFrameDuration","Math","floor","useAnimatedReaction","pause","play","setVolume","useFrameCallback","frameInfo","currentTimestamp","timestamp","delta","isOver","useEffect","runOnUI","exports"],"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 Animated<T> = SharedValue<T> | T;\n\ninterface PlaybackOptions {\n looping: Animated<boolean>;\n paused: Animated<boolean>;\n seek: Animated<number | null>;\n volume: Animated<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 currentFrame.value = tex.makeNonTextureImage();\n tex.dispose();\n }\n }\n};\n\nconst setFrame = (video: Video, currentFrame: SharedValue<SkImage | null>) => {\n \"worklet\";\n const img = video.nextImage();\n if (img) {\n if (currentFrame.value) {\n currentFrame.value.dispose();\n }\n currentFrame.value = img;\n } else {\n copyFrameOnAndroid(currentFrame);\n }\n};\n\nconst defaultOptions = {\n looping: true,\n paused: false,\n seek: null,\n currentTime: 0,\n volume: 0,\n};\n\nconst useOption = <T>(value: Animated<T>) => {\n \"worklet\";\n // TODO: only create defaultValue is needed (via makeMutable)\n const defaultValue = Rea.useSharedValue(\n Rea.isSharedValue(value) ? value.value : value\n );\n return Rea.isSharedValue(value) ? value : defaultValue;\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 lastTimestamp = Rea.useSharedValue(-1);\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 const frameDuration = 1000 / framerate;\n const currentFrameDuration = Math.floor(frameDuration);\n Rea.useAnimatedReaction(\n () => isPaused.value,\n (paused) => {\n if (paused) {\n video?.pause();\n } else {\n lastTimestamp.value = -1;\n video?.play();\n }\n }\n );\n Rea.useAnimatedReaction(\n () => seek.value,\n (value) => {\n if (value !== null) {\n copyFrameOnAndroid(currentFrame);\n video?.seek(value);\n currentTime.value = value;\n seek.value = null;\n }\n }\n );\n Rea.useAnimatedReaction(\n () => volume.value,\n (value) => {\n video?.setVolume(value);\n }\n );\n Rea.useFrameCallback((frameInfo: FrameInfo) => {\n \"worklet\";\n if (!video) {\n return;\n }\n if (isPaused.value) {\n return;\n }\n const currentTimestamp = frameInfo.timestamp;\n if (lastTimestamp.value === -1) {\n lastTimestamp.value = currentTimestamp;\n }\n const delta = currentTimestamp - lastTimestamp.value;\n\n const isOver = currentTime.value + delta > duration;\n if (isOver && looping.value) {\n seek.value = 0;\n currentTime.value = seek.value;\n lastTimestamp.value = currentTimestamp;\n }\n // On Web the framerate is uknown.\n // This could be optimized by using requestVideoFrameCallback (Chrome only)\n if ((delta >= currentFrameDuration && !isOver) || Platform.OS === \"web\") {\n setFrame(video, currentFrame);\n currentTime.value += delta;\n lastTimestamp.value = currentTimestamp;\n }\n });\n\n useEffect(() => {\n return () => {\n // TODO: should video simply be a shared value instead?\n Rea.runOnUI(disposeVideo)(video);\n };\n }, [video]);\n\n return {\n currentFrame,\n currentTime,\n duration,\n framerate,\n rotation,\n size,\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAAoD,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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BAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;MACvEK,QAAQ,CAACC,KAAK,EAAER,YAAY,CAAC;MAC7Be,WAAW,CAACX,KAAK,IAAIoD,KAAK;MAC1BxB,aAAa,CAAC5B,KAAK,GAAGkD,gBAAgB;IACxC;EACF,CAAC,CAAC;EAEF,IAAAI,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACX;MACAvC,wBAAG,CAACwC,OAAO,CAACrC,YAAY,CAAC,CAACd,KAAK,CAAC;IAClC,CAAC;EACH,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,OAAO;IACLR,YAAY;IACZe,WAAW;IACXkB,QAAQ;IACRG,SAAS;IACTM,QAAQ;IACRJ;EACF,CAAC;AACH,CAAC;AAACsB,OAAA,CAAArC,QAAA,GAAAA,QAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Video } from "../../skia/types";
2
+ type VideoSource = string | null;
3
+ export declare const useVideoLoading: (source: VideoSource) => Video | null;
4
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useVideoLoading = void 0;
7
+ var _react = require("react");
8
+ var _reactNativeReanimated = require("react-native-reanimated");
9
+ var _skia = require("../../skia");
10
+ const runtime = (0, _reactNativeReanimated.createWorkletRuntime)("video-metadata-runtime");
11
+ const useVideoLoading = source => {
12
+ const [video, setVideo] = (0, _react.useState)(null);
13
+ const cb = src => {
14
+ "worklet";
15
+
16
+ const vid = _skia.Skia.Video(src);
17
+ (0, _reactNativeReanimated.runOnJS)(setVideo)(vid);
18
+ };
19
+ (0, _react.useEffect)(() => {
20
+ if (source) {
21
+ (0, _reactNativeReanimated.runOnRuntime)(runtime, cb)(source);
22
+ }
23
+ }, [source]);
24
+ return video;
25
+ };
26
+ exports.useVideoLoading = useVideoLoading;
27
+ //# sourceMappingURL=useVideoLoading.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNativeReanimated","_skia","runtime","createWorkletRuntime","useVideoLoading","source","video","setVideo","useState","cb","src","vid","Skia","Video","runOnJS","useEffect","runOnRuntime","exports"],"sources":["useVideoLoading.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport {\n createWorkletRuntime,\n runOnJS,\n runOnRuntime,\n} from \"react-native-reanimated\";\n\nimport type { Video } from \"../../skia/types\";\nimport { Skia } from \"../../skia\";\n\nconst runtime = createWorkletRuntime(\"video-metadata-runtime\");\n\ntype VideoSource = string | null;\n\nexport const useVideoLoading = (source: VideoSource) => {\n const [video, setVideo] = useState<Video | null>(null);\n const cb = (src: string) => {\n \"worklet\";\n const vid = Skia.Video(src) as Video;\n runOnJS(setVideo)(vid);\n };\n useEffect(() => {\n if (source) {\n runOnRuntime(runtime, cb)(source);\n }\n }, [source]);\n return video;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AAEA,MAAMG,OAAO,GAAG,IAAAC,2CAAoB,EAAC,wBAAwB,CAAC;AAIvD,MAAMC,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAe,IAAI,CAAC;EACtD,MAAMC,EAAE,GAAIC,GAAW,IAAK;IAC1B,SAAS;;IACT,MAAMC,GAAG,GAAGC,UAAI,CAACC,KAAK,CAACH,GAAG,CAAU;IACpC,IAAAI,8BAAO,EAACP,QAAQ,CAAC,CAACI,GAAG,CAAC;EACxB,CAAC;EACD,IAAAI,gBAAS,EAAC,MAAM;IACd,IAAIV,MAAM,EAAE;MACV,IAAAW,mCAAY,EAACd,OAAO,EAAEO,EAAE,CAAC,CAACJ,MAAM,CAAC;IACnC;EACF,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAOC,KAAK;AACd,CAAC;AAACW,OAAA,CAAAb,eAAA,GAAAA,eAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Video } from "../../skia/types";
2
+ type VideoSource = string | null;
3
+ export declare const useVideoLoading: (source: VideoSource) => Video | null;
4
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useVideoLoading = void 0;
7
+ var _react = require("react");
8
+ var _skia = require("../../skia");
9
+ const useVideoLoading = source => {
10
+ const [video, setVideo] = (0, _react.useState)(null);
11
+ (0, _react.useEffect)(() => {
12
+ if (source) {
13
+ const vid = _skia.Skia.Video(source);
14
+ vid.then(v => setVideo(v));
15
+ }
16
+ }, [source]);
17
+ return video;
18
+ };
19
+ exports.useVideoLoading = useVideoLoading;
20
+ //# sourceMappingURL=useVideoLoading.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_skia","useVideoLoading","source","video","setVideo","useState","useEffect","vid","Skia","Video","then","v","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AAIO,MAAME,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAe,IAAI,CAAC;EACtD,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIJ,MAAM,EAAE;MACV,MAAMK,GAAG,GAAGC,UAAI,CAACC,KAAK,CAACP,MAAM,CAAmB;MAChDK,GAAG,CAACG,IAAI,CAAEC,CAAC,IAAKP,QAAQ,CAACO,CAAC,CAAC,CAAC;IAC9B;EACF,CAAC,EAAE,CAACT,MAAM,CAAC,CAAC;EACZ,OAAOC,KAAK;AACd,CAAC;AAACS,OAAA,CAAAX,eAAA,GAAAA,eAAA"}
@@ -1,5 +1,7 @@
1
1
  import type { SkImage } from "../Image";
2
- export type NativeBuffer<T extends bigint | ArrayBuffer | CanvasImageSource | unknown = unknown> = T;
2
+ export declare abstract class CanvasKitWebGLBuffer {
3
+ }
4
+ export type NativeBuffer<T extends bigint | ArrayBuffer | CanvasImageSource | CanvasKitWebGLBuffer | unknown = unknown> = T;
3
5
  export type NativeBufferAddr = NativeBuffer<bigint>;
4
6
  export type NativeBufferWeb = NativeBuffer<CanvasImageSource>;
5
7
  export type NativeBufferNode = NativeBuffer<ArrayBuffer>;
@@ -3,10 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isNativeBufferWeb = exports.isNativeBufferNode = exports.isNativeBufferAddr = void 0;
6
+ exports.isNativeBufferWeb = exports.isNativeBufferNode = exports.isNativeBufferAddr = exports.CanvasKitWebGLBuffer = void 0;
7
+ class CanvasKitWebGLBuffer {}
8
+ exports.CanvasKitWebGLBuffer = CanvasKitWebGLBuffer;
7
9
  const isNativeBufferAddr = buffer => buffer instanceof BigInt;
8
10
  exports.isNativeBufferAddr = isNativeBufferAddr;
9
- const isNativeBufferWeb = buffer => buffer instanceof HTMLVideoElement || buffer instanceof HTMLCanvasElement || buffer instanceof ImageBitmap || buffer instanceof OffscreenCanvas || buffer instanceof VideoFrame || buffer instanceof HTMLImageElement || buffer instanceof SVGImageElement;
11
+ const isNativeBufferWeb = buffer => buffer instanceof HTMLVideoElement || buffer instanceof HTMLCanvasElement || buffer instanceof ImageBitmap || buffer instanceof OffscreenCanvas || buffer instanceof VideoFrame || buffer instanceof HTMLImageElement || buffer instanceof SVGImageElement || buffer instanceof CanvasKitWebGLBuffer;
10
12
  exports.isNativeBufferWeb = isNativeBufferWeb;
11
13
  const isNativeBufferNode = buffer => buffer instanceof ArrayBuffer;
12
14
  exports.isNativeBufferNode = isNativeBufferNode;
@@ -1 +1 @@
1
- {"version":3,"names":["isNativeBufferAddr","buffer","BigInt","exports","isNativeBufferWeb","HTMLVideoElement","HTMLCanvasElement","ImageBitmap","OffscreenCanvas","VideoFrame","HTMLImageElement","SVGImageElement","isNativeBufferNode","ArrayBuffer"],"sources":["NativeBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport type NativeBuffer<\n T extends bigint | ArrayBuffer | CanvasImageSource | unknown = 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 buffer instanceof VideoFrame ||\n buffer instanceof HTMLImageElement ||\n buffer instanceof SVGImageElement;\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 * Release a native buffer that was created with `MakeFromImage`.\n */\n Release: (nativeBuffer: NativeBuffer) => void;\n}\n"],"mappings":";;;;;;AAUO,MAAMA,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AAACC,OAAA,CAAAH,kBAAA,GAAAA,kBAAA;AACnD,MAAMI,iBAAiB,GAC5BH,MAAoB,IAEpBA,MAAM,YAAYI,gBAAgB,IAClCJ,MAAM,YAAYK,iBAAiB,IACnCL,MAAM,YAAYM,WAAW,IAC7BN,MAAM,YAAYO,eAAe,IACjCP,MAAM,YAAYQ,UAAU,IAC5BR,MAAM,YAAYS,gBAAgB,IAClCT,MAAM,YAAYU,eAAe;AAACR,OAAA,CAAAC,iBAAA,GAAAA,iBAAA;AAE7B,MAAMQ,kBAAkB,GAC7BX,MAAoB,IACWA,MAAM,YAAYY,WAAW;AAACV,OAAA,CAAAS,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["CanvasKitWebGLBuffer","exports","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\n | ArrayBuffer\n | CanvasImageSource\n | CanvasKitWebGLBuffer\n | unknown = 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 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 * Release a native buffer that was created with `MakeFromImage`.\n */\n Release: (nativeBuffer: NativeBuffer) => void;\n}\n"],"mappings":";;;;;;AAEO,MAAeA,oBAAoB,CAAC;AAAEC,OAAA,CAAAD,oBAAA,GAAAA,oBAAA;AAetC,MAAME,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AAACH,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AACnD,MAAMG,iBAAiB,GAC5BF,MAAoB,IAEpBA,MAAM,YAAYG,gBAAgB,IAClCH,MAAM,YAAYI,iBAAiB,IACnCJ,MAAM,YAAYK,WAAW,IAC7BL,MAAM,YAAYM,eAAe,IACjCN,MAAM,YAAYO,UAAU,IAC5BP,MAAM,YAAYQ,gBAAgB,IAClCR,MAAM,YAAYS,eAAe,IACjCT,MAAM,YAAYH,oBAAoB;AAACC,OAAA,CAAAI,iBAAA,GAAAA,iBAAA;AAElC,MAAMQ,kBAAkB,GAC7BV,MAAoB,IACWA,MAAM,YAAYW,WAAW;AAACb,OAAA,CAAAY,kBAAA,GAAAA,kBAAA"}
@@ -73,6 +73,6 @@ export interface Skia {
73
73
  TextBlob: TextBlobFactory;
74
74
  Surface: SurfaceFactory;
75
75
  ParagraphBuilder: ParagraphBuilderFactory;
76
- Video: (url: string) => Video;
76
+ Video: (url: string) => Promise<Video> | Video;
77
77
  NativeBuffer: NativeBufferFactory;
78
78
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\nimport type { Video } from \"./Video\";\nimport type { NativeBufferFactory } from \"./NativeBuffer\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n ParagraphBuilder: ParagraphBuilderFactory;\n Video: (url: string) => Video;\n NativeBuffer: NativeBufferFactory;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\nimport type { Video } from \"./Video\";\nimport type { NativeBufferFactory } from \"./NativeBuffer\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n ParagraphBuilder: ParagraphBuilderFactory;\n Video: (url: string) => Promise<Video> | Video;\n NativeBuffer: NativeBufferFactory;\n}\n"],"mappings":""}
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CanvasKitWebGLBufferImpl = void 0;
7
+ var _types = require("../types");
8
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
10
+ 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); }
11
+ class CanvasKitWebGLBufferImpl extends _types.CanvasKitWebGLBuffer {
12
+ constructor(surface, source) {
13
+ super();
14
+ this.surface = surface;
15
+ this.source = source;
16
+ _defineProperty(this, "image", null);
17
+ }
18
+ toImage() {
19
+ if (this.image === null) {
20
+ this.image = this.surface.makeImageFromTextureSource(this.source);
21
+ }
22
+ if (this.image === null) {
23
+ throw new Error("Failed to create image from texture source");
24
+ }
25
+ this.surface.updateTextureFromSource(this.image, this.source);
26
+ return this.image;
27
+ }
28
+ }
29
+ exports.CanvasKitWebGLBufferImpl = CanvasKitWebGLBufferImpl;
30
+ //# sourceMappingURL=CanvasKitWebGLBufferImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_types","require","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","CanvasKitWebGLBufferImpl","CanvasKitWebGLBuffer","constructor","surface","source","toImage","image","makeImageFromTextureSource","Error","updateTextureFromSource","exports"],"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(public surface: Surface, private source: TextureSource) {\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,IAAAA,MAAA,GAAAC,OAAA;AAAgD,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,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 class JsiSkImageFactory extends _Host.Host {
23
23
  throw new Error("Invalid NativeBuffer");
24
24
  }
25
25
  if (!surface) {
26
- // TODO: this is way to slow
27
- const img = this.CanvasKit.MakeImageFromCanvasImageSource(buffer);
26
+ let img;
27
+ if (buffer instanceof HTMLImageElement || buffer instanceof HTMLVideoElement || buffer instanceof ImageBitmap) {
28
+ img = this.CanvasKit.MakeLazyImageFromTextureSource(buffer);
29
+ } else if (buffer instanceof _types.CanvasKitWebGLBuffer) {
30
+ img = buffer.toImage();
31
+ } else {
32
+ img = this.CanvasKit.MakeImageFromCanvasImageSource(buffer);
33
+ }
28
34
  return new _JsiSkImage.JsiSkImage(this.CanvasKit, img);
29
35
  } else if (!image) {
30
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_Host","_JsiSkImage","_JsiSkData","JsiSkImageFactory","Host","constructor","CanvasKit","MakeImageFromViewTag","viewTag","view","console","log","Promise","resolve","MakeImageFromNativeBuffer","buffer","surface","image","isNativeBufferWeb","Error","img","MakeImageFromCanvasImageSource","JsiSkImage","makeImageFromTextureSource","updateTextureFromSource","MakeImageFromEncoded","encoded","JsiSkData","fromValue","MakeImage","info","data","bytesPerRow","alphaType","getEnum","AlphaType","colorSpace","ColorSpace","SRGB","colorType","ColorType","height","width","exports"],"sources":["JsiSkImageFactory.ts"],"sourcesContent":["import type { CanvasKit, Image } from \"canvaskit-wasm\";\n\nimport { isNativeBufferWeb } from \"../types\";\nimport type {\n SkData,\n ImageInfo,\n SkImage,\n NativeBuffer,\n ImageFactory,\n} from \"../types\";\n\nimport { Host, getEnum } from \"./Host\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkData } from \"./JsiSkData\";\nimport type { JsiSkSurface } from \"./JsiSkSurface\";\n\nexport class JsiSkImageFactory extends Host implements ImageFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeImageFromViewTag(viewTag: number): Promise<SkImage | null> {\n const view = viewTag as unknown as HTMLElement;\n // TODO: Implement screenshot from view in React JS\n console.log(view);\n return Promise.resolve(null);\n }\n\n MakeImageFromNativeBuffer(\n buffer: NativeBuffer,\n surface?: JsiSkSurface,\n image?: JsiSkImage\n ) {\n if (!isNativeBufferWeb(buffer)) {\n throw new Error(\"Invalid NativeBuffer\");\n }\n if (!surface) {\n // TODO: this is way to slow\n const img = this.CanvasKit.MakeImageFromCanvasImageSource(buffer);\n return new JsiSkImage(this.CanvasKit, img);\n } else if (!image) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).makeImageFromTextureSource(buffer) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).updateTextureFromSource(\n image,\n buffer\n ) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n }\n }\n\n MakeImageFromEncoded(encoded: SkData) {\n const image = this.CanvasKit.MakeImageFromEncoded(\n JsiSkData.fromValue(encoded)\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number) {\n // see toSkImageInfo() from canvaskit\n const image = this.CanvasKit.MakeImage(\n {\n alphaType: getEnum(this.CanvasKit.AlphaType, info.alphaType),\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n colorType: getEnum(this.CanvasKit.ColorType, info.colorType),\n height: info.height,\n width: info.width,\n },\n JsiSkData.fromValue(data),\n bytesPerRow\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AASA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAGO,MAAMI,iBAAiB,SAASC,UAAI,CAAyB;EAClEC,WAAWA,CAACC,SAAoB,EAAE;IAChC,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,IAAe,EAAEC,IAAY,EAAEC,WAAmB,EAAE;IAC5D;IACA,MAAMf,KAAK,GAAG,IAAI,CAACX,SAAS,CAACuB,SAAS,CACpC;MACEI,SAAS,EAAE,IAAAC,aAAO,EAAC,IAAI,CAAC5B,SAAS,CAAC6B,SAAS,EAAEL,IAAI,CAACG,SAAS,CAAC;MAC5DG,UAAU,EAAE,IAAI,CAAC9B,SAAS,CAAC+B,UAAU,CAACC,IAAI;MAC1CC,SAAS,EAAE,IAAAL,aAAO,EAAC,IAAI,CAAC5B,SAAS,CAACkC,SAAS,EAAEV,IAAI,CAACS,SAAS,CAAC;MAC5DE,MAAM,EAAEX,IAAI,CAACW,MAAM;MACnBC,KAAK,EAAEZ,IAAI,CAACY;IACd,CAAC,EACDf,oBAAS,CAACC,SAAS,CAACG,IAAI,CAAC,EACzBC,WACF,CAAC;IACD,IAAIf,KAAK,KAAK,IAAI,EAAE;MAClB,OAAO,IAAI;IACb;IACA,OAAO,IAAIK,sBAAU,CAAC,IAAI,CAAChB,SAAS,EAAEW,KAAK,CAAC;EAC9C;AACF;AAAC0B,OAAA,CAAAxC,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"names":["_types","require","_Host","_JsiSkImage","_JsiSkData","JsiSkImageFactory","Host","constructor","CanvasKit","MakeImageFromViewTag","viewTag","view","console","log","Promise","resolve","MakeImageFromNativeBuffer","buffer","surface","image","isNativeBufferWeb","Error","img","HTMLImageElement","HTMLVideoElement","ImageBitmap","MakeLazyImageFromTextureSource","CanvasKitWebGLBuffer","toImage","MakeImageFromCanvasImageSource","JsiSkImage","makeImageFromTextureSource","updateTextureFromSource","MakeImageFromEncoded","encoded","JsiSkData","fromValue","MakeImage","info","data","bytesPerRow","alphaType","getEnum","AlphaType","colorSpace","ColorSpace","SRGB","colorType","ColorType","height","width","exports"],"sources":["JsiSkImageFactory.ts"],"sourcesContent":["import type { CanvasKit, Image } from \"canvaskit-wasm\";\n\nimport { CanvasKitWebGLBuffer, isNativeBufferWeb } from \"../types\";\nimport type {\n SkData,\n ImageInfo,\n SkImage,\n NativeBuffer,\n ImageFactory,\n} from \"../types\";\n\nimport { Host, getEnum } from \"./Host\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkData } from \"./JsiSkData\";\nimport type { JsiSkSurface } from \"./JsiSkSurface\";\nimport type { CanvasKitWebGLBufferImpl } from \"./CanvasKitWebGLBufferImpl\";\n\nexport class JsiSkImageFactory extends Host implements ImageFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeImageFromViewTag(viewTag: number): Promise<SkImage | null> {\n const view = viewTag as unknown as HTMLElement;\n // TODO: Implement screenshot from view in React JS\n console.log(view);\n return Promise.resolve(null);\n }\n\n MakeImageFromNativeBuffer(\n buffer: NativeBuffer,\n surface?: JsiSkSurface,\n image?: JsiSkImage\n ) {\n if (!isNativeBufferWeb(buffer)) {\n throw new Error(\"Invalid NativeBuffer\");\n }\n if (!surface) {\n let img: Image;\n if (\n buffer instanceof HTMLImageElement ||\n buffer instanceof HTMLVideoElement ||\n buffer instanceof ImageBitmap\n ) {\n img = this.CanvasKit.MakeLazyImageFromTextureSource(buffer);\n } else if (buffer instanceof CanvasKitWebGLBuffer) {\n img = (\n buffer as CanvasKitWebGLBuffer as CanvasKitWebGLBufferImpl\n ).toImage();\n } else {\n img = this.CanvasKit.MakeImageFromCanvasImageSource(buffer);\n }\n return new JsiSkImage(this.CanvasKit, img);\n } else if (!image) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).makeImageFromTextureSource(buffer) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).updateTextureFromSource(\n image,\n buffer\n ) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n }\n }\n\n MakeImageFromEncoded(encoded: SkData) {\n const image = this.CanvasKit.MakeImageFromEncoded(\n JsiSkData.fromValue(encoded)\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number) {\n // see toSkImageInfo() from canvaskit\n const image = this.CanvasKit.MakeImage(\n {\n alphaType: getEnum(this.CanvasKit.AlphaType, info.alphaType),\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n colorType: getEnum(this.CanvasKit.ColorType, info.colorType),\n height: info.height,\n width: info.width,\n },\n JsiSkData.fromValue(data),\n bytesPerRow\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AASA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAIO,MAAMI,iBAAiB,SAASC,UAAI,CAAyB;EAClEC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,oBAAoBA,CAACC,OAAe,EAA2B;IAC7D,MAAMC,IAAI,GAAGD,OAAiC;IAC9C;IACAE,OAAO,CAACC,GAAG,CAACF,IAAI,CAAC;IACjB,OAAOG,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAC9B;EAEAC,yBAAyBA,CACvBC,MAAoB,EACpBC,OAAsB,EACtBC,KAAkB,EAClB;IACA,IAAI,CAAC,IAAAC,wBAAiB,EAACH,MAAM,CAAC,EAAE;MAC9B,MAAM,IAAII,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,IAAI,CAACH,OAAO,EAAE;MACZ,IAAII,GAAU;MACd,IACEL,MAAM,YAAYM,gBAAgB,IAClCN,MAAM,YAAYO,gBAAgB,IAClCP,MAAM,YAAYQ,WAAW,EAC7B;QACAH,GAAG,GAAG,IAAI,CAACd,SAAS,CAACkB,8BAA8B,CAACT,MAAM,CAAC;MAC7D,CAAC,MAAM,IAAIA,MAAM,YAAYU,2BAAoB,EAAE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AS,EAAEV,IAAI,CAACS,SAAS,CAAC;MAC5DE,MAAM,EAAEX,IAAI,CAACW,MAAM;MACnBC,KAAK,EAAEZ,IAAI,CAACY;IACd,CAAC,EACDf,oBAAS,CAACC,SAAS,CAACG,IAAI,CAAC,EACzBC,WACF,CAAC;IACD,IAAIrB,KAAK,KAAK,IAAI,EAAE;MAClB,OAAO,IAAI;IACb;IACA,OAAO,IAAIW,sBAAU,CAAC,IAAI,CAACtB,SAAS,EAAEW,KAAK,CAAC;EAC9C;AACF;AAACgC,OAAA,CAAA9C,iBAAA,GAAAA,iBAAA"}
@@ -36,6 +36,7 @@ var _JsiSkFontMgrFactory = require("./JsiSkFontMgrFactory");
36
36
  var _JsiSkAnimatedImageFactory = require("./JsiSkAnimatedImageFactory");
37
37
  var _JsiSkParagraphBuilderFactory = require("./JsiSkParagraphBuilderFactory");
38
38
  var _JsiSkNativeBufferFactory = require("./JsiSkNativeBufferFactory");
39
+ var _JsiVideo = require("./JsiVideo");
39
40
  const JsiSkApi = CanvasKit => ({
40
41
  Point: (x, y) => new _JsiSkPoint.JsiSkPoint(CanvasKit, Float32Array.of(x, y)),
41
42
  RuntimeShaderBuilder: _ => {
@@ -81,9 +82,7 @@ const JsiSkApi = CanvasKit => ({
81
82
  FontMgr: new _JsiSkFontMgrFactory.JsiSkFontMgrFactory(CanvasKit),
82
83
  ParagraphBuilder: new _JsiSkParagraphBuilderFactory.JsiSkParagraphBuilderFactory(CanvasKit),
83
84
  NativeBuffer: new _JsiSkNativeBufferFactory.JsiSkNativeBufferFactory(CanvasKit),
84
- Video: _localUri => {
85
- throw new Error("Not implemented on React Native Web");
86
- }
85
+ Video: _JsiVideo.createVideo.bind(null, CanvasKit)
87
86
  });
88
87
  exports.JsiSkApi = JsiSkApi;
89
88
  //# sourceMappingURL=JsiSkia.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_JsiSkPoint","require","_JsiSkPaint","_JsiSkRect","_JsiSkColor","_JsiSkSurfaceFactory","_JsiSkRRect","_JsiSkRSXform","_JsiSkContourMeasureIter","_JsiSkPictureRecorder","_JsiSkPictureFactory","_JsiSkPathFactory","_JsiSkMatrix","_JsiSkColorFilterFactory","_JsiSkTypefaceFactory","_JsiSkMaskFilterFactory","_JsiSkRuntimeEffectFactory","_JsiSkImageFilterFactory","_JsiSkShaderFactory","_JsiSkPathEffectFactory","_JsiSkDataFactory","_JsiSkImageFactory","_JsiSkSVGFactory","_JsiSkTextBlobFactory","_JsiSkFont","_JsiSkVerticesFactory","_JsiSkPath","_JsiSkTypeface","_JsiSkTypefaceFontProviderFactory","_JsiSkFontMgrFactory","_JsiSkAnimatedImageFactory","_JsiSkParagraphBuilderFactory","_JsiSkNativeBufferFactory","JsiSkApi","CanvasKit","Point","x","y","JsiSkPoint","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","JsiSkRRect","RSXform","scos","ssin","tx","ty","JsiSkRSXform","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","Color","ContourMeasureIter","path","forceClosed","resScale","JsiSkContourMeasureIter","JsiSkPath","fromValue","Paint","paint","JsiSkPaint","setAntiAlias","PictureRecorder","JsiSkPictureRecorder","Picture","JsiSkPictureFactory","Path","JsiSkPathFactory","Matrix","matrix","JsiSkMatrix","identity","ColorFilter","JsiSkColorFilterFactory","Font","typeface","size","JsiSkFont","undefined","JsiSkTypeface","Typeface","JsiSkTypefaceFactory","MaskFilter","JsiSkMaskFilterFactory","RuntimeEffect","JsiSkRuntimeEffectFactory","ImageFilter","JsiSkImageFilterFactory","Shader","JsiSkShaderFactory","PathEffect","JsiSkPathEffectFactory","MakeVertices","bind","Data","JsiSkDataFactory","Image","JsiSkImageFactory","AnimatedImage","JsiSkAnimatedImageFactory","SVG","JsiSkSVGFactory","TextBlob","JsiSkTextBlobFactory","XYWHRect","width","height","JsiSkRect","Surface","JsiSkSurfaceFactory","TypefaceFontProvider","JsiSkTypefaceFontProviderFactory","FontMgr","JsiSkFontMgrFactory","ParagraphBuilder","JsiSkParagraphBuilderFactory","NativeBuffer","JsiSkNativeBufferFactory","Video","_localUri","exports"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: (_localUri: string) => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n});\n"],"mappings":";;;;;;AAYA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAA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SAAS,CAAC;EACvC+E,aAAa,EAAE,IAAIC,oDAAyB,CAAChF,SAAS,CAAC;EACvDiF,GAAG,EAAE,IAAIC,gCAAe,CAAClF,SAAS,CAAC;EACnCmF,QAAQ,EAAE,IAAIC,0CAAoB,CAACpF,SAAS,CAAC;EAC7CqF,QAAQ,EAAEA,CAACnF,CAAS,EAAEC,CAAS,EAAEmF,KAAa,EAAEC,MAAc,KAAK;IACjE,OAAO,IAAIC,oBAAS,CAACxF,SAAS,EAAEA,SAAS,CAACqF,QAAQ,CAACnF,CAAC,EAAEC,CAAC,EAAEmF,KAAK,EAAEC,MAAM,CAAC,CAAC;EAC1E,CAAC;EACDE,OAAO,EAAE,IAAIC,wCAAmB,CAAC1F,SAAS,CAAC;EAC3C2F,oBAAoB,EAAE,IAAIC,kEAAgC,CAAC5F,SAAS,CAAC;EACrE6F,OAAO,EAAE,IAAIC,wCAAmB,CAAC9F,SAAS,CAAC;EAC3C+F,gBAAgB,EAAE,IAAIC,0DAA4B,CAAChG,SAAS,CAAC;EAC7DiG,YAAY,EAAE,IAAIC,kDAAwB,CAAClG,SAAS,CAAC;EACrDmG,KAAK,EAAGC,SAAiB,IAAK;IAC5B,MAAM,IAAI3F,KAAK,CAAC,qCAAqC,CAAC;EACxD;AACF,CAAC,CAAC;AAAC4F,OAAA,CAAAtG,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["_JsiSkPoint","require","_JsiSkPaint","_JsiSkRect","_JsiSkColor","_JsiSkSurfaceFactory","_JsiSkRRect","_JsiSkRSXform","_JsiSkContourMeasureIter","_JsiSkPictureRecorder","_JsiSkPictureFactory","_JsiSkPathFactory","_JsiSkMatrix","_JsiSkColorFilterFactory","_JsiSkTypefaceFactory","_JsiSkMaskFilterFactory","_JsiSkRuntimeEffectFactory","_JsiSkImageFilterFactory","_JsiSkShaderFactory","_JsiSkPathEffectFactory","_JsiSkDataFactory","_JsiSkImageFactory","_JsiSkSVGFactory","_JsiSkTextBlobFactory","_JsiSkFont","_JsiSkVerticesFactory","_JsiSkPath","_JsiSkTypeface","_JsiSkTypefaceFontProviderFactory","_JsiSkFontMgrFactory","_JsiSkAnimatedImageFactory","_JsiSkParagraphBuilderFactory","_JsiSkNativeBufferFactory","_JsiVideo","JsiSkApi","CanvasKit","Point","x","y","JsiSkPoint","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","JsiSkRRect","RSXform","scos","ssin","tx","ty","JsiSkRSXform","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","Color","ContourMeasureIter","path","forceClosed","resScale","JsiSkContourMeasureIter","JsiSkPath","fromValue","Paint","paint","JsiSkPaint","setAntiAlias","PictureRecorder","JsiSkPictureRecorder","Picture","JsiSkPictureFactory","Path","JsiSkPathFactory","Matrix","matrix","JsiSkMatrix","identity","ColorFilter","JsiSkColorFilterFactory","Font","typeface","size","JsiSkFont","undefined","JsiSkTypeface","Typeface","JsiSkTypefaceFactory","MaskFilter","JsiSkMaskFilterFactory","RuntimeEffect","JsiSkRuntimeEffectFactory","ImageFilter","JsiSkImageFilterFactory","Shader","JsiSkShaderFactory","PathEffect","JsiSkPathEffectFactory","MakeVertices","bind","Data","JsiSkDataFactory","Image","JsiSkImageFactory","AnimatedImage","JsiSkAnimatedImageFactory","SVG","JsiSkSVGFactory","TextBlob","JsiSkTextBlobFactory","XYWHRect","width","height","JsiSkRect","Surface","JsiSkSurfaceFactory","TypefaceFontProvider","JsiSkTypefaceFontProviderFactory","FontMgr","JsiSkFontMgrFactory","ParagraphBuilder","JsiSkParagraphBuilderFactory","NativeBuffer","JsiSkNativeBufferFactory","Video","createVideo","exports"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n});\n"],"mappings":";;;;;;AAYA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,wBAAA,GAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,wBAAA,GAAAZ,OAAA;AACA,IAAAa,qBAAA,GAAAb,OAAA;A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MAAc,KAAK;IACjE,OAAO,IAAIC,oBAAS,CAACxF,SAAS,EAAEA,SAAS,CAACqF,QAAQ,CAACnF,CAAC,EAAEC,CAAC,EAAEmF,KAAK,EAAEC,MAAM,CAAC,CAAC;EAC1E,CAAC;EACDE,OAAO,EAAE,IAAIC,wCAAmB,CAAC1F,SAAS,CAAC;EAC3C2F,oBAAoB,EAAE,IAAIC,kEAAgC,CAAC5F,SAAS,CAAC;EACrE6F,OAAO,EAAE,IAAIC,wCAAmB,CAAC9F,SAAS,CAAC;EAC3C+F,gBAAgB,EAAE,IAAIC,0DAA4B,CAAChG,SAAS,CAAC;EAC7DiG,YAAY,EAAE,IAAIC,kDAAwB,CAAClG,SAAS,CAAC;EACrDmG,KAAK,EAAEC,qBAAW,CAAC1B,IAAI,CAAC,IAAI,EAAE1E,SAAS;AACzC,CAAC,CAAC;AAACqG,OAAA,CAAAtG,QAAA,GAAAA,QAAA"}
@@ -0,0 +1,24 @@
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
+ setSurface(surface: Surface): void;
13
+ nextImage(): import("../types").SkImage;
14
+ seek(time: number): void;
15
+ rotation(): 0;
16
+ size(): {
17
+ width: number;
18
+ height: number;
19
+ };
20
+ pause(): void;
21
+ play(): void;
22
+ setVolume(volume: number): void;
23
+ dispose(): void;
24
+ }
@@ -0,0 +1,83 @@
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
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
11
+ 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); }
12
+ const createVideo = async (CanvasKit, url) => {
13
+ const video = document.createElement("video");
14
+ return new Promise((resolve, reject) => {
15
+ video.src = url;
16
+ video.style.display = "none";
17
+ video.crossOrigin = "anonymous";
18
+ video.volume = 0;
19
+ video.addEventListener("loadedmetadata", () => {
20
+ document.body.appendChild(video);
21
+ resolve(new JsiVideo(new _JsiSkImageFactory.JsiSkImageFactory(CanvasKit), video));
22
+ });
23
+ video.addEventListener("error", () => {
24
+ reject(new Error(`Failed to load video from URL: ${url}`));
25
+ });
26
+ });
27
+ };
28
+ exports.createVideo = createVideo;
29
+ class JsiVideo {
30
+ constructor(ImageFactory, videoElement) {
31
+ this.ImageFactory = ImageFactory;
32
+ this.videoElement = videoElement;
33
+ _defineProperty(this, "__typename__", "Video");
34
+ _defineProperty(this, "webglBuffer", null);
35
+ document.body.appendChild(this.videoElement);
36
+ }
37
+ duration() {
38
+ return this.videoElement.duration * 1000;
39
+ }
40
+ framerate() {
41
+ throw new Error("Video.frame is not available on React Native Web");
42
+ }
43
+ setSurface(surface) {
44
+ // If we have the surface, we can use the WebGL buffer which is slightly faster
45
+ // This is because WebGL cannot be shared across contextes.
46
+ // This can be removed with WebGPU
47
+ this.webglBuffer = new _CanvasKitWebGLBufferImpl.CanvasKitWebGLBufferImpl(surface, this.videoElement);
48
+ }
49
+ nextImage() {
50
+ return this.ImageFactory.MakeImageFromNativeBuffer(this.webglBuffer ? this.webglBuffer : this.videoElement);
51
+ }
52
+ seek(time) {
53
+ if (isNaN(time)) {
54
+ throw new Error(`Invalid time: ${time}`);
55
+ }
56
+ this.videoElement.currentTime = time / 1000;
57
+ }
58
+ rotation() {
59
+ return 0;
60
+ }
61
+ size() {
62
+ return {
63
+ width: this.videoElement.videoWidth,
64
+ height: this.videoElement.videoHeight
65
+ };
66
+ }
67
+ pause() {
68
+ this.videoElement.pause();
69
+ }
70
+ play() {
71
+ this.videoElement.play();
72
+ }
73
+ setVolume(volume) {
74
+ this.videoElement.volume = volume;
75
+ }
76
+ dispose() {
77
+ if (this.videoElement.parentNode) {
78
+ this.videoElement.parentNode.removeChild(this.videoElement);
79
+ }
80
+ }
81
+ }
82
+ exports.JsiVideo = JsiVideo;
83
+ //# sourceMappingURL=JsiVideo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_CanvasKitWebGLBufferImpl","require","_JsiSkImageFactory","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","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","setSurface","surface","webglBuffer","CanvasKitWebGLBufferImpl","nextImage","MakeImageFromNativeBuffer","seek","time","isNaN","currentTime","rotation","size","width","videoWidth","height","videoHeight","pause","play","setVolume","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\";\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 throw new Error(\"Video.frame is not available on React Native Web\");\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 dispose() {\n if (this.videoElement.parentNode) {\n this.videoElement.parentNode.removeChild(this.videoElement);\n }\n }\n}\n"],"mappings":";;;;;;AAIA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAAwD,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,C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