JS sound playing in background
function playSound(fName) {
try {
if (this.player != undefined) {
player.pause();
}
player = new Audio(fName);
player.play();
} catch(v) {
console.log(v.message);
}
}
Written by Yaroslav Samardak
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Related Tags
#javascript
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#