it works.
I have a collection with a field named file which is of media type.
following is the code:
var mediaid = 12;
fetch('http://localhost:1337/api/sample-medias/' + mediaid + "?populate=file")
.then(function (response) {
return response.json();
}).then(function (data) {
console.log(data);
});