6 Replies Latest reply on Oct 3, 2013 1:31 PM by dfm_

    OSMF error not handled

    dfm_ Level 1

      I'm using OSMF Version: 2.0, build: 2494. While I connect to a Live stream and stream stopped unexpectedly (broadcaster turn it off) I get error:

       

       

      Error: Error #2154: The NetStream Object is invalid.  This may be due to a failed NetConnection.
          at flash.net::NetStream/play2()
          at org.osmf.net::NetLoader/reconnectStream()
          at MethodInfo-2568()
      

       

      Do someone encounter it or how I can catch it? I use

       

      _mediaPlayer.addEventListener( MediaErrorEvent.MEDIA_ERROR, mediaErrorEventHandler);
      

       

      for event handling but it does not get catch.

        • 1. Re: OSMF error not handled
          sinious Most Valuable Participant

          A quick way you might be able to diagnose this particular error is just running a try {} catch() {} while printing the .type property returned from any caught errors.

           

          e.g.

           

          try

          {

               _mediaPlayer.play();

          }

          catch (e:*)

          {

               // trace event and type

               trace("MediaPlayer Error: " + e.toString() + " " + e.type);

          }

           

          Before you run the .play() method, if the state of the MediaPlayer class is not ready then it will throw an IllegalOperationError. Just check _mediaPlayer.canPlay boolean first.

          http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/org/osmf/media/MediaPla yer.html#play()

          1 person found this helpful
          • 2. Re: OSMF error not handled
            dfm_ Level 1

            Hi sinious,

             

            the problem is that this try/catch block wont work like that. because you need to catch when there is error inside that tree error. And It seems that the error is summoned from evnet.

             

            Anyway I give it a try and yes, It was not working:

             

            Basicalyl Ido lit like:

             

            } else if (_mediaPlayer.canPlay) {
            if (_mediaPlayer.playing) {
               _mediaPlayer.pause();
            } else {
               try {
              _mediaPlayer.play();
               } catch (e:*){
              trace("MediaPlayer Error: " + e.toString() + " " + e.type);
               }
            }
            

            Thanks for the try if you have any ideas?

            • 3. Re: OSMF error not handled
              sinious Most Valuable Participant

              The error is pretty clear that the player is reconnecting via the NetStream play2() method and it's having an issue with the initial connection. It's just a wrapper around NetConnection/NetStream so it should be internally handling a NetConnection drop and push it through it's own MediaErrorEvent.

               

              I believe you'll need to consider attaching and handling more events to get to the bottom of why you're not being told the NetConnection has an issue. Here's all the events/consts you can hook to:

              http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/org/osmf/events/package -detail.html

               

              I'd be particularly interested in hooking the mediaPlayerStateChange to see what the .state property is when the issue occurs.

               

              What is the nature of your video content? Is it multi-bitrate? Is it DRM protected? What server type and version are you connecting to?

              • 4. Re: OSMF error not handled
                dfm_ Level 1

                trace output goes like:

                 

                playState  = stopped

                mediaPlayerState  = playbackError

                .....

                Error: Error #2154: The NetStream Object is invalid.  This may be due to a failed NetConnection.

                    at flash.net::NetStream/play2()

                    at org.osmf.net::NetLoader/reconnectStream()

                    at MethodInfo-2573()

                Error: Error #2154: The NetStream Object is invalid.  This may be due to a failed NetConnection.

                    at flash.net::NetStream/onResult()

                                   broadcast change =true

                It is not multi bitrate, not it is DRM protected. The server that the company used is based on Erlang Media Server (first time working with this animal )

                • 5. Re: OSMF error not handled
                  sinious Most Valuable Participant

                  Are you invoking the reconnect yourself? Can you show the code you're using to establish connection (as much as you can) and your settings on the player.

                   

                  Are your feeds multi-bitrate? The first thing I'd do is see if there's a content mux issue and stop the stream from changing between varying bitrate streams just for testing. Check the autoDynamicStreamSwitch and set it to false if needed with switchDynamicStreamIndex if in manual mode:

                  http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/org/osmf/media/MediaPla yer.html#autoDynamicStreamSwitch

                   

                  I'm out of the office for a few days from here so others are welcome to respond.

                  1 person found this helpful
                  • 6. Re: OSMF error not handled
                    dfm_ Level 1

                    rtmp://cdn102.webvideocore.net/live/8advhc6pwvgo0884wosk

                     

                    this is the stream,

                     

                     

                    resource = new StreamingURLResource(DataVariable.playerConfig.url.replace('/live/', '/pull/'), StreamType.LIVE_OR_RECORDED);

                                   

                    _element = new LightweightVideoElement(resource);

                     

                    _mediaPlayer = new MediaPlayer();

                    _mediaPlayer.addEventListener( MediaErrorEvent.MEDIA_ERROR, mediaErrorEventHandler);

                    _mediaPlayer.autoRewind = false;

                    _mediaPlayer.bufferTime = 4;

                     

                    _mediaPlayer.volume = FlashVariable.volume;

                     

                    _mediaContainer = new MediaContainer();

                    addChild( _mediaContainer );

                     

                    and I play it like

                     

                     

                    _mediaPlayer.media = _element;

                    _mediaContainer.addMediaElement(_element);