I think this code run on local browser . During developement the camera access is silently denied. Its need domain host .