This is my code. I have 2 buttons one is linked to #streama and the other is linked to streamb
I have 2 problems
- When I click any button twice it plays the audio twice (3clicks = 3time being played at the same time … and so on)
-
When I click any button the other audio must stops so it allow the new clicked button to play alone
(function( $ ) {
$( “#streama” ).on( “click”, function( event ){
var hassen = new Audio(‘http://mywebsite:8000/streama‘);
hassen.play();
event.preventDefault();
});
})( jQuery );(function( $ ) {
$( “#streamb” ).on( “click”, function( event ){
var hassen = new Audio(‘http://mywebsite:8000/streamb’);
hassen.play();
event.preventDefault();
});
})( jQuery );