I have created a video texture, and am playing it on the screen, using Pixi, like so:
var texture = PIXI.Texture.fromVideo('video.mp4');
var app = new PIXI.Application(1600, 700, { transparent: true });
document.body.appendChild(app.view);
var video = new PIXI.Sprite(texture);
video.width = 1600;
video.height = 700;
app.stage.addChild(video);
The video automatically begins playing when added, and everything is great. However, I then want to be able to restart the video on command so I've added the following function:
function replay(){
texture.baseTexture.source.currentTime = 0;
texture.baseTexture.source.play();
}
Which seems to work; however, in Firefox, about one in every five times of calling the function this warning appears:
Error: WebGL warning: texSubImage2D: Source must not be null.
Again, everything seems to work - the video does restart and play through again, but the presence of this warning makes me a bit nervous.
What is the cause of this warning and what can be done to prevent it from being thrown?