Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Loop FLV without slowing down computer

Posted on 2009-05-07
7
Medium Priority
?
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

722 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