This is possible due to Bluetooth Profiles, commonly known as A2DP (Advanced Audio Distribution Profile), HFP (Hands-Free Profile). Android P might bring the HID aka Human Interface Device profile, ...
I test drove the new Android Desktop Mode with my Pixel, and it genuinely wowed me ...