Closed qasymcorp closed 10 months ago
Microphone.End(microphoneName)
before proceeding to the part where I use the screen recordingI would like you to test it in a new project. Just the webcam demo scene with microphone selected. That should determine if the issue is either: a) It works - AVPro Movie Capture is not having issues finding your mic, so its probably something in your code preventing it b) It doesn't work - AVPro Movie Capture isn't finding your mic for some reason
I found the issue here.
WebCamTexture
to record the cameraCaptureFromWebCamTexture
to the texture from step 2 (also added two buttons to start and stop capturing)The problem is how PrepareCapture
method is implemented
Consider the following code:
using RenderHeads.Media.AVProMovieCapture;
using UnityEngine;
namespace UnitedAssociates.AVProMovieCapture
{
public class RecordingManager : MonoBehaviour
{
private CaptureFromWebCamTexture recorder;
[SerializeField] private DeviceCamera deviceCamera;
private void Awake()
{
recorder = gameObject.AddComponent<CaptureFromWebCamTexture>();
recorder.CompletedFileWritingAction += OnRecordingFinished;
}
private void Start()
{
recorder.AudioCaptureSource = AudioCaptureSource.Microphone;
recorder.SetSourceTexture(deviceCamera.FrontCamera);
recorder.PrepareCapture();
}
public void OnStartRecordingButtonClicked()
{
recorder.StartCapture();
}
public void OnStopRecordingButtonClicked()
{
if (recorder.IsCapturing())
recorder.StopCapture();
}
private void OnRecordingFinished(FileWritingHandler obj)
{
Debug.Log($"Path: {obj.Path}");
}
}
}
Intuitively it seemed to me that I need to put PrepareCapture
in the Start
method so that it prepares all the necessary resources before actually starting the capture.
If you run the code as it is in this case, it is going to say "No microphone was found" (even though I can clearly see how I am using it)
If you run the code with the recorder.PrepareCapture();
line commented out (or removed), it is going to record everything quite well.
I attached the unitypackage file with the scene and scripts (I hope it works!) [redacted]
Let me know if you have any questions
During my troubleshooting process, I found myself reflecting on the purpose of this particular method and its relevance to my implementation. In an effort to gain a deeper understanding, I attempted to access the documentation to review the method's description. Regrettably, my search for this information was unsuccessful.
The package's included documentation did not yield the method description I was seeking, and even when I tried to use Ctrl
+ F
within the provided PDF, I couldn't locate any relevant details. The online documentation, although informative with method names and arguments, lacked the comprehensive descriptions I needed.
I am writing to inquire if there might be an alternate source of documentation or if I may be overlooking a specific resource. If there is indeed a more comprehensive guide or any supplementary information available, I would greatly appreciate your guidance on how to access it.
Were you able to reproduce the error? Any updates?
Description When I want to record, it works fine but it doesn't record sounds. I do receive a warning saying "No microphone found", though in the same build I do use microphone somewhere else before
Your Setup (please complete the following information):
recorder.AudioCaptureSource = AudioCaptureSource.Microphone
To Reproduce Steps to reproduce the behavior:
Logs I added
Debug.LogWarning($"Microphone.devices[0] = {Microphone.devices[0]}");
into one of my scripts just to show that Microphone actually exists and it worksScreenshots
Videos