title: Load video source into videojs or mediaelementjs dynamically from ajax?
body: <p>I need to load video source, multiple types, from another website, which on get returns text link into video.</p>
  
  <p>For example i open:</p>
  
  <p><a href="http://www.getthisvideoexample.com?whichvideo=id0" rel="nofollow">http://www.getthisvideoexample.com?whichvideo=id0</a></p>
  
  <p>it shows in web browser text link:
  <a href="http://someotherserver.com/somesubdomainrandomuniquenumber/thisisyourvideovalidforsometime.mp4" rel="nofollow">http://someotherserver.com/somesubdomainrandomuniquenumber/thisisyourvideovalidforsometime.mp4</a></p>
  
  <p>or
  <a href="http://www.getthisvideoexample.com?whichvideo=id0&amp;webm=true" rel="nofollow">http://www.getthisvideoexample.com?whichvideo=id0&amp;webm=true</a></p>
  
  <p>and it shows in web browser text link:
  <a href="http://someotherserver.com/somesubdomainrandomuniquenumber/thisisyourvideovalidforsometime.webm" rel="nofollow">http://someotherserver.com/somesubdomainrandomuniquenumber/thisisyourvideovalidforsometime.webm</a></p>
  
  <p>But this server sometimes, when load is high,returns 500 error.
  So i need to handle it all.</p>
  
  <p>Lets take for example:</p>
  
  <pre><code>&lt;video id="myVideo"&gt;&lt;/video&gt;
  var player = new MediaElementPlayer('#myVideo', {
  type: ['video/mp4', 'video/webm'],
  success: function (mediaElement, domObject) {
  
      var sources = [
          { src: "HOW_TO_PUT_HERE_DYNAMICALLY_LOADED_MP4_LINK?", type: 'video/mp4' },
          { src: "HOW_TO_PUT_HERE_DYNAMICALLY_LOADED_WEBM_LINK?", type: 'video/webm' }
      ];
  
      mediaElement.setSrc(sources);
      mediaElement.load();
      mediaElement.play();
  }
  </code></pre>
  
  <p>});</p>
  
  <p>Also how to make it so, that if 500 or other error is returned instead of link to video, code will just wait few seconds and try again, or display message with text "trying again, wait...."?
  Thanks.</p>