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 :: how to get img src from xml 
Html :: form boilerplate 
Html :: static html template 
Html :: html year picker 
Html :: get all html element data using angular 
Html :: type time html returns 24 hour time change to 12 hour 
Html :: loader for html 
Html :: declare variable in html angular 
Html :: Using SVG as an <img 
Html :: how to show data in html table from database in multiple table in laravel 
Html :: css without separate file 
Html :: html code convert in pdf 
Html :: metal gear 
Html :: link a hyperlink from different folder 
Html :: format json logs 
Html :: dropbox embed 
Html :: func.apply is not a function at HTMLUnknownElement.callCallback 
Html :: command checked datagrid wpf 
Html :: justify content css 
Html :: lorem long text 
Html :: tailwind tag input 
Html :: magento 2 theme claue pagination not showing up 
Html :: ionic checkbox value by function 
Html :: ajust aos 
Html :: marquee attributes 
Html :: WEBSITES WITH INNERHTML 
Html :: bootdtarp 
Html :: allow <= 20 characters in search engine snippets 
Html :: /etc/ 
Html :: Cause Dropbox To Behave Like A CDN (Content Delivery Network) For IMG/GIF Files 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =