如何将 如下语句(new引用挂在cdn上的脚本)改为import

源代码如下:
`const hands = new Hands({locateFile: (file) => {
return https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file};
}});`
源于https://google.github.io/medi...

现在通过npm install ,本地已经下好了 @mediapipe/hands 这个包,我希望调用他 demo中的hands.setOptions方法

如何改为通过import等方式调用本地下好的包

另外

const camera = new Camera(videoElement, {
  onFrame: async () => {
    await hands.send({image: videoElement});
  },
  width: 1280,
  height: 720
});

是否需要同样进行修改呢,如果需要 怎么修改

阅读 1.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题