4 Replies Latest reply: Nov 4, 2011 10:34 AM by Andrei1 RSS

    using netstream appendBytes with mp4 file

    tekCorap_

      hi. i am trying to play a mp4 video file with netstream.appendbytes method. but the video down't loading. when i am load a flv video file, the player play the flv video but when i am trying a mp4 video file, don't loading. flv works, but mp4 don't works. why? Please help me!

      my code is

      
      import flash.net.URLRequest;
      import flash.net.URLStream;
      import flash.events.ProgressEvent;
      import flash.events.Event;
      import flash.utils.ByteArray;
      import flash.net.NetConnection;
      import flash.net.NetStream;
      import flash.media.Video;
      import flash.events.NetStatusEvent;
      
      
      var urr:URLRequest;
      var urs:URLStream;
      var nc:NetConnection;
      var ns:NetStream;
      var vid:Video;
      urr=new URLRequest("http://video.ak.fbcdn.net/cfs-ak-snc6/214988/655/115514355195743_26925.mp4?oh=53935006d42b2db7f970d41f07ab617d&oe=4DA8FD00&__gda__=1302920448_181887f1c8692424282dcc9b072f59a0");
      urs=new URLStream();
      urs.addEventListener(flash.events.ProgressEvent.PROGRESS,progresHnd);
      urs.addEventListener(flash.events.Event.COMPLETE,completeHnd);
      urs.addEventListener(flash.events.Event.CLOSE,closeHnd);
      urs.addEventListener(flash.events.Event.OPEN,openHnd);
      urs.load(urr);
      
      
      function progresHnd(e:Object):void{
           trace (e);
           var bytes:ByteArray=new ByteArray();
           urs.readBytes(bytes,0,urs.bytesAvailable);
           ns.appendBytes(bytes);
           
           }
           
      function closeHnd(e:Object):void{
           trace (e);
           }
           
      function completeHnd(e:Object):void{
           trace (e);
           }
           
      function openHnd(e:Object):void{
           trace (e);
           nc=new NetConnection();
           nc.connect(null);
           ns=new NetStream(nc);
           vid=new Video();
           vid.attachNetStream(ns);
           ns.play(null);     
           addChild(vid);
           }