0

I'm trying to have a jsfl script import a video into my .fla project and export the entire thing as a .swf automatically Is it possible to disable the video wizard when importing videos? I'd hate to have to manually confirm all the options every single time. The video is in .flv format if that makes any difference

CodedMonkey
  • 458
  • 1
  • 7
  • 17
  • If you want to import a video into a swf just for playback, why not use the FLVPlayback component and and a line of code to get the path to the flv/f4v/mov file from FlashVars and pass it to the player ? Any particular reason why you need to import a video into the fla ? – George Profenza Sep 17 '11 at 12:01
  • George, that sounds like I'd be streaming the video then, and I want to include the video in the final .swf file so as to minimize any errors and potential load time after the video starts playing. The clip I am trying to import is only like 3 seconds long so it would work well as embedded in the .swf – CodedMonkey Sep 19 '11 at 16:50

1 Answers1

2

AFAIK you can't bypass the FLV import dialog directly (using the JSFL API).

I've tried automating the FLV import wizard using a Sikuli script. The script can be run from JSFL using the undocumented FLfile.runCommandLine().

I'm using OSX so I'm not sure if this next part applies for Windows too. If I run the sikuli + the script directly:

FLfile.runCommandLine("/Applications/Sikuli-IDE.app/Contents/MacOS/JavaApplicationStub /Users/george/Documents/sikuli/importFLV.skl");

Flash will wait for this to run then continue importing the FLV which is a problem. The Sikuli script will timeout since the Import FLV dialog will never appear.

Still, I can run this:

FLfile.runCommandLine("open -a /Applications/Sikuli-IDE.app/Contents/MacOS/JavaApplicationStub /Users/george/Documents/sikuli/importFLV.skl");

And this seems to open a window of the application and runs the script asynchronously, which is great. Then I run the import. The sikuli script:

  1. waits for the faded out(out of focus) dialog
  2. clicks to get focus
  3. clicks the Embed FLV in SWF and play in timeline option
  4. waits for the dialog with the proper option selected
  5. clicks Continue
  6. waits for the next screen
  7. clicks Continue
  8. waits for the next screen
  9. clicks Finish

Also, on my machine, the script always worked when I had SikuliIDE open (with no particular script) and minimized.

The full test script to import a video looks like this:

var doc = fl.getDocumentDOM();
FLfile.runCommandLine("open -a /Applications/Sikuli-IDE.app/Contents/MacOS/JavaApplicationStub /Users/george/Documents/sikuli/importFLV.skl");
var path = FLfile.platformPathToURI('Users/george/Desktop/cuePointTest_1.flv');
doc.importFile(path);

You can find a recording of the script running here. After I run the JSFL script, the rest of the clicks are handled by Sikuli. You can also download the source script and the Sikuli executable script for my setup, but I imagine it will be different on yours. Sikuli is easy to use: type a command, go to your app and press CMD/Ctrl + Shift + 2 to grab a snapshot and continue.

If this does the job for your, then you can probably modify the sikuli script to wait for some time to do the clicks for the next video in the sequence, while Flash loads a new document. There should be other workarounds to manage a list of videos, but that makes sense if this solution works for your setup.

George Profenza
  • 50,687
  • 19
  • 144
  • 218
  • I ended up just embedding the videos in the framework .fla file. Turns out those videos will be consistently needed throughout all my flash videos :D. Your answer was too thorough not to accept though :) – CodedMonkey Oct 13 '11 at 23:21
  • Have you tested Sikuli scripts on multiple machines/OSs? – Justin Putney Apr 19 '12 at 15:52
  • Thanks (for the tweet as well :) ) I've tried it on multiple machines, but same os (osx). In theory it should work on windows/mac/linux (based on the downloadable versions). – George Profenza Apr 19 '12 at 16:07