With engine 166.3 my video playback seems to work fine and runs at the start of the game however, with engine updates 1.67.2 and 1.67.3 the same video no longer plays back. The sound seems to play fine and all my debug info seems to think there is no issue (no errors)
My code and project is long and complicated so its not easy to simply describe what’s going on. All I know is that this just stopped working today when my engine updated. When I use the older engine 1.66.3 it works fine.
Anti aliasing didn’t change anything. I did a capture with Spector.js. Ive never used it before though so I have no idea what Im looking at with the results. I went through with it and nothing particularly stands out.
I do see the following warning repeated in the latest engine version:
GL_INVALID_OPERATION: The destination level of the destination texture must be defined
This does not appear in 1.66.3
Could this be related? What does it mean and how can I resolve it?
Thanks, unfortunately the video still doesn’t play and I get the long list of warnings when it tries to play:
[.WebGL-00007750046F1C00] GL_INVALID_OPERATION: The destination level of the destination texture must be defined.
I get the same problem. I used the code from the video texture tutorial with only slight modifications and get the same error about destination.
Here is my code it is attached to the root of the scene.
var VideoTexture = pc.createScript('videoTexture');
VideoTexture.attributes.add('video', {
title: 'Video',
description: 'MP4 video asset to play back on this video texture.',
type: 'asset'
});
VideoTexture.attributes.add('playEvent', {
title: 'Play Event',
description: 'Event that is fired as soon as the video texture is ready to play.',
type: 'string',
default: ''
});
// initialize code called once per entity
VideoTexture.prototype.initialize = function() {
var app = this.app;
// Create HTML Video Element to play the video
var video = document.createElement('video');
video.autoplay = true;
video.crossOrigin = 'anonymous';
//video.loop = true;
// muted attribute is required for videos to autoplay
//video.muted = true;
// critical for iOS or the video won't initially play, and will go fullscreen when playing
video.playsInline = true;
//console.log(video.src);
// iOS video texture playback requires that you add the video to the DOMParser
// with at least 1x1 as the video's dimensions
var style = video.style;
style.width = '1px';
style.height = '1px';
style.position = 'absolute';
style.opacity = '0';
style.zIndex = '-1000';
style.pointerEvents = 'none';
document.body.appendChild(video);
// Create a texture to hold the video frame data
this.videoTexture = new pc.Texture(app.graphicsDevice, {
format: pc.PIXELFORMAT_R8_G8_B8,
minFilter: pc.FILTER_LINEAR_MIPMAP_LINEAR,
magFilter: pc.FILTER_LINEAR,
addressU: pc.ADDRESS_CLAMP_TO_EDGE,
addressV: pc.ADDRESS_CLAMP_TO_EDGE,
mipmaps: false
});
this.videoTexture.setSource(video);
video.addEventListener('canplay', function (e) {
app.fire(this.playEvent, this.videoTexture);
console.log("can play fires");
}.bind(this));
// set video source
video.src = this.video.getFileUrl();
this.app.on('button:clicked:PlayButton',function (e) {
video.play();
}.bind(this));
this.app.on('button:clicked:PauseButton',function (e) {
video.pause();
//video.currentTime = 0;
}.bind(this));
this.app.on('button:clicked:ReplayButton',function (e) {
console.log(video.currentTime);
video.currentTime = video.currentTime - 10;
console.log(video.currentTime);
}.bind(this));
this.app.on('button:clicked:GoToTest',function(){
video.pause();
},this);
};
// update code called every frame
VideoTexture.prototype.update = function(dt) {
// Transfer the latest video frame to the video texture
this.videoTexture.upload();
};
When I changed it to autoplay = true then the video plays, otherwise when I have it wait to play with once the button is pressed I only get sound and I get the WebGL error about destination level.
Here is also the code attached to the entity that is the screen of my scene that plays the video.
var UiElement = pc.createScript('uiElement');
UiElement.attributes.add('playEvent', {
title: 'Play Event',
description: 'Set the TV screen material emissive map on this event.',
type: 'string',
default: ''
});
// initialize code called once per entity
UiElement.prototype.initialize = function() {
this.app.on(this.playEvent, function (videoTexture) {
console.log("plays video");
this.entity.element.texture = videoTexture;
}, this);
};
Anyone have any idea on a timeframe for Chromium fixes? Or even if they are ever likely to happen? It’s just that my boss is asking me when the videos will be fixed
Cheers