My application sends a lot of meta data to the net stream to do things like show an image. If a subscriber comes in after publishing starts, is there programmatic way to access the meta data so the window is sync with the publisher.
Thanks,
Douglas
My application sends a lot of meta data to the net stream to do things like show an image. If a subscriber comes in after publishing starts, is there programmatic way to access the meta data so the window is sync with the publisher.
Thanks,
Douglas
There is a way to get all data at one time from a recorded stream, that I've read about on livedocs but never implemented -- should work with Wowza, but it doesn't mention live streams.
http://livedocs.adobe.com/fms/2/docs...=00000588.html
It might be up to you to maintain state somehow. You could log actions into an object on the publish side (assuming you are using a Flash app), and send everything to new clients when they arrive.In the following example, data messages in the recorded stream file log.flv are returned all at once, rather than at the intervals at which they were originally recorded.
var my_ns:NetStream = new NetStream(my_nc);
my_ns.play("log", 0, -1, 2);
Richard
Last edited by rrlanham; 06-27-2009 at 01:50 PM.
Thanks. I'll have a look at that.
What I'm doing now is sending an object with the state to wowza from the publisher and when subscriber connects, I send that object to them. What I don't like about that is that I have to do a nc.call for every nc.send but maybe there's no other way.
Regards,
Douglas
BTW - you guys are fantastic support
Thanks!
I think this could be done server-side using onMetaData method of IMediaStreamActionNotify2 to populate an AMFDataObj to send to new clients onConnect.
Richard
I can't get onMetaData to trigger, here's the relevant code which I took from another post :
public void onStreamCreate(IMediaStream stream) {
IMediaStreamActionNotify actionNotify = new myListener();
WMSProperties props = stream.getProperties();
synchronized(props)
{
props.put("streamActionNotifier", actionNotify);
}
stream.addClientListener(actionNotify);
getLogger().info("Added client listener");
}
getLogger().info("onStreamCreate: " + stream.getSrc());
}
public void onStreamDestroy(IMediaStream stream) {
getLogger().info("onStreamDestroy: " + stream.getSrc());
}
public void onCall(String handlerName, IClient client,
RequestFunction function, AMFDataList params) {
getLogger().info("onCall: " + handlerName);
}
class myListener implements IMediaStreamActionNotify2 {
@Override
public void onPauseRaw(IMediaStream stream, boolean isPause, double location) {
// TODO Auto-generated method stub
}
@Override
public void onPause(IMediaStream stream, boolean isPause, double location) {
// TODO Auto-generated method stub
}
public void onMetaData(IMediaStream stream,AMFPacket packet){
System.out.println("onMetaData ***************************");
}
@Override
public void onPlay(IMediaStream stream, String streamName,
double playStart, double playLen, int playReset) {
// TODO Auto-generated method stub
}
@Override
public void onPublish(IMediaStream stream, String streamName,
boolean isRecord, boolean isAppend) {
System.out.println("onMetaData ***************************");
// TODO Auto-generated method stub
}
@Override
public void onSeek(IMediaStream stream, double location) {
// TODO Auto-generated method stub
}
@Override
public void onStop(IMediaStream stream) {
// TODO Auto-generated method stub
}
@Override
public void onUnPublish(IMediaStream stream, String streamName,
boolean isRecord, boolean isAppend) {
// TODO Auto-generated method stub
}
}
}
Thanks
This onMetadata handler only works for live streams. There is a way to do this with vod stream but you need to create your own MediaReader and override the getMetedata method. I am not in front of a computer but will try to document when I get a chance.
C
This is close to what you need. It shows you how to get the metadata everytime a .flv file is accessed. See if this helps.
Charlie
I'm using a live-record stream. I'm not sure what you meant by "close to what you need".
This,unfortunately, did not work.
var my_ns:NetStream = new NetStream(my_nc);
my_ns.play("log", 0, -1, 2);
Thanks,
Douglas
Hi,
I added a IMediaStreamActionNotify2 listener to my code. The onPlay and onPublish get called but the onMetaData never does. I thought that would be triggered by executing a NetStream.send from the client. Am I missing something?
Thanks,
Douglas
It will get called if you are setting the onMetadata data. See this page that describes setting the metadata using @setDataFrame:
http://www.adobe.com/livedocs/flashm...=00000190.html
Charlie