Skip to main content
Known Participant
May 2, 2010
Question

Sending metaData with netStream.send is not working

  • May 2, 2010
  • 1 reply
  • 4776 views

I'm trying to send metaData from client to FMS server when recording Webcam video and have implemented sending of metaData as stated on Adobe's help page at: http://help.adobe.com/en_US/FlashMediaServer/3.5_Deving/WS5b3ccc516d4fbf351e63e3d11a0773d56e-7ff6.html

However when I play the recorded video  from FMS, my custom metaData properties trace "undefined". I can trace  default metaData properties such as duration or videocodecid  successfully, but not my custom properties such customProp, width or height. Here is part of my code that is related to the issue:
 
private function  ncNetStatus(event:NetStatusEvent):void {              
     if  (event.info.code == "NetConnection.Connect.Success") {   
          ns = new NetStream(nc); 
         ns.client = this; 
          ns.publish(webcam_test, "record");   
     }   
}
 
private function netStatus(event:NetStatusEvent):void {  
     if  (event.info.code == "NetStream.Publish.Start") {  
          sendMetadata();     
     }
}
 
private function sendMetadata():void {
      trace("sendMetaData() called...");
     myMetadata = new  Object(); 
     myMetadata.customProp = "Welcome to the Live feed of  YOUR LIFE"; 
     ns.send("@setDataFrame", "onMetaData",  myMetadata);
}
 
public function  onMetaData(info:Object):void { 
     trace('videocodecid:  ',info.videocodecid); //returns 2
     trace('customProp:  ',info.customProp); // returns undefined
}
 
And here is my trace result:  
NetConnection.Connect.Success
NetStream.Publish.Start
sendMetaData() called...
NetStream.Record.Start
Stopped webcam recording... 
NetStream.Record.Stop
NetStream.Unpublish.Success
NetStream.Play.Reset
NetStream.Play.Start
videocodecid: 2 
customProp: undefined 

    This topic has been closed for replies.

    1 reply

    Adobe Employee
    May 4, 2010

    Hi,

    I think you are not using ns.send correctly. If I am not mistaken following is the syntax for that

    ns.send(handlerName, [p1, ..., pN]) where handlerName is the method you need to define on server side script on the corresponding stream not on client.

    Ex - ns.send("onStreamInfo",myMetadata); - Client side

    Server Side :

    application.onPublish = function( client, stream )
    {
    trace("In application.onPublish in main.asc : Client published a live stream named - " + stream.name + ".");
    stream.onStreamInfo = function(info)
    {

      trace("videocodecid : " + info.videocodecid);
      trace("customProp : " + info.customProp);
    }

    }

    Regards,

    Amit

    smohadjerAuthor
    Known Participant
    May 4, 2010

    But the "Add metadata to live video" example on adobe.help.com Website does not use a server-side script and states that sending of metaData and defining of a function to handle the data is all possible on client side alone. See the example and notes here:

    http://help.adobe.com/en_US/FlashMediaServer/3.5_Deving/WS5b3ccc516d4fbf351e63e3d11a0773d56e-7ff6.html

    Adobe Employee
    May 4, 2010

    Ya u r right let me try at my end and get back to u soon.

    Regards,

    Amit