简体   繁体   English

如何在没有浏览器的情况下运行SWF(在Linux服务器上)?

[英]How to run SWF without a browser (on a linux server)?

I have a swf file that connects to a remote flash server and receives some data. 我有一个连接到远程闪存服务器并接收一些数据的swf文件。 For security reasons I can't make this swf file web accessible so I can't use browser to run it. 出于安全原因,我不能使这个swf文件可以访问,所以我不能使用浏览器来运行它。 Is there a way to run it on the server side from a command prompt (under linux)? 有没有办法从命令提示符(在Linux下)在服务器端运行它?

You can use Xvfb or Xfake to run a X server that doesn't interface to real hardware. 您可以使用XvfbXfake来运行不与实际硬件接口的X服务器。 If they aren't available as packages for your distribution, you can build them from the Xorg xserver sources. 如果它们不可用作您的发行版的软件包,则可以从Xorg xserver源构建它们。

(Or use MarkR's Xvnc suggestion.) (或者使用MarkR的Xvnc建议。)

The Adobe plugin used to ship with a stand-alone executable named flashplayer or gflashplayer , which was usable outside of the browser. Adobe插件曾经附带一个名为flashplayergflashplayer的独立可执行文件,可在浏览器之外使用。 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. 如果您使用Flash的免费实现,Gnash和Swfdec分别带有独立的gnashswfdec可执行文件。

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: 这将启动Xvfb显示:20(只需确保选择一个未使用的数字;正常显示从:0开始, ssh的X转发通常分配:10及以上,我看到一些Xvnc设置开始于:90 ),并在其中运行gnash

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

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: 如果您使用ubuntu,请键入sudo apt-get install xvfb ,然后从adobe下载flashplayer,尝试这样,它运行良好:

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 或者如果你使用windows,你可以双击服务器上的swf,它现在运行,与其他服务器一起使用,只需使用此swf作为服务器的一部分,计算值并返回,swf run loop for ever,因为它是服务器

最好的方法是通过Wine安装“Macromedia Flash Player MX”。它将安装Macromedia MX和“Macromedia Flash Player”..现在只需转到你的swf文件并将其默认应用程序更改为“Macromedia Flash Player”(不是Macromedia MX) )

You could make the SWF web accessible and protect the directory using .htaccess files. 您可以使SWF Web可访问并使用.htaccess文件保护目录。

See Apache .htaccess Tutorial for further information. 有关详细信息,请参阅Apache .htaccess教程

You could also try ffplay (ffplay -fs somefile.swf) to run the swf. 你也可以试试ffplay(ffplay -fs somefile.swf)来运行swf。

Edited: Looks like ffplay uses SDL so X may not be required. 编辑:看起来ffplay使用SDL,因此可能不需要X.

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. 更新:不要让没有GUI阻止你做你能做什么,如果你使用SSH看看这篇文章如何将你的X显示导出到你的本地工作站。 Trying to tunnel X over SSH 试图通过SSH隧道X.

Adobe Air? Adobe Air?

The main problem is command prompt, not the "web accessibility". 主要问题是命令提示符,而不是“Web可访问性”。 If you can run FireFox, I am sure you can load the file by filesystem path. 如果你可以运行FireFox,我相信你可以通过文件系统路径加载文件。 I would be really surprised if it was possible to run SWF stuff on the command line. 如果可以在命令行上运行SWF,我会感到非常惊讶。 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... 我的意思是,并非原则上这是不可能的,只是SWF的重点通常是显示一些闪烁和跳跃的垃圾,所以没有人想要编写命令行工具来运行它......

PS. PS。 I assume you are aware of the fact that you can run FireFox on a Linux server, right? 我假设你知道你可以在Linux服务器上运行FireFox,对吧? (The whole X Windows thingie?) (整个X Windows thingie?)

You could easily (ish) write a C program which implements the netscape plugin interface to interface with Flash directly. 你可以很容易地(ish)编写一个C程序,它实现了netscape插件接口,直接与Flash接口。 That would work. 那会有用。

However, it would probably still require an X server to do this - you could use XVnc or something to run headless. 但是,它可能仍然需要X服务器来执行此操作 - 您可以使用XVnc或其他东西来运行无头。

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. 您的要求听起来有点奇怪 - 也许用其他语言重写Flash组件是一种更易于维护的设计。

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. Adobe的Ichabod可能会解决您的问题,但我似乎无法找到任何信息,无论是公共消费还是仅供搜索提供商使用。 Just an echo chamber of articles like one on ReadWriteWeb . 只是一个像ReadWriteWeb上的文章的回声室。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM