我想在浏览器中使用html播放音频;以及如何在html 中播放存储在我们的计算机/笔记本电脑中的音频/视频
我试过下面的代码。。。
<!DOCTYPE html>
<html>
<body>
<audio controls>
<source src="C:UsersabcDesktopsong.ogg" type="audio/ogg">
<source src="C:UsersabcDesktopsong.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</body>
</html>
这不起作用。。。
您可以使用许多不同的标签来使用HTML播放音频,例如,您可以使用<object>
标签:
<object height="50" width="100" data="Example.mp3"></object>
或者<embed>
标签:
<embed height="50" width="100" src="Example.mp3">
但最好的解决方案是使用以下代码行:
<audio controls>
<source src="example.mp3" type="audio/mpeg">
<source src="example.ogg" type="audio/ogg">
<embed height="50" width="100" src="Example.mp3">
</audio>
您的代码也是正确的,但您的浏览器可能不支持。感谢收听,如果您需要更多信息,请访问www.w3schools.com