Displaying Binary Multimedia Content with PrimeFaces

Displaying Binary Multimedia Content with PrimeFaces

PrimeFaces p:media component is a generic multimedia player supporting various formats like flash, windows media, quicktime and real player. Suppose you have a mov file located at your application’s webroot. This file can be displayed as;

Basic Usage

By default player is calculated based on the file extension, still you can also choose a specific player;

Binary Content
This is where things get interesting, suppose you keep your multimedia files in a database with binary format. Using PrimeFaces StreamedContent API, it’s easy to display them as well.

That’s it, by providing a streamedcontent instance, p:media can display the binary file easily. This is actually the same process for displaying binary images, see my Dynamic Images with JSF tutorial for more information.

Live Demo
Live demo of p:media is at PrimeFaces Online Showcase.

1 Comment
  • Oleg
    6 August 2010 at 10:37

    Hello Cagatay,

    Some contents cannot be displayed embedded. For instance, Firefox/Safari/Chrome don’t have a plugin for MS Office documents. What happens in this case? Will be document displayed extern in an external browser window?

Post a Comment