Skip navigation
Stanfield_A
Currently Being Moderated

Streaming Problems (End of stream & AsyncErrorEvent)

Apr 5, 2013 7:18 AM

Tags: #flash #code #streaming_video #video_playback #netstream.play.stopped #end_of_stream #asyncerrorevent #flash.net.netstream #onmetadata #2044 #2095

Hey,

 

Here's the section that I need help with:

 

My current output:

  • Playback connection OK
  • Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback onMetaData. error=ReferenceError: Error #1069: Property onMetaData not found on flash.net.NetStream and there is no default value.

          at MethodInfo-14()

  • Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback onMetaData. error=ReferenceError: Error #1069: Property onMetaData not found on flash.net.NetStream and there is no default value.

          at MethodInfo-14()

 

I addition to this I need to find when the stream ends.

 

Cheers.

 
Replies
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 5, 2013 7:27 AM   in reply to Stanfield_A

    create an onMetaData function to handle the metadata and use a listener to detect the end of your stream, either by adding a cuepoint, checking duration or using a netstatus change event. 

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 5, 2013 9:42 AM   in reply to Stanfield_A

    you should use something like;

     

    var duration:Number;

    var ns:NetStream=new NetStream(your_netconnection);

    ns.addEventListener(NetStatusEvent.NET_STATUS,statusChangeF);  // you'll need to import the NetStatusEvent and you may need to use the full path like flash.events.NetStatusEvent.NET_STATUS

    ns.client=this;

     

    function onMetaData(eobj:Object):void{

    for(var s:String in eobj){

    trace(s,eobj[s]);

    }

    duration = eobj.duration;

    }

     

    function statusChangeF(e:NetStatusEvent):void{

    switch (event.info.code){

            case "NetStream.Play.Stop":

    if(ns.time==duration){

    // stream completed.  do whatever

    }

                break;

        }

    }

     
    |
    Mark as:
  • kglad
    72,189 posts
    Jul 21, 2002
    Currently Being Moderated
    Apr 5, 2013 11:55 AM   in reply to Stanfield_A

    that's not even close to the code i suggested.

     

    to start, never nest named functions.  under no circumstance will that work.

     

    next, your netconnection client definition is screwy. 

     

    unnest all your functions,  use the code i suggested and add what ever you want to it like

     

    function onBWDone(...rest):void{

    //whatever

    }

     

    p.s. paste your code into this forum, don't use a link to your code.  years from now, others checking this thread won't be able to follow it.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points