     public function stop():Boolean {
       ns.dispose();
       nc.close();
+      this.currentState = "stopped";
       return true;
     }
 
     public function pause():Boolean {
+      if (this.currentState !== 'playing') {
+        ErrorManager.dispatchError(800);
+        return false;
+      }
       ns.pause();
+      this.currentState = "paused";
       return true;
     }
 
     public function resume():Boolean {
+      if (this.currentState !== 'paused') {
+        ErrorManager.dispatchError(801);
+        return false;
+      }
       ns.resume();
       return true;
     }

    private var nc:NetConnection;
    private var ns:NetStream;
    public var ended:Boolean = false;

    public function HTTPClient(video:Video, urlParsed:Object) {
      this.urlParsed = urlParsed;


      if (!ended && 'NetStream.Buffer.Empty' === event.info.code) {
        dispatchEvent(new ClientEvent(ClientEvent.PAUSED, { 'reason': 'buffering' }));
        this.currentState = "paused";
        return;
      }

      if ('NetStream.Pause.Notify' === event.info.code) {
        dispatchEvent(new ClientEvent(ClientEvent.PAUSED, { 'reason': 'user' }));
        this.currentState = "paused";
        return;
      }
    }
