HTML <audio>、<bgsound> 和 <embed> 音频标签之间的区别

Difference Between HTML <audio>, <bgsound> and <embed> audio tags

<audio><bgsound><embed> 标签有什么区别?

我正在尝试在我的网站上添加背景声音。试过 <embed> 但它在移动设备上不起作用。同样,<bgsound> 也有一些限制。 <audio> 标签对我有用。

任何人都可以解释一下它们之间的区别吗?

<audio>是标准,HTML 5、包含声音的方法。使用这个。

<bgsound> 是一种非标准的、仅限 Internet Explorer 的方法,用于包含早于 HTML 5.

的声音

<embed> 是一种包含没有本机支持且预期由插件处理的内容的方法。

< bgsound > : The HTML tag is used to play a soundtrack in the background. This tag is for Internet Explorer only.

< bgsound >:仅适用于 Internet Explorer

总结: HTML 背景声音元素 () 是一个将背景声音与页面相关联的 Internet Explorer 元素。

示例:

<bgsound src="sound1.mid">
<bgsound src="sound2.au" loop="infinite">

< audio > & < video > : Standard Way To Implement audio and video in Website currently

< audio > : HTML5 元素指定在网页中嵌入音频的标准方式。 ( ogg,mp3.etc。支持)

示例:

<audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio

< embed > : 3rd partiy Plugins like Java application , Flash apps.. etc,

< embed > :它的 3rd Partiy 插件现在已经过时了。 ( 该元素创建一个嵌入式面板,第三方应用程序(例如基于 Flash 的对象)可以在其中 运行。

示例:

<!DOCTYPE html>
<html>
<head>
<title>HTML Embed Tag</title>
</head>
<body>
<embed src="www.abc./html/yourfile.mdi" width="250" height="100" />
</body>
</html>