How to remove component that is empty on dynamic page?

You can use this example and modify the code to suit your needs here.
https://support.wix.com/en/article/corvid-tutorial-hiding-a-video-player-when-there-is-no-video-to-play