Not exactly the same as what you're asking, but Android has a feature that can automatically record up to 45 minutes of footage, and automatically share with your emergency contacts. Triggered by pressing the power button 5 times. Located under Safety & Emergency settings.