Reputation: 1719
I recently updated Unity to 5.5.1 (also tested Unity 5.5.2p2) and my custom video player is no longer working on Chrome. It works on Firefox and Edge however and continues to work on Chrome when building with 5.3
The error I'm getting is this:
[.Offscreen-For-WebGL-000001C45847DE90]GL ERROR :GL_INVALID_OPERATION : glCopyTextureCHROMIUM: texture is immutable
I'm not sure which code is generating this error but here's what we're doing in Javascript land to display the video:
WebGLMovieTextureCreate: function(url)
{
var str = Pointer_stringify(url);
var video = document.createElement('video');
video.style.display = 'none';
video.src = str;
video.crossOrigin='anonymous';
return videoInstances.push(video) - 1;
},
WebGLMovieTextureUpdate: function(video, tex)
{
if (videoInstances[video].paused)
return;
GLctx.bindTexture(GLctx.TEXTURE_2D, GL.textures[tex]);
GLctx.texImage2D(GLctx.TEXTURE_2D, 0, GLctx.RGBA, GLctx.RGBA, GLctx.UNSIGNED_BYTE, videoInstances[video]);
},
WebGLMovieTexturePlay: function(video)
{
videoInstances[video].play();
},
Anyone familiar with the error that could recommend a work around?
Upvotes: 1
Views: 1858
Reputation: 154
I had the same problem. After digging into it I started to look at the logs closely and noticed that Unity 5.5.2 has a message like the following on startup.
Initialize engine version: 5.5.2f1 (3829d7f588f3)
UnityLoader.js:2 Creating WebGL 2.0 context.
Renderer: WebKit WebGL
Vendor: WebKit
Version: OpenGL ES 3.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium))
GLES: 3
Compared to Unity 5.4 has a message:
Initialize engine version: 5.4.0f3 (a6d8d714de6f)
Creating WebGL 1.0 context.
Renderer: WebKit WebGL
Vendor: WebKit
Version: WebGL 1.0 (OpenGL ES 2.0 Chromium)
GLES: 0
Notice that the API versions are different. After seeing that I went to the WebGL Player settings and under 'Other Settings' you can uncheck 'Auto Graphics API' and remove WebGL 2.0 support which will force Unity back to the old API. I don't know how to fix this for WebGL 2.0 but that should at least make your video work.
Note: * This is a decent enough workaround assuming you don't need access to the newer API. I'm hopeful someone will have a better answer and know how to fix the code for the new API.
Upvotes: 1