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

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

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

