Question : FLV looping problem...

Hi, experts

I have the following code that works pretty well. However, it slows down the computer and use almost 50% of CPU. I would like to ask how can I fix the problem so the looping does not slow down computer. The FLV frame rate is 24fts. I think the code keep streaming from server. Is there a way to save the animation in cache and loop from cache ?

Cheers

B
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
purple_video.attachVideo(stream_ns);
stream_ns.play("purple_effects.flv");
 
 
stream_ns.onStatus = function(info) {
	if (info.code == "NetStream.Play.Stop") {
		stream_ns.seek(0);
	}
};
Open in New Window Select All

Answer : FLV looping problem...

I ran in to this issue a long while ago... the trick is this... you need to set the Expires headers and kill the eTags... that will make flash load the flv from cache...

proof
http://www.digitalbarn.tv/work.html

if you watch the net you'll see that even thou it's streamed on the http it only calls it once...

if your on apache use the .htaccess file.. add

# 3months
pdf|swf|mov|mp3|wmv|ppt)$">
  Header set Cache-Control "max-age=7257600"

# WEEK

  Header set Cache-Control "max-age=604800"

# 45 MIN

  Header set Cache-Control "max-age=2700"



# CMSMS unset ETag
ng|gif|js|css|gz|swf)$">
Header unset ETag
FileETag None



you can read more here

http://developer.yahoo.com/performance/rules.html#expires


this will solve your issue

cheers
jeremyBass
Random Solutions  
 
programming4us programming4us