androidflutterjust-audio

just_audio with headers does not working in Android


In just_audio package, when I use headers with setUrl, ex:

final duration = await player.setUrl('
    https://example.com/audio.m4a',
    headers: {'header1': 'value1', 'header2': 'value2'}
);

I get this exception in Android only:

PlayerException ((0) Source error)

How to solve this issue? And help please.


Solution

  • To be able to use headers in just_audio package, you must apply the setup here:

    https://pub.dev/packages/just_audio#platform-specific-configuration