Hide "Media Control Card" based on Soundbar Source

Hi everyone,

I’m fairly new to Home Assistant so please excuse my ignorance.

I have added a “Media Control Card” to control my Sonos Soundbar. This is useful when I’m playing music directly to my Sonos Soundbar, but it becomes pretty useless when the Soundbar is being used for Television content. Therefore, I want to hide the “Media Control Card” if the Soundbar Source is set to “TV”. I use Apple Music to play content on my Soundbar (If this helps).

I am able to see the Source of Soundbar, but this is for the “Entity Badge”, I’m not seeing the option available when I look in the “visibility” section of the “Media Control Card”.

Can anyone assist with how I’m able to get this working, or even if it’s possible?

Thank you,

I use a custom component for a similar use case:

Now, tbh, I didn’t follow the recent builtin UI improvements, so somebody else could come with a solution without a custom component.