actionscript 3 - Simple flash video loop play (played on android) always crash after a few hours -
why flash-based video player on android crash after few hours of play?
i'm writing flash-based android app. thing native android part using webview load flash swf. swf acted container module (which written in flash as3). 1 of module simple video module loop play set of video playlist forever.
i've considered memory leak, after printing memory usage (using flash's system.totalmemory), result around 12mb 14mb (which seems normal 2 videos). i've test flash using both webview , other third party swf player android (such "swf player" , "smart swf player"), results in crash after few hours.
the as3 code simple , can't see possible cause this. here main class:
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; } } }
is there missed or did wrong in code?
thanks in advance.
the problem "mysteriously" disappeared after switch air instead of flash. no code changed, changed release setting flash player air android. can run continuously several days without problem.
Comments
Post a Comment