Stereonaut!

Introducing Apache2::EmbedFLV – Exposing FLVs with Flowplayer and a customized interface
~ Jan 17, 2009

with 10 comments

Situation

You have a bunch of Flash videos, FLV files. Every once in a while you dump new files on your publicly accessible Apache directory. You would like to give your users the ability to play those FLVs within a webpage you provide, instead of just serving them the files for a direct download. Maybe you want this for all FLVs, not only an specific directory.

Solution

Apache2::EmbedFLV!

<Files ~ "\.flv$">
  SetHandler modperl
  PerlResponseHandler Apache2::EmbedFLV
</Files>

So now, all your FLV files will be served through Apache2::EmbedFLV on mod_perl with a neat interface you can define yourself, and using the very nice and GPL'ed Flowplayer.

Apache2::EmbedFLV uses a default template, but you can define your own with:

<Files ~ "\.flv$">
  SetHandler modperl
  PerlSetVar template /path/to/your/template.tt
  PerlResponseHandler Apache2::EmbedFLV
</Files>

Also, Apache2::EmbedFLV expects to find Flowplayer (flowplayer.swf and flowplayer.controls.swf) on http://your.server.com/flowplayer.swf, the root of your server. So you can do something like this to make it work:

Alias /flowplayer.swf /home/web/flowplayer/flowplayer.swf
Alias /flowplayer.controls.swf /home/web/flowplayer/flowplayer.controls.swf

Or, you just define the flowplayer variable:

<Files ~ "\.flv$">
  SetHandler modperl
  # relative to the document root
  PerlSetVar flowplayer /swf/flowplayer.swf
  # or absolute:
  PerlSetVar flowplayer http://my.other.server/was/hacked/flowplayer.swf
  PerlResponseHandler Apache2::EmbedFLV
</Files>

Action!

You can see it in action at http://axiombox.com/apache2-embedflv/flv.

This Radiohead video is particularly cool :-)

Getting it

UPDATE: Oops! Fixed link to Flowplayer's website! flowplayer.org. Thanks to those who noticed and let me knew.

Written by David Moreno

January 17th, 2009 at 6:22 pm

10 Responses to 'Introducing Apache2::EmbedFLV – Exposing FLVs with Flowplayer and a customized interface'

Subscribe to comments with RSS or TrackBack to 'Introducing Apache2::EmbedFLV – Exposing FLVs with Flowplayer and a customized interface'.

  1. Your link to FlowPlayer is broken.

    Ken Bloom

    17 Jan 09 at 7:04 pm

  2. Hey David,

    This is definately a very neat trick with only one small issue, the flowplayer url is .org not .com. :)

    http://flowplayer.org/

    Great post otherwise,
    Dean

    Dean

    17 Jan 09 at 7:43 pm

  3. Hi David. Your link to the Flowplayer website goes to a cybersquatter. If you do s/\.com/.org/ it'll be correct.

    Aside from that, neat post and it seems like a useful module.

    Jimmy Kaplowitz

    17 Jan 09 at 8:05 pm

  4. Also, just noticed that Flowplayer claims that their product is GPL3, but also claims that you have very specific branding and linking requirements that need to show up in the rendered version of the webpage and link to the specific root URL of the Flowplayer site. This doesn't seem consistent with being GPL3, unless they're intending it as an additional restriction, in which case it's not GPL3. (They seem to think it's not additional.)

    Clearly the GPL3 does require making available the source code, but this should be doable just as legally via a non-rendered HTML comment accessible in-browser with View Source, giving the URL of a local source copy hosted on the web site which is using Flowplayer.

    In short, the licensing is unclear (possibly even non-DFSG-free) and should really be resolved/clarified, especially if anyone wants to put it in Debian.

    Jimmy Kaplowitz

    17 Jan 09 at 8:14 pm

  5. Any idea if this should work with gnash? I tried with gnash from debian unstable and at least here it showed only white background with the following debug messages:

    15862:3059476176] 11:09:46 DEBUG: Your X server expects RGB24 pixmap data for standard mode.
    15862:3059476176] 11:09:46 DEBUG: Created XEmbedded window
    15862:3059476176] 11:09:46 DEBUG: void gnash::Gui::resize_view(int, int) enter
    15862:3059476176] 11:09:46 DEBUG: Framebuffer pixel format is RGB24 (little-endian host)
    15862:3059476176] 11:09:46 DEBUG: Base url set to: http://axiombox.com/apache2-embedflv/flv/radiohead_bodysnatchers2.flv
    15862:3059476176] 11:09:46 UNIMPLEMENTED: SWF9 is not fully supported, trying anyway but don't expect it to work
    15862:3059476176] 11:09:46 DEBUG: GTK-AGG 390000 bytes offscreen buffer allocated
    15862:3059476176] 11:09:46 DEBUG: Initialized AGG buffer , 390000 bytes, 425×300, rowsize is 1275 bytes
    15862:3059476176] 11:09:46 DEBUG: Empty SOLSafeDir directive: we'll use '/tmp'
    15862:3059476176] 11:09:46 DEBUG: Advance interval timer set to 10 ms (~ 100 FPS)
    15862:3058482064] 11:09:46 DEBUG: Descriptive metadata from movie http://axiombox.com/flowplayer.swf: application/x-shockwave-flashAdobe Flex 3 Applicationhttp://www.adobe.com/products/flexunknownunknownENJan 7, 2009
    15862:3058482064] 11:09:46 DEBUG: Setting script limits: max recursion 1000, timeout 60 seconds
    15862:3058482064] 11:09:46 DEBUG: SERIALNUMBER: Version 3.6.3.2 – Build 3958 – Timestamp 1231332253195
    15862:3058482064] 11:09:46 UNIMPLEMENTED: DOABCDEFINE tag parsed but not yet used
    15862:3058482064] 11:09:46 UNIMPLEMENTED: FIXME: tagtype = 76
    15862:3058482064] 11:09:46 DEBUG: Tag 82 has a size of 167993 bytes !!
    15862:3058482064] 11:09:46 UNIMPLEMENTED: DOABCDEFINE tag parsed but not yet used
    15862:3059476176] 11:09:46 DEBUG: Global instance list grew to 1 entries
    15862:3059476176] 11:09:46 DEBUG: void gnash::Gui::resize_view(int, int) enter
    15862:3059476176] 11:09:46 DEBUG: void gnash::Gui::resize_view(int, int) enter
    15862:3059476176] 11:10:17 DEBUG: Loading native class Mouse

    Timo Juhani Lindfors

    18 Jan 09 at 5:32 am

  6. @Ken, @Dean, @Jimmy: Thanks for letting me know the link was busted. I've also fixed it on the linked locations.

    David Moreno

    18 Jan 09 at 3:20 pm

  7. @Jimmy_Kaplowitz: Thanks for bringing such an interesting topic up. I understand that they require users to show the links to the Flowplayer website only if the logos and links on the player are removed. Apparently this is due to a requirement on the GPLv3 to let users know and understand their rights. This, however, yes, it is a bit unclear or probably misunderstood.

    I will make contact with the authors so this can be clarified and hopefully included within Debian and others, without too many problems :)

    David Moreno

    18 Jan 09 at 3:28 pm

  8. [...] I spent time working on Apache2::EmbedFLV, I thought it was a good idea to do the same for audio files, specifically MP3 [...]

  9. wasn't there a new release for this?

    Radford

    1 Mar 09 at 4:24 pm

  10. Not that I'm impressed a lot, but this is more than I expected when I found a link on Delicious telling that the info is quite decent. Thanks.

Leave a Reply