i\'m trying to finish the audio/video recording loop by pressing a key (or by other event), if i use the simple time.sleep() in the main loop work perfectly