0
votes

I want to use HTML5 <video> tag inside a JSF/Facelets page. I tried the following, but it does not work.

<h:body>
    Hello from Facelets
    <br />
    <section id="reproductor">
        <video src='http://minkbooks.com/content/trailer.mp4' >
        </video>
    </section>
    <h:link outcome="welcomePrimefaces" value="Primefaces welcome page" />
</h:body>
2
What's the problem you're facing? Saying doesn't work is like going to doctor and say I feel sick, can you heal me?Luiggi Mendoza

2 Answers

3
votes

JSF is in the context of this question merely a HTML code generator. So, JSF is actually completely irrelevant in the concrete problem. You would have had exactly the same problem when using e.g. JSP, ASP, PHP etc to produce HTML code, or even when using a static HTML file.

Coming back to your concrete problem, provided that your browser supports the HTML5 tags in question, then your concrete problem is simply caused because you're trying to stream a video cross-domain. This is not supported by <video> nor <audio> tag. You need to provide the video file from your own domain (i.e. put the file in the very same webapp as where your JSF file is).

Assuming that you've put a copy of the video file in the same folder as the JSF file, this should do:

<video src="trailer.mp4" />
0
votes

In addition of @BalusC response above, dont forget to map the file type for your static content in the deployment descriptor (web.xml). Here are the lines:

 <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.mp4</url-pattern>
 </servlet-mapping>