用js播放.wav文件
复制代码 代码如下:
<html>
<head>
<script language="javascript">
function playSound(id)
{
var node=document.getElementById(id);
if(node!=null)
{
node.Play();
}
}
</script>
</head>
<body>
<embed name="3_devUnknown" id="3_devUnknown" src="/UploadFiles/2021-04-02/music.wav"></body>
</hmtl>
var recordhisStore = new Ext.data.JsonStore({
root: 'dataRoot',
totalProperty: 'totalCount',
idProperty: 'threadid',
remoteSort: true,
fields: [
{name: 'id', type: 'string'},
{name: 'src', type: 'string'},
{name: 'dst', type: 'string'},
{name: 'srcip', type: 'string'},
{name: 'dstip', type: 'string'},
{name: 'begin_date', type: 'date', dateFormat:'Y-m-d H:i:s'},//onclick='javascript:startwav(\" "+ value +" \")'
{name: 'end_date', type: 'date', dateFormat:'Y-m-d H:i:s'},
{name: 'content', type: 'string', convert:function(value,rec){
return "<embed id='"+ rec.id +"_devUnknown' name='"+ rec.id +"_devUnknown' src='music.wav' loop=false autostart=false hidden=true><a href='#' onclick=\"javascript:playSound('"+rec.id+"_devUnknown')\">"+value+"</a></embed>";
}}
],
proxy: new Ext.data.HttpProxy({
url: 'ctl.php?c=HisRecordQueryController&a=Query'
}),
sortInfo: {field: 'begin_date', direction: 'ASC'},
listeners:{
beforeload:function(obj,params){
var begin_date = document.getElementById("his_startdt").value;
var end_date = document.getElementById("his_enddt").value;
var src = document.getElementById("his_src").value;
var dst = document.getElementById("his_dst").value;
recordhisStore.baseParams = {limit:params.params.limit,start:params.params.start,begindate:begin_date,enddate:end_date,src:src,dst:dst};
}
}
});

js播放wav文件
复制代码 代码如下:
使用js,每隔1s播放对应的wav文件
<script language="javascript">
var arr = new Array();
var c = 0;
window.onload = function () {
var value1 = '<%=tel_2 %>';
var value2 = '<%=je %>'
StrToArray(value1);
StrToArray(value2);
}
var StrToArray = function (str) {
for (var i = 0; i < str.length; i++) {
arr[arr.length] = str.charAt(i);
}
}
var id = window.setInterval(function () {
if (c > arr.length) {
window.clearInterval(id); //清除
return;
}
embed(arr[c++]);
}, 1000);
var embed = function (num) {
if (num == "" || typeof num == "undefined") return;
document.getElementById("embed").innerHTML = "<embed name=\"player\" TYPE=\"application/x-mplayer2\" src=\"../wav/" + num + ".wav\" loop=\"false\" autostart=\"true\" hidden=\"true\"></embed>";
}
</script>
标签:
js,播放,wav

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
评论“js播放wav文件(源码)”
暂无“js播放wav文件(源码)”评论...