You can now also play MP3s streamed from the internet. (Very rough & wonky code. More or less proof-of-concept right now.)

This commit is contained in:
2019-11-20 06:13:15 +01:00
parent 94489618ca
commit b989784fb9
5 changed files with 96 additions and 6 deletions

View File

@@ -545,10 +545,16 @@ bool Player::play() {
void Player::_play_file(String file, uint32_t file_offset) {
INFO("play_file('%s', %d)\n", file.c_str(), file_offset);
_spi->select_sd();
_file = new SDDataSource(file);
if (file.startsWith("/")) {
_file = new SDDataSource(file);
} else if (file.startsWith("https://")) {
_file = new HTTPSDataSource(file);
} else {
return;
}
_file_size = _file->size();
_spi->select_sd(false);
if (!_file) {
if (!_file || !_file->usable()) {
DEBUG("Could not open file %s", file.c_str());
return;
}