Open lincollincol opened 2 years ago
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
Hi @niklasdahlheimer, how to processAudio with url from API has headers.
@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