This happened to me (microphone didn't work, speaker phone and video recording did) in May 2018 after an upgrade to Android 8.1.0. Google Support had me place the phone in safe mode (hold power button down until 'safe mode' option appears) which disables 3rd party apps. Once in safe mode the microphone started working again which indicated the problem was in an app/OS conflict. Technician recommended I delete apps one or two at a time and test after each one to see which caused the problem but I was on travel with no good way to test so I deleted a large swatch of apps at once (primarily store/weather/beach) and then tried. Problem has disappeared. I'll reinstall apps as needed until problem occurs again.