View Full Version : using mediaDisplay
mgd2004
10-25-2004, 06:21 PM
I'm looking for some help with the mediaDisplay component.
I have an instance of the component on the stage named " video_player "
For some reason, I can't get the listener to work. The FLV is in the same directory as my FLA and SWF, so the file doesn't really need to stream from a web site.
Here's my code:
//set content
video_player.setMedia("e08_screen_09_video.flv", "FLV");
video_player.volume = 100;
video_player.aspectRatio = true;
video_player.totalTime = 10; // time in seconds
trace(video_player.contentPath);
trace(video_player.volume);
trace(video_player.bytesTotal);
// create Listener for VIDEO
var video_playerListener = new Object();
video_playerListener.complete = function(eventObject) {
trace("media is Finished");
gotoAndStop("end");
}
video_player.addEventListener("complete", video_playerListener);
video_player.play();
mmm..pi..3.14..
10-25-2004, 06:28 PM
I think it should be "onComplete" instead of just "complete" for you listener, I could be wrong though :rolleyes:
Eric
mgd2004
10-25-2004, 06:46 PM
Eric,
Thanks for the suggestion. I tried it and it didn't work. In the Help file it has an example, which is what I used and it says "complete".
Any other suggestions?
Thanks again for trying.
Matt
mmm..pi..3.14..
10-25-2004, 07:13 PM
Well, I tried your code and it worked fine and I tried this code and it worked fine too, try this...it's not much different but it might make a difference ;)
//set content
video_player.setMedia("Fire.flv", "FLV");
video_player.volume = 100;
video_player.aspectRatio = true;
video_player.totalTime = 10;
// time in seconds
// create Listener for VIDEO
var video_playerListener = new Object();
video_playerListener.complete = function(eventObject) {
if (eventObject) {
trace("media is Finished");
gotoAndStop("end");
}
};
video_player.addEventListener("complete", video_playerListener);
video_player.play();
Eric :)
mgd2004
10-25-2004, 08:07 PM
Eric,
Thank you for the help. There must be something else going on then. I am on a mac running MX 2004 Professional. I am going to try this on the PC and see if it works. I retyped all the actionScript thinking maybe the copy paste method was screwing things up, but still no luck. If I figure this out, I will post it.
Thanks for your help!
Matt
stesmi99
11-09-2004, 12:38 AM
I'm having the exact same problem right now. To make matters worse mine is all inside a class and created dynamically so I cant even add totalTime but that shouldn't matter. Then just now I noticed that my FLV is not playing right to the end , like it stops 0.040 seconds before the end or something - weird?! NO wonder complete is not firing in the listener....
oscar goldman
11-09-2004, 07:39 PM
I've experienced the same problem and tracked it down to the actual flv file and how it's created. It seems certain types of media don't convert properly to flv files -- the end of stream info is not there. We exported some .mov files to flv from quicktime using the flash video plug-in, and none of those files would trigger the "complete" event. however, using other flv files from other sources worked fine. I would suggest trying to create your flv through some other process and see if that works. I think this is another kink to work out with the flv file format.
Jozzle
12-21-2004, 11:48 AM
Hi,
I'm experiencing the same as Oscar right now... all my .flv's are dynamically loaded and do play, but with a few of them the "complete" event doesn't trigger. All .flv's are .mov's exported with the flash pro plugin for quicktime. The only thing is, we recieve the .mov's from a third party and i don't know how they are created.
Does anyone know of a working procedure to get raw (movie) data in the correct Quicktime's .mov format?
Greets
same problem here, my project use sorensen squeeze to generate flv. some video can triggle the complete event some don't. i think it may have something to do with the video frame rate, flash frame rate, video streaming buffering settings. i can't find a solution either.
Sorry for bringing this up, it is rather old...but I am having this problem when I use the exporters like QuickTime and Cleaner.
When I use Flash to export the video, the complete event happens. The problem with that is the metadata doesn't come with it so then you would have to use http://swfx.org/flv-duration/index.jsp
Has anyone else found this to be so? or is there a better fix? Is this a bug in the external exporter?
Pseudonym
05-11-2005, 10:56 AM
Well, it's taken me most of the afternoon, but I think I've finally stumbled across the solution...
The problem:
I had edited my video in Adobe Premiere, and exported it as a Quicktime .MOV file (using the Sorenson codec, in case anyone cares). I then imported it into Flash as an embedded movie, and exported it out again as an FLV file. This all seemed pretty straight forward, and was done as the help file suggests.
Using the MediaController and Media Display components worked perfectly, and my video streamed as it was meant to. Unfortunately, the Complete event refused to trigger when the movie finished playing, and nothing I did could persuade it otherwise.
The solution:
When importing the .MOV file into Flash, the import wizard gives you a choice of
- Import the entire video, or
- Edit the video first
I had always been importing the entire video (why wouldn't you? It had already been edited in Premiere). HOWEVER - it appears that if you choose the Edit option, it rewrites the file to include the missing data that should have caused Complete to trigger. Having been rewritten, Flash is then able to identify the end of a video stream, and the Complete event works quite happily.
I hope this works for other people, and saves them an afternoon of frustration. :)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.