Open ddgg-el opened 5 months ago
I've got a goofy workaround, which is to define CanvasRenderingContext2D
in the web worker scope.
declare let self: WorkerGlobalScope &
typeof globalThis & {
CanvasRenderingContext2D: typeof OffscreenCanvasRenderingContext2D;
};
self.CanvasRenderingContext2D = OffscreenCanvasRenderingContext2D;
DrawingUtils
seems perfectly happy with this.
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
macOS 12.6
MediaPipe Tasks SDK version
npm package version 0.10.12
Task name (e.g. Image classification, Gesture recognition etc.)
Pose Landmarker
Programming Language and version (e.g. C++, Python, Java)
Typescript
Describe the actual behavior
Instanciating a DrawingUtils with an OffscreenCanvasRenderingContext2D as cpuContext in Worker returns an Uncaught ReferenceError: CanvasRenderingContext2D is not defined
Describe the expected behaviour
a DrawingUtils is properly Instantiated
Standalone code/steps you may have used to try to get what you need
Other info / Complete Logs