View Full Version : media component jump to next frame when flv done?
Navarone
06-02-2005, 06:47 PM
I am using the media display component with the media controller. When the flv is done playing I need to jump to another frame. In the past I have not had good success getting this to work. Has anyone found a reliable method that can do this? :)
Navarone
06-02-2005, 07:40 PM
I put this code on the media display component trying to get the total time of the flv and comparing it to the playhead time. The way I have it set up both values start at zero. Anyone have any ideas on this?
onClipEvent (enterFrame) {
var tTime = Math.round(_root.display.totalTime);
//trace(tTime);
var myPlayerListener = new Object();
myPlayerListener.change = function(eventObject) {
var myPosition = Math.round(_root.display.playheadTime);
var myPercentPosition = (myPosition/totalTime);
trace("totalTime =" +tTime)
trace("postion =" +myPosition);
if (myPosition == tTime) {
_root.gotoAndStop("info");
}
};
_root.display.addEventListener("change", myPlayerListener);
}
--edited--
this code doesn't work either, dispite that the Listener displays "media finished" in the out put window.
_root.stop();
_root.display.stop();
_root.display.autoPlay = true;
_root.display.activePlayControl = true;
_root.display.controllerPolicy = 'on';
_root.display.setMedia("videos/video1.flv", "FLV");
_root.display.play(0);
_root.myController.volume = 100;
//////////////////////////////////////
var myListener = new Object();
myListener.complete = function(eventObject) {
trace("one - media is Finished");
_root.gotoAndPlay("two");
};
_root.display.addEventListener("complete", myListener);
Navarone
06-03-2005, 07:30 PM
For those of you who are following this thread. Macromedia has issued a new version of thier Flash Video Exporter w/new Media Components. You will need to use the Flash Extension Mgr. to install the new components. The new exporter is located here http://www.macromedia.com/devnet/mx/flash/video.html
you_rock
06-03-2005, 08:02 PM
I have not used the new media components. I just know the old ones didnt work.
I now use Netstream for playing videos. It is the most reliable.
Here is code that may help you if you want to keep using the components. I use it to set a cue point at the end of a video then return to the menu movie.
myCuePointListener = new Object(); //new listener
myCuePointListener.cuePoint = function(eventObject){
//listener events
if(eventObject.cuePointName == "End"){
myMCL.removeAllCuePoints();
trace("END");
myMCL.setMedia("menu.flv", "FLV");
}
}
//
function addCueAtEnd(){
clearInterval(cueIntervalID);
endVar=myMCL._totalTime;
endVar-=1.1;//frames and seconds do not always match so set the end a second from the end of the video
myMCL.addCuePoint("End", endVar);
trace("INIT TIME " +timeVar);
trace(_root.myMCL._totalTime);
}
myMCL.addEventListener("cuePoint", myCuePointListener);//listener for cue point
myMCL.setMedia("intro.flv", "FLV");//init first movie
//
addCueAtEnd();//add cue
//
stop();
willythekid
06-17-2005, 04:57 PM
Here is the code I use to get Flash to jump to a specific frame after FLV is completed
stop();
myMediaComponentInstanceName.setMedia("myFlvUrl.flv", "FLV");
var listener = new Object();
listener.complete = function(objetEvt) {
trace(myMediaComponentInstanceName.contentPath + "complete");
_root.gotoAndPlay(1);
};
myMediaComponentInstanceName.addEventListener("complete", listener);
Navarone
06-17-2005, 05:08 PM
I too was disappointed in the media components that came with flash and ultimately when with the netStream object. I used something like this but not all flv's have the MetaData:
var netConn = new NetConnection();
netConn.connect(null);
var ns = new NetStream(netConn);
my_video.attachVideo(ns);
ns.setBufferTime(5);
ns.play("videos/video11.flv");
getTotalTime = function () {
ns.onMetaData = function(obj) {
_global.videoDuration = obj.duration;
// trace(obj.duration);
};
};
onEnterFrame = function () {
getTotalTime();
totalPlayingTime = Math.round(_global.videoDuration);
currentPlayingTime = Math.round(ns.time);
if (totalPlayingTime == currentPlayingTime) {
// ns.seek(0);
// ns.pause();
ns.close();
gotoAndPlay("contact2");
}
};
However, the new media components released with the new video exporter are now capable of detecting the onListener.complete function and will actually go to a frame specified. That was one of the big issues with the components, they would never jump to the next frame. :)
Flash Gordon
04-22-2006, 04:56 AM
Hey Navarone,
Does the Flash Video Exporter 1.2 (or 1.1) really have a "2 pass" encoder. I'm not sure which version I have, but I unfortunately see no options for 2 pass encoder. :(
Navarone
04-24-2006, 12:57 PM
According to this tech note http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=4d2dd150
flash 8 only has a 1 pass encoder.
I use the Sorenson Squeeze Suite for windows program which has a 2 pas encoder. I haven't really found the need to use the encoder built into flash. :)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.