Closed NonaSuomy closed 3 years ago
You should wait for end of wav/mp3. You can use the info event about it, call audio.connecttohost when this event arrives. See audio.cpp 1045 line.
Are you talking about this line?
I can't seem to trigger it without crashing.
Any chance there's some sample code on how to play a local file then play a stream without crashing?
wait for !audio.isRunning()
before starting a new song.
For example https://github.com/CelliesProjects/eStreamPlayer32 uses that to start the next item.
Thank you @CelliesProjects worked like a charm.
boolean f_firstboot=false; // First boot of device for playing startup sound.
boolean f_secondboot=false; // Second thing to start playing on device (last radio station).
void setup(){
f_firstboot=true; // Play startup sound
}
void loop(){
if(f_firstboot==true){
audio.connecttoSD("/test.wav");
audio.loop();
f_firstboot=false;
f_mp3eof=false;
f_secondboot=true;
}
else if (f_secondboot==true){
if (!audio.isRunning()){
audio.connecttohost(setStation(pref.getUInt("station"))); // Last used station
audio.loop();
//audio.printDetails();
if(_station=="") showStation(); // If station gives no icy-name display _stationname
f_secondboot=false;
}
}
}
It seems to not play the wav and then plays the station instead. On the console it says that it started the wav before that.