Search code examples
htmlruby-on-railsbackground-music

Background music on rails app


I try to add background sound in a rails app. The code is like this:

embed src="followme.mp3" autostart="true" loop="true" hidden="true"

but where should I put the sound? In the assets folder?


Solution

  • Easy Answer

    Put the file in the public/ directory. Example: public/my_audio_file.mp3

    Better, Cleaner Answer

    Put all of your audio files in a single folder like: public/audio/my_audio_file.mp3. Then do something like:

    embed src="audio/my_audio_file.mp3" autostart="true" loop="true" hidden="true"