Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
softmaniaperu opened this issue Jul 4, 2023 · 3 comments

Comments

@softmaniaperu
Copy link

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

@meowtec
Copy link
Owner

meowtec commented Jul 5, 2023

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

@softmaniaperu
Copy link
Author

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

@meowtec
Copy link
Owner

meowtec commented Jul 11, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants