@shopify/react-native-skia 1.3.3 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/android/cpp/jni/JniPlatformContext.cpp +4 -3
  2. package/cpp/rnskia/RNSkJsiViewApi.h +25 -67
  3. package/cpp/rnskia/RNSkManager.cpp +1 -1
  4. package/cpp/rnskia/RNSkView.h +0 -11
  5. package/lib/commonjs/external/reanimated/useAnimatedImageValue.d.ts +1 -1
  6. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
  7. package/lib/commonjs/external/reanimated/useVideo.js +22 -9
  8. package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
  9. package/lib/commonjs/external/reanimated/useVideoLoading.d.ts +4 -0
  10. package/lib/commonjs/external/reanimated/useVideoLoading.js +28 -0
  11. package/lib/commonjs/external/reanimated/useVideoLoading.js.map +1 -0
  12. package/lib/commonjs/external/reanimated/useVideoLoading.web.d.ts +4 -0
  13. package/lib/commonjs/external/reanimated/useVideoLoading.web.js +20 -0
  14. package/lib/commonjs/external/reanimated/useVideoLoading.web.js.map +1 -0
  15. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +3 -1
  16. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js +4 -2
  17. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  18. package/lib/commonjs/skia/types/Skia.d.ts +1 -1
  19. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  20. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.d.ts +9 -0
  21. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.js +30 -0
  22. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -0
  23. package/lib/commonjs/skia/web/JsiSkImageFactory.js +8 -2
  24. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  25. package/lib/commonjs/skia/web/JsiSkia.js +2 -3
  26. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  27. package/lib/commonjs/skia/web/JsiVideo.d.ts +24 -0
  28. package/lib/commonjs/skia/web/JsiVideo.js +83 -0
  29. package/lib/commonjs/skia/web/JsiVideo.js.map +1 -0
  30. package/lib/commonjs/views/SkiaDomView.js +3 -1
  31. package/lib/commonjs/views/SkiaDomView.js.map +1 -1
  32. package/lib/commonjs/views/SkiaDomView.web.js +2 -0
  33. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  34. package/lib/commonjs/views/SkiaJSDomView.js +3 -1
  35. package/lib/commonjs/views/SkiaJSDomView.js.map +1 -1
  36. package/lib/commonjs/views/SkiaPictureView.js +1 -1
  37. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  38. package/lib/commonjs/views/types.d.ts +0 -8
  39. package/lib/commonjs/views/types.js +0 -3
  40. package/lib/commonjs/views/types.js.map +1 -1
  41. package/lib/module/external/reanimated/useAnimatedImageValue.d.ts +1 -1
  42. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
  43. package/lib/module/external/reanimated/useVideo.js +22 -9
  44. package/lib/module/external/reanimated/useVideo.js.map +1 -1
  45. package/lib/module/external/reanimated/useVideoLoading.d.ts +4 -0
  46. package/lib/module/external/reanimated/useVideoLoading.js +20 -0
  47. package/lib/module/external/reanimated/useVideoLoading.js.map +1 -0
  48. package/lib/module/external/reanimated/useVideoLoading.web.d.ts +4 -0
  49. package/lib/module/external/reanimated/useVideoLoading.web.js +13 -0
  50. package/lib/module/external/reanimated/useVideoLoading.web.js.map +1 -0
  51. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +3 -1
  52. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js +2 -1
  53. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  54. package/lib/module/skia/types/Skia.d.ts +1 -1
  55. package/lib/module/skia/types/Skia.js.map +1 -1
  56. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.d.ts +9 -0
  57. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js +23 -0
  58. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -0
  59. package/lib/module/skia/web/JsiSkImageFactory.js +9 -3
  60. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  61. package/lib/module/skia/web/JsiSkia.js +2 -3
  62. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  63. package/lib/module/skia/web/JsiVideo.d.ts +24 -0
  64. package/lib/module/skia/web/JsiVideo.js +75 -0
  65. package/lib/module/skia/web/JsiVideo.js.map +1 -0
  66. package/lib/module/views/SkiaDomView.js +3 -1
  67. package/lib/module/views/SkiaDomView.js.map +1 -1
  68. package/lib/module/views/SkiaDomView.web.js +2 -0
  69. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  70. package/lib/module/views/SkiaJSDomView.js +3 -1
  71. package/lib/module/views/SkiaJSDomView.js.map +1 -1
  72. package/lib/module/views/SkiaPictureView.js +1 -1
  73. package/lib/module/views/SkiaPictureView.js.map +1 -1
  74. package/lib/module/views/types.d.ts +0 -8
  75. package/lib/module/views/types.js +0 -4
  76. package/lib/module/views/types.js.map +1 -1
  77. package/lib/typescript/src/external/reanimated/useAnimatedImageValue.d.ts +1 -1
  78. package/lib/typescript/src/external/reanimated/useVideoLoading.d.ts +4 -0
  79. package/lib/typescript/src/external/reanimated/useVideoLoading.web.d.ts +4 -0
  80. package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +3 -1
  81. package/lib/typescript/src/skia/types/Skia.d.ts +1 -1
  82. package/lib/typescript/src/skia/web/CanvasKitWebGLBufferImpl.d.ts +9 -0
  83. package/lib/typescript/src/skia/web/JsiVideo.d.ts +24 -0
  84. package/lib/typescript/src/views/types.d.ts +0 -8
  85. package/package.json +1 -1
  86. package/src/external/reanimated/useAnimatedImageValue.ts +1 -1
  87. package/src/external/reanimated/useVideo.ts +25 -9
  88. package/src/external/reanimated/useVideoLoading.ts +25 -0
  89. package/src/external/reanimated/useVideoLoading.web.ts +17 -0
  90. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +10 -2
  91. package/src/skia/types/Skia.ts +1 -1
  92. package/src/skia/web/CanvasKitWebGLBufferImpl.ts +22 -0
  93. package/src/skia/web/JsiSkImageFactory.ts +16 -3
  94. package/src/skia/web/JsiSkia.ts +2 -3
  95. package/src/skia/web/JsiVideo.ts +96 -0
  96. package/src/views/SkiaDomView.tsx +4 -1
  97. package/src/views/SkiaDomView.web.tsx +4 -0
  98. package/src/views/SkiaJSDomView.tsx +4 -1
  99. package/src/views/SkiaPictureView.tsx +0 -1
  100. package/src/views/types.ts +0 -13
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","SkiaPictureViewNativeComponent","JsiDrawingContext","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","OS","SkiaJSDomView","Component","constructor","props","_defineProperty","_nativeId","current","root","onTouch","onSize","assertSkiaViewApi","setJsiProperty","nativeId","componentDidUpdate","prevProps","undefined","draw","makeImageSnapshot","rect","redraw","Skia","rec","PictureRecorder","canvas","beginRecording","ctx","render","picture","finishRecordingAsPicture","componentWillUnmount","mode","debug","viewProps","createElement","_extends","collapsable","nativeID","callJsiMethod","requestRedraw","Error"],"sources":["SkiaJSDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { Skia, SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport { JsiDrawingContext } from \"../dom/types\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewProps, SkiaDomViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView: HostComponent<SkiaPictureViewProps> =\n Platform.OS !== \"web\"\n ? SkiaPictureViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\nexport class SkiaJSDomView extends React.Component<\n SkiaDomViewProps & { Skia: Skia }\n> {\n constructor(props: SkiaDomViewProps & { Skia: Skia }) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onTouch, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onTouch) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onTouch\", onTouch);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps & { Skia: Skia }) {\n const { root, onTouch, onSize } = this.props;\n if (root !== prevProps.root && root !== undefined) {\n assertSkiaViewApi();\n this.draw();\n }\n if (onTouch !== prevProps.onTouch) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onTouch\", onTouch);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n this.draw();\n //SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n private draw() {\n const { root, Skia } = this.props;\n if (root !== undefined) {\n assertSkiaViewApi();\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.render(ctx);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n }\n\n /**\n * Clear up the dom node when unmounting to release resources.\n */\n componentWillUnmount(): void {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", null);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.callJsiMethod === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB,SAASC,QAAQ,QAAQ,aAAa;AACtC,OAAOC,8BAA8B,MAAM,yCAAyC;AACpF,SAASC,iBAAiB,QAAQ,cAAc;AAEhD,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,qBAA0D,GAC9DL,QAAQ,CAACM,EAAE,KAAK,KAAK,GACjBL,8BAA8B;AAC9B;AACC,IAAY;AAEnB,OAAO,MAAMM,aAAa,SAASR,KAAK,CAACS,SAAS,CAEhD;EACAC,WAAWA,CAACC,KAAwC,EAAE;IACpD,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IACb,IAAI,CAACC,SAAS,GAAGR,gBAAgB,CAACS,OAAO,EAAE;IAC3C,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC;IAAO,CAAC,GAAGN,KAAK;IACvC,IAAII,IAAI,EAAE;MACRG,iBAAiB,CAAC,CAAC;MACnBd,WAAW,CAACe,cAAc,CAAC,IAAI,CAACN,SAAS,EAAE,MAAM,EAAEE,IAAI,CAAC;IAC1D;IACA,IAAIC,OAAO,EAAE;MACXE,iBAAiB,CAAC,CAAC;MACnBd,WAAW,CAACe,cAAc,CAAC,IAAI,CAACN,SAAS,EAAE,SAAS,EAAEG,OAAO,CAAC;IAChE;IACA,IAAI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+ {"version":3,"names":["React","Platform","SkiaPictureViewNativeComponent","JsiDrawingContext","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","OS","SkiaJSDomView","Component","constructor","props","_defineProperty","_nativeId","current","root","onTouch","onSize","assertSkiaViewApi","setJsiProperty","console","warn","nativeId","componentDidUpdate","prevProps","undefined","draw","makeImageSnapshot","rect","redraw","Skia","rec","PictureRecorder","canvas","beginRecording","ctx","render","picture","finishRecordingAsPicture","componentWillUnmount","mode","debug","viewProps","createElement","_extends","collapsable","nativeID","requestRedraw","Error"],"sources":["SkiaJSDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { Skia, SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport { JsiDrawingContext } from \"../dom/types\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewProps, SkiaDomViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView: HostComponent<SkiaPictureViewProps> =\n Platform.OS !== \"web\"\n ? SkiaPictureViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\nexport class SkiaJSDomView extends React.Component<\n SkiaDomViewProps & { Skia: Skia }\n> {\n constructor(props: SkiaDomViewProps & { Skia: Skia }) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onTouch, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onTouch) {\n assertSkiaViewApi();\n console.warn(\n `The onTouch property is deprecated and will be removed in the next Skia release.\nSee: https://shopify.github.io/react-native-skia/docs/animations/gestures`\n );\n SkiaViewApi.setJsiProperty(this._nativeId, \"onTouch\", onTouch);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps & { Skia: Skia }) {\n const { root, onTouch, onSize } = this.props;\n if (root !== prevProps.root && root !== undefined) {\n assertSkiaViewApi();\n this.draw();\n }\n if (onTouch !== prevProps.onTouch) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onTouch\", onTouch);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n this.draw();\n //SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n private draw() {\n const { root, Skia } = this.props;\n if (root !== undefined) {\n assertSkiaViewApi();\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.render(ctx);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n }\n\n /**\n * Clear up the dom node when unmounting to release resources.\n */\n componentWillUnmount(): void {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", null);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw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BAAwB,CAAC,CAAC;MAC9ClC,WAAW,CAACe,cAAc,CAAC,IAAI,CAACN,SAAS,EAAE,SAAS,EAAEwB,OAAO,CAAC;IAChE;EACF;;EAEA;AACF;AACA;EACEE,oBAAoBA,CAAA,EAAS;IAC3BrB,iBAAiB,CAAC,CAAC;IACnBd,WAAW,CAACe,cAAc,CAAC,IAAI,CAACN,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC;EAC7D;EAEAuB,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEI,IAAI;MAAEC,KAAK,GAAG,KAAK;MAAE,GAAGC;IAAU,CAAC,GAAG,IAAI,CAAC/B,KAAK;IACxD,oBACEX,KAAA,CAAA2C,aAAA,CAACrC,qBAAqB,EAAAsC,QAAA;MACpBC,WAAW,EAAE,KAAM;MACnBC,QAAQ,EAAG,GAAE,IAAI,CAACjC,SAAU,EAAE;MAC9B2B,IAAI,EAAEA,IAAK;MACXC,KAAK,EAAEA;IAAM,GACTC,SAAS,CACd,CAAC;EAEN;AACF;AAEA,MAAMxB,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEd,WAAW,KAAK,IAAI,IACpBA,WAAW,CAACe,cAAc,KAAK,IAAI,IACnCf,WAAW,CAAC2C,aAAa,KAAK,IAAI,IAClC3C,WAAW,CAACuB,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMqB,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC"}
@@ -75,7 +75,7 @@ export class SkiaPictureView extends React.Component {
75
75
  }
76
76
  }
77
77
  const assertSkiaViewApi = () => {
78
- if (SkiaViewApi === null || SkiaViewApi.setJsiProperty === null || SkiaViewApi.callJsiMethod === null || SkiaViewApi.requestRedraw === null || SkiaViewApi.makeImageSnapshot === null) {
78
+ if (SkiaViewApi === null || SkiaViewApi.setJsiProperty === null || SkiaViewApi.requestRedraw === null || SkiaViewApi.makeImageSnapshot === null) {
79
79
  throw Error("Skia View Api was not found.");
80
80
  }
81
81
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","SkiaPictureViewNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","SkiaPictureView","Component","constructor","props","_defineProperty","_nativeId","current","picture","onSize","assertSkiaViewApi","setJsiProperty","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","redraw","requestRedraw","render","mode","debug","viewProps","createElement","_extends","collapsable","nativeID","callJsiMethod","Error"],"sources":["SkiaPictureView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkRect } from \"../skia/types\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\nexport class SkiaPictureView extends React.Component<SkiaPictureViewProps> {\n constructor(props: SkiaPictureViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { picture, onSize } = props;\n if (picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaPictureViewProps) {\n const { picture, onSize } = this.props;\n if (picture !== prevProps.picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode ?? \"default\"}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.callJsiMethod === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAOC,8BAA8B,MAAM,yCAAyC;AAEpF,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,qBAAqB,GAAGH,8BAA8B;AAE5D,OAAO,MAAMI,eAAe,SAASL,KAAK,CAACM,SAAS,CAAuB;EACzEC,WAAWA,CAACC,KAA2B,EAAE;IACvC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IACb,IAAI,CAACC,SAAS,GAAGP,gBAAgB,CAACQ,OAAO,EAAE;IAC3C,MAAM;MAAEC,OAAO;MAAEC;IAAO,CAAC,GAAGL,KAAK;IACjC,IAAII,OAAO,EAAE;MACXE,iBAAiB,CAAC,CAAC;MACnBZ,WAAW,CAACa,cAAc,CAAC,IAAI,CAACL,SAAS,EAAE,SAAS,EAAEE,OAAO,CAAC;IAChE;IACA,IAAIC,MAAM,EAAE;MACVC,iBAAiB,CAAC,CAAC;MACnBZ,WAAW,CAACa,cAAc,CAAC,IAAI,CAACL,SAAS,EAAE,QAAQ,EAAEG,MAAM,CAAC;IAC9D;EACF;EAIA,IAAWG,QAAQA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACN,SAAS;EACvB;EAEAO,kBAAkBA,CAACC,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I,IACnCb,WAAW,CAAC6B,aAAa,KAAK,IAAI,IAClC7B,WAAW,CAACoB,aAAa,KAAK,IAAI,IAClCpB,WAAW,CAACiB,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMa,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC"}
1
+ {"version":3,"names":["React","SkiaPictureViewNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","SkiaPictureView","Component","constructor","props","_defineProperty","_nativeId","current","picture","onSize","assertSkiaViewApi","setJsiProperty","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","redraw","requestRedraw","render","mode","debug","viewProps","createElement","_extends","collapsable","nativeID","Error"],"sources":["SkiaPictureView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkRect } from \"../skia/types\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\nexport class SkiaPictureView extends React.Component<SkiaPictureViewProps> {\n constructor(props: SkiaPictureViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { picture, onSize } = props;\n if (picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaPictureViewProps) {\n const { picture, onSize } = this.props;\n if (picture !== prevProps.picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode ?? \"default\"}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAOC,8BAA8B,MAAM,yCAAyC;AAEpF,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,qBAAqB,GAAGH,8BAA8B;AAE5D,OAAO,MAAMI,eAAe,SAASL,KAAK,CAACM,SAAS,CAAuB;EACzEC,WAAWA,CAACC,KAA2B,EAAE;IACvC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IACb,IAAI,CAACC,SAAS,GAAGP,gBAAgB,CAACQ,OAAO,EAAE;IAC3C,MAAM;MAAEC,OAAO;MAAEC;IAAO,CAAC,GAAGL,KAAK;IACjC,IAAII,OAAO,EAAE;MACXE,iBAAiB,CAAC,CAAC;MACnBZ,WAAW,CAACa,cAAc,CAAC,IAAI,CAACL,SAAS,EAAE,SAAS,EAAEE,OAAO,CAAC;IAChE;IACA,IAAIC,MAAM,EAAE;MACVC,iBAAiB,CAAC,CAAC;MACnBZ,WAAW,CAACa,cAAc,CAAC,IAAI,C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AM,GACTC,SAAS,CACd,CAAC;EAEN;AACF;AAEA,MAAMZ,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEZ,WAAW,KAAK,IAAI,IACpBA,WAAW,CAACa,cAAc,KAAK,IAAI,IACnCb,WAAW,CAACoB,aAAa,KAAK,IAAI,IAClCpB,WAAW,CAACiB,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMY,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC"}
@@ -37,16 +37,8 @@ export type TouchHandlers = {
37
37
  onEnd?: (touchInfo: ExtendedTouchInfo) => void;
38
38
  };
39
39
  export type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;
40
- /**
41
- * Listener interface for value changes
42
- */
43
- export interface ValueListener {
44
- addListener: (callback: () => void) => number;
45
- removeListener: (id: number) => void;
46
- }
47
40
  export interface ISkiaViewApi {
48
41
  setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
49
- callJsiMethod: <T extends Array<unknown>>(nativeId: number, name: string, ...args: T) => void;
50
42
  requestRedraw: (nativeId: number) => void;
51
43
  makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
52
44
  makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;
@@ -5,8 +5,4 @@ export let TouchType = /*#__PURE__*/function (TouchType) {
5
5
  TouchType[TouchType["Cancelled"] = 3] = "Cancelled";
6
6
  return TouchType;
7
7
  }({});
8
-
9
- /**
10
- * Listener interface for value changes
11
- */
12
8
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SharedValueType<SkSize>;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":"AAaA,WAAYA,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;;AAqCrB;AACA;AACA"}
1
+ {"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SharedValueType<SkSize>;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":"AAaA,WAAYA,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA"}
@@ -1,3 +1,3 @@
1
- import { type SharedValue } from "react-native-reanimated";
1
+ import type { SharedValue } from "react-native-reanimated";
2
2
  import type { DataSourceParam, SkImage } from "../../skia/types";
3
3
  export declare const useAnimatedImageValue: (source: DataSourceParam, paused?: SharedValue<boolean>) => SharedValue<SkImage | null>;
@@ -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,4 @@
1
+ import type { Video } from "../../skia/types";
2
+ type VideoSource = string | null;
3
+ export declare const useVideoLoading: (source: VideoSource) => Video | null;
4
+ export {};
@@ -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>;
@@ -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
  }
@@ -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,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
+ }
@@ -37,16 +37,8 @@ export type TouchHandlers = {
37
37
  onEnd?: (touchInfo: ExtendedTouchInfo) => void;
38
38
  };
