meowtec / audio-cutter

🎵 Experiential ~ Cut audio online 在线的音频剪切器
https://meowtec.github.io/audio-cutter/dist
179 stars 46 forks source link

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

Open softmaniaperu opened 1 year ago

softmaniaperu commented 1 year ago

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

meowtec commented 1 year ago

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

softmaniaperu commented 1 year ago

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

meowtec commented 1 year ago

@softmaniaperu

What is the way you want to read the URL?

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.