Hi Bill - thanks for the response.

I haven't found the "proper" solution yet either, but I do have a
hack...

1) Attach an event listener to the VideoEvent.PLAYHEAD_UPDATE event
2) Inside that listener, check if the video is supposed to end within
0.5 seconds (or some threshold)
3) If video is supposed to be ending very soon, start a timer, attach
event listener to its TIMER_COMPLETE event
4) Once the TIMER_COMPLETE event fires, check if (a) the video claims
it's still playing and (b) the video that was playing 0.5 seconds ago is
the same video that is supposedly playing now, if yes, just dispatch the
videoDisplay's VideoEvent.COMPLETE event


Attach an event listener to the videodisplay's
VideoEvent.PLAYHEAD_UPDATE event

playheadUpdate() {
if (videoDisplay.totalTime - videoDisplay.playheadTime < .5) {
     // The video is supposed to end withing .5 seconds, and normally you
would expect
     // the complete event to fire
     set vidSource = videoDisplay.source
     start some timer that will fire in (videoDisplay.totalTime -
videoDisplay.playheadTime + .5) seconds, i.e. 0.5 seconds after the
complete event should fire.
     attach a TimerEvent.TIMER_COMPLETE event to the Timer
}
}

timerComplete() {
     if (videoDisplay.playing && videoDisplay.source = vidSource) {
       videoDisplay.dispatchEvent(new VideoEvent(VideoEvent.COMPLETE));
     }
}

What do you think about that?

Yair

--- In [email protected], "beecee1977" <[EMAIL PROTECTED]> wrote:
>
> Well you're not crazy, but I've no solution I'm afraid:
>
> http://tech.groups.yahoo.com/group/flexcomponents/message/1549
>
> I'd imagine it's something to do with how the flv is encoded? You
> could try catching a state change event when the video stops playing
> at the end, but I haven't tried that myself...
>
> Good luck.
> Bill
>
> --- In [email protected], "Yair Flicker" yair@ wrote:
> >
> > Hello again!
> >
> > I'm having ANOTHER problem with the VideoDisplay control where I
> set it
> > to play a video, attach an event handler to its complete event, but
> the
> > complete event never gets triggered/fired! Note this happens
> > consistently with select FLV's - it doesn't happen all the time. To
> > rephrase that, on certain FLV's the VideoDisplay control operates
> > properly and fires the complete event on completion, on other
> certain
> > FLV's the VideoDisplay control completes but doesn't fire the
> complete
> > event!!! Am I crazy? Or is this another blatant bug?
> >
> > Try this MXML (I'm using Flex 2.01):
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > <http://www.adobe.com/2006/mxml%22>  layout="absolute">
> >
> > <mx:Script>
> > <![CDATA[
> > private function complete():void {
> > vid.visible = false;
> > txt.visible = true;
> > }
> > ]]>
> > </mx:Script>
> >
> > <mx:VideoDisplay id="vid"
> > source="http://ash-v14.ash.youtube.com/get_video?video_id=qP_3_NtG-
> lo"
> > <http://ash-v14.ash.youtube.com/get_video?video_id=qP_3_NtG-lo%22>
> > autoPlay="true" width="450" height="338" complete="complete()" />
> >
> > <mx:Text id="txt" text="IF YOU SEE ME THE VIDEODISPLAY COMPLETED!!!"
> > fontSize="16" color="0x000000" visible="false" />
> >
> > </mx:Application>
> >
> > That's a 30 second clip btw. You will never see the "IF YOU SEE ME
> THE
> > VIDEODISPLAY COMPLETED!!!" text. Now, however, if you change the
> source
> > to http://www.mediacollege.com/video-
> gallery/testclips/barsandtone.flv
> > <http://www.mediacollege.com/video-
> gallery/testclips/barsandtone.flv>
> > (6 second clip), the clip completes and you WILL see "IF YOU SEE ME
> THE
> > VIDEODISPLAY COMPLETED!!!"
> >
> > Any suggestions as to what may be going on?  Thanks!
> >
>


Reply via email to