How to use media field with entity browser widget in a frontend theme?
I found the solution.

I just copied the media.html.twig template from classy theme to my custom theme which did not work.

We need to copy this file also container.html.twig to our custom theme's templates directory then it will work.