What is blob in the <video src=blob:url>?

kulls picture kulls · Oct 28, 2015 · Viewed 36.3k times · Source

Can anyone explain what the blob: indicates in the URL in this video tag?

<video class="" 
       style="width: 640px; height: 360px; left: 0px; top: 0px; transform: none; opacity: 1;" 
       src="blob:https://www.youtube.com/5c42620b-a028-451b-9b64-424996802355">
</video>

Answer

aptx4869 picture aptx4869 · Sep 19, 2016

That is a youtube video with shaka player which plays DASH content without browser plugins using Media Source Extensions.

The blob url is generated by createObjectURL. for example:

var video = document.querySelector('video');

var assetURL = 'frag_bunny.mp4';
// Need to be specific for Blink regarding codecs
// ./mp4info frag_bunny.mp4 | grep Codec
var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"';

if ('MediaSource' in window && MediaSource.isTypeSupported(mimeCodec)) {
  var mediaSource = new MediaSource;
  //console.log(mediaSource.readyState); // closed
  video.src = URL.createObjectURL(mediaSource);
  mediaSource.addEventListener('sourceopen', sourceOpen);
} else {
  console.error('Unsupported MIME type or codec: ', mimeCodec);
}