2

Im working on a slideshow based on the jquery cycle plugin (found here: http://jquery.malsup.com/cycle/). The slideshow slides between different divs where I can put different content such as images and text. However i'd also like to add swf movies to the script wich just on a basic overview works. The video starts playing when the slide becomes visible but stops before it's done and goes over to next slide.

Of course this happens since i have a timer for how long each slide should be visible. What i wonder though is if there's a way with the script for it to dynimacly get the length of the video and not change slide until the video is complete and just do this for swf videos.

Other content should hold on to the timer.

Best Regards Paparappa

Paparappa
  • 2,099
  • 3
  • 18
  • 35

1 Answers1

0

It should be no problem.

First use the ExternalInterface to communicate between Flash and JQuery. Check out this question Trigger jquery with flash or directly http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html.

Then you have two options:

Get the length of the video stream from the MetaData object:

1) set the NetStream clinet to this

mainNS = new NetStream(mainNC);
mainNS.client = this;

2) have a onMetaData public method in this class

public function onMetaData(infoObject : Object) : void {
     if (infoObject.hasOwnProperty('duration')) {
          _duration = Number(infoObject['duration']);
     }          
}

Or listen to the video end:

1)

mainNS = new NetStream(mainNC);
mainNS.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

2)

private function netStatusHandler(event : NetStatusEvent) : void {
    if (event.info['code'] == "NetStream.Play.Stop") {
        trace('video end');         
    }
}
Community
  • 1
  • 1
daniel.sedlacek
  • 8,129
  • 9
  • 46
  • 77
  • Okey. First I have to say sorry that i'm not more of a javascript expert then i should be. Even though you've been really helpful showing me what to use I don't know how to use it. If I have an swf file that is 10 seconds. How do i make jquery cycle recognize this and not just slide to the next with this code: $(document).ready(function() { $('.slideshow').cycle({ fx: 'fade', speed: 500, timeout: 5000, delay: -0, pause: 1 }); }); – Paparappa Nov 09 '10 at 14:45
  • lol, I'm not JS developer either :). What you call Flash video - is it an animation or video? Always the same duration or dynamic? – daniel.sedlacek Nov 09 '10 at 15:14
  • It is dynamic im afraid lol. It will be different videos for different pages so to speak – Paparappa Nov 09 '10 at 15:35
  • hello i have the same trouble.. did you get any solutions for this – Gowri Feb 11 '11 at 10:02
  • guys what exactly do you want and why is my solution not enough? – daniel.sedlacek Feb 11 '11 at 10:07