code: function waitForReadyState(element, readyState, interval, done) {
    var timer = setInterval(function() {
      if (element.readyState >= readyState) {
        clearInterval(timer);
        done(null, true);
      }
    }, interval);
  }
docs: Wait for an element to reach the given readyState by polling. The HTML5 video element exposes a `readystatechange` event that could be listened for instead, but it seems to be unreliable on some browsers.