Capturing audio in the scene can be tricky, especially when trying to capture audio from a video texture.
We have a sample project demonstrating how to include scene audio in A-Frame with MediaRecorder, which is done with xrextras-capture-config and <a-entity sound>
.
Unfortunately, a video texture is not considered βscene audioβ. As a workaround, I suggest following the same approach as the sample project and manually playing the sound via its own entity and muting the video track itself.
For example:
<!-- html -->
<a-scene>
<a-assets>
<video id="video" src="./assets/video-sound.mp4" muted></video>
<audio id="audio" src="./assets/video-sound.mp4"></audio>
</a-assets>
<xrextras-capture-config request-mic="manual" ...></xrextras-capture-config>
<a-camera position="0 1 2">
<a-entity sound="src: #audio"></a-entity>
</a-camera>
<a-box material="src: #video"></a-box>
</a-scene>
// js
const playVideo = () => {
const video = document.getElementById('video')
const audio = document.querySelector('[sound]')
audio.components.sound.playSound()
video.play()
}
window.addEventListener('click', playVideo)
Let us know how things go!