Tutorial :How to run SWF without a browser (on a linux server)?



Question:

I have a swf file that connects to a remote flash server and receives some data. For security reasons I can't make this swf file web accessible so I can't use browser to run it. Is there a way to run it on the server side from a command prompt (under linux)?


Solution:1

You can use Xvfb or Xfake to run a X server that doesn't interface to real hardware. If they aren't available as packages for your distribution, you can build them from the Xorg xserver sources.

(Or use MarkR's Xvnc suggestion.)

The Adobe plugin used to ship with a stand-alone executable named flashplayer or gflashplayer, which was usable outside of the browser. I think it still exists, but is in the developer package, or something like that.

If you're using a free implementation of Flash, both Gnash and Swfdec come with stand-alone gnash and swfdec executables respectively.

This starts Xvfb on display :20 (just make sure to pick a number that's not in use; normal displays start at :0, ssh's X forwarding typically allocates :10 and up, and I've seen some Xvnc setups start at :90), and runs gnash inside of it:

startx /usr/bin/gnash http://url.to/flash.swf -- /usr/bin/Xvfb :20  


Solution:2

If you use ubuntu , type sudo apt-get install xvfb, and then download the flashplayer from adobe, and just try like this, it work well:

xvfb-run ./flashplayer test.swf  

Or if you use windows, you can just double click the swf on the server, and it running now, communction with other server, just use this swf as part of server, calculate the value and return ,swf run loop for ever as it's a server


Solution:3

You could make the SWF web accessible and protect the directory using .htaccess files.

See Apache .htaccess Tutorial for further information.

You could also try ffplay (ffplay -fs somefile.swf) to run the swf.

Edited: Looks like ffplay uses SDL so X may not be required.

But I dont think this would be installed on your server. YMMV

Updated: Dont let the no GUI stop you in what you can do, if you use SSH look at this article how to export your X display to your local workstation. Trying to tunnel X over SSH


Solution:4

Adobe Air?

The main problem is command prompt, not the "web accessibility". If you can run FireFox, I am sure you can load the file by filesystem path. I would be really surprised if it was possible to run SWF stuff on the command line. I mean, not that this is not possible in principle, it's just that the point of SWF is usually in displaying some blinking and jumping junk, so nobody bothers to write command-line tools to run it...

PS. I assume you are aware of the fact that you can run FireFox on a Linux server, right? (The whole X Windows thingie?)


Solution:5

You could easily (ish) write a C program which implements the netscape plugin interface to interface with Flash directly. That would work.

However, it would probably still require an X server to do this - you could use XVnc or something to run headless.

Nontrivial, but would work.

Your requirement sounds a bit strange - perhaps it would be a more maintainable design to rewrite the Flash component in some other language.


Solution:6

Adobe's Ichabod would probably solve your problem, but I can't seem to find any information whether it's available for public consumption, or just for search providers. Just an echo chamber of articles like one on ReadWriteWeb.


Solution:7

Best way is Install "Macromedia Flash Player MX" via Wine.. It will install Macromedia MX along with "Macromedia Flash Player".. Now just go to your swf file and change its default application to "Macromedia Flash Player"(not Macromedia MX)


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »