HDMI Sound Output and Video Issues

I assumed wrong that Analog audio and HDMI would be a different audio devices rather than sub-device on same device

Try this to add new Pulseaudio module temporarily
pactl load-module module-switch-on-connect
that should handle automatic switching to HDMI and back

If it doesn’t work right for your needs, reloading Pulseaudio will remove it
can use command pulseaudio -k && pulseaudio --start
but log out or restart pc will also reload Pulseaudio

if you are happy with how that works, it can be added to Pulseaudio permanently
sudo nano /etc/pulse/default.pa
must use sudo to save changes, but can change nano for name of another text editor if preferred
Add this line to end of file
load-module module-switch-on-connect
Save changes and close text editor
reload Pulsaudio (see earlier)

There is another way to do this by changing card profile in Pulseaudio,
but is more complicated setting up udev rule to do it automatically