Make Rails Play Nice With FLVPlayback Skin
Posted April 3rd, 2010 in Programming / Comments OffTags: Apache, Flash, Ruby on Rails
Flash assets like an FLVPlayback skin will typically be located in your public folder. However, according to http://kb2.adobe.com/cps/608/608abffd.html, “in a loading scenario, the skin SWF for the FLVPlayback component must be relative to the loading HTML file containing the parent SWF on the server, not to the location of the loaded SWF.” This is bad, since when you load a page, the URL will typically be /:controller/:action, which means the FLVPlayback skin URL will be /:controller/myskin.swf even if your parent SWF is in /public. You can verify this in Firebug on the Net tab. The problem will manifest itself with a loaded Flash movie with no controls. You can fix this by creating a rewrite rule in your .htaccess file.
RewriteRule ^.*/myskin.swf$ /pathto/myskin.swf
Any request ending in myskin.swf will be redirected to /pathto/myskin.swf under the public folder.