made some changes to implement getUserMedia.