当前位置: 首页 > 网络学院 > 网页制作基础教程 > Internet > 在网络中播放音频

Internet
播放QuickTime电影
播放Real视频电影
网络多媒体元素参考
Windows媒体播放器参考
MIME 参考
W3C 简介
W3C 标准化进程
W3C HTML
W3C XHTML
W3C XML
W3C CSS
W3C XSL
W3C XML Schema
W3C XPath
W3C XQuery
W3C DOM
W3C Soap
W3C WSDL
W3C RDF 和 OWL
W3C SMIL

Internet 中的 在网络中播放音频


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1181 ::
收藏到网摘: n/a

Sounds can be played "inline" or by a "helper", depending on the HTML element you use.
声音可以在“线内”播放或作为“提示音”,主要根据你所使用的HTML元素来决定。


Inline Sound
线内声音

When sound is included in a web page, or as part of a web page, it is called inline sound.
当声音嵌套在网页中时,或作为网页的一部分时,我们称之为“线内声音”。

Inline sound can be added to a web page by using the <bgsound> element or the <img> element.
线内声音可以通过<bgsound>元素或<img>元素添加到网页中。

If you plan to use inline sounds in your web applications, be aware that many people find inline sound annoying. Also note that some users might have turned off the inline sound option in their browser.
如果你计划在你的网络应用程序中使用线内声音,请注意,很多人是非常讨厌线内声音的。而且还要注意,有些用户可能会关闭网络浏览器的线内声音选项。

Our best advice is to include inline sound only in web pages where the user expects to hear the sound. An example of this is a page which opens after the user has clicked on a link to hear a recording.
我们的最佳建议是:仅在那些用户希望听到声音的页面中加载声音。其中的一个案例是:在用户点击一个链接之后听到声音时在打开页面。


Using A Helper (Plug-In)
使用在线助手(内置插件)

A helper application is a program that can be launched by the browser to "help" playing sound. Helper applications are also called Plug-Ins.
助手程序使用与激发播放浏览器内声音的应用程序。助手程序也可以叫做插件程序。

Helper applications can be launched using the <embed> element, the <applet> element, or the <object> element.
助手程序可以使用<embed>元素、<applet>元素或<object>元素来激发。

One great advantage of using a helper application is that you can let some (or all) of the player settings be controlled by the user.
使用助手程序的一个最大的好处就是:你可以让用户来控制播放器设置程序。

Most helper applications allows manually (or programmed) control over the volume settings and play functions like rewind, pause, stop and play.
大多数助手程序支持使用手动(或程序)来控制音量属性和播放函数,如:重复、暂停、停止和播放。


Using The <bgsound> Element
使用<bgsound>元素

Internet Explorer supports an element called <bgsound>.
IE支持<bgsound>元素。

The purpose of this element is to provide a background sound for a web page:
该元素的用途是在网页中插入背景音乐。

<bgsound src="beatles.mid" />

The code fragment above displays a MIDI file as background music for a web page.
上述代码片断显示了作为网页背景音乐的MIDI文件。

Click here to try it yourself [自己尝试一下]

A list of attributes for the <bgsound> element can be found in a later chapter of this tutorial.
<bgsound>元素的属性列表可以在教程的后面章节中找到。

Note: The <bgsound> element is not a standard HTML or XHTML element. It is supported by Internet Explorer only.
注意:<bgsound>元素不是一个标准的HTML或XHTML元素。它只支持IE。


Using The <img> Element
使用<img>元素

Internet Explorer supports the dynsrc attribute in the <img> element.
IE 支持<img>元素中的dynsrc属性。

The purpose of this element is to embed multimedia elements in web page:
该元素的目的是在网页中嵌套多媒体元素:

<img dynsrc="horse.wav" />

The code fragment above displays a WAVE file embedded in a web page.
上述代码片断显示了嵌套在网页中的WAVE文件。

Click here to try it yourself [自己尝试一下]

Note: The dynsrc attribute is not a standard HTML or XHTML attribute. It is supported by Internet Explorer only.
注意:dynsrc属性不是一个标准的HTML或XHTML元素。它只支持IE。


Using The <embed> Element
使用<embed>元素

Internet Explorer and Netscape both support an element called <embed>.
IE 和 Netscape浏览器都支持<embed>元素。

The purpose of this element is to embed multimedia elements in web page:
该元素的目的是在网页中嵌套多媒体元素:

<embed src="beatles.mid" />

The code fragment above displays a MIDI file embedded in a web page.
上述代码片断显示了嵌套在网页中的MIDI文件。

Click here to try it yourself [自己尝试一下]

A list of attributes for the <embed> element can be found in a later chapter of this tutorial.
<embed>元素的属性列表可以在教程的后面章节中找到。

Note: The <embed> element is supported by both Internet Explorer and Netscape, but it is not a standard HTML or XHTML element. The World Wide Web Consortium (W3C) recommend using the <object> element instead.
注意:<embed>元素可以同时被IE和Netscape浏览器支持,但是,它并不是标准的HTML元素或XTHML元素。万维网联盟(W3C)推荐使用<object>元素来替代。


Using The <object> Element
使用<object>元素

Internet Explorer and Netscape both support an HTML element called <object>.
IE 和 Netscape浏览器都支持名为<object>的HTML元素。

The purpose of this element is to embed multimedia elements in web page:
该元素的目的是在网页中嵌套多媒体元素:

<object
classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="FileName" value="liar.wav" />
</object>

The code fragment above displays a WAVE file embedded in a web page.
上述代码片断显示了嵌套在网页中的WAVE文件。

Click here to try it yourself [自己尝试一下]

A list of attributes for the <object> element can be found in a later chapter of this tutorial.
<object>元素的属性列表可以在教程的后面章节中找到。


Using A Hyperlink
使用一个超链接

If a web page includes a hyperlink to a media file, most browsers will use a "helper application" to play the file:
如果网页包含了指向媒体文件的超链接,那么,大多数浏览器将使用一个“助手程序”来播放文件:

<a href="beatles.mid">
Click here to play the Beatles
</a>

The code fragment above displays a link to a MIDI file. If the user clicks on the link, the browser will launch a helper application like Windows Media Player to play the MIDI file.
上述代码片断显示了嵌套在网页中的MIDI文件。如果用户点击了链接,那么浏览器助手程序如Windows Media Player将播放MIDI文件。

Click here to try it yourself [自己尝试一下]

评论 (0) All

登陆 | 还没注册?