i use netstream.appendbytes
streaming (flv) http, works intermittently (it works, after refresh, doesn't work, works , on...)
what problem?, have not idea
my code is:
import flash.display.*; import flash.events.* import flash.net.*; import flash.utils.bytearray; import com.hurlant.util.hex; var videourl:string = "http://url/vivo/flash"; //elemento de conexíon var conn:netconnection = new netconnection(); conn.connect(null); //stream de red var stream:netstream; //conexión stream = new netstream(conn); //oyente stream.addeventlistener(asyncerrorevent.async_error, asyncerrorhandler); function play() { var urlstream:urlstream = new urlstream(); //oyentes de urlstream urlstream.addeventlistener(statusevent.status, instatus); urlstream.addeventlistener(event.complete, completehandler); urlstream.addeventlistener(securityerrorevent.security_error, securityerrorhandler); urlstream.addeventlistener(progressevent.progress, oyenteprocesocarga); //urlstream.addeventlistener(progressevent.progress, describeprocesocarga); urlstream.addeventlistener(ioerrorevent.io_error, ioerror); //video var video:video = new video(640,480); video.attachnetstream(stream); addchild(video); stream.play(null); urlstream.load(new urlrequest(videourl)); } function ioerror(event:ioerrorevent):void { textarea.text += event + "\n"; } function oyenteprocesocarga(event:progressevent):void { var encr:bytearray = new bytearray(); event.target.readbytes(encr); stream.appendbytes(encr); } function describeprocesocarga(event:progressevent):void { if (event.target.bytesavailable > 0){ var encr:bytearray = new bytearray(); event.target.readbytes(encr); } } function securityerrorhandler(event:securityerrorevent):void { } function asyncerrorhandler(event:asyncerrorevent):void { // ignore asyncerrorevent events. } function completehandler(event:event):void { } function instatus(event:statusevent):void { } play();
maybe use stream buffer http tcp not packets arrive @ time.
Comments
Post a Comment