Search
 
SCRIPT & CODE EXAMPLE
 

HTML

how to stop html audio

sound.pause();
sound.currentTime = 0;
Comment

how to stop audio when playing other in html

const audios_with_src = document.querySelectorAll('.audios')
const play = document.querySelectorAll('.fa-play')
const pause = document.querySelectorAll('.fa-pause-circle')
const stop = document.querySelectorAll('.fa-stop')
const main_player = document.querySelector('.main-audio')

for(let i =0; i < audios_with_src.length; i++) {
 play[i].addEventListener('click', (e) => {
    main_player.src = audios_with_src[i].src;
    main_player.play()   
    })

pause[i].addEventListener('click', () => {
    main_player.pause()
})

stop[i].addEventListener('click', () => {
    main_player.pause()
    main_player.currentTime = 0;  // there is no stop() function so had to do this
})


}
Comment

PREVIOUS NEXT
Code Example
Html :: elseif vuejs 
Html :: link d3 
Html :: how do i link back out a folder using th a-href tag 
Html :: rick astley never gonna give you up 
Html :: how to make email required in html 
Html :: html space code 
Html :: iphone disable zoom on select 
Html :: thumbnail html 
Html :: vue js v-for array index 
Html :: change the font-size on a label css 
Html :: input type checkbox and hide checkbox 
Html :: bootsrap card 
Html :: load image file from input in html 
Html :: bootstrap responsive sticky top 
Html :: class html 
Html :: how to make body full size 
Html :: liens hypertexte html mdn 
Html :: html with lang 
Html :: file input html 
Html :: itextsharp html to pdf 
Html :: what is hydration in react? 
Html :: tailwind css range slider 
Html :: html colspan 
Html :: boarder color of type text 
Html :: jquery radio button checked on page load 
Html :: click button to go to sub pag on html 
Html :: make dictionary english html 
Html :: how to create image link in html 
Html :: what is the best programming language in 2021 
Html :: favicon icon 404 error for html 5 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =