Category: developers journal

Flowplayer ReferenceError woes (Flash hates mod_deflate!)

Author: seven April 1, 2009

My screwed friend Zytzagoo was able to convince me to try out new crazy Flash video player called flowplayer. It really does have nice javascript API and it’s much better in some thing than my own old homebrew players. There is no better way to test something than to implement it on new site we had in production.

But things usually tend to complicate it self day before site launch… and they sure did. I’ve spent 5 hours trying to figure out why flowplayer didn’t work on first load with empty cache on Firefox 3. I tested flowplayer 3.0.6 and commercial-3.1.0dev.

With Flash Player debug version I would get this error:
ReferenceError: Error #1065: Variable Launcher is not defined.
at global/flash.utils::getDefinitionByName()
at org.flowplayer.view::Preloader/init()
at org.flowplayer.view::Preloader()

With plain vanilla Flash Player I would get only blank screen with flash loaded but without controls or anything.

At first, I thought it has to do something with the way I am loading the player (jquery document ready, window.onload, flashembed, in head, in body of xhtml….). I tried every possible combination there is.

I was getting nowhere, and as a last straw I tried loading flowplayer directly into the browser without ANY html. BAM, same error! But, to make things worse loading flowplayer swf from flowplayer.com server http://www.jquerytools.org/swf/flowplayer-3.0.7.swf) DID NOT throw the error.

After careful examination of headers, I discovered that I was accidentally gziping swf files on apache level with mod_deflate.

After I removed gzip everything worked as it should.

This is not the first time I made this discovery, but this time I decided to write a blog post as a reminder to my self. :) I remember having same situation some time ago with Internet Explorer and some random .swf files. Other situation where mod_deflate screwed me in the past was when I was gziping xml which Flash was loading on runtime.

AFAIK, mod_deflate compresses swf files and sends them with chunked transfer encoding to the browser. For some reason, last chunk is not detected but flash content is started up. This also explains why flash works after browser refresh. The content is read from browser cache un-chunked.

The solution is to add .swf to the extensions that are not to be compressed by mod_deflate (in your apache config or .htaccess).

Author
seven
CEO/CTO at Nivas®
Neven Jacmenović has been passionately involved with computers since late 80s, the age of Atari and Commodore Amiga. As one of internet industry pioneers in Croatia, since 90s, he has been involved in making of many award winning, innovative and successful online projects. He is an experienced full stack web developer, analyst and system engineer. In his spare time, Neven is transforming retro-futuristic passion into various golang, Adobe Flash and JavaScript/WebGL projects.

    One thought on “Flowplayer ReferenceError woes (Flash hates mod_deflate!)”

  • veeery nice information. will remember it :)

  • Leave a Reply

    Your email address will not be published. Required fields are marked *