[Solved] Play audio on website
Posted: Fri Aug 13, 2021 8:31 am
Hi there!
I'm currently facing a challenge where I need to play wav audio files on an HTML website. To give an impression of the codebase, let's say there's an SD card connected with SPI and we're using the fileserver example.
This example has been modified with the following piece of code to enable audio controls to be visible.
This however, (of course) results in all files first being sent to the laptop. Is anyone aware of another way to play files on the website itself?
Kind regards,
An interested Jochem
I'm currently facing a challenge where I need to play wav audio files on an HTML website. To give an impression of the codebase, let's say there's an SD card connected with SPI and we're using the fileserver example.
This example has been modified with the following piece of code to enable audio controls to be visible.
Code: Select all
httpd_resp_sendstr_chunk(req, "<tr><td><audio controls><source src=\"");
httpd_resp_sendstr_chunk(req, req->uri);
httpd_resp_sendstr_chunk(req, entry->d_name);
if (entry->d_type == DT_DIR) {
httpd_resp_sendstr_chunk(req, "/");
}
httpd_resp_sendstr_chunk(req, "\" type=\"audio/wav\">");
httpd_resp_sendstr_chunk(req, "</audio></td><td>");
Kind regards,
An interested Jochem