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

Process audio from Uri feature #40

Open
lincollincol opened this issue Feb 19, 2022 · 3 comments · Fixed by #39
Open

Process audio from Uri feature #40

lincollincol opened this issue Feb 19, 2022 · 3 comments · Fixed by #39
Assignees
Labels
enhancement New feature or request

Comments

@lincollincol
Copy link
Owner

lincollincol commented Feb 19, 2022

No description provided.

@lincollincol
Copy link
Owner Author

@niklasdahlheimer Currently, It's not possible to process uri with Amplituda directly, but I'm working on it. This code will help you to convert uri to an internal file that can be processed with Amplituda. This approach also solves problems such as obtaining a path or access to a file

So, the reason Amplituda doesn't work with uri, is that I need to get the context to process uri. I don't really like this approach, but it seems there are no other options. Currently, I'm looking for the opportunity to work with uri in NDK, but there are no results yet

@niklasdahlheimer
Copy link

Thanks for you response! The mentioned workaround does it's job but a big disadvantage is, that the cacheDir will unnecessarily grow and grow and, like I already mentioned, the performance will suffer from cloning all audio files (especially for big wave files).

I don't like passing the context around either, but in this case I think it's reasonable as all other API functions which process URIs also do that. Besides that it would be up to the user if one uses processAudio(File: file) or processAudio(Context: context, Uri: uri).

You could simply adapt the way MediaExtractor is handling URIs:
setDataSource(Context context, Uri uri, Map<String, String> headers) is just a wrapper around setDataSource(String path, Map<String, String> headers):
Android Source code

@khiemdnt
Copy link

khiemdnt commented Dec 5, 2023

Hi @niklasdahlheimer, how to processAudio with url from API has headers.

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

Successfully merging a pull request may close this issue.

3 participants