There is no auto restart built into the camera or the API. You may be able to use a task management application like tasker. However, I have not tried it and do not know the capabilities.
Another approach is to build a plugin to do this. However, I have not see a plugin that can take this approach. It’s a good idea.