1 Reply Latest reply on Oct 23, 2012 6:49 AM by Ioana Mirela Iacob

    Playing sounds/video with mediaOutput

    Ioana Mirela Iacob Newbie

      Hello,

       

       

          I can't seem to play sounds with the a4j:mediaOutput component. Here's my try:

       

       

       

      ... 
                MediaOutput mediaOutput = new MediaOutput();
                  mediaOutput.setId("wavRenderer");
                  mediaOutput.setSession(false);
                  mediaOutput.setCacheable(false);
                  mediaOutput.setElement("object");
                  mediaOutput.setMimeType("audio/x-wav");
                  mediaOutput.setUriAttribute("data");
                  mediaOutput.setCreateContent(facesContext.getApplication().createMethodBinding("#{WAVRenderer.play}", 
                                                                                                      new Class[]{OutputStream.class, Object.class}));
                  mediaOutput.setValue(new MediaData());
      
      .....
      
      public void play(OutputStream out, Object data) throws IOException {
              try{
                 
                  out.write(getSoundByteArray());
              }catch(Exception e){
                 ...
              }
          }
      

       

      I noticed setMimeType does not work, I need to re-set it with javascript. However, the play method does not get called. In Firefox nothing happens, in IE I see a player on the page but activex is blocked, if I change settings, an external player is started (windows media player) with error (probably it's missing the sound to play, since the play method isn't called). What am I doing wrong?

       

       

      Richfaces version used: 3.3.3.Final (upgrading is out of question)

      Jboss 4.2.3

       

      Please help.

      Thank you.

      Ioana.