         public function resume():void {
             if(_state == HLSStates.PAUSED) {
                 clearInterval(_interval);
-                _setState(HLSStates.PLAYING);
                 _stream.resume();
                 _interval = setInterval(_checkBuffer,100);
+                _setState(HLSStates.PLAYING);
             }
         };
 

        public function pause():void {
            if(_state == HLSStates.PLAYING || _state == HLSStates.BUFFERING) {
                clearInterval(_interval);
                _setState(HLSStates.PAUSED);
                _stream.pause();
            }
        };


               }
            }
            if((_state == HLSStates.PLAYING) ||
               (_state == HLSStates.BUFFERING && (buffer > _loader.getSegmentAverageDuration() || _reached_vod_end)))
             {
                //Log.txt("appending data into NetStream");
                while(_buffer_current_index < _buffer.length && _stream.bufferLength < 2*_loader.getSegmentAverageDuration()) {
