0

I have a problem in Flash with AS3 to playing a video mp4, this is a H.264 video with AAC, I try to play video while it is loading as any web site, but my code doesn't work, I have two codes:

  1. Using FLVPlayback:

    var par:Object = LoaderInfo(this.root.loaderInfo).parameters;
    
    //vidRepFla is my FLVPlayback       
    vidRepFla.addEventListener(VideoEvent.READY,vid_ready);
    vidRepFla.addEventListener(VideoProgressEvent.PROGRESS,vid_progress);
    
    vidRepFla.isLive = true;
    vidRepFla.bufferTime = 1;
    
    vidRepFla.play(par.source);
    
    function vid_ready(e:VideoEvent):void{
        trace('Playing!');
        vidRepFla.play();
    }
    
    function vid_progress(e:VideoProgressEvent){
        trace(e.bytesLoaded);
    }   
    
  2. Using NetStream:

    var par:Object = LoaderInfo(this.root.loaderInfo).parameters;
    var video:Video;
    var connect_nc:NetConnection = new NetConnection(); 
    connect_nc.connect(null);
    var stream_ns:NetStream = new NetStream(connect_nc);
    stream_ns.client = this;
    
    video = new Video();
    addChild(video);    
    
    stream_ns.bufferTime = 1;
    
    video.attachNetStream(stream_ns);
    stream_ns.play(par.source); 
    

Do you know if I need something more or if this type video don't work the bufferTime?

Thanks!

Tim
  • 2,121
  • 2
  • 20
  • 30
sgb004
  • 347
  • 4
  • 14
  • Your question is not clear: which of your codes does not work? Both? What does it mean "does not work"? Does it throw a compiler error? Runtime error? Or it just simply doesn't play/buffer correctly? – Fygo Apr 02 '14 at 19:11
  • It doesn't play/buffer correctly, the video plays only when fully loaded – sgb004 Apr 03 '14 at 04:10

1 Answers1

0

I work with Netstream and use a different method. I did notice something on the Adobe documentation for this. I read that the bufferTime setting Only works on flv files, this could be the problem since you are using mp4.

More information here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html

user2561920
  • 121
  • 3
  • 14