0

Not sure what I'm doing wrong. I added:

<h:form id="media">
<a4j:mediaOutput id="aud"  element="object" cacheable="false" session="true"
    title="canYouSeeMe"
    width="300"
        createContent="#{mediaPlay.play}"
        value="#{sdh:storeDataAndGetKey(mediaPlay.selectedFileData)}"
        mimeType="audio/x-mpeg" />
</h:form>

When I first opened the page in Firefox I got a message that I needed to install the QuickTime plugin. But nothing else. I see no link or way to play the audio in FF or IE. The recursive storeDataAndGetKey method I got from a tutorial here: https://community.jboss.org/wiki/A4jmediaOutputAndLargeObjectsAsValue for large objects.

private static DataHolder getGraphDataHolder() {
        FacesContext fc = FacesContext.getCurrentInstance();

        ExternalContext externalContext = fc.getExternalContext();
        Map<String, Object> sessionMap = externalContext.getSessionMap();
        Object session = externalContext.getSession(true);
        DataHolder holder;
        synchronized (session) {
            holder = (DataHolder) sessionMap.get(DATA_HOLDER_ATTRIBUTE_NAME);
            if(holder == null){
                holder = new DataHolder();
                sessionMap.put(DATA_HOLDER_ATTRIBUTE_NAME, holder);
            }
        }
        return holder;
    }

    public static Object getDataByKey(Object key) {
        DataHolder holder = getGraphDataHolder();

        return holder.getDataByKey(key);
    }

mediaPlay.play:

public synchronized void play (OutputStream stream, Object object) throws IOException {
     Object restoredData = SessionDataHelper.getDataByKey(object);
     byte[] soundData = ((Data) restoredData).getFileData();
     stream.write(soundData);
}

I can see the component in the page source, but not in the rendered page. I'm not even sure what I'm supposed to see.

EDIT TO ADD RAW HTML after the page loads

<form id="j_id18:media" name="j_id18:media" method="post" action="/home.seam" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_id18:media" value="j_id18:media" />
<object id="j_id18:media:aud" data="/a4j/s/3_3_1.GAorg.ajax4jsf.resource.UserResource/n/s/-1007594989/DATA/eAFlUs9rE0EUfl0stv4Aa6ziQai1KIiZmGS3UWpBUFEhsWJsQT297L4ks8zurDOz6WrRmxcFL169edWL!gVeC176NwgiIoggXp2dFKV1DgNv-N73fe978!Y7TGoFZ6UaMIyx8GPdZ4q0zFVIbFWTurNdLKwqfhUNQnkqwTcP9rThYKgIDV2RqaHUGDjcjnGENYHpoLbSiyk0S23YS0XGLedDeAoTbZhKZMT7nKLtenKEIidXFJn1crqkKFgfQ9IslEkmU8vNusYK3ZAiItXFEal7mx-WX73-1PHAa8N0KFDrW5jQTg9do3g6sB72adsTOQ4DR8cuuax1SXEU!DH2BC0VWSl!xkoynafOgCCjGQl2FwcdMkMZXSsyO4nmMnU5AEwcACgUHB-bttDduPe1zReff!svPYer!MX9Y3rz7Hn35!2tSyWidHCyXEbck9pJ7-a7mWSi9-PYr!0fZzqldhnc1PoszJzaSCjieFvgI5bZ6wlArqDywA3LypXYDF0c77bWvnw9sXHdCdo5PANHSl-MS7aSmyw3FkiYGDjknl3veJ1ZVqwvgl8byoRYMTSJmLvcWDzXDOZ2!ITl-f!czNt4DSy0ggZSE!1qENYvVP3zF6mKjSCq9lutRp2CZt0Pmn8A3l!elQ__" title="canYouSeeMe" width="300"></object><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id2" />

</form>

This is Seam 2.2, RichFaces 3.3.3. Running on JBoss 5.1

gebuh
  • 797
  • 14
  • 40

0 Answers0