Nokia 5 on 7.1.2 here. I had never captured a photo while listening to music. I am facing the same issue. Weird Bug !
Hi Anna / Moderator.
I hope this bug can be reported to the Developer teams.
I had a chat with Nokia support. They asked me to switch off the Camera Shutter sound and this is the reason the main speakers get activated and the music resumes playback on both speaker and headphones. But I'm unable to switch off the camera shutter sound after reinstalling the default camera application.
Couldn't get any response from the Camera app team on Play store. I found the below link in FAQs