2 Replies Latest reply on May 20, 2012 4:06 PM by maheshabr

    Seam 2 framework to display video in web page

    vanimahesh

      We are using seam framework to develop web application. We need to display video in web page after reading video stored in database blob. The video's are stored in database in standard formats such as flv, mpg etc. Appreciate, if any body can provide some information on how to implement this in seam.

        • 1. Re: Seam 2 framework to display video in web page
          jr_rodriguez_l

          Videos stored in database are not recommended by performance reasons, I reccomend you to remove your blob field from your database and dump it to a folder in your website and add a string path to it in the database, that's a very good practice

           

          I can give you other two solutions that you can research:

           

          Solution A: Render the video with  a4j:mediaOutput from Richfaces

           

          <a:mediaOutput element="#{yourBean.yourByteArrayField}" mimeType="video/avi"

                              createContent="#{sampleBean.paint}" value="#{item}"

                              style="width:25px; height:25px;" cacheable="false">

                          </a:mediaOutput>

           

          this is the method in SampleBean:

           

          public void paint(OutputStream stream, Object object) throws IOException

          {

                Tbookactividad a = (Tbookactividad)object;

               if (a!=null) {

                      if (a.getBimagen()!=null && a.getBimagen().length>0) {

                         stream.write(a.getBimagen());

                                 }

               }

          }

           

          Solution B: Render the video with  p:media from Primefaces 1.1 for JSF 1.2

           

          You can use primefaces 1.2 to show your media contents, only you have to specify your content mime type:

           

          <p:media value="http://www.youtube.com/v/KZnUr8lcqjo" width="425" height="344" player="quicktime"/>

          • 2. Re: Seam 2 framework to display video in web page
            maheshabr

            Thanks Juan