moved UI select media logic into a function to fix a render issue at init time