我试图将ARCore用于Android上的增强现实应用程序,我想在检测到图像时显示视频,该应用程序可以很好地检测到图像,但未显示视频,我使用了ChromaKey示例作为指导,我不确定是什么问题。
这是我的应用程序的oncreate方法
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>test</title>
</head>
<body>
<label>Goals:</label>
<input type="text" class="input-box" id="goals" />
<input
type="button"
name="submit"
value="Submit"
class="button"
id="submit"
/>
</body>
<script
src="https://code.jquery.com/jquery-3.4.1.js"
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
crossorigin="anonymous"
></script>
<script src="./app.js"></script>
</html>
这是我进行增强图像识别的地方
// Gather Inputs
let goals = document.getElementById("goals").value;
console.log("goals");
$("#submit").click(function() {
// Check Goals Input
if (goals === "") {
console.log("fail");
} else {
window.print();
}
});
最后这是我用来显示视频的方法
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
arFragment = (CustomArFragment) getSupportFragmentManager().findFragmentById(R.id.ux_fragment);
arFragment.getArSceneView().getScene().addOnUpdateListener(this);
arFragment.getPlaneDiscoveryController().hide();
texture = new ExternalTexture();
mediaPlayer = MediaPlayer.create(this, R.raw.vid);
mediaPlayer.setSurface(texture.getSurface());
}