question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can It play a blob file?

See original GitHub issue

Should the player be able to play a blob file?

I am trying to download 2 vimeo clips from my vimeo account both with vanilla XHR and with axios, then make them into their respective blob in order to have 'em ready to play without having to load first. I need really quick response and no loading time.

So when I call this.load(url), can url be a blob file?

At the moment, I can’t make it work. Here is the code that I have to fetch the clips. With axios:

  const endpoint = '/oembed.json';

  function fetchRessource(url) {
    return axios(endpoint, {
      method: 'GET',
      baseURL: 'https://vimeo.com/api/',
      params: { url: url, },
      responseType: 'blob',
      onDownloadProgress: event => console.log('Downloading... -> ', event)
    })
      .then(blob => { return blobUtil.createObjectURL(new Blob([blob])) })
      .catch(err => `Could not create the objectURL from the arrayBuffer - ${err}`); // IE10+
  }

  return axios.all([
    fetchRessource(url1),
    fetchRessource(url2)
  ])
  .then(axios.spread((url1, url2) => {
    return [url1, url2];
  }));

This gives me back the blobURLs but throws this when I am trying to play them: onError Event {isTrusted: true, type: "error", target: video, currentTarget: video, eventPhase: 2…}bubbles: falsecancelBubble: falsecancelable: truecomposed: falsecurrentTarget: nulldefaultPrevented: falseeventPhase: 0isTrusted: truepath: Array[10]returnValue: truesrcElement: videotarget: videotimeStamp: 9187.02type: "error"__proto__: Event Looks like a Media error: code 4

With XHR:

function loadIt(file) {
  const req = new XMLHttpRequest();
  req.onload = () => { return URL.createObjectURL(req.response) };
  req.open("GET", file);
  req.setRequestHeader('Access-Control-Allow-Origin', '*');
  req.responseType = "blob";
  req.send();
}

This throws another error and is not even able to get anything from the server: XMLHttpRequest cannot load https://vimeo.com/187265782/83876b2cdc. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
cookpetecommented, Apr 1, 2018

@x-yuri ReactPlayer will fall back to the FilePlayer if it cannot play the URL with other players. Playing blobs should still work. It works for me in this fiddle using URL.createObjectURL():

https://jsfiddle.net/0pn9avov/

1reaction
cookpetecommented, Oct 21, 2016

I would simply render three ReactPlayers with the question and answer clips all loaded (with playing set to false for the answer clips), then just hide/show/play the relevant player depending on the answer. You would be waiting the same amount of time (probably longer) to load in blob strings compared to waiting for each iframe to call onReady.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Download a Video With a Blob in the URL - Alphr
Go to the SaveFrom.net page and paste the blob URL into the designated field. · The website will show a video thumbnail, and...
Read more >
How do we download a blob url video [closed] - Stack Overflow
9 Answers 9 · 1) Go to the network tab and sort by Media · 2) You will see something here and select...
Read more >
How to Download Video with Blob URL - SYSGeeker
If you have a Blob video file that you want to download from a website, you can do so using the VLC Media...
Read more >
7 Quick Solutions to Download Blob Videos (Tested and Free)
To get the blob video downloader, click the "Free Download" button above. Once the downloading process is finished, install, and run the software...
Read more >
How to Download Video with Blob URL (Top 3 Ways) - TechCult
To download blob videos from Facebook, first, open the DevTools for the webpage. Click on Network and find the file with a .m3u8...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found