PDA

View Full Version : Q: Events that fire when a flv or mp3 has ended?


gordee
11-18-2008, 02:27 PM
I'm wondering if there is a way to detect when an audio or video file has finished? It would be useful to trigger a tween or other function. I guess it would mean editing the plugins for flvplayer and mp3hotspot. Does any know if it is possible?

thanks

siesfor
11-18-2008, 05:35 PM
you just need to add an onLoad event with a timer parameter to your mp3/flv hotspot. ie...

onLoad = "timer=1,,,doFunction"

you're just telling the timer to kick-in after the mp3/flv loads, but since it doesn't specify a length of time, the timer waits until after the file has finished playing to activate your next function.

gordee
11-19-2008, 12:22 AM
Thanks Siesfor. I really thought there would me more to it than that.

myksa
11-19-2008, 12:45 PM
Actually it doesn'w work for me, it fires immediately my function.

I'm using this code:


<spot
id="i"
type="box"
url="plugins/flvplayer.swf?file=menu/intro.flv"
onLoad="timer=1,,,next"
next="loadPano(xml_file=next.xml);"
/>



and onLoad function doesn't wait to play whole flv movie, but loads the next pano immediately.

Any ideas how to fix this?

Thanks

siesfor
11-20-2008, 03:34 AM
yeah, you're right myksa, it appears to move on after it finishes loading the player rather than after playing the flv. That's a bummer, I had only tried it with mp3hotspot. Off hand, there doesn't appear to be a way to do it with flvplayer, but if it can be done with an mp3, I'd have to imagine it's possible to set up for an flv to do the same(?)

myksa
11-20-2008, 05:55 AM
As flv is a streaming video, I think it would be hard to do it, but maybe it can be managed by modyfication of flvplayer. I would try to do something, and hope it will work ;)

myksa
11-20-2008, 10:01 AM
To detect end of a flv video I've made simple modyfication to flvplayerplugin. I've added a listener which fires when flv finishes. Listeners executes a global function called onFlvComplete in xml.

This is the code which have to be added to initHandler function in flvplayer.fla:

player.addEventListener("complete", function(eventObject:Object):void { hotspots.execute("global.onFlvComplete;"); });

It helped me a lot, and I hope it helps someone else ;)