Media element has to be video. Use Image.onload.