Do I have to wait until the video is completely downloaded from cache so it can make it a blob url and plays the <video> in HTML?

Viewed 48

So I have some URL.createObjectURL thing here and followed from Stack Overflow, i forgot where since I accidentally used Incognito that makes no history.

Here is the code:

function changeVideoSource(blob) {
            blob = new Blob([blob], { type: 'video/quicktime' });
            var blobUrl = URL.createObjectURL(blob);
            console.log(`Changing video source to blob URL "${blobUrl}"`)
            scope.setState({encodedvideo: blobUrl})
          }
          
          function fetchVideo(url) {
            return fetch(url).then(function(response) {        
              return response.blob();
            });
          }
          
          fetchVideo(`https://anys3videos.s3.eu-west-2.amazonaws.com/vids/${this.state.video}/raw`).then(function(blob) {
            changeVideoSource(blob);
          });

As the video is initialized and this came from my Network from Chrome DevTools: Network from Chrome DevTools

Which that "596 B" is downloading and started playing at 14.7 MB, Unlike YouTube, it plays instantly with gray progress at the progress bar.

Yes, I am using a framework called React.js, bet it would be much tricky.

blob = new Blob([blob], { type: 'video/quicktime' }); was added so i has support and playable for iOS Safari.

0 Answers
Related