Record video/audio in the background

Hey there! I’m looking for a solution to start recording video/audio through my app while the app is still in the foreground. So, the video/audio recording should happen in the background and stop whenever I press the stop button in my app. Is something like this even possible?

If this is possible as PIP even better. The important goal is to be able to record while still using the app.

Thank you!

Anyone, any ideas? Is something like this even possible?