Solved

Loop FLV without slowing down computer

Posted on 2009-05-07
7
288 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
Independent Software Vendors: 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
YouTube Link 10 369
Removing Flash from Website 6 72
Could you point a workaround on how to open this Adobe Flash documents? 5 187
CD Rom not playing 13 61
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,…
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 how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

726 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