refactor getuserMedia timing