Solved

Loop FLV without slowing down computer

Posted on 2009-05-07
7
283 Views
Last Modified: 2013-11-11
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.

Cheers

B
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

0
Comment
Question by:mingchih
  • 4
  • 3
7 Comments
 
LVL 22

Expert Comment

by:rascalpants
ID: 24326422

does the CPU spike up to 50% even when you don't use the loop?


rp / ZA

0
 

Author Comment

by:mingchih
ID: 24327583
no.... it was only like 5% before playing the flash
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24327794

is that the only code in the project?  maybe it is something else that is causing a memory leak...

rp / ZA
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:mingchih
ID: 24327915
no, without that code, everything else runs fast and smooth..... with that code.... everything slow down :(

I wonder is it because the code keep streaming at every loop ? is it possible to have animation save in cache and run from cache ? if possible
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24327995
well, my first thought, before I saw your code, was that you were creating a new instance in memory each time...  but Unless the seek method does this natively, I am not sure why this would be happening...

And normally when the video is streamed in, it is cached once it is loaded...  but it looks like you are using progressive download anyway...

have to look into this...  be back later


rp / ZA
0
 

Author Comment

by:mingchih
ID: 24328070
I can also change to streaming too... progressive or streaming has same slow down computer result...

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect("rtmp://www.site.com/ondemand/media/flash/flv");
var stream_ns:NetStream = new NetStream(connection_nc);
purple_video.attachVideo(stream_ns);
stream_ns.play("purple_effects");


stream_ns.onStatus = function(info) {
      if (info.code == "NetStream.Play.Stop") {
            stream_ns.seek(0);
      }
};
0
 
LVL 22

Accepted Solution

by:
rascalpants earned 500 total points
ID: 24436010

sorry for the delay on the response... must has slipped through the cracks...


I would try these onStatus info codes instead of "NetStream.Play.Stop"

NetStream.Buffer.Flush
NetStream.Buffer.Empty


this is normally what gets passed when a FLV has finished streaming...


rp / ZA


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now