hi,
is it possible and how i get the metadata on server-side (video width and height) of a live stream? i need to limit the publisher video resolution!
thanks
hi,
is it possible and how i get the metadata on server-side (video width and height) of a live stream? i need to limit the publisher video resolution!
thanks
Here is the basic idea:
package com.wowza.wms.plugin.test.module;
import com.wowza.wms.amf.AMFPacket;
import com.wowza.wms.module.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.amf.*;
public class ModuleOnMetadataDebugger extends ModuleBase
{
class MetadataDebugger implements IMediaStreamActionNotify2
{
public void onPlay(IMediaStream stream, String streamName, double playStart, double playLen, int playReset)
{
}
public void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
{
}
public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
{
}
public void onPause(IMediaStream stream, boolean isPause, double location)
{
}
public void onSeek(IMediaStream stream, double location)
{
}
public void onStop(IMediaStream stream)
{
}
public void onMetaData(IMediaStream stream, AMFPacket metaDataPacket)
{
byte[] data = metaDataPacket.getData();
AMFDataList metaDataList = new AMFDataList(data);
getLogger().info("onMetaData["+stream.getContextStr()+"]: "+metaDataList.toString());
}
public void onPauseRaw(IMediaStream stream, boolean isPause, double location)
{
}
}
public void onStreamCreate(IMediaStream stream)
{
getLogger().info("onStreamCreate");
stream.addClientListener(new MetadataDebugger());
}
}
Charlie
Try like this:
public void onMetaData(IMediaStream stream, AMFPacket metaDataPacket)
{
getLogger().info("onMetaData By: " + stream.getClientId());
byte[] data = metaDataPacket.getData();
AMFDataList metaDataList = new AMFDataList(data);
getLogger().info("onMetaData["+stream.getContextStr()+"]: "+metaDataList.toString());
AMFDataObj obj = getParamObj(metaDataList, 1);
getLogger().info("Duration: "+ obj.getString("audiodevice"));
}
Richard
thanks charlie but it throws all the metadata:
INFO server comment - onMetaData[test/definst/live_1]: AMFDataList:
[0] onMetaData
[1] object
{Obj[]: author: “”, copyright: “”, description: “”, keywords: “”, rating: “”, title: “”, presetname: “Custom”, creationdate: "Wed Mar 23 16:53:06 2011
", videodevice: “Video1”, framerate: 15.0, width: 320.0, height: 240.0, videocodecid: “avc1”, videodatarate: 500.0, avclevel: 31.0, avcprofile: 66.0, videokeyframe_frequency: 5.0}
how i get only the width??? i’m newbie at java sorry!
problem solved!
thanks rrlanham and charlie.