I don’t think it will work with S3 or FSS3. It is Java. Here is the source:
package com.wowza.wms.plugin.collection.module;
import com.wowza.wms.amf.*;
import com.wowza.wms.application.IApplicationInstance;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import java.io.File;
import com.wowza.util.FileUtils;
import com.wowza.util.IFileProcess;
public class ModuleVideoNameList extends ModuleBase {
AMFDataMixedArray recordedMovies = new AMFDataMixedArray();
String storageDir;
class PutFile implements IFileProcess
{
public void onFile(File file)
{
String sizeSuffix="";
String s = storageDir;
if (file.length()<1024000)
{
sizeSuffix = "["+ Math.round((file.length() * .001)) + " kb]";
}
else
{
sizeSuffix = "["+ Math.round((file.length() * .000001)) + " MB]";
}
String fileName = file.getName();
String _abpath = file.getAbsolutePath().replace("\\", "/");
String _parent = file.getParent().replace("\\", "/");
String _path = file.getPath().replace("\\", "/");
fileName = fileName.replace(storageDir, "");
String fn = file.getName().toLowerCase();
if (fn.indexOf(".m4v")>-1 || fn.indexOf(".mov")>-1 || fn.indexOf(".mp4")>-1 || fn.indexOf(".f4v")>-1)
{
fileName="mp4:" + fileName;
}
if (file.length() > 0 && fileName.indexOf(".")>-1)
{
recordedMovies.put(fileName, new AMFDataItem(fileName.replace(".flv", "") + " " + sizeSuffix));
getLogger().info("fileName: " + fileName);
}
}
}
public void getVideoNames(IClient client, RequestFunction function,
AMFDataList params) {
getLogger().info("getFiles");
storageDir = client.getAppInstance().getStreamStoragePath();
recordedMovies = new AMFDataMixedArray();
IApplicationInstance app = client.getAppInstance();
PutFile putfile = new PutFile();
FileUtils.traverseDirectory(new File(app.getStreamStoragePath().replace("_definst_", app.getName())), putfile);
sendResult(client, params, recordedMovies);
}
}
To call this from Flash, here is an AS3 version. If you are using Flex, you an use the Bindable ArrayCollection with a ComboBox. In Flash CS you can change it to an Array
netconnection.call("getVideoNames",new Responder(videoNamesHandler));
[Bindable]
privat var recordedStreamsDP = new ArrayCollection();
private function videoNamesHandler(results:Object):void
{
for( var item:String in results )
{
var obj:ObjectProxy = new ObjectProxy(); // In Flex use ObjectProxy to populate Bindable ArrayCollection.
obj.label = results[item];
obj.value = item;
recordedStreamsDP.addItemAt(obj,0);
}
}
This should work in Flash AS3 or AS2:
var result:Object = new Object();
result.onResult = function(results:Object)
{
for( var item:String in results )
{
trace(results[item]);
trace(item);
}
}
netconnection.call("getVideoNames", result);
Richard