0

I've been Googling around trying to find out to create blob URLs for iFrame and while i'm completely new to javascript iv'e managed to splice some code together which mostly works, however it's not loading the video.

HTML:

<iframe class="test" width="500" height="300" />

JAVASCIPT:

var url = `https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_30mb.mp4`;

var blob = new Blob([url], {type: 'video/mp4'});
var iframe = document.querySelector(".test");
iframe.src = URL.createObjectURL(blob);

can someone point out why this isn't working for me ? Like i said i'm new, so if possible could you kind of explain it instead of just supplying the answer.

Thanks, Paul.

Uncaught TypeError: Failed to construct 'Blob': The provided value cannot be converted to a sequence.
at window.onload

(index):34 Uncaught ReferenceError: html is not defined
at window.onload
  • Iv'e added it to the post – Paulamonopoly Nov 20 '19 at 00:30
  • Does this answer your question? [How to get a file or blob from an object URL?](https://stackoverflow.com/questions/11876175/how-to-get-a-file-or-blob-from-an-object-url) – Bagus Tesa Nov 20 '19 at 01:27
  • 1
    In the `new Blob` constructor, the first parameter must be the actual data, not the address at which the data can be found. Also, are you sure you need an iFrame at all here? What about just using [the ` – Cédric Van Rompay Aug 24 '20 at 07:38

0 Answers0