0
votes

I have managed to embed a youtube video in Flash, using the YouTube ActionScript 3.0 Player API https://developers.google.com/youtube/flash_api_reference.

It's working fine but I need some additional functionality. I have multiple videos on a frame, so the first thing I want to do is

  1. If VIDEO 1 is playing and I click VIDEO 2, I want VIDEO 1 to stop.
  2. I want any video that is playing to stop when I leave the frame.

In regards to the latter, I'm aware I could create a button for navigation and add player.stopVideo(); function to it BUT it gets more complicated because the SWF is inside one of the (horrible) flipping book apps, so the navigation is controlled by the flipping book app, not the actual SWF that contains the videos.

Any workarounds for my 2 problems above?

1

1 Answers

0
votes

You could add an event listener to your video. The event onStateChange should help you:

Possible values are unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).

You can start the other video by using:

player.playVideo()