Coder Social home page Coder Social logo

deveon95 / webserver-radio-dash Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 248 KB

Modified ESP32 web server example for hosting MPEG DASH files for internet radios

License: Creative Commons Zero v1.0 Universal

CMake 1.70% Makefile 1.34% Python 15.94% C 73.28% HTML 7.74%
embedded esp32 mpeg-dash webserver bbc

webserver-radio-dash's Introduction

MPEG-DASH HTTP File Server for ESP32

Based on the Simple HTTP File Server Example

This code example has been modified to allow hosting MPEG-DASH (.mpd) files in a manner supported by internet radios. Specifically, it was designed to allow local hosting of .mpd files which allow BBC Radio 1 Dance and BBC Radio 1 Relax to be listened to on an internet radio as the BBC have decided to make these streams "BBC Sounds exclusive" and forbid internet radio providers from including them in their databases. A .mpd file contains instructions for connecting to the BBC servers and playing an MPEG-DASH stream; this server does not receive and process audio itself.

It's worth checking here before buying any hardware in case officially-hosted .mpd file links are discovered in the future. At this time, only HLS links are known, which are not supported by many internet radios.

This project makes two modifications to the original example which are required for Frontier internet radios to work with the files:

  • Sets content-type header to application/dash+xml for files with a .mpd extension
  • Sets content-length header with length of the file

This code should work on any model of ESP32, but it was tested on an ESP32-S3.

ESP32

Convenient breakout boards with USB ports are available cheaply from various sources.

Setup

This project requires the ESP-IDF framework to be installed. Once done, a few simple commands from the ESP-IDF Command Line are required to configure the project.

Use idf.py set-target to set the chip to whichever one you are using (e.g. ESP32S3) - do this first as it will clear all subsequent settings such as WiFI passwords.

Use idf.py menuconfig to open up the configuration tool. Go down to 'Example Connection Configuration' in the list, press Enter, then enter your WiFI connection parameters, then press Q to quit.

Connect an ESP32 board to the computer and use Device Manager to check which COM port has been assigned to it. Run idf.py build flash monitor -p COMx to build and flash the project, and to open a serial terminal. This will allow you to easily see whether the WiFi connection was successful and what IP address has been assigned.

If the build is successful and the WiFi configuration is correct, the board should connect to your access point. Open your router configuration and set the device to use a static IP address.

Type the IP address into a web browser and you'll see the 'ESP32 File Server' page. Use the controls in the top right corner to upload your .mpd files and they'll appear in the list. All you have to do now is add each URL from the table to your MPEG-DASH supporting internet radio as a custom URL (e.g. http://192.168.4.12/bbc_radio_one_dance_hq.mpd) and it should just work!

.mpd files

Two example .mpd files are included which work at the time of writing. Should the BBC change the links or add new "BBC Sounds Exclusive" stations in the future, use the instructions below to get the new stream URLs.

The BBC DASH links can be obtained by opening BBC Sounds in a web browser, pressing F12 to open developer tools, going to the Network tab, applying the Media filter, then starting the desired live radio stream. Copy the .dash link that appears except for the last part, change 'https' to 'http', then it should work if you put the link in the templates provided.

BBC Sounds link extraction screenshot

webserver-radio-dash's People

Contributors

deveon95 avatar

Stargazers

Jost Alemann avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.