Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

url

youtube

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> 
like image 708
kulls Avatar asked Oct 28 '15 10:10

kulls


People also ask

What is a blob url?

Blob URLs contain pseudo protocols that can create a temporary URL to audio and video files. This type of URL essentially acts as a fake source for the media on the website, so you can’t download it directly. Instead, you have to use third-party conversion tools.

How to download Blob video?

How to Download Blob Videos? Method 1. Download with Direct Video URL (Work with Most Sites) Method 2. Download with M3U8 Playlists (Work with Most Sites) Method 3. Download with .mp4 Link (Work with Some Sites) Extra: Can I Convert Blob URL to Normal URL? Disclaimer: This guide is limited to personal fair use only.

How to download blob url videos from cisdem?

Paste the link in the Cisdem app and click on the Download button on the bottom right corner of the screen. 6. The video will download to your computer. Freemake is a highly efficient video converter and downloader that can easily download blob URL videos. Most of the services on the app require the premium package.

What is a blob object in JavaScript?

A Blob object represents a file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system.


2 Answers

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); } 
like image 184
aptx4869 Avatar answered Sep 20 '22 12:09

aptx4869


It indicates that the url was created using the createObjectURL static method of the URL object .. createObjectURL takes a single parameter which should be one of either a Blob, a File, or MediaSource object, and it returns a url which represents the object given by parameter. (see MDN - URL.createObjectURL)

You can try console.log(URL.createObjectURL(new MediaSource())); in the console to demonstrate that it creates a "blob:https://...(url)...". However, you would normally set the src attribute of a video element to reference the created object url which itself is a reference to the MediaSource object. You can then fetch the stream of a video asset using XMLHttpRequest and append the response as a buffer to the MediaSource object, the exact details of which you can learn from this live demo found on https://developer.mozilla.org/en-US/docs/Web/API/MediaSource#Examples .. This allows greater control over the stream which, e.g., you could use to allow features such as playback speed and video quality adjustment.

But this is the old way of doing things from what I've read, and support will eventually be dropped from newer browsers (see "browsers are removing support for doing this"). The new way is to just set the srcObject attribute of the video element to reference the MediaSource object directly, instead of having to do the intermediate step of creating an object url using URL.createObjectURL (see MDN - srcObject attribute) ..

like image 36
Quinn Dirks Avatar answered Sep 17 '22 12:09

Quinn Dirks