Hi,
It should be a silly question, but I am desperate with my complete lack of Java experience.
I have searched forum and modified ModuleVideoNameList to get published live streams names using ApplicationInstance.getPublishStreamNames().
But I don’t know how to put List into AMFDataMixedArray.
I need some help here.
-John
import com.wowza.wms.amf.AMFDataList;
import com.wowza.wms.amf.AMFDataMixedArray;
import com.wowza.wms.application.IApplicationInstance;
import com.wowza.wms.client.IClient;
import com.wowza.wms.module.ModuleBase;
import com.wowza.wms.request.RequestFunction;
public class GetPublishedStreamNames extends ModuleBase {
AMFDataMixedArray publishedStreams = new AMFDataMixedArray();
public void getStreamNames(IClient client, RequestFunction function, AMFDataList params) {
getLogger().info("getFiles");
publishedStreams = new AMFDataMixedArray();
IApplicationInstance app = client.getAppInstance();
publishedStreams = app.getPublishStreamNames();
sendResult(client, params, publishedStreams);
}
}
Wowza
package com.wowza.wms.example.module;
import java.util.*;
import com.wowza.wms.amf.AMFDataList;
import com.wowza.wms.amf.AMFDataMixedArray;
import com.wowza.wms.application.IApplicationInstance;
import com.wowza.wms.client.IClient;
import com.wowza.wms.module.ModuleBase;
import com.wowza.wms.request.RequestFunction;
public class ModuleGetPublishedStreamNames extends ModuleBase {
public void getStreamNames(IClient client, RequestFunction function, AMFDataList params) {
getLogger().info("getFiles");
AMFDataObj publishedStreams = new AMFDataObj();
IApplicationInstance app = client.getAppInstance();
List<String> streams = app.getStreams().getPublishStreamNames();
Iterator<String> iter = streams.iterator();
while(iter.hasNext())
{
String streamName = iter.next();
publishedStreams.put(streamName, streamName);
}
sendResult(client, params, publishedStreams);
}
}
Flash client-side:
public function getStreamNames():void
{
if (nc==null)
return;
nc.call("getStreamNames",streamNameResponder);
}
private var streamNameResponder:flash.net.Responder = new flash.net.Responder(function(ret:Object):void
{
for (var prop:String in ret)
{
trace(" "+prop + " = " + ret[prop]);
}
});
Richard
John,
I updated the example Module. Here is the client-side of it:
public function getStreamNames():void
{
if (nc==null)
return;
nc.call("getStreamNames",streamNameResponder);
}
private var streamNameResponder:flash.net.Responder = new flash.net.Responder(function(ret:Object):void
{
for (var prop:String in ret)
{
trace(" "+prop + " = " + ret[prop]);
}
});
Richard
Richard,
It worked but only returns one stream name instead of all three streams.
It looks like returning only last streams name element of from getPublishedStreamNames.
I can see all three stream names in ‘stream’ object in the debugger.
Is there anything I am missing?
-John
Thank you. It finally worked.