Search code examples
ruby-on-railsrubyaudio-streaminginternet-radio

Online audio stream using ruby on rails


I'm trying to write small website that can stream audio online(radio station) and got few questions: 1. Do i have to index all my music files into database, or i can randomily pick file from file system and play it. 2. When should i use ajax to load new song(right after last finished, or few seconds before to get responce from server with link to file?) 3. Is it worth to use ajax, or better make list, that will play its full time and then start over?


Solution

  • I think you are asking the wrong Questions.

    • You need to think about how you will play the Audio in the browser (what player will you be using?).
    • You don't need Ruby on Rails to deliver the Files to the client. They can be requested directly from the Web server (Apache or Nginx)
    • Rails is only required for rendering the Website alongside the Player that will then play the Audio. Depending on what player you are using you can either control it through javascript to request the next song from the server or simply write a static playlist to the client that then gets played.