2010-03-05 04:05:37 +0000 2010-03-05 04:05:37 +0000
30
30
Advertisement

如何使用Google Chrome浏览器播放.swf文件?

Advertisement

我有一个*.swf文件,我的Windows XP机器上没有安装flash播放器,请问有什么方法可以使用Google Chrome浏览器播放.swf文件,或者有什么网络应用可以播放.swf吗?我不介意安装任何浏览器插件,但我介意安装任何桌面应用程序。

Advertisement
Advertisement

答案 (6)

82
82
82
2015-05-12 11:23:33 +0000

我创建了一个文件flash.html,内容是这样的:

<object>
    <embed src="file.swf" width="100%" height="100%"></embed>
</object>
``` &001 

然后在Chrome浏览器中打开文件,

否则当我在拖动一个`swf`文件到Chrome浏览器时,它只是在下载文件。
5
5
5
2017-05-23 17:22:38 +0000

Catttdaddy的回答](https://superuser.com/a/1101657/522)基本上是正确的,但Chrome浏览器57及以后的版本,插件已被禁用(详情请看[这个](https://www.ghacks.net/2017/01/29/google-removes-plugin-controls-from-chrome/)),你可能需要通过Chrome浏览器的设置,以另一种方式启用Flash。如果没有启用,文件将被下载而不是打开。要在Chrome浏览器中启用Flash:

  • 输入URL chrome://settings/
  • 搜索 “Flash”
  • 在 “隐私 "下,点击 "内容设置”
  • 在Flash下,选择 “允许网站运行Flash "选项

您可能希望在打开SWF文件后,出于安全或其他原因,将其改为原始设置。

3
Advertisement
3
3
2010-11-18 16:41:17 +0000
Advertisement

你可以用Google Chrome浏览器播放.swf文件。只需将文件从当前位置拖到当前标签页上即可。

3
3
3
2016-07-16 17:23:35 +0000

Chrome有一个内置的Flash播放器,名为PepperFlash。转到chrome:///plugins/并确保 “Adobe Flash Player "已启用。你也可以去chrome:///components/确保它已更新。如果你仍然有问题,请到 "你的根 "中查看 "你的用户名",然后将pepflashplayer.dll重命名为pepflashplayerX.dll。

2
Advertisement
2
2
2018-10-26 20:22:46 +0000
Advertisement

对于有这个问题的Linux用户,我创建了下面的脚本作为解决方法:

在继续进行之前,你必须确保pepper-flash已经安装了Chrome/Chromium,(Firefox的flashplugin),唯一的检查方法(不使用下面的解决方法)是在互联网上播放一个flash文件。(或者在Firefox中,到about:plugins,看看它是否有 “Shockwave Flash”)

#!/bin/bash
if [-z $1]; then
   swf=$(ls *.swf | tail -1)
else
   swf=$@
fi

html=$(echo $swf | sed 's:swf:html:g')
echo '<embed src='$swf 'width="100%" height="100%"></embed>' | sed 's:src=:src=":g' | sed 's:swf:swf":g' > "$html"

#chromium "$html" && sleep 20 && rm "$html"
#google-chrome "$html" && sleep 20 && rm "$html"
#firefox about:config & wmctrl -xa firefox && sleep 0.2 && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && firefox "$html" && firefox about:config && wmctrl -xa firefox && sleep 0.2 && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && sleep 20 && rm "$html"

(或者与dash兼容)

要使用这个脚本,请将其保存为swftohtml.sh (可以是任何名字,不一定要以.sh结尾),在你想的任何位置,然后将其转换为可运行的命令,或者在bashrc中为其创建一个别名,或者复制到/usr/bin/。记得运行chmod +x swftohtml.sh,使其可执行。

脚本在没有参数的情况下运行时,会在当前文件夹中寻找一个swf文件,并生成一个相应的html文件,可以在浏览器中运行这个swf文件。如果文件夹里有一个以上的swf文件,它将默认为最后一个(例如,如果你有filename1.0.swf和filename2.0.swf,它将默认为filename2.0.swf)

如果要针对一个特定的swf文件,你可以输入文件名(或文件的完整路径)作为脚本的参数,它将使用该文件。(例如 swftohtml.sh filename 1.0.swftohtml.sh filename 1.0.swf )

如果你想完全自动化脚本:

要在浏览器中自动打开swf文件,并在使用后自动删除生成的html文件,请在脚本底部取消以下一行(取决于你的浏览器):

#chromium "$html" && sleep 20 && rm "$html"
#google-chrome "$html" && sleep 20 && rm "$html"
#firefox about:config & wmctrl -xa firefox && sleep 0.2 && xdotool key Return && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && firefox "$html" && firefox about:config && wmctrl -xa firefox && sleep 0.2 && xdotool key Return && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && sleep 20 && rm "$html"

脚本将在创建后立即在浏览器中打开html文件。如果你的浏览器已经运行了一个实例,它将在20秒内删除html文件(给你足够的时间告诉浏览器使用flash插件打开该文件)。如果你的浏览器没有现有的实例,那么该文件将在浏览器关闭后20秒内被删除。

有了这个设置,你可以配置SWF文件与脚本一起打开,这个过程现在是完全自动化的,这样你就可以直接打开SWF文件,而不必担心手动创建(或删除)html文件,换句话说,它现在的行为就像它应该做的那样。(请记住,可能会有一些没有删除html文件的情况,当这种情况发生时,你可以安全地忽略它。)

对于Firefox用户:

Firefox版本的比较麻烦,它需要安装wmctrl和xdotool。原因是Firefox要想用这种方式播放本地的swf文件,你需要在about:config中禁用plugins.http\https_only,脚本会自动禁用它,打开flash文件,然后重新启用,因为这是大多数人都希望保持启用的设置。在运行命令之前,浏览器需要打开。如果你认为你的firefox浏览器在运行命令时很可能会被关闭,请将这一行替换为:

firefox about:config & sleep 1 && wmctrl -xa firefox && sleep 0.2 && xdotool key Return && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && firefox "$html" && firefox about:config && wmctrl -xa firefox && sleep 0.2 && xdotool key Return && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && sleep 20 && rm "$html"

性能测试:

我做了一些基本的性能测试,结果是:

  • Chrome/Chromium Pepper Flash (PPAPI)。最快
  • Adobe Flash Projector (NPAPI)(Wine)。最快
  • Firefox Flashplugin (NPAPI):

至于稳定性,PPAPI会遇到一些NPAPI不会遇到的BUG/错误,但这种情况很少见。对于其他任务来说,这不太可能有什么关系。

0
0
0
2010-03-05 04:20:30 +0000

除非弄错了,否则你需要这个插件来播放SWF文件,因为SWF需要动作脚本库才能发挥作用。

Advertisement

相关问题

16
1
18
10
1
Advertisement