I'm also trying to use pdf with DefaultStreamedContent and the media tag using primefaces 3.4.1
pdfStream = new DefaultStreamedContent(is, "application/pdf");
<p:media value="#{reportBackerBean.pdfStream}" width="100%" height="300px">
Since the default is based on the file extension (see
http://cagataycivici.wordpress.com/2010 ... rimefaces/),
I can understand if it is not able to detect what player to use. However, player="pdf" seems no longer to be supported.
The attributes section of the media tag documentation indicates
attribute: player, possible values are "quicktime","windows","flash","real".
(
http://www.primefaces.org/documentation.html version 3.3)
Based on examples I saw online, I saw tried this with the player="pdf" attribute:
<p:media value="#{reportBackerBean.pdfStream}" player="pdf" width="100%" height="300px">
but I see the following error:
"pdf is not a valid media player type"
Dropping this line into my getPdfStream method shows that there is no player "pdf"
Map<String, MediaPlayer> mp = MediaPlayerFactory.getPlayers();
mp =
[0] HashMap$Entry "real => org.primefaces.component.media.player.RealPlayer@3acd811"
[1] HashMap$Entry "flash => org.primefaces.component.media.player.FlashPlayer@489d45f9"
[2] HashMap$Entry "windows => org.primefaces.component.media.player.WindowsPlayer@4d5d03ad"
[3] HashMap$Entry "quicktime => org.primefaces.component.media.player.QuickTimePlayer@159c7a89"
This matches the source code I found at
http://grepcode.com/file/repository.pri ... ctory.java
getPlayers() {
if(players == null) {
players = new HashMap<String, MediaPlayer>();
players.put(MediaPlayer.QUICKTIME, new QuickTimePlayer());
players.put(MediaPlayer.FLASH, new FlashPlayer());
players.put(MediaPlayer.WINDOWS, new WindowsPlayer());
players.put(MediaPlayer.REAL, new RealPlayer());
}
I found source for a different version of this MediaPlayerFactory.getPlayers() which included the line but this does not currently seem to be available in primefaces 3.4.1.
players.put(MediaPlayer.PDF, new PDFPlayer());
http://code.google.com/p/primefaces/sou ... ava?r=7840
Has anyone been able to get the media tag to work for pdf display using DefaultStreamedContent?
primefaces 3.4.1
glassfish 3.1.2
firefox 16.0.2