8thwall anable Audio on video recording

Hi theree!

So im using 8ThWall with its XRextras XR8.MediaRecorder. Now i need to have also the audio recorded, when the user is recording a video.

Im not sure, how to achieve this in Playcanvas, because in my opinion its not that good referenced in their excamples.

Found some information on this side of their docs, but maybe somebody can explain to me what i need to pass there? Is it the PlayCanvas Sound component i would have to reference for “audioContext”?

Thanks a lot!

You can try getting the AudioContext instance via the engine internals engine/src/platform/sound/manager.js at c3c7e6cf0143b3aa87f44a314c627a5a9e6c3f80 · playcanvas/engine · GitHub

From a script, it be

this.app.systems.sound.context

Hi @yaustar,

thanks for your fast reply - i tried your approach and adjusted the configure function like:

const pcAudioContext = this.app.systems.sound.context;

XR8.MediaRecorder.configure({
      maxDurationMs: 15000,
      enableEndCard: false,
      requestMic: XR8.MediaRecorder.RequestMicOptions.MANUAL,
      audioContext: pcAudioContext,
  });

But still the video has no audio recorded - not sure whats missing here to make this work. There is no excample i could find with a configure setup made in PlayCanvas …

Is this excample somehow adjustable for PlayCanvas scope (from the documentation referenced above)?

const userConfiguredAudioOutput = ({microphoneInput, audioProcessor}) => {
  const myCustomAudioGraph = ...
  myCustomAudioSource.connect(myCustomAudioGraph)
  microphoneInput.connect(myCustomAudioGraph)

  // Connect audio graph end node to hardware.
  myCustomAudioGraph.connect(microphoneInput.context.destination)

  // Audio graph will be automatically connected to processor.
  return myCustomAudioGraph
}
const threejsAudioContext = THREE.AudioContext.getContext()
XR8.MediaRecorder.configure({
  configureAudioOutput: userConfiguredAudioOutput,
  audioContext: threejsAudioContext,
  requestMic: XR8.MediaRecorder.RequestMicOptions.AUTO,
})

im not sure if the audioContext is relevant or the configureAudioOutput parameter… what would the “myCustomAudioGraph” in this context? :roll_eyes:

Based on their parameter description defining the audioContext should enough to have audio / ingame sound recorded by the video too.

I would check that the code I gave you actually returns an audio context object, beyond that I can’t really help and you would be better off asking on the 8th Wall Slack and/or digging into the PlayCanvas engine source

@yaustar

yes the code returns an audio context - i wrote them too - lets see, if there is an answer in time.

Thank you anyway for your input!