5 Replies Latest reply: Apr 5, 2013 11:55 AM by kglad RSS

    Streaming Problems (End of stream & AsyncErrorEvent)

    Stanfield_A Community Member

      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.

        • 1. Re: Streaming Problems (End of stream & AsyncErrorEvent)
          kglad CommunityMVP

          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. 

          • 2. Re: Streaming Problems (End of stream & AsyncErrorEvent)
            Stanfield_A Community Member

            Thanks for the help so far, it's definitely pointed me in the right direction!

             

            I should clarify that I am using the RED5 Server instead of the Flash Media Server to stream the video content to the application. The FLV files I am using were converted/derived from MP4 files originally and I don't know if the FLV files themselves are meant to hold the metadata.

             

            Would it be possible for you to provide some example code snippets to help or provide some further information to help me out?

             

            Thanks again

            • 3. Re: Streaming Problems (End of stream & AsyncErrorEvent)
              kglad CommunityMVP

              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;

                  }

              }

              • 4. Re: Streaming Problems (End of stream & AsyncErrorEvent)
                Stanfield_A Community Member

                I've implemented that into my code as best I could, however I now get some more errors.

                 

                Current output:

                • Playback connection OK
                • TypeError: Error #2007: Parameter listener must be non-null.

                          at flash.events::EventDispatcher/addEventListener()

                          at MethodInfo-15(

                • 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-15()

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

                          at MethodInfo-15()

                • 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-15()

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

                          at MethodInfo-15()

                 

                Link to the new code:

                http://bit.ly/12qXkvc

                 

                Am I missing something really obvious?

                 

                Thanks again - your time and help is appreciated!

                • 5. Re: Streaming Problems (End of stream & AsyncErrorEvent)
                  kglad CommunityMVP

                  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.