So I have this code that opens my ''player'' that I made myself. But when player is opened no sound comes out, it never happened before. What could be the reason. When opened with Chrome no sound comes no matter how player is opened, whatever it would be pop up, or link pasted into url bar.Do you have any idea.?
You can check my player here: http://newfm.ddns.me:12/m.player.html
Html code for pop up:
<html>
<head>
<style>
<!--Image is used instead of text, to link page-->
a {
background: url(https://image.ibb.co/cxnuMU/playbutton.png) center no- repeat;
display: block;
width: 44px;
height: 45px;
}
</style>
</head>
<!--Link to the page and size page should be opened in-->
<a href="#" onClick="window.open('http://newfm.ddns.me:12/m.player.html','pagename','resizable,height=640,width=370'); return false;"></a>
The thing that sends sound in this player is that "play button". Could it be that I need to add SSL to my stream url?
Html code for play button :
<div class="ex1">
<a id="play-pause-button" class="fa fa-pause"></a>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script>
var audio = new Audio("http://newfmplayer.ddns.net:8000/newfm128.m3u");
$('#play-pause-button').on("click",function(){
if($(this).hasClass('fa-play'))
{
$(this).removeClass('fa-play');
$(this).addClass('fa-pause');
audio.play();
}
else
{
$(this).removeClass('fa-pause');
$(this).addClass('fa-play');
audio.pause();
}
});
audio.onended = function() {
$("#play-pause-button").removeClass('fa-pause');
$("#play-pause-button").addClass('fa-play');
};
</script>
<style media="screen" type="text/css">
@import url(https://cdnjs.cloudflare.com/ajax/libs/font- awesome/4.6.3/css/font-awesome.min.css);
#play-pause-button{
font-size: 50px;
cursor: pointer;
color: black;
position: relative;
left: 150px;
top: 480px;
}
</style>
</div>
</body></html>
I also tested just tested if it would work with simple code :
<audio controls>
<source src="http://newfmplayer.ddns.net:8000/newfm128.m3u" type="audio/mpeg">
</audio>
And it didn't work either.