在exceution之后显示音频,但音频不会在Chrome浏览器中播放 [英] Displays audio after exceution but audio doesnot gets played in chrome browser
问题描述
我需要开发一个web应用程序,以编程方式转换dss和ds2文件,并在我尝试过的所有浏览器中播放转换后的音频文件,但我不能这样做,因为我是新手,任何人都可以帮助我。
以下是我尝试的方式,但它在Chrome浏览器中不起作用。我在这里做的是我从NCH Software下载了开关声音软件并转换了dss和ds2文件转换为.wav格式。转换后我需要将这些wav文件放在我的应用程序的一个文件夹中,我已经在这个工程中给出了路径它只适用于firefox浏览器,但不适用于chrome浏览器。这是我使用的代码。我怎么能这样做才能在所有浏览器中播放文件
这是我尝试的第一种方式
I need to develop a web application which converts dss and ds2 files programmatically an d play those converted audio files in all browsers i tried a lot but i could not do it as i am new to this can anyone help me out.
Below is the way which i tried but it is not working in chrome browser.What i did here is i had downloaded switch sound software from NCH Software and converted dss and ds2 files to .wav format.After conversion i need to place those wav files in a folder in my application and i had given the path in this works it works only in firefox browser but not in chrome browser.This is the code that i used.how can i do this such that the files should get played in all browsers
This is the first way i tried
//$("#audio").attr("autoplay", true);
//document.getElementById("audio").play();//to play
//document.getElementById("audio").pause();//to pause
window.onload = function () { document.getElementById("audio").play(); }
window.addEventListener("load", function () { document.getElementById("audio").play(); });
<%-- <audio src="Sounds/DPM317.wav" controls="controls" autoplay="autoplay">--%>
<%-- <audio src="Sounds/DS250069new.wav" controls="controls" autoplay="autoplay">
<audio controls="">
<source src="Sounds/DPM317.wav" type="audio/wav" />
Your browser does not support the audio element.
--%>
<audio id="audio" controls="" autoplay="">
<source src="Sounds/DPM317.wav" type="audio/wav" />
您的浏览器不支持音频元素。
这是我尝试的第二种方式
Your browser does not support the audio element.
This is the second way i tried
<title>
function PlaySound(soundobj) {
var thissound = document.getElementById(soundobj);
thissound.play();
}
function PauseSound(soundobj) {
var thissound = document.getElementById(soundobj);
thissound.pause();
}
<audio id="audio1" controls="controls" preload="auto" src="Sounds/DPM317.wav" type="audio/wav">
<audio id="audio2" controls="controls" preload="auto" src="Sounds/DS250069new.wav" type="audio/wav">
/pre>
But none of them are working in chrome browser can anyone help me out as iam new to this<
What I have tried:
i tried the above codes which i had posted but none of them are working
推荐答案
( #audio)。attr(autoplay,true);
//document.getElementById(\"audio\").play();//播放
//document.getElementById(\"audio\").pause();//暂停
window.onload = function(){document.getElementById(audio)。play();
window.addEventListener(load,function(){document.getElementById(audio)。play();});
<% - < ; audio src =Sounds / DPM317.wavcontrols =controlsautoplay =autoplay> - %>
<% - < audio src =Sounds / DS250069new.wav控件=controlsautoplay =autoplay>
< audio controls =>
< source src =Sounds / DPM317.wavtype =audio / wav/>
您的浏览器不支持音频元素。
- %>
< audio id = audio < span class =code-attribute> controls = autoplay = >
< source src = Sounds / DPM317.wav type = audio / wav / >
("#audio").attr("autoplay", true); //document.getElementById("audio").play();//to play //document.getElementById("audio").pause();//to pause window.onload = function () { document.getElementById("audio").play(); } window.addEventListener("load", function () { document.getElementById("audio").play(); }); <%-- <audio src="Sounds/DPM317.wav" controls="controls" autoplay="autoplay">--%> <%-- <audio src="Sounds/DS250069new.wav" controls="controls" autoplay="autoplay"> <audio controls=""> <source src="Sounds/DPM317.wav" type="audio/wav" /> Your browser does not support the audio element. --%> <audio id="audio" controls="" autoplay=""> <source src="Sounds/DPM317.wav" type="audio/wav" />
您的浏览器不支持音频元素。
这是我尝试的第二种方式
Your browser does not support the audio element.
This is the second way i tried
<title>
function PlaySound(soundobj) {
var thissound = document.getElementById(soundobj);
thissound.play();
}
function PauseSound(soundobj) {
var thissound = document.getElementById(soundobj);
thissound.pause();
}
<audio id="audio1" controls="controls" preload="auto" src="Sounds/DPM317.wav" type="audio/wav">
<audio id="audio2" controls="controls" preload="auto" src="Sounds/DS250069new.wav" type="audio/wav">
/pre>
But none of them are working in chrome browser can anyone help me out as iam new to this<
What I have tried:
i tried the above codes which i had posted but none of them are working
您缺少脚本标记,关闭TITLE标签 - 一堆东西。
制作HTM L格式良好,然后再试一次。
You're missing script tags, closing TITLE tags - a bunch of stuff.
Make the HTML well-formed and try again.
这篇关于在exceution之后显示音频,但音频不会在Chrome浏览器中播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!