phát âm thanh javascript
var audio = new Audio("hindi/Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3");
audio.play();
phát âm thanh trong javascripts
var audio = new Audio('Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3');
audio.play();
phát âm thanh javascripts
var bMusic = new Audio('Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3')
bMusic.play()
phát âm thanh với js
var audio = new Audio('Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3');
audio.play();
phát âm thanh trong javascript
<script>
function play() {
var audio = new Audio('https://www.yourdomainname.net/media/hinndi/Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3');
audio.play();
}
</script>
<button onclick-"play();">PLAY MY AUDIO</button>
javascript phát âm thanh
//play audio with from html audio element:
document.getElementById('song_name').play();
//play audio with out html audio tag
var myAudio = new Audio('Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3');
myAudio.play();
<audio controls>
<source src="Agar_Tum_Saath_Ho_FULL_AUDIO_Song.ogg" type="audio/ogg">
<source src="Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3" type="audio/mpeg">
</audio>
Dưới đây là một đoạn mã mẫu có thể phát tệp song_name.
<audio controls id="song_name">
<source src="Agar_Tum_Saath_Ho_FULL_AUDIO_Song.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<p>Click the buttons to play or pause the song_name.</p>
<button onclick="play()" type="button">Play </button>
<button onclick="pause()" type="button">Pause</button>
<script>
var fetchSongNm= document.getElementById("song_name");
function play() {
fetchSongNm.play();
}
function pause() {
fetchSongNm.pause();
}
</script>
Tôi hy vọng bạn có được ý tưởng về javascript phát âm thanh khi nhấp chuột.
- Bài đăng blog này ban đầu được xuất bản tại: https://www.pakainfo.com