Glade to see this function is moved here. Please also change view.js to use media_utils.js.