Page 1 of 1

Can I somehow determine what timelines are in a SWF File?

Posted: Wed Jul 16, 2008 11:00 pm
by GuyWithDogs
If I take a random SWF file, can I load it into the f-in-box control and determine how many timelines are contained in it? What I'm finding is that a lot of SWF files, particularly those having video embedded, don't run everything from the main timeline. I'm trying to determine when a SWF file is "done" - as in it reached the last frame it's meant to play. But if the main timeline doesn't have all the frames, then I'm sunk (aren't I?).

As an example, look at Wondershare's PPT2SWF product. It will take a Powerpoint slide show and convert it to a SWF file, including all the animations, etc. Up until v5 of their product, they ended up with the operation on the main timeline, and I could use a timer to query the current frame and compare to the total frame count. However, as of v5, if your Powerpoint has 3 slides, then the SWF file has 3 frames. However, if your slide show is 15 seconds long, it doesn't take 15 seconds to reach the last frame in the SWF. It happens fast, but the SWF does play for 15 seconds.

I need to determine how long the SWF should really be playing for. Can I do that somehow?

Posted: Thu Jul 17, 2008 5:03 pm
by Softanics
Thank you for your question.

There is no an ideal solution. I can suggest you to get snapshots periodically and compare last two (or more). If some number of last snapshots are equal, then a movie has stopped.

Thank you.

Posted: Mon Jul 21, 2008 2:57 pm
by GuyWithDogs
Softanics wrote:There is no an ideal solution. I can suggest you to get snapshots periodically and compare last two (or more). If some number of last snapshots are equal, then a movie has stopped.
Thank you.


Have you got code for some sort of fast comparison of snapshots? I can't imagine how this might be done quickly.

Posted: Mon Jul 21, 2008 5:30 pm
by Softanics
How about comparing CRC32 of pixel buffers? If it's equal, then compare pixel-by-pixel.

Posted: Mon Jul 21, 2008 8:32 pm
by GuyWithDogs
I was thinking about this further. Since I don't know what a given SWF file looks like ahead of time, then deciding it's done based on a lack of change for some number of (milli)seconds is dangerous. There's nothing that says a SWF couldn't be a slideshow with images shown for 15 seconds each. I don't have any way of knowing that 15 seconds is OK.

Obviously the Flash OCX knows when it's done. I'm surprised (a bit) that there's no event surfaced, or a flag available that indicates that the file is "done playing" or "reached the end".

I was looking at the Adobe.com site for hints. Unfortunately, it looks like you have to have paid for a support plan to actually ask an engineer a question. I've dropped a couple of messages in their forum, but no responses as of yet.

Posted: Tue Jul 22, 2008 8:22 am
by Softanics
GuyWithDogs wrote:Obviously the Flash OCX knows when it's done.


I don't think so.

For example, a movie has the only frame with infinite video inside. There is no "finish" for such movie, right?

Or a flash game.