背景:想在Raspberry Pi下的chrome下播放声音,通过后台播放太慢了,于是想通过html直接调用后立即播放。
<audio src="/style/music.wav" controls="controls" id="play" style="display:none">
Your browser does not support the audio element.
</audio>
audio.play();
事实上Raspberry下的chrome并不能播放mp3和m4a:
________________________________________________________________________________
var audio = document.getElementById('play');
function neworder(){
$.post('/index.php/admin/order/neworder',
{id:112},
function(data,status){
if(data.status==1){
if(one){
one=false;
neworders=data.msg;
}else if(neworders==data.msg){
}else if(neworders<data.msg){
audio.play();
}
}else{}
},'json');
}
setInterval("neworder()",60000)
来自:http://www.ziqiangxuetang.com/jsref/met-audio-play.html
<audio src="/style/music.wav" controls="controls" id="play" style="display:none">
Your browser does not support the audio element.
</audio>
audio.play();
事实上Raspberry下的chrome并不能播放mp3和m4a:
________________________________________________________________________________
var audio = document.getElementById('play');
function neworder(){
$.post('/index.php/admin/order/neworder',
{id:112},
function(data,status){
if(data.status==1){
if(one){
one=false;
neworders=data.msg;
}else if(neworders==data.msg){
}else if(neworders<data.msg){
audio.play();
}
}else{}
},'json');
}
setInterval("neworder()",60000)
来自:http://www.ziqiangxuetang.com/jsref/met-audio-play.html
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/8271/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2015-10-2 15:50
评论列表