Make a javascript file to download the video in blob stream

Job ID: 31995803

Budget: $10 – $30 USD

Nowadays I am using the following script to download the video, but it only plays after the video has been fully downloaded.

Requirements:
- Need to be in plain javascript supported by major browsers.
- Can use fetch, XMLHttpRequest and MediaSource.
- The video isn't allowed to download again when the loop restart.

The script:

let xhr = new XMLHttpRequest();
xhr.open("GET", `https://gateway.pinata.cloud/ipfs/QmU6F5kKM4yqfRhEf4EU7YrN22RrNmypKfzx62k9Fvjmi8/${_status}.mp4`, true);
xhr.responseType = "blob";
xhr.onload = function () {
vid.src = window.URL.createObjectURL(xhr.response);
vid.volume(0);
vid.loop();
vid.autoplay(true);
if(checkUpkeep()) updatePrice(false);
};
xhr.send();