Closed timothydillan closed 3 years ago
You need to execute the below code in the loop to play the mp3 stream
` // While the audio is playing, if (mp3a->isRunning()) { //Serial.println("MP3 is running."); // Check if we've played for a second, if (millis() - lastms >= 1000) { lastms = millis(); // and show that we've played for a second. Serial.printf("Running for %d ms...\n", lastms); } // If the mp3 is not looping, if (!mp3a->loop()) { // stop the MP3. mp3a->stop(); } } else { // If the audio is not playing, print it and // set audioplaying to true. Serial.println("MP3 done"); delay(1000); audioPlaying = false; }
`
You need to execute the below code in the loop to play the mp3 stream
` // While the audio is playing, if (mp3a->isRunning()) { //Serial.println("MP3 is running."); // Check if we've played for a second, if (millis() - lastms >= 1000) { lastms = millis(); // and show that we've played for a second. Serial.printf("Running for %d ms...\n", lastms); } // If the mp3 is not looping, if (!mp3a->loop()) { // stop the MP3. mp3a->stop(); } } else { // If the audio is not playing, print it and // set audioplaying to true. Serial.println("MP3 done"); delay(1000); audioPlaying = false; }
`
That code is executed, it's in the speak
function and I'm already calling the speak
function in the main loop function. I couldn't find a way to fix it, so I just used a HTTP connection instead.
Hi there.
I'm currently making an RFID project where when an RFID tag is scanned, a GET request will be sent to my website, and data in JSON format will be retrieved from the response. This, however, interrupts the ESP8266Audio library.
The problem is, is it'll play once, and the next time I'll scan my RFID tag, it'll just skip to MP3 Done immediately. The TTS link generated is fine.
Any help is appreciated.