Refactor mediaSources