开发者

FLV Playback stops unexpectedly and never recovers

I'm working on a project where there are short clips of fly throughs rendered from maya of a 3D environment. I worked up a swf that loads the clips as FLV and plays them accordingly.

My current script seems to bomb during the FLV playback sometimes and never recovers. The swf size is 1280x720 and around 1500 bitrate but the clips are pretty small. Usually under 1mb and I'm preloading all the flv's before playback. Heres a trimed down version 开发者_如何学运维of my script:

function playFLV(fileName) {  
var netConnection:NetConnection = new NetConnection();
 netConnection.connect(null); 
 var netStream:NetStream = new NetStream(netConnection);
 VideoHolder.MainVideo.attachVideo(netStream);
 // Status Events
 netStream.onStatus = function(infoObject:Object) {
  // Status Codes
  tracer.text = infoObject.code;  
  switch (infoObject.code) {
   // StartPlay
   case "NetStream.Play.Start":
    // Do some stuff
    break; 
   // StopPlay    
   case "NetStream.Buffer.Empty":    
    // Do some stuff
    break;       
  }
 } 
 // Play
 if(netStream.bytesLoaded==netStream.bytesTotal ) {  
  netStream.setBufferTime(2); // I tried playing with the buffer time but nadda
  netStream.play("flv/"+fileName);  
 }
}

I'm wondering if there is a more efficient way of doing this. I was thinking of maybe key framing each frame into SWF files and using loadMovie.

Any ideas would be much appreciated.


Have you considered merging the FLVs server side into a single FLV? I think you could even do this dynamically if your source FLVs all have identical CODECs and CODEC parameters.

I'd also spend more time on working out why you are having problems.

  • Have you confirmed that the FLVs were preloaded as you expected?
  • Are they being cached properly browser side?
  • Is that cache intact?
  • What exactly is the error message?

These are all details that I don't see in your question that I would be asking myself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