typo: media.readystate should be media.readyState