If i use chromakey video like below , getting this error . Please look on it also . can we play videos in ARscene . @ThomasGorisse
renderable.getMaterial().setExternalTexture("videoTexture", texture);
renderable.getMaterial().setFloat4("keyColor", CHROMA_KEY_COLOR);
AnchorNode anchorNode = new AnchorNode(anchor);
// Create a node to render the video and add it to the anchor.
Node videoNode = new Node();
anchorNode.setParent(arFragment.getArSceneView().getScene());
videoNode.setParent(anchorNode);
// Vector3 vectorScale = new Vector3(Float.parseFloat(scalex), 0.0001f, Float.parseFloat(scaley));
Vector3 vectorPos = new Vector3(Float.parseFloat(posx), Float.parseFloat(posy),(Float.parseFloat(posz)));
Quaternion rx = Quaternion.eulerAngles(new Vector3(Float.parseFloat(rotatex), 0.0f, 0.0f));
Quaternion ry = Quaternion.eulerAngles(new Vector3(0.0f, Float.parseFloat(rotatey), Float.parseFloat(rotatez)));
// Set Scaling
// videoNode.setLocalScale(vectorScale);
// Set Position
videoNode.setLocalPosition(vectorPos);
// Set Rotation
videoNode.setLocalRotation(Quaternion.multiply(rx,ry));
// Start playing the video when the first node is placed.
if (!mediaPlayer.isPlaying()) {
mediaPlayer.start();
texture.getSurfaceTexture().setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
@Override
public void onFrameAvailable(SurfaceTexture surfaceTexture) {
videoNode.setRenderable(renderable);
texture.getSurfaceTexture().setOnFrameAvailableListener(null);
}
});
} else {
videoNode.setRenderable(renderable);
}
})
.exceptionally(
throwable -> {
Toast toast =
Toast.makeText(this, "Unable to load video renderable", Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
return null;
});`