<!DOCTYPE html>
<html lang="en">
<video id="media" style="width: 100%;height:400px;" controls>
<source src="${pageContext.request.contextPath}/file/video/${fileName}">
</video>
<audio id="media" controls>
<source src="${pageContext.request.contextPath}/file/audio/${fileName}"/>
</audio>
var media = $("#media");
if(media[0].paused) {
media[0].play();
}
else {
media[0].pause();
}
$(document).ready(function(){
var media = $("#media");
media[0].onplay = function(){
$("#switch1").attr("src","${pageContext.request.contextPath}/style/images/0ff1.png");
};
media[0].onpause = function(){
$("#switch1").attr("src","${pageContext.request.contextPath}/style/images/ON0.png");
};
});
原文地址:http://blog.csdn.net/hubiao_0618/article/details/45640541