How do I change URL in AudioPlayer #1788
-
I have created a sketch which uses the AudioPlayer class and I use the AudioSourceDynamicURL class as my source class. I have created a webpage so that I can send new URLs to my player which is using a AI Thinker AudioKit with an ES8388 chip. All is working fine when I declare a urls array and I specify the radios urls, the problem comes when I send the new url to the player I can not get it to work, and I am unable to find an example. I have studied the class declarations and have tried various options but to no available. Here is my code const char *ssid = "";
const char *pwd = "";
const char *urls[] = {
"http://192.111.140.11:8272/stream"
"http://31.132.6.142:4231/listen.pls?sid=1"
};
ICYStream urlStream(ssid,pwd);
AudioSourceDynamicURL source(urlStream, urls, "audio/mp3");
AudioBoardStream out(AudioKitEs8388V1);
MP3DecoderHelix dec;
AudioPlayer player(source, out, dec); The code from setup() curSSID = WiFi.SSID().c_str();
curPWD = WiFi.psk().c_str();
urlStream.setSSID(curSSID); // TODO - needs fixing, but works if explicitly defined
urlStream.setPassword(curPWD);
auto config = out.defaultConfig();
out.begin(config);
dec.begin();
player.setVolume(ini_block.reqvol); // ini Volume from nvs
//player.setMetadataCallback(showStreamTitle); // The metadata
player.begin(); This is my connect to host code which I think is where my problem is. source.addURL(host.c_str()); // New url
source.selectStream("http://lynx.prostreaming.net:8272/stream"); // Hard coded url for testing
player.setAudioSource(source);
player.begin(); The code in loop() player.copy();
.... // other code Any help would be welcome |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Why don't just just look at the class documentation of AudioSourceDynamicURL. |
Beta Was this translation helpful? Give feedback.
Why don't just just look at the class documentation of AudioSourceDynamicURL.
I don't understand why you are asking us to look up the method name, when you can do this yourself