@shopify/react-native-skia 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/external/reanimated/useVideoLoading.js +2 -1
- package/lib/commonjs/external/reanimated/useVideoLoading.js.map +1 -1
- package/lib/module/external/reanimated/useVideoLoading.js +2 -1
- package/lib/module/external/reanimated/useVideoLoading.js.map +1 -1
- package/package.json +1 -1
- package/src/external/reanimated/useVideoLoading.ts +2 -1
@@ -10,12 +10,13 @@ var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
11
|
const runtime = _ReanimatedProxy.default.createWorkletRuntime("video-metadata-runtime");
|
12
12
|
const useVideoLoading = source => {
|
13
|
+
const runOnJS = _ReanimatedProxy.default.runOnJS;
|
13
14
|
const [video, setVideo] = (0, _react.useState)(null);
|
14
15
|
const cb = src => {
|
15
16
|
"worklet";
|
16
17
|
|
17
18
|
const vid = _skia.Skia.Video(src);
|
18
|
-
|
19
|
+
runOnJS(setVideo)(vid);
|
19
20
|
};
|
20
21
|
(0, _react.useEffect)(() => {
|
21
22
|
if (source) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_skia","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","runtime","Rea","createWorkletRuntime","useVideoLoading","source","video","setVideo","useState","cb","src","vid","Skia","Video","
|
1
|
+
{"version":3,"names":["_react","require","_skia","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","runtime","Rea","createWorkletRuntime","useVideoLoading","source","runOnJS","video","setVideo","useState","cb","src","vid","Skia","Video","useEffect","runOnRuntime","exports"],"sources":["useVideoLoading.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport type { Video } from \"../../skia/types\";\nimport { Skia } from \"../../skia\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nconst runtime = Rea.createWorkletRuntime(\"video-metadata-runtime\");\n\ntype VideoSource = string | null;\n\nexport const useVideoLoading = (source: VideoSource) => {\n const runOnJS = Rea.runOnJS;\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 Rea.runOnRuntime(runtime, cb)(source);\n }\n }, [source]);\n return video;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAoC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpC,MAAMG,OAAO,GAAGC,wBAAG,CAACC,oBAAoB,CAAC,wBAAwB,CAAC;AAI3D,MAAMC,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAMC,OAAO,GAAGJ,wBAAG,CAACI,OAAO;EAC3B,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;IACpCL,OAAO,CAACE,QAAQ,CAAC,CAACI,GAAG,CAAC;EACxB,CAAC;EACD,IAAAG,gBAAS,EAAC,MAAM;IACd,IAAIV,MAAM,EAAE;MACVH,wBAAG,CAACc,YAAY,CAACf,OAAO,EAAES,EAAE,CAAC,CAACL,MAAM,CAAC;IACvC;EACF,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAOE,KAAK;AACd,CAAC;AAACU,OAAA,CAAAb,eAAA,GAAAA,eAAA"}
|
@@ -3,12 +3,13 @@ import { Skia } from "../../skia";
|
|
3
3
|
import Rea from "./ReanimatedProxy";
|
4
4
|
const runtime = Rea.createWorkletRuntime("video-metadata-runtime");
|
5
5
|
export const useVideoLoading = source => {
|
6
|
+
const runOnJS = Rea.runOnJS;
|
6
7
|
const [video, setVideo] = useState(null);
|
7
8
|
const cb = src => {
|
8
9
|
"worklet";
|
9
10
|
|
10
11
|
const vid = Skia.Video(src);
|
11
|
-
|
12
|
+
runOnJS(setVideo)(vid);
|
12
13
|
};
|
13
14
|
useEffect(() => {
|
14
15
|
if (source) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useEffect","useState","Skia","Rea","runtime","createWorkletRuntime","useVideoLoading","source","video","setVideo","cb","src","vid","Video","
|
1
|
+
{"version":3,"names":["useEffect","useState","Skia","Rea","runtime","createWorkletRuntime","useVideoLoading","source","runOnJS","video","setVideo","cb","src","vid","Video","runOnRuntime"],"sources":["useVideoLoading.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport type { Video } from \"../../skia/types\";\nimport { Skia } from \"../../skia\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nconst runtime = Rea.createWorkletRuntime(\"video-metadata-runtime\");\n\ntype VideoSource = string | null;\n\nexport const useVideoLoading = (source: VideoSource) => {\n const runOnJS = Rea.runOnJS;\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 Rea.runOnRuntime(runtime, cb)(source);\n }\n }, [source]);\n return video;\n};\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAG3C,SAASC,IAAI,QAAQ,YAAY;AAEjC,OAAOC,GAAG,MAAM,mBAAmB;AAEnC,MAAMC,OAAO,GAAGD,GAAG,CAACE,oBAAoB,CAAC,wBAAwB,CAAC;AAIlE,OAAO,MAAMC,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAMC,OAAO,GAAGL,GAAG,CAACK,OAAO;EAC3B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGT,QAAQ,CAAe,IAAI,CAAC;EACtD,MAAMU,EAAE,GAAIC,GAAW,IAAK;IAC1B,SAAS;;IACT,MAAMC,GAAG,GAAGX,IAAI,CAACY,KAAK,CAACF,GAAG,CAAU;IACpCJ,OAAO,CAACE,QAAQ,CAAC,CAACG,GAAG,CAAC;EACxB,CAAC;EACDb,SAAS,CAAC,MAAM;IACd,IAAIO,MAAM,EAAE;MACVJ,GAAG,CAACY,YAAY,CAACX,OAAO,EAAEO,EAAE,CAAC,CAACJ,MAAM,CAAC;IACvC;EACF,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAOE,KAAK;AACd,CAAC"}
|
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.
|
10
|
+
"version": "1.3.6",
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
12
12
|
"main": "lib/module/index.js",
|
13
13
|
"react-native": "src/index.ts",
|
@@ -10,11 +10,12 @@ const runtime = Rea.createWorkletRuntime("video-metadata-runtime");
|
|
10
10
|
type VideoSource = string | null;
|
11
11
|
|
12
12
|
export const useVideoLoading = (source: VideoSource) => {
|
13
|
+
const runOnJS = Rea.runOnJS;
|
13
14
|
const [video, setVideo] = useState<Video | null>(null);
|
14
15
|
const cb = (src: string) => {
|
15
16
|
"worklet";
|
16
17
|
const vid = Skia.Video(src) as Video;
|
17
|
-
|
18
|
+
runOnJS(setVideo)(vid);
|
18
19
|
};
|
19
20
|
useEffect(() => {
|
20
21
|
if (source) {
|