-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'. #392
Comments
Can you please check if the above commit fixes your problem? I'm a bit baffled that you saw this particular error message, since |
I'll test this over the coming days, but my initial tests have been positive--it looks to be OK. Thanks a lot. |
I'm still hitting this. It's triggered by a re-render in React, so it's probably my bug vs. yours, but in case you're interested, this is what I see:
|
I removed my effect's cleanup logic, and this goes away: useEffect(() => {
let player;
function destroy() {
if (player) {
player.destroy();
player = null;
}
}
const canvasElem = canvasElemRef.current;
if (!(canvasElem && canvasElem instanceof HTMLCanvasElement)) {
return destroy();
}
if (!isVisible) {
return destroy();
}
try {
player = new window.JSMpeg.Player(src, {
canvas: canvasElem,
audio: false,
});
} catch (err) {
console.warn(err);
destroy();
}
// This is causing the crash for me, removing makes things work
// return () => {
// destroy();
// };
}, [src, canvasElemRef, isVisible]) |
Considering that this happens on re-render, only when you previously call If the element is indeed re-used, then Can you try to explicitly re-create the |
I'm using jsmpeg in React, and sometimes I get this
Failed to execute 'shaderSource'
error (usually on tear-down or some re-render), I suspect due to React destroying the canvas context when jsmpeg doesn't expect it.I notice that mapbox-gl-js had a similar issue, and added checks on the context being lost. Not a deal breaker, but probably something that someone with more knowledge of WebGL could fix.
Regardless, this thing is absolutely amazing. Thanks for sharing, it works so well!
The text was updated successfully, but these errors were encountered: