• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

FMS Administration api help

New Here ,
Nov 07, 2009 Nov 07, 2009

Copy link to clipboard

Copied

How to use: getNetStreamStats() Flash Media Server 3.5
actionscript 3 with an example thanks,
my application name is : liveVideo
livefeed name is: livefeedLive
please one example how to make a call for this application
my English is not good

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Nov 13, 2009 Nov 13, 2009

Sorry don't have much time to write detailed code, but following is bare minimum which i think should work for you, you can modify and add detail later and customize it to suit your need:

import flash.net.NetConnection;

import flash.net.NetStream;

import flash.events.*;

import flash.system.Capabilities;

var nc:NetConnection;

var resp1:Responder;

var resp2:Responder;

function onCallSuccess(resObj):void{

for(var i in resObj){

trace("NetStream  Top Level data:"+i);

trace("NetStream  Top Level value:"+res

...

Votes

Translate

Translate
Adobe Employee ,
Nov 13, 2009 Nov 13, 2009

Copy link to clipboard

Copied

As of now I will give you example with http and later will try to post AS3 example

Take your example: You are publishing with name "livefeedLive" to application called "liveVideo" (assuming admin/admin as userid/password for Admin)

Run this command in browser: http://<server-ip>:1111/admin/getNetStreams?auser=admin&apswd=admin&appInst= liveVideo/_definst_ 

This will give you below result: (just a sample result)

<?xml version="1.0" encoding="utf-8" ?>
- <result>
<level>status</level>
<code>NetConnection.Call.Success</code>
<timestamp>11/13/2009 1:27:11 PM</timestamp>
<name>_defaultRoot_:_defaultVHost_:::_0</name>
- <data>
<_0>ABACAAAA</_0>
</data>
</result>
Now use streamid returned make your getNetStreamStats call as follows:
http://10.192.22.82:1111/admin/getNetStreamStats?auser=admin&apswd=admin&appInst=liveVideo/_definst_&streamids=ABACAAAA - you will get result as below: (again sample result)
<?xml  version="1.0" encoding="utf-8" ?>
- <result>
<level>status</level>
<code>NetConnection.Call.Success</code>
<timestamp>11/13/2009 1:32:19 PM</timestamp>
- <data>
- <_0>
<name>livefeedLive</name>
<time>11/13/2009 1:26:06 PM</time>
<type>publishing</type>
<client>oAACAAAA</client>
<stream_id>ABACAAAA</stream_id>
<client_type>normal</client_type>
</_0>
</data>
</result>
Will try to post AS3 code soon

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 13, 2009 Nov 13, 2009

Copy link to clipboard

Copied

First I want to say thanks for your help

I sent immediately experiment with the information I've written, and I tell you that everything worked very well, the responses that the server returns me they are very quick and with all the information that interests me

my afflictions and to make these calls to the server via actionscript 3 to obtain all the information that the server give me little about his condition, and very important for me to see if a flux and online video how many people are watching, etc.
and then another very important thing, whether the live video feed also has an audio track
because I saw a live publishing not send metadata
Thanks again for your useful help
p.s. excuse
my English is not very good

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 13, 2009 Nov 13, 2009

Copy link to clipboard

Copied

Sorry don't have much time to write detailed code, but following is bare minimum which i think should work for you, you can modify and add detail later and customize it to suit your need:

import flash.net.NetConnection;

import flash.net.NetStream;

import flash.events.*;

import flash.system.Capabilities;

var nc:NetConnection;

var resp1:Responder;

var resp2:Responder;

function onCallSuccess(resObj):void{

for(var i in resObj){

trace("NetStream  Top Level data:"+i);

trace("NetStream  Top Level value:"+resObj);

if( i.toString() == "data"){

for(var j in resObj){

trace("NetStream  Low Level Data:"+j);

trace("NetStream   Low Level Value:"+resObj);

if(resObj != null){

nc.call("getNetStreamStats",resp2,"live/_definst_",resObj);

}

}

}

}

}

function onCallSuccess2(resObj):void{

//write similar code as onCallSuccess as per your req

for(var m in resObj){

trace("NetStreamStats Top Level Data:"+resObj);

for(var n in resObj){

for(var o in resObj){

trace("NetStreamStats Low Level Data:"+resObj);

}

}

}

}

nc = new NetConnection();

resp1 = new Responder(onCallSuccess,null);

resp2 = new Responder(onCallSuccess2,null);

nc.addEventListener(NetStatusEvent.NET_STATUS, script_ncStatus);

function script_ncStatus(event:NetStatusEvent):void{

var info:Object = event.info;

if(info.code=="NetConnection.Connect.Success"){

nc.call("getNetStreams",resp1,"live/_definst_");

}

}

nc.connect("rtmp://<server-ip>/admin","admin","admin");

There are lot other codes which you can use to get other statistics in above fashion , like getLiveStreams,getLiveStreamStats - please refer Admin API guide which comes with FMS installation.

Hope it works for you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 13, 2009 Nov 13, 2009

Copy link to clipboard

Copied

Thanks, you are the best !!! tanks, tanks, thousand thanks
your script worked great
response that comes from the server when the live is online:
NetStream  Top Level data:code
NetStream  Top Level value:NetConnection.Call.Success
NetStream  Top Level data:name
NetStream  Top Level value:_defaultRoot_:_defaultVHost_:::_1
NetStream  Top Level data:data
NetStream  Top Level value:ABAgg8gC
NetStream  Low Level Data:0
NetStream   Low Level Value:ABAgg8gC
NetStream  Top Level data:level
NetStream  Top Level value:status
NetStream  Top Level data:timestamp
NetStream  Top Level value:Fri Nov 13 11:46:23 GMT+0100 2009
NetStreamStats Top Level Data:NetConnection.Call.Success
NetStreamStats Top Level Data:[object Object]
NetStreamStats Low Level Data:myVideo
NetStreamStats Low Level Data:publishing
NetStreamStats Low Level Data:normal
NetStreamStats Low Level Data:ADAgg8gC
NetStreamStats Low Level Data:Fri Nov 13 11:45:57 GMT+0100 2009
NetStreamStats Low Level Data:ABAgg8gC
NetStreamStats Top Level Data:status
NetStreamStats Top Level Data:Fri Nov 13 11:46:23 GMT+0100 2009

because this response is so : NetStreamStats Top Level Data:[object Object]


one other small question how to intercept (via actionscript 3) if live video feed has audio

the publisher is the normal webcam usb

Thanks again for your help


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 13, 2009 Nov 13, 2009

Copy link to clipboard

Copied

I know what i am telling is cryptic way but i dont know what is your use case, but what you can do is just play the stream via netstream at client end and define handler for your metadata. If your metadata contains audiocodecId field , it has audio , and if there is no such field in metadata there is no audio

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 13, 2009 Nov 13, 2009

Copy link to clipboard

Copied

Will try to do a test, so I see if I can make this thing sound, if I can not lay it to her to ask for help?
thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 13, 2009 Nov 13, 2009

Copy link to clipboard

Copied

LATEST

These are the two files that I use, one for sending the video and audio from a webcam and another that does only see

How do I know if there audio in the viewer to do see a message like "the user has closed microphone"
if audio comes in when there to see a button Mute / Unmute
Tank

______________________________________________________________________________

publisher.fla

var nc:NetConnection;
var ns:NetStream;
var vid:Video;
var cam:Camera;
var mic:Microphone;

nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
nc.connect("rtmp://192.168.1.10/detectAudioFromLive");

function onNetStatus(event:NetStatusEvent):void {
trace(event.info.code);
if (event.info.code=="NetConnection.Connect.Success") {

  cam=Camera.getCamera();
  mic=Microphone.getMicrophone();
  ns=new NetStream(nc);
  cam.setQuality(0,100);
  cam.setMode(320,240,25);
  ns.attachCamera(cam);
  ns.attachAudio(mic);

  var metaData:Object = new Object();
  metaData.title="liveCameraInfo";
  metaData.width=320;
  metaData.height=240;
  ns.send("@setDataFrame", "onMetaData", metaData);


  //then publish video
  ns.publish("liveCamera", "live");
  vid.x=10;
  vid.y=10;
  vid.attachCamera(cam);
  addChild(vid);

}
}

_______________________________________________________________________________

viewer.fla

var nc:NetConnection;
var ns:NetStream;
var vid:Video;

nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
nc.connect("rtmp://192.168.1.10/detectAudioFromLive");

function onNetStatus(event:NetStatusEvent):void {
trace(event.info.code);
if (event.info.code=="NetConnection.Connect.Success") {

  ns=new NetStream(nc);
  ns.play("liveCamera");

  //then view livevideo in the stage
  //vid = new Video();//this method create new video
  vid.x=10;
  vid.y=10;
  vid.attachNetStream(ns);
  addChild(vid);
 
}
}

var obj:Object = new Object();
function onMetaData(info:Object):void {
//outputWindow.appendText(info.customProp);
metaData.text=info.customProp;
trace(info.customProp);
var msg:String;
msg=info.customProp;

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines