added error msg and formatted code for webcam permission