I am trying to provide recording functionality (save gameplay as video file) for my Unity WebGL game.
I can easily record video stream (via javascript plugin) as
let canvasStream = canvas.captureStream();
But I fail to record audio.
I can go with
stream = await navigator.mediaDevices.getUserMedia(constraints);
But I don’t like this method. It creates popup, interrupting the game. I’d like it to go smoothly, without interruption.
I see the WEBAudio
object created on the page with WEBAudio.audioInstances, WEBAudio.audioContext
, etc. But I failed to get audio stream from there.
No errors logged and no audio in my recording. Just video.
Appreciate your help and advice on how to get Audio Stream from any of these available objects:
WEBAudio
WEBAudio.audioContext
WEBAudio.audioContext.destination
WEBAudio.audioInstances[1].buffer
WEBAudio.audioInstances[1].getNumberOfChannels()
WEBAudio.audioInstances[2].gain
Thank you.