Html 从 HTML5 调用 .swf

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9733561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 23:10:20  来源:igfitidea点击:

Calling .swf From HTML5

html

提问by Ann Sanderson

I'm new to HTML5 and am trying to get a simple example working of calling a .swf video file from an HTML button (or similar).

我是 HTML5 的新手,正在尝试使用一个简单的示例来从 HTML 按钮(或类似按钮)调用 .swf 视频文件。

I have gotten this code so far but it doesn't seem to work...

到目前为止我已经得到了这个代码,但它似乎不起作用......

<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <video src='test.swf' id='v' controls>
      Your browser does not support HTML5 video.
    </video>
    </br>
    <button onclick="document.getElementById('v').play()">Play</button>
    <button onclick="document.getElementById('v').pause()">Pause</button>
  </body>
</html>

Any help would be appreciated...

任何帮助,将不胜感激...

回答by Fábio N Lima

You can use embed tag:

您可以使用嵌入标签:

SWF WITH BACKGROUND

有背景的 SWF

<embed src="main.swf" width="550" height="400" />

SWF WITH TANSPARENT BACKGROUND

具有透明背景的 SWF

<embed src="main.swf" width="550" height="400" wmode="transparent" />

SWF WITH FLASHVARS

带有 Flashvars 的 SWF

<embed src="main.swf" width="550" height="400" flashvars="id=hello world" wmode="transparent" />

To control the swf, you need to use External Interface functions.

要控制 swf,您需要使用外部接口函数。

回答by Simon West

.swf is not a supported file format for the <video>element the only supported file formats are MPEG-4/H.264 Ogg/Theora and WebM/VP8 with suppport for individual formats varying across browsers.

.swf 不是<video>元素支持的文件格式,唯一支持的文件格式是 MPEG-4/H.264 Ogg/Theora 和 WebM/VP8,支持不同浏览器的各种格式。

For information on which browsers support what, refer to the excellent caniuse.com.

有关哪些浏览器支持哪些内容的信息,请参阅优秀的caniuse.com

For a run down of the HTML5 video element I highly recommend Operas Introduction to HTML5video

为了深入了解 HTML5 视频元素,我强烈推荐Operas Introduction to HTML5video