I have an issue with Safari desktop. This snippet of code works even on the mobile version of Safari just not on the desktop version (12.1).
js
var targetBeep = "targetBeep";
var atmos = "atmos";
createjs.Sound.registerSound("targetBeep.mp3", targetBeep);
createjs.Sound.registerSound("25372639_dark-tension-atmosphere_by_umcsound_preview.mp3", atmos);
$( ".play" ).css({'cursor': 'pointer'}).click(function() {
setTimeout(function () {
createjs.Sound.play(atmos);
}, 2000);
});
HTML
<div class="play">
play
</div>
<script src='https://code.jquery.com/jquery-2.2.4.min.js'></script>
<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>
Is it a problem with the code or is it Safari desktop? If its Safari what can I do to resolve this
var atmos = "atmos";
createjs.Sound.registerSound("https://upload.wikimedia.org/wikipedia/commons/1/12/03may2020-tobefree.mp3", atmos);
$(".play").css({
'cursor': 'pointer'
}).click(function() {
setTimeout(function() {
createjs.Sound.play(atmos);
}, 2000);
});
<div class="play">
play
</div>
<script src='https://code.jquery.com/jquery-2.2.4.min.js'></script>
<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>