PDA

View Full Version : Media.progress


motionid
10-23-2003, 12:24 AM
Quick question.
I am trying to use a MediaDisplay component to display some video. The quality of my encoding a quite high and will not smoothly stream.
How can I wait for the data to load and then automatically play the file?

I figure you would us Media.progress to make it work but I haven't had too much experience working with listeners and don't quite understand how I might write it.

Sample macromedia code in the help for Media.progress is:

var myProgressListener = new Object();
myProgressListener.progress = function(){
// Make lightMovieClip blink while progress is occurring
var lightVisible = lightMovieClip.visible;
lightMovieClip.visible = !lightVisible;
}

Any help appreciated.

Cheers,

Sean.

motionid
10-23-2003, 07:36 AM
ok,
There doesn't seem to be any real way to test the streaming of a video clip using "test movie" - which makes this process quit tricky (I could have all this wrong though).

Anyway, I wrote this based on the Macromedia sample code - the goal, to pre load the movie clip and have it play back at a normal frame rate:
var myProgressListener = new Object();
myProgressListener.progress = function() {
myBytes = Math.round((myMov.bytesLoaded/myMov.bytesTotal)*100);
myTextField.text = "pre loading "+myBytes+"% of the clip";
if (myBytes == 100) {
myTextField.text = "";
myMov.play(0);
}
};

Actually I posted another solution before – but is was completely flawed. So I’ve edited my post.

Cheers,

Sean.

usuhamlet_2001
02-17-2005, 10:52 PM
Thank you for posting your working script. It was exactly what I was looking for.

usuhamlet_2001