title: Simple flash video loop play (played on android) always crash after a few hours
body: <p>Why is my flash-based video player on android always crash after a few hours of play?</p>
  
  <p>I'm writing a flash-based Android App. The only thing that native android part do using webview to load a flash swf. The swf acted as the container for all module (which all written in flash as3). One of the module is a simple video module which loop play a set of video playlist forever.</p>
  
  <p>I've considered memory leak, but after printing memory usage (using flash's System.totalMemory), the result is always around 12MB to 14MB (which seems normal for two videos). I've test the flash using both webview and other third party swf player for android (such as "Swf Player" and "Smart SWF Player"), all results in crash after a few hours.</p>
  
  <p>The as3 code is simple and I can't see any possible cause for this. Here is my main class:</p>
  
  <pre><code>import flash.display.MovieClip;
  import flash.media.Video;
  import flash.net.NetConnection;
  import flash.net.NetStream; 
  import flash.events.NetStatusEvent;
  
  public class simpleVid extends MovieClip {      
      private var video:Video;
      private var nc:NetConnection;
      private var ns:NetStream;
      private var uri:Array = new Array("vid1.flv", "vid2.flv");
      private var counter:int = 0;
  
      public function simpleVid() {
          // constructor code
          nc = new NetConnection();
          nc.connect(null);
          ns = new NetStream(nc);
          video = new Video();
          video.attachNetStream(ns);
  
          ns.client = {onMetaData:videoReady, NetStatusEvent:onStatusEvent};
          ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
  
          ns.play(uri[counter]);
          stage.addChild(video);
  
          counter++;
          counter = counter % 2;
      }
  
      public function videoReady(item:Object){
          video.width = 1280;
          video.height = 720;
      }
  
      public function onStatusEvent(event:NetStatusEvent):void{
          if (event.info.code == "NetStream.Play.Stop") {
              ns.play(uri[counter]);
              counter++;
              counter = counter % 2;
          }
      }
  }
  </code></pre>
  
  <p>Is there is anything I missed or I did wrong in this code?</p>
  
  <p>Thanks in advance.</p>