39
39
  export type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;
40
- /**
41
- * Listener interface for value changes
42
- */
43
- export interface ValueListener {
44
- addListener: (callback: () => void) => number;
45
- removeListener: (id: number) => void;
46
- }
47
40
  export interface ISkiaViewApi {
48
41
  setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
49
- callJsiMethod: <T extends Array<unknown>>(nativeId: number, name: string, ...args: T) => void;
50
42
  requestRedraw: (nativeId: number) => void;
51
43
  makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
52
44
  makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "1.3.3",
10
+ "version": "1.3.5",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "react-native": "src/index.ts",
@@ -1,5 +1,5 @@
1
1
  import { useEffect } from "react";
2
- import { type FrameInfo, type SharedValue } from "react-native-reanimated";
2
+ import type { FrameInfo, SharedValue } from "react-native-reanimated";
3
3
 
4
4
  import { useAnimatedImage } from "../../skia/core/AnimatedImage";
5
5
  import type { DataSourceParam, SkImage } from "../../skia/types";
@@ -1,11 +1,11 @@
1
1
  import type { SharedValue, FrameInfo } from "react-native-reanimated";
2
2
  import { useEffect, useMemo } from "react";
3
3
 
4
- import { Skia } from "../../skia/Skia";
5
4
  import type { SkImage, Video } from "../../skia/types";
6
5
  import { Platform } from "../../Platform";
7
6
 
8
7
  import Rea from "./ReanimatedProxy";
8
+ import { useVideoLoading } from "./useVideoLoading";
9
9
 
10
10
  type Animated<T> = SharedValue<T> | T;
11
11
 
@@ -16,6 +16,18 @@ interface PlaybackOptions {
16
16
  volume: Animated<number>;
17
17
  }
18
18
 
19
+ const copyFrameOnAndroid = (currentFrame: SharedValue<SkImage | null>) => {
20
+ "worklet";
21
+ // on android we need to copy the texture before it's invalidated
22
+ if (Platform.OS === "android") {
23
+ const tex = currentFrame.value;
24
+ if (tex) {
25
+ currentFrame.value = tex.makeNonTextureImage();
26
+ tex.dispose();
27
+ }
28
+ }
29
+ };
30
+
19
31
  const setFrame = (video: Video, currentFrame: SharedValue<SkImage | null>) => {
20
32
  "worklet";
21
33
  const img = video.nextImage();
@@ -23,11 +35,9 @@ const setFrame = (video: Video, currentFrame: SharedValue<SkImage | null>) => {
23
35
  if (currentFrame.value) {
24
36
  currentFrame.value.dispose();
25
37
  }
26
- if (Platform.OS === "android") {
27
- currentFrame.value = img.makeNonTextureImage();
28
- } else {
29
- currentFrame.value = img;
30
- }
38
+ currentFrame.value = img;
39
+ } else {
40
+ copyFrameOnAndroid(currentFrame);
31
41
  }
32
42
  };
33
43
 
@@ -57,7 +67,7 @@ export const useVideo = (
57
67
  source: string | null,
58
68
  userOptions?: Partial<PlaybackOptions>
59
69
  ) => {
60
- const video = useMemo(() => (source ? Skia.Video(source) : null), [source]);
70
+ const video = useVideoLoading(source);
61
71
  const isPaused = useOption(userOptions?.paused ?? defaultOptions.paused);
62
72
  const looping = useOption(userOptions?.looping ?? defaultOptions.looping);
63
73
  const seek = useOption(userOptions?.seek ?? defaultOptions.seek);
@@ -66,7 +76,10 @@ export const useVideo = (
66
76
  const currentTime = Rea.useSharedValue(0);
67
77
  const lastTimestamp = Rea.useSharedValue(-1);
68
78
  const duration = useMemo(() => video?.duration() ?? 0, [video]);
69
- const framerate = useMemo(() => video?.framerate() ?? 0, [video]);
79
+ const framerate = useMemo(
80
+ () => (Platform.OS === "web" ? -1 : video?.framerate() ?? 0),
81
+ [video]
82
+ );
70
83
  const size = useMemo(() => video?.size() ?? { width: 0, height: 0 }, [video]);
71
84
  const rotation = useMemo(() => video?.rotation() ?? 0, [video]);
72
85
  const frameDuration = 1000 / framerate;
@@ -86,6 +99,7 @@ export const useVideo = (
86
99
  () => seek.value,
87
100
  (value) => {
88
101
  if (value !== null) {
102
+ copyFrameOnAndroid(currentFrame);
89
103
  video?.seek(value);
90
104
  currentTime.value = value;
91
105
  seek.value = null;
@@ -118,7 +132,9 @@ export const useVideo = (
118
132
  currentTime.value = seek.value;
119
133
  lastTimestamp.value = currentTimestamp;
120
134
  }
121
- if (delta >= currentFrameDuration && !isOver) {
135
+ // On Web the framerate is uknown.
136
+ // This could be optimized by using requestVideoFrameCallback (Chrome only)
137
+ if ((delta >= currentFrameDuration && !isOver) || Platform.OS === "web") {
122
138
  setFrame(video, currentFrame);
123
139
  currentTime.value += delta;
124
140
  lastTimestamp.value = currentTimestamp;
@@ -0,0 +1,25 @@
1
+ import { useEffect, useState } from "react";
2
+
3
+ import type { Video } from "../../skia/types";
4
+ import { Skia } from "../../skia";
5
+
6
+ import Rea from "./ReanimatedProxy";
7
+
8
+ const runtime = Rea.createWorkletRuntime("video-metadata-runtime");
9
+
10
+ type VideoSource = string | null;
11
+
12
+ export const useVideoLoading = (source: VideoSource) => {
13
+ const [video, setVideo] = useState<Video | null>(null);
14
+ const cb = (src: string) => {
15
+ "worklet";
16
+ const vid = Skia.Video(src) as Video;
17
+ Rea.runOnJS(setVideo)(vid);
18
+ };
19
+ useEffect(() => {
20
+ if (source) {
21
+ Rea.runOnRuntime(runtime, cb)(source);
22
+ }
23
+ }, [source]);
24
+ return video;
25
+ };
@@ -0,0 +1,17 @@
1
+ import { useEffect, useState } from "react";
2
+
3
+ import type { Video } from "../../skia/types";
4
+ import { Skia } from "../../skia";
5
+
6
+ type VideoSource = string | null;
7
+
8
+ export const useVideoLoading = (source: VideoSource) => {
9
+ const [video, setVideo] = useState<Video | null>(null);
10
+ useEffect(() => {
11
+ if (source) {
12
+ const vid = Skia.Video(source) as Promise<Video>;
13
+ vid.then((v) => setVideo(v));
14
+ }
15
+ }, [source]);
16
+ return video;
17
+ };
@@ -1,7 +1,14 @@
1
1
  import type { SkImage } from "../Image";
2
2
 
3
+ export abstract class CanvasKitWebGLBuffer {}
4
+
3
5
  export type NativeBuffer<
4
- T extends bigint | ArrayBuffer | CanvasImageSource | unknown = unknown
6
+ T extends
7
+ | bigint
8
+ | ArrayBuffer
9
+ | CanvasImageSource
10
+ | CanvasKitWebGLBuffer
11
+ | unknown = unknown
5
12
  > = T;
6
13
 
7
14
  export type NativeBufferAddr = NativeBuffer<bigint>;
@@ -20,7 +27,8 @@ export const isNativeBufferWeb = (
20
27
  buffer instanceof OffscreenCanvas ||
21
28
  buffer instanceof VideoFrame ||
22
29
  buffer instanceof HTMLImageElement ||
23
- buffer instanceof SVGImageElement;
30
+ buffer instanceof SVGImageElement ||
31
+ buffer instanceof CanvasKitWebGLBuffer;
24
32
 
25
33
  export const isNativeBufferNode = (
26
34
  buffer: NativeBuffer
@@ -96,6 +96,6 @@ export interface Skia {
96
96
  TextBlob: TextBlobFactory;
97
97
  Surface: SurfaceFactory;
98
98
  ParagraphBuilder: ParagraphBuilderFactory;
99
- Video: (url: string) => Video;
99
+ Video: (url: string) => Promise<Video> | Video;
100
100
  NativeBuffer: NativeBufferFactory;
101
101
  }
@@ -0,0 +1,22 @@
1
+ import type { Surface, TextureSource, Image } from "canvaskit-wasm";
2
+
3
+ import { CanvasKitWebGLBuffer } from "../types";
4
+
5
+ export class CanvasKitWebGLBufferImpl extends CanvasKitWebGLBuffer {
6
+ public image: Image | null = null;
7
+
8
+ constructor(public surface: Surface, private source: TextureSource) {
9
+ super();
10
+ }
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
+ }
@@ -1,6 +1,6 @@
1
1
  import type { CanvasKit, Image } from "canvaskit-wasm";
2
2
 
3
- import { isNativeBufferWeb } from "../types";
3
+ import { CanvasKitWebGLBuffer, isNativeBufferWeb } from "../types";
4
4
  import type {
5
5
  SkData,
6
6
  ImageInfo,
@@ -13,6 +13,7 @@ import { Host, getEnum } from "./Host";
13
13
  import { JsiSkImage } from "./JsiSkImage";
14
14
  import { JsiSkData } from "./JsiSkData";
15
15
  import type { JsiSkSurface } from "./JsiSkSurface";
16
+ import type { CanvasKitWebGLBufferImpl } from "./CanvasKitWebGLBufferImpl";
16
17
 
17
18
  export class JsiSkImageFactory extends Host implements ImageFactory {
18
19
  constructor(CanvasKit: CanvasKit) {
@@ -35,8 +36,20 @@ export class JsiSkImageFactory extends Host implements ImageFactory {
35
36
  throw new Error("Invalid NativeBuffer");
36
37
  }
37
38
  if (!surface) {
38
- // TODO: this is way to slow
39
- const img = this.CanvasKit.MakeImageFromCanvasImageSource(buffer);
39
+ let img: Image;
40
+ if (
41
+ buffer instanceof HTMLImageElement ||
42
+ buffer instanceof HTMLVideoElement ||
43
+ buffer instanceof ImageBitmap
44
+ ) {
45
+ img = this.CanvasKit.MakeLazyImageFromTextureSource(buffer);
46
+ } else if (buffer instanceof CanvasKitWebGLBuffer) {
47
+ img = (
48
+ buffer as CanvasKitWebGLBuffer as CanvasKitWebGLBufferImpl
49
+ ).toImage();
50
+ } else {
51
+ img = this.CanvasKit.MakeImageFromCanvasImageSource(buffer);
52
+ }
40
53
  return new JsiSkImage(this.CanvasKit, img);
41
54
  } else if (!image) {
42
55
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -42,6 +42,7 @@ import { JsiSkFontMgrFactory } from "./JsiSkFontMgrFactory";
42
42
  import { JsiSkAnimatedImageFactory } from "./JsiSkAnimatedImageFactory";
43
43
  import { JsiSkParagraphBuilderFactory } from "./JsiSkParagraphBuilderFactory";
44
44
  import { JsiSkNativeBufferFactory } from "./JsiSkNativeBufferFactory";
45
+ import { createVideo } from "./JsiVideo";
45
46
 
46
47
  export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
47
48
  Point: (x: number, y: number) =>
@@ -127,7 +128,5 @@ export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
127
128
  FontMgr: new JsiSkFontMgrFactory(CanvasKit),
128
129
  ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),
129
130
  NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),
130
- Video: (_localUri: string) => {
131
- throw new Error("Not implemented on React Native Web");
132
- },
131
+ Video: createVideo.bind(null, CanvasKit),
133
132
  });
@@ -0,0 +1,96 @@
1
+ import type { CanvasKit, Surface } from "canvaskit-wasm";
2
+
3
+ import type { CanvasKitWebGLBuffer, Video, ImageFactory } from "../types";
4
+
5
+ import { CanvasKitWebGLBufferImpl } from "./CanvasKitWebGLBufferImpl";
6
+ import { JsiSkImageFactory } from "./JsiSkImageFactory";
7
+
8
+ export const createVideo = async (
9
+ CanvasKit: CanvasKit,
10
+ url: string
11
+ ): Promise<Video> => {
12
+ const video = document.createElement("video");
13
+ return new Promise((resolve, reject) => {
14
+ video.src = url;
15
+ video.style.display = "none";
16
+ video.crossOrigin = "anonymous";
17
+ video.volume = 0;
18
+ video.addEventListener("loadedmetadata", () => {
19
+ document.body.appendChild(video);
20
+ resolve(new JsiVideo(new JsiSkImageFactory(CanvasKit), video));
21
+ });
22
+ video.addEventListener("error", () => {
23
+ reject(new Error(`Failed to load video from URL: ${url}`));
24
+ });
25
+ });
26
+ };
27
+
28
+ export class JsiVideo implements Video {
29
+ __typename__ = "Video" as const;
30
+
31
+ private webglBuffer: CanvasKitWebGLBuffer | null = null;
32
+
33
+ constructor(
34
+ private ImageFactory: ImageFactory,
35
+ private videoElement: HTMLVideoElement
36
+ ) {
37
+ document.body.appendChild(this.videoElement);
38
+ }
39
+
40
+ duration() {
41
+ return this.videoElement.duration * 1000;
42
+ }
43
+
44
+ framerate(): number {
45
+ throw new Error("Video.frame is not available on React Native Web");
46
+ }
47
+
48
+ setSurface(surface: Surface) {
49
+ // If we have the surface, we can use the WebGL buffer which is slightly faster
50
+ // This is because WebGL cannot be shared across contextes.
51
+ // This can be removed with WebGPU
52
+ this.webglBuffer = new CanvasKitWebGLBufferImpl(surface, this.videoElement);
53
+ }
54
+
55
+ nextImage() {
56
+ return this.ImageFactory.MakeImageFromNativeBuffer(
57
+ this.webglBuffer ? this.webglBuffer : this.videoElement
58
+ );
59
+ }
60
+
61
+ seek(time: number) {
62
+ if (isNaN(time)) {
63
+ throw new Error(`Invalid time: ${time}`);
64
+ }
65
+ this.videoElement.currentTime = time / 1000;
66
+ }
67
+
68
+ rotation() {
69
+ return 0 as const;
70
+ }
71
+
72
+ size() {
73
+ return {
74
+ width: this.videoElement.videoWidth,
75
+ height: this.videoElement.videoHeight,
76
+ };
77
+ }
78
+
79
+ pause() {
80
+ this.videoElement.pause();
81
+ }
82
+
83
+ play() {
84
+ this.videoElement.play();
85
+ }
86
+
87
+ setVolume(volume: number) {
88
+ this.videoElement.volume = volume;
89
+ }
90
+
91
+ dispose() {
92
+ if (this.videoElement.parentNode) {
93
+ this.videoElement.parentNode.removeChild(this.videoElement);
94
+ }
95
+ }
96
+ }
@@ -26,6 +26,10 @@ export class SkiaDomView extends React.Component<SkiaDomViewProps> {
26
26
  }
27
27
  if (onTouch) {
28
28
  assertSkiaViewApi();
29
+ console.warn(
30
+ `The onTouch property is deprecated and will be removed in the next Skia release.
31
+ See: https://shopify.github.io/react-native-skia/docs/animations/gestures`
32
+ );
29
33
  SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
30
34
  }
31
35
  if (onSize) {
@@ -110,7 +114,6 @@ const assertSkiaViewApi = () => {
110
114
  if (
111
115
  SkiaViewApi === null ||
112
116
  SkiaViewApi.setJsiProperty === null ||
113
- SkiaViewApi.callJsiMethod === null ||
114
117
  SkiaViewApi.requestRedraw === null ||
115
118
  SkiaViewApi.makeImageSnapshot === null
116
119
  ) {
@@ -12,6 +12,10 @@ export class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {
12
12
 
13
13
  protected renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void {
14
14
  if (this.props.onTouch) {
15
+ console.warn(
16
+ `The onTouch property is deprecated and will be removed in the next Skia release.
17
+ See: https://shopify.github.io/react-native-skia/docs/animations/gestures`
18
+ );
15
19
  this.props.onTouch([touches]);
16
20
  }
17
21
  if (this.props.onSize) {
@@ -29,6 +29,10 @@ export class SkiaJSDomView extends React.Component<
29
29
  }
30
30
  if (onTouch) {
31
31
  assertSkiaViewApi();
32
+ console.warn(
33
+ `The onTouch property is deprecated and will be removed in the next Skia release.
34
+ See: https://shopify.github.io/react-native-skia/docs/animations/gestures`
35
+ );
32
36
  SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
33
37
  }
34
38
  if (onSize) {
@@ -117,7 +121,6 @@ const assertSkiaViewApi = () => {
117
121
  if (
118
122
  SkiaViewApi === null ||
119
123
  SkiaViewApi.setJsiProperty === null ||
120
- SkiaViewApi.callJsiMethod === null ||
121
124
  SkiaViewApi.requestRedraw === null ||
122
125
  SkiaViewApi.makeImageSnapshot === null
123
126
  ) {
@@ -78,7 +78,6 @@ const assertSkiaViewApi = () => {
78
78
  if (
79
79
  SkiaViewApi === null ||
80
80
  SkiaViewApi.setJsiProperty === null ||
81
- SkiaViewApi.callJsiMethod === null ||
82
81
  SkiaViewApi.requestRedraw === null ||
83
82
  SkiaViewApi.makeImageSnapshot === null
84
83
  ) {