title: H264 video works using src attribute. Same video fails using the MediaSource API (Chromium)
body: <p><a href="http://www.youtube.com/html5" rel="noreferrer">http://www.youtube.com/html5</a> indicates that Google Chrome is compliant with MediaSource Extensions &amp; H.264. </p>
  
  <p>I make a simple test checking that my video is supported by Chromium, using the 
      &lt;video id='player' autoplay='true'>
          &lt;source src='/test.mp4'  type='video/mp4' />
      &lt;/video></p>
  
  <p>The video plays smoothly.</p>
  
  <p>A second alternative that also works fine consists in loading through AJAX the byte chain and converting the buffer to a URI object. Then asigning such URI to the (video) source.src attribute. </p>
  
  <p>Finally I try to load the same video through AJAX and inject it into a MediaSource Buffer. It fails with the error 4. (Source Not supported). </p>
  
  <p>The code used is similar to:</p>
  
  <pre><code>var mediaSource = new (window.MediaSource || window.WebKitMediaSource)();
  window.video = document.getElementById('video1');
  window.video.addEventListener("error", function onError(err) {
      alert("window.video error detected:");
      console.dir(window.video.error); window.worker.terminate();
  }); 
  window.video.pause();
  window.video.src = URL.createObjectURL(mediaSource);
  var onMediaSourceOpen = function (e) {
      mediaSource.removeEventListener('sourceopen', onMediaSourceOpen);
      window.videoSource = mediaSource.addSourceBuffer('video/mp4;codecs="avc1.4d001e,mp4a.40.2"');
      injectVideoIntoBuffer();
  }   
  
  mediaSource.addEventListener('sourceopen', onMediaSourceOpen);
  
  var injectVideoIntoBuffer = function onResponse() {
      var xhr = new XMLHttpRequest();
      xhr.open('GET', "test.mp4");
      xhr.responseType = 'arraybuffer';
      xhr.addEventListener("readystatechange", function () {
           // Next line raises a MediaError, code: 4, (MEDIA_ERR_SRC_NOT_SUPPORTED)
           videoSource.appendBuffer(new Uint8Array(xhr.response));
            ... 
      }, false);
      xhr.send();
  }
  </code></pre>
  
  <p>I tried different mp4 files, generated either with ffmpeg/avconv or MP4Box. Not luck at this moment. A similar code works fine with VP8/WebM test files.</p>
  
  <p>Thanks in advance for any help/hint or link!</p>
  
  <p>Enrique</p>