Git Product home page Git Product logo

Comments (2)

pietrop avatar pietrop commented on July 17, 2024

Some notes of what I got so far.

TL;DR: still no viable solution.


In the demo app once the local media is uploaded we create an object url and pass that to the component.

const fileURL = URL.createObjectURL(file);

So I was looking to see if we could use the file name(as this would not change 🀞and should allow us to retrieve the corresponding transcript from local storage on page refresh) instead of the blob url, without having to pass it to the component.

after a bit of exploration I had figured out that you can convert an object url back into a blob

var blob = null;
var xhr = new XMLHttpRequest(); 
xhr.open("GET",  window.fileURL);  // `window.fileURL` is the url to convert
xhr.responseType = "blob";//force the HTTP response, response-type header to be blob
xhr.onload = function() 
{
    blob = xhr.response;//xhr.response is now a blob object
}
xhr.send();

However the problem is that a blob by its nature only has two attributes, size and type

{size: 85047555, type: "video/mp4"}

as explained here on stackoverflow you could then convert this into a file

var file = new File([blob], "name");

But it doesn't seem possible to get the original file name of an object url even after converting it to a blob as it is not stored in the blob.

from react-transcript-editor.

pietrop avatar pietrop commented on July 17, 2024

fixed in this PR #72

from react-transcript-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.