我想在我的网站上播放音频视频文件.plz帮助我实现这一目标。你可以建议我任何球员的名字或一段代码。
我正在使用此代码,但它支持mp3和mp4格式。
<div class="content-top">
<div class="wrap">
<div class="section group">
<?php echo $typehtml;?>
</div>
<video width="640" height="360" controls>
<source src="admin/audiovideo/<?php echo $videoname;?>" type="video/mp4" />
<source src="__VIDEO__.OGV" type="video/ogg" />
<object width="640" height="360" type="application/x-shockwave-flash" data="__FLASH__.SWF">
<param name="movie" value="__FLASH__.SWF" />
<param name="flashvars" value="controlbar=over&image=__POSTER__.JPG&file=__VIDEO__.MP4" />
<param name="movie" value="__FLASH__.SWF" />
<param name="flashvars" value="controlbar=over&image=__POSTER__.JPG&file=__VIDEO__.FLV" />
<param name="movie" value="__FLASH__.SWF" />
<param name="flashvars" value="controlbar=over&image=__POSTER__.JPG&file=__audio__.MP3" />
<!-- fallback image. note the title field below, put the title of the video there -->
<img src="__VIDEO__.JPG" width="640" height="360" alt="__TITLE__"
title="No video playback capabilities, please download the video below" />
</object>
</video>
</div>
</div>
答案 0 :(得分:0)
试试这个
<!DOCTYPE html>
<html>
<body>
<button onclick="changeSource()" type="button">Change Video</button>
<br>
<video id="video1" controls="controls" autoplay="autoplay">
<source id="mp4_src" src="mov_bbb.mp4" type="video/mp4">
<source id="ogg_src" src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
<script>
function changeSource()
{
document.getElementById("mp4_src").src="movie.mp4";
document.getElementById("ogg_src").src="movie.ogg";
document.getElementById("video1").load();
}
</script>
<p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
</body>
</html>
来自http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_av_met_load
的链接