我如何使用 html 基本上将音频播放器嵌入我的网站?
How do I basically embed an audio player into my website using html?
我知道以前有人问过这个问题,但我还是有点小麻烦。我想在不同的位置将小的 mp3 文件嵌入到网站页面上。我已经记录了这些文件并将它们下载到(你猜对了)我的下载中。如果我要使用这样的东西:
<audio src="something.mp3" controls></audio>
我如何创建一个路径 link 到我的音频文件,以便其他人都可以收听它。我知道这可能非常简单,但我仍然很难过。
你可以用很多东西。
<audio controls>
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.mp4"
type='audio/mp4'>
<!-- The next two lines are only executed if the browser doesn't support MP4 files -->
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga"
type='audio/ogg; codecs=vorbis'>
<!-- The next line will only be executed if the browser doesn't support the <audio> tag-->
<p>Your user agent does not support the HTML5 Audio element.</p>
</audio>
或者
<embed serc="YourMusic.mp3" autostart="true" loop="true" width="2" height="0">
</embed>
使用 META 嵌入背景音效:
<meta http-equiv="REFRESH" content="0;URL='ourmusic.wav'" >
嵌入音频:
<bgsound src="he-knows.wav" LOOP="-1" >
<EMBED SRC="he-knows.mp3" HIDDEN="true" AUTOSTART="true" LOOP="infinite" Height=145 width=160></EMBED>
使用对象标签:
<object data="music.wav" type="audio/x-mplayer2" width="320" height="240">
<param name="src" value="music.wav">
<param name="autoplay" value="false">
<param name="autoStart" value="0">
Hear the sound : <a href="music.wav">music</a>
</object>
嗯,你需要把你的mp3连同html文件放在服务器上,并使用相对路径。
如果您的 html 文件和 mp3 文件在同一目录中
public_html/
index.html
something.mp3
那么你可以保持代码不变。
如果您想将 mp3 保存在子目录中
public_html/
index.html
mp3/
something.mp3
然后您需要指定与 html 文件在目录树中的位置相关的路径。
<audio src="mp3/something.mp3">
需要说明的是:您不能使用网站下载中的mp3 文件,您需要先将mp3 放到服务器上。 (实际上,您可以将他们放在一些免费服务上,例如 Dropbox,并从您的网站向他们发送 link)。
祝你好运。
我知道以前有人问过这个问题,但我还是有点小麻烦。我想在不同的位置将小的 mp3 文件嵌入到网站页面上。我已经记录了这些文件并将它们下载到(你猜对了)我的下载中。如果我要使用这样的东西:
<audio src="something.mp3" controls></audio>
我如何创建一个路径 link 到我的音频文件,以便其他人都可以收听它。我知道这可能非常简单,但我仍然很难过。
你可以用很多东西。
<audio controls>
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.mp4"
type='audio/mp4'>
<!-- The next two lines are only executed if the browser doesn't support MP4 files -->
<source src="http://media.w3.org/2010/07/bunny/04-Death_Becomes_Fur.oga"
type='audio/ogg; codecs=vorbis'>
<!-- The next line will only be executed if the browser doesn't support the <audio> tag-->
<p>Your user agent does not support the HTML5 Audio element.</p>
</audio>
或者
<embed serc="YourMusic.mp3" autostart="true" loop="true" width="2" height="0">
</embed>
使用 META 嵌入背景音效:
<meta http-equiv="REFRESH" content="0;URL='ourmusic.wav'" >
嵌入音频:
<bgsound src="he-knows.wav" LOOP="-1" >
<EMBED SRC="he-knows.mp3" HIDDEN="true" AUTOSTART="true" LOOP="infinite" Height=145 width=160></EMBED>
使用对象标签:
<object data="music.wav" type="audio/x-mplayer2" width="320" height="240">
<param name="src" value="music.wav">
<param name="autoplay" value="false">
<param name="autoStart" value="0">
Hear the sound : <a href="music.wav">music</a>
</object>
嗯,你需要把你的mp3连同html文件放在服务器上,并使用相对路径。
如果您的 html 文件和 mp3 文件在同一目录中
public_html/
index.html
something.mp3
那么你可以保持代码不变。
如果您想将 mp3 保存在子目录中
public_html/
index.html
mp3/
something.mp3
然后您需要指定与 html 文件在目录树中的位置相关的路径。
<audio src="mp3/something.mp3">
需要说明的是:您不能使用网站下载中的mp3 文件,您需要先将mp3 放到服务器上。 (实际上,您可以将他们放在一些免费服务上,例如 Dropbox,并从您的网站向他们发送 link)。
祝你好运。