0

I am developing a primefaces-mobile web app. I want to use p:media tag, but it does not show video on mobile device. My code:

<p:media value="#{basePath}/resources/3.mp4" width="340"
    height="250" player="quicktime">
    <f:param name="autoPlay" value="false" />
</p:media>

But on the same page, following code works perfectly fine:

<video width="400" height="300" controls="controls">
    <source src="#{basePath}/resources/3.mp4" type="video/mp4" />
</video>

1 Answers1

2

If I'm not mistaken, p:media generates a quicktime specific tag. The <video> tag is html5 and thus differs. For the first one you need a quicktime player and for the second you need a html5 capable browser.

You don't need to use a PrimeFaces tag ;-) html tags are fine too. Afaik html5 is supported on Android by default, I'm not sure about IPhone/IPad though.

siebz0r
  • 18,867
  • 14
  • 64
  • 107
  • Can I give `InputStream` to `video` tag? Actually the video is in the database, I create the `InputStream` in java and assign it to `p:media` element. Can I do that with `video` tag? –  Jan 29 '13 at 09:07
  • @djaqeel No, you cannot use a `video` tag with an `InputStream`. Aside from this, storing a video in a database is bad practice (unless it's a NoSQL). If you store the video's on disk it'll work, just like in your question ;-) – siebz0r Jan 29 '13 at 11:27
  • I saved the video from database to temporary directory in public directory on the server, and then gave the path of the file to `video` tag.(That's how I guess the primefaces `media` tag makes use of `InputStream`.) –  Feb 13 '13 at 06:32