Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not play local mp3 from FS (SPIFFS) #863

Open
selimovur opened this issue Oct 9, 2024 · 4 comments
Open

Does not play local mp3 from FS (SPIFFS) #863

selimovur opened this issue Oct 9, 2024 · 4 comments

Comments

@selimovur
Copy link

I try to play local and remote files in my project, it works fine when play with "connecttohost" however it does not play a simple mp3 file from spiffs even though it returns true while connecting to the file. So help pls...

@Explorerlowi
Copy link

You should use connecttoFS to play mp3 files in spiffs

@selimovur
Copy link
Author

You should use connecttoFS to play mp3 files in spiffs

Thanks for your reply, but I'm already calling it before calling audio.loop function.

@selimovur
Copy link
Author

#pragma once
#include "Audio.h"
#include <WiFi.h>

Audio audio;

#define BUTTON_PIN 27
#define SD_CS 4

const char* ssid = "??";
const char* password = "??";

void setup() {
Serial.begin(115200);
delay(1000);

SPIFFS.begin(true);

Serial.println("Connecting to wifi...");
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting...");
}

Serial.println("Connected..");
Serial.print("IP Adress: ");
Serial.println(WiFi.localIP());

pinMode(BUTTON_PIN, INPUT_PULLUP);
pinMode(SD_CS, OUTPUT);
digitalWrite(SD_CS, HIGH);

audio.setPinout(17, 18, 16);
audio.setVolume(21);

if(SPIFFS.exists("/open_sound.mp3")){
Serial.println("File is existing");
Serial.println(audio.connecttoFS(SPIFFS, "/open_sound.mp3"));
}
else {
Serial.println("File does not exist");
}
}

void loop() {
audio.loop();
}

@selimovur
Copy link
Author

The file does exist and audioconnecttoFS returns 1 but not playing, when i try the same example with audioconnecttohost, it does work..

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

No branches or pull requests

2 participants