<!doctype html>
<html>
<head>
<title>multiple pseudo scenes</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/aframe/0.5.0/aframe.js">
</script>
</head>
<body>
<a-scene>
<a-assets>
<video id="video-src" autoplay="false" src="https://www.youtube.com/watch?
v=Uz12cLvkVYY"></video>
</a-assets>
<a-video id="video-screen" src="#video-src" position="1.591 2.206 -11"
width="30" height="13">
</a-video>
</a-scene>
</body>
</html>
这是我的代码。我想使用帧在场景中加载 youtube 视频。但它没有显示任何内容。如何使用 a-frame 加载 YouTube 视频?
最佳答案
如果您可以将 youtube URL 放入 <video>
中,将会非常方便标签,但不幸的是,这不是它的工作原理。要在您的页面中嵌入 youtube 视频,您需要遵循 youtube 中的一种方法 API ,最终以一种或另一种方式在包含视频的页面中插入 iframe。
和iframes can't be used inside a-frame :
There is no way for the browser to display
<iframe>
s within WebGL. While it is possible to overlay an<iframe>
on top of the canvas, the<iframe>
will not display in VR nor can it integrate with the scene.
进一步在 a-frame 文档中,youtube 是 specifically mentioned :
Can I render YouTube videos as a texture? No. You could proxy YouTube videos as a texture or download them locally to serve, but that is against their terms of service.
...这表明视频是可能的,但 youtube 不是(出于法律原因,而不是技术原因)。如果您需要这样做,您将需要一个非 YouTube 视频源。
关于html - Youtube 视频以一帧加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48623223/