//上传
$("#voice_file").on("change", function () {
var objUrl = upload_file(this.files[0]);
if (objUrl.code == 1) {
$('#video_url').val(objUrl.data.photo)
$('.imgWrap').html('')
var audioFile = get\_object\_uRL(this.files\[0\]);
$("#audio").attr("src", audioFile);
$("#audio")\[0\].pause();
$("#audio").show();
getTime();
} else {
layer.msg(objUrl.msg, {icon: 5});
}
});
//获取时长
function getTime() {
setTimeout(function () {
var duration = $("#audio")[0].duration;
if(isNaN(duration)){
getTime();
}else{
console.info("该歌曲的总时间为:"+$("#audio")[0].duration+"秒")
$('#ma_time').val(duration)
}
}, 10);
}
手机扫一扫
移动阅读更方便
你可能感兴趣的文章