This was quite frustrating, but we managed to get it up and running. The solution is actually quite simple (once you know what to do):
If you decide NOT to use the cloud-hosted JW Player (which is quite easy to set up since the asset pipeline is not involved), download and unzip the jwplayer
folder.
Drop the extracted jwplayer
folder into your Rails app's /app/assets/javascripts
folder.
Add the following to your /app/assets/javascripts/application.js
:
//= require jwplayer/jwplayer
//= require jwplayer/jwplayer.html5
Run rake assets:precompile
.
To get the player up and running in a view, use the piece of (HAML) code below. (Additional options are available here.)
%div{id: 'video'} Loading the player...
:javascript
jwplayer('video').setup({
file: 'INSERT_VIDEO_FILE_PATH_HERE',
flashplayer: "#{asset_path('jwplayer.flash.swf')}",
html5player: "#{asset_path('jwplayer.html5.js')}"
});
It's essential you specify the flashplayer
and html5player
attributes (in case you want to support both versions of the player).
Customize away!