Я делаю игру и хочу играть аудио с моей страницы jsp. Я пытался сделать это с помощью различных решений, но ни один из них не был полезен для меня.играть аудио в jsp-файле в моем проекте
Я пробовал этот путь и некоторые другие. Чего я еще не пробовал?
playSound('game_start_sound');
function playSound(id){
\t var audio = document.getElementById(id);
\t \t audio.play();
\t // \t alert("played");
}
<audio id="game_start_sound">
<source src="http://localhost:8080/firstproject/sound/gamestart.mp3" type='audio/mpeg; codecs="mp3"'></embed>
</audio>
<audio id="game_start_sound">
<embed src="<%=request.getContextPath()%>/sound/gamestart.mp3" type='audio/mpeg; codecs="mp3"'></embed>
</audio>
<audio id="game_start_sound">
<embed src="http://localhost:8080/firstproject/sound/gamestart.mp3" type='audio/mpeg; codecs="mp3"'></embed>
</audio>
<embed id="game_start_sound">
<source src="http://localhost:8080/firstproject/sound/gamestart.mp3" type='audio/mpeg; codecs="mp3"'></embed>
</embed>
Я также пробовал то же самое в своей первой строке кода, и он находится на странице jsp. –