Integrate DeepAR Shoes try-on SDK with react

242 Views Asked by At

I am trying to implement DeepAR SDK for shoe try-on in my react app but when I try to instantiate DeepAR class I got a weird error:

Uncaught (in promise) RuntimeError: Aborted(both async and sync fetching of the wasm failed). Build with -sASSERTIONS for more info.
    at q2 (deepar.esm.js:1:676382)
    at Q2 (deepar.esm.js:1:676689)
    at deepar.esm.js:1:755786

I tried to put those files in public folder, and inside src but it didn't work.

 const deepar = new DeepAR({
    canvas,
    licenseKey: import.meta.env.VITE_DEEPAR_SDK_KEY,
    deeparWasmPath: "../lib/wasm/deepar.wasm",
    footTrackingConfig: {
      poseEstimationWasmPath: "../lib/wasm/libxzimgPoseEstimation.wasm",
      detectorPath: iosDetected
        ? "../lib/models/foot/foot-detector-ios.bin"
        : "../lib/models/foot/foot-detector-android.bin",
      trackerPath: iosDetected
        ? "../lib/models/foot/foot-tracker-ios.bin"
        : "../lib/models/foot/foot-tracker-android.bin",
      objPath: "../lib/models/foot/foot-model.obj",
    },
    callbacks: {
      onInitialize: () => {
        deepar.startVideo();
        // deepar.switchEffect(0, "mask", "/effects/Shoe_PBR");
      },
      onCameraPermissionAsked: () => console.log("onCameraPermissionAsked"),
      onCameraPermissionGranted: () => console.log("onCameraPermissionGranted"),
      onCameraPermissionDenied: () => console.log("onCameraPermissionDenied"),
      onVideoStarted: () => console.log("onVideoStarted"),
      onError: (error) => console.log("onError", error),
    },
  });
0

There are 0 best solutions below