Skip to content

Conversation

harajune
Copy link

@harajune harajune commented Jul 18, 2021

Issues

  • AudioFileSourceHTTPStream lacks a basic auth feature.
  • Also, SSL.

What I created

  • add setAuthorization method to AudioFileSourceHTTPStream. This method will set the basic auth setting to HTTPClient.
  • add setClient method to AudioFileSourceHTTPStream. This method enables users to use WiFiClientSecure to set a root CA certificate.

Sample

wifi_client = new WiFiClientSecure();
wifi_client->setCACert(ROOT_CA);

file = new AudioFileSourceHTTPStream();
file->setClient(wifi_client); // here
file->setAuthorization(BASIC_USER, BASIC_PASS); // here
file->open(url);
buff = new AudioFileSourceBuffer(file, 2048);
out = new AudioOutputI2S(0, 1);
out->SetOutputModeMono(true);
out->SetGain(1.0);
mp3 = new AudioGeneratorMP3();
mp3->RegisterStatusCB(StatusCallback, (void*)"mp3");
mp3->begin(buff, out);

Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing related to URL size change, but generally looks good. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants