This has been something I've wanted to address ever since I got my new Mac mini, and your post is the first search result that comes up which isn't already archived. After jumping through a lot of archived threads with partial information, I think I found a way to make the popup stop recurring in Big Sur:
- Go to System Preferences -> Sharing
- Select "Media Sharing" in the left pane
- Check the "Share media with guests" box in the right pane
- The firewall prompt will pop up, I chose deny, but it should theoretically be safe to allow
- Uncheck the "Media Sharing" box in the left pane
- Uncheck the "Share media with guests" box in the right pane
If you look at your firewall settings, mediasharingd will now be listed, and you can switch between allow and deny in the future if you need to. Because a setting has been chosen, the pop-up shouldn't occur anymore.