JW Player - player loading error: HTML5 player not found in Rails 3.2 application on Heroku

I have a licensed version of JW Player 6. I downloaded the files and placed them in the assets / javascript directory. In addition to the skins catalog, there is a JS file for the HTML5 player, as well as a flash.swf file for a flash player. Everything I have done so far has worked locally, but as soon as I click on Heroku, I get errors.

First try:

In my application.js file:

 ... //= require jwplayer/jwplayer //= require jwplayer/jwplayer.html5 # the file name is jwplayer.html5.js ... 

After starting rake assets:clean ; rake assets:precompile rake assets:clean ; rake assets:precompile I get the following error in the view (on Heroku):

 An ActionView::Template::Error occurred in nodes#show: jwplayer/jwplayer.html5.js isn't precompiled 

Second attempt:

In my application.js file:

 ... //= require jwplayer/jwplayer ... 

Then I added this to the production.rb environment configuration file:

 # Also tried %w(jwplayer.html5.js) config.assets.precompile += %w(jwplayer/jwplayer.html5.js) 

After cleaning and pre-compiling the assets and clicking on Heroku, the original ActionView::Template::Error no longer occurs, but now JW Player displays this message:

 Error loading player: HTML5 player not found 

This is the initialization of the JW Player in the HAML view:

 :javascript jwplayer("video_display_object_#{display_object.id}").setup({ width: "948", height: "533", image: "#{display_object.video_screenshot_url}", file: "#{display_object.resource_url}", modes: [ { type: 'flash', src: "#{asset_path('jwplayer/jwplayer.flash.swf')}", config: { skin: "#{asset_path('jwplayer/skins/beelden.xml')}", 'controlbar.position': 'over', 'controlbar.idlehide': 'true' } }, // I've also tried "#{javascript_path('jwplayer/jwplayer.html5.js}" // And "/assets/jwplayer/jwplayer.html5.js" { type: 'html5', src: "#{asset_path('jwplayer/jwplayer.html5.js')}" } ] }); 

I really don't know what to do at this moment. As I mentioned earlier, everything works locally, not on Heroku.

Any suggestions?

+7
ruby-on-rails heroku asset-pipeline jwplayer jwplayer6
source share
1 answer

It was very unpleasant, but we managed to launch it. The solution is actually quite simple (as soon as you know what to do):

If you decide NOT to use the cloud-based JW Player (which is pretty easy to set up because the pipeline is not involved), download and unzip the jwplayer folder.

Drop the extracted jwplayer folder into the Rails application folder /app/assets/javascripts .

Add the following to your /app/assets/javascripts/application.js :

 //= require jwplayer/jwplayer //= require jwplayer/jwplayer.html5 

Run rake assets:precompile .

To start the player in viewing mode, use the code snippet (HAML) 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')}" }); 

You must specify the attributes flashplayer and html5player (if you want to support both versions of the player).

Change the settings!

+5
source share

All Articles