Open jackbdu opened 4 months ago
We need to remove this call: https://github.com/ml5js/ml5-next-gen/blob/542e5a5171a428e807451ca901cc130b54d6f8e9/src/BodyPose/index.js#L56 (and any others like it)
There will be no window._incrementPreload
when using instance mode because _incrementPreload
will be a property of the p5 instance, rather than a property of the window.
I'm also getting an error for preloading
ml5.bodySegmentation
in instance mode, and that could be fixed by declaring a global variablelet video;
.
Likely we have some code that is using an improperly scoped video
variable. We definitely should not have a global/window scoped video
variable anywhere. I suspect it's an issue where we are using this.video
in a context where this
is actually the window. That sort of thing can be fixed by binding the function to the correct this
context. I would need to dig into the code to find where the bad variable is.
We're using a variable video
that doesn't exist on like 34 of BodySegmentation
.
Creating a new issue to track the progress of this:
@lindapaiste Thank you for adding support for instance mode. I was able to preload most models (
ml5.faceMesh
,ml5.handPose
,ml5.imageClassifier
,ml5.neuralNetwork
, andml5.sentiment
) but I'm getting an error forml5.bodyPose
. See this minimal sketch demonstrating the issue. I also included my temporary fix in the comments, which creates blankwindow._incrementPreload()
andwindow._decrementPreload()
to avoid this error.I'm also getting an error for preloading
ml5.bodySegmentation
in instance mode, and that could be fixed by declaring a global variablelet video;
.Originally posted by @jackbdu in https://github.com/ml5js/ml5-next-gen/issues/81#issuecomment-2067780151