Conditionally previewing selected option image

I am creating a field where the user can toggle within an image/video media type.
On image being selected, the panel will preview an image, but on toggling to video, the preview will keep showing the image previously selected.

Is there a way I can allow the panel to preview an image (I have a video poster field too when toggling to video option) based on which option is toggled?

Thanks a lot in advance!

Iā€™m missing a bit of context. Are you talking about a custom field? Or a files field with an image query? Could you please provide more specific information?