I finally found the missing bit of information. ![]()
But I got not far with this either.
I modified the AudioPlaybackDemo like this, but it crashes.
edit:
Logcat says this:
2022-07-11 18:09:17.963 8632-8632/com.juce.audioplaybackdemo A/libc: stack corruption detected (-fstack-protector)
2022-07-11 18:09:17.963 8632-8632/com.juce.audioplaybackdemo A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 8632 (dioplaybackdemo), pid 8632 (dioplaybackdemo)
bool loadURLIntoTransport (const URL& audioURL)
{
// unload the previous file source and delete it..
transportSource.stop();
transportSource.setSource (nullptr);
currentAudioFileSource.reset();
AudioFormatReader* reader = nullptr;
#if ! JUCE_IOS
if (audioURL.isLocalFile())
{
if (androidDocument.hasValue()) // this is true
reader = formatManager.createReaderFor (androidDocument.createInputStream()); // this crashes
}
else
#endif
{
if (reader == nullptr)
reader = formatManager.createReaderFor (audioURL.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress)));
}
if (reader != nullptr)
{
currentAudioFileSource.reset (new AudioFormatReaderSource (reader, true));
// ..and plug it into our transport source
transportSource.setSource (currentAudioFileSource.get(),
32768, // tells it to buffer this many samples ahead
&thread, // this is the background thread to use for reading-ahead
reader->sampleRate); // allows for sample rate correction
return true;
}
return false;
}
Is anyone using the `AndroidDocument` class successfully for playing an audio file and could help me out?
