audio-cutter icon indicating copy to clipboard operation
audio-cutter copied to clipboard

Instead of selecting or dragging a file, can i set a file from an URL file?

Open softmaniaperu opened this issue 1 year ago • 3 comments

I want to have a web page with a preloaded file from an URL. Thanks.

softmaniaperu avatar Jul 04 '23 20:07 softmaniaperu

No because if you load file from an URL, you might get CORS issues.

meowtec avatar Jul 05 '23 04:07 meowtec

But if it is loaded from an URL of the same domain?

softmaniaperu avatar Jul 06 '23 10:07 softmaniaperu

@softmaniaperu

What is the way you want to read the URL?

  • From a URL query like this: https://meowtec.github.io/audio-cutter/dist/?audio=https://host/path.mp3 ?
  • Or read from a text box such as window.prompt()?

If CORS is not a problem, both are easy to implement. All that needs to be done is adding a componentDidMount lifecycle in src/index.tsx, and fetch the audio URL to a blob, then call handleFileChang(blob). (We should modify File to Blob on some places).

If you can code, PR welcome.

meowtec avatar Jul 11 '23 14:07 meowtec