I’m trying to setup an app where I can upload .mp3 samples and play them back. Paul Irish recommends MediaElementPlayer, so I’ve started futzing around with it. I happily see that there is a gem available (Thank you Axel K.), but I just can’t seem to get it working.
I’ve included the gem, and the asset pipeline seems to be loading everything, but when the page loads, there is a player for each song, but it shows 0:00 on each end and when I press play, nothing happens. The path to the songs are all correct as well.
Here is the code from my view:
<% @songs.each do |song| %>
<%= song.id %>: <%= song.title %><br/>
<audio id="player<%= song.id %>" src="<%= song.tune.path %>" type="<%= song.tune_content_type %>" controls="controls">
</audio>
<% end %>
<script>
$('audio').mediaelementplayer();
</script>
I copied the format and the audio tags directly from the MediaElementPlayer site example (which could be the problem, but I’m not seeing how…)
Also potentially of import, I’m using Paperclip to upload the .mp3s.
**UPDATE:
I just dropped a song into a public folder of my app and setup and audio tag for it, and it works. This makes me think there is something wrong with the way that songs are being uploaded. But all the info seems to be correct (path, content-type, etc…)…
So, I went through and just configured Amazon S3 (which is what I’ll be using in production), and everything works without a hitch. There has to be something with where the file is stored locally, or how it’s stored, or, heck, I don’t know. But setting up S3 and storing the clips there works like a dream.