如何用html5制作一个网页用播放器,能够播放MP3、MP4等格式音视频文件,功能包含开始、暂停、快进功能,急求html5代码。
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript">
var audioTag = document.createElement('audio');
if (!(!!(audioTag.canPlayType) && ("no" != audioTag.canPlayType("audio/mpeg")) && ("" != audioTag.canPlayType("audio/mpeg")))) {
AudioPlayer.embed("audioplayer_1", {soundFile: "your.mp3", transparentpagebg: "yes"});
$( '#audioplayer').hide();
}
else
{
$( '#audioplayer' ).audioPlayer();
}
</script>
</head>
<body>
<p id="audioplayer_1"></p>
<audio id="audioplayer" preload="auto" controls style="width:100%;" >
<source src="xxxxxxxx.mp3" type="audio/mp3">
<!-- 这里SRC中的就是音乐文件的名字,改成你电脑上的。音乐文件要和html文件在同一目录下-->
</audio>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript">
var audioTag = document.createElement('audio');
if (!(!!(audioTag.canPlayType) && ("no" != audioTag.canPlayType("audio/mpeg")) && ("" != audioTag.canPlayType("audio/mpeg")))) {
AudioPlayer.embed("audioplayer_1", {soundFile: "your.mp3", transparentpagebg: "yes"});
$( '#audioplayer').hide();
}
else
{
$( '#audioplayer' ).audioPlayer();
}
</script>
</head>
<body>
<p id="audioplayer_1"></p>
<audio id="audioplayer" preload="auto" controls style="width:100%;" >
<source src="xxxxxxxx.mp3" type="audio/mp3">
<!-- 这里SRC中的就是音乐文件的名字,改成你电脑上的。音乐文件要和html文件在同一目录下-->
</audio>
</body>
</html>
温馨提示:答案为网友推荐,仅供参考