|
-
help with dynamically loaded flvs and cue points
I have 5 videos (and the list will more than likely grow quickly) that I'm trying to load into my main movie. Originally, each video had it's own flvplayback clip which had it's contentpath set and therefore read the cue points. When I did it this way I was able to go to a certain part of the clip and pause it at the cue point. However, I'm trying to make it all more efficient so I now have 1 flvplayback and I'm trying to dynamically load the correct clip. It does load the video, but I get an invalid seek error and it won't go to the cue point. Is there a way to load the cue point data when I initially load the flv and then seek to that point rather than just trying to play and seek? I am assuming that the problem is due to the fact that the flv player has no idea when it loads the movie what cue points are available. Any ideas? Thanks.
-
The flvplayback component does know what cuepoints are available once it receives the metadata for the file. But, you can't seek to a cue point until that part of the movie is loaded. So you're either trying to seek before it receives the metadata, or you're trying to seek before it's loaded enough of the .flv. Take a look at Flash Help under FLVPlayback.metadataReceived to see some examples of reading the metadata and cuepoints.
-
Thanks. I'm trying to create a preloader for the clip so I can then look at the data once it's loaded and go to the right cue point. I've used the code from the example given in the flash help for preloading an flv. In an empty document it works fine. But when I try to use it in my existing movie, it doesn't get into the setInterval portion. I have checked my version settings and anything else I could think of but I can't find a reason why one would work and the other wouldn't. In the code below you'll see that when it goes into the interval method call, it traces "yo". As I said, in a brand new doc, it works and displays that, but when I try to debug it in my existing doc, it never goes into that interval method.
Code:
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play("http://www.helpexamples.com/flash/video/lights_short.flv");
this.createTextField("loaded_txt", this.getNextHighestDepth(), 10, 10, 160, 22);
this.loaded_txt.textColor = 0xFFFFFF;
this.loaded_txt.text = "yo";
progressBar_mc._visible = true;
var loaded_interval:Number = setInterval(checkBytesLoaded, 15, stream_ns);
function checkBytesLoaded(my_ns:NetStream) {
var pctLoaded:Number = Math.round(my_ns.bytesLoaded / my_ns.bytesTotal * 100);
loaded_txt.text = Math.round(my_ns.bytesLoaded / 1000) + " of " + Math.round(my_ns.bytesTotal / 1000) + " KB loaded (" + pctLoaded + "%)";
progressBar_mc.bar_mc._xscale = pctLoaded;
if (pctLoaded>=100) {
clearInterval(loaded_interval);
progressBar_mc._visible = false;
}
trace("yo");
}
-
Nevermind, I'm an idiot. I put the checkBytesLoaded function within another function that is called when you click a button to start the video. Moving it outside of course made it work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|