Open monupurohit opened 2 months ago
This code works pretty well, however somtime media is not getting played when trying to power on/Off multiple time or Pressing EN switch multiple time, this plays.
how to debug if this is network issue or some cache issue causing not to play the media stream
This issue is stale because it has been open for 30 days with no activity.
Any assistance?
This issue is stale because it has been open for 30 days with no activity.
I need to handle cashing, how to clear cashing/ need to clear buffer.
My Internet radio is not playing online stream. When pressing EN button for multiple time it plays. Unable to identify the issue
include
include
include
include
include
include
include
define I2S_DOUT 25
define I2S_BCLK 27
define I2S_LRC 26
define MAX_LOG_SIZE 1024 // Maximum size of the log buffer
WebServer server(80); // Create WebServer object on port 80
Audio audio; int subscription = 0; // Default value for subscription status String logBuffer = ""; // Buffer to store logs
String serverRead = "https://*****.amazonaws.com/Test//SubscriptionStatus?Period=MAC=";
void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA);
}
void loop() { server.handleClient(); // Handle incoming client requests audio.loop(); // Process audio
}
void addToLogBuffer(String message) { logBuffer += message + "\n";
}
void sendData(int dta) { HTTPClient http; String url = serverName + "&field1=" + dta; http.begin(url.c_str()); int httpResponseCode = http.GET(); if (httpResponseCode > 0) { Serial.print("HTTP Response code: "); Serial.println(httpResponseCode); addToLogBuffer("HTTP Response code: " + String(httpResponseCode)); } else { Serial.print("Error code: "); Serial.println(httpResponseCode); addToLogBuffer("Error code: " + String(httpResponseCode)); } http.end(); }
int receiveData() { HTTPClient http; String url = serverRead + WiFi.macAddress(); http.begin(url.c_str()); int httpResponseCode = http.GET(); if (httpResponseCode > 0) { String payload = http.getString(); JSONVar myObject = JSON.parse(payload); if (JSON.typeof(myObject) == "undefined") { Serial.println("Parsing input failed!"); addToLogBuffer("Parsing input failed!"); return 0; } int subscriptionStatus = (int)myObject["SubscriptionStatus"]; // Assuming the JSON field name addToLogBuffer("Subscription Status received: " + String(subscriptionStatus)); return subscriptionStatus; // Should be 0 or 1 based on your API response } else { Serial.print("Receive Error code: "); Serial.println(httpResponseCode); addToLogBuffer("Receive Error code: " + String(httpResponseCode)); return 0; // Default to 0 if there's an error } http.end(); }