Description
howler.js is an audio library for the modern web. It defaults to Web Audio API and falls back to HTML5 Audio. This makes working with audio in JavaScript easy and reliable across all platforms.
Additional information, live demos and a user showcase are available at howlerjs.com.
Source: https://howlerjs.com/
Sample code [howler.html]
<!DOCTYPE html>
<html>
<head>
<title>Howler MP3</title>
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/howler.js/2.0.3/howler.js"></script>
<style type="text/css">
*{
font-family: arial;
font-size: 16px;
}
</style>
</head>
<body>
<center>
<input type="button" class="play" value="Play"/>
</center>
<script type="text/javascript">
$(document).ready(function(){
var sound = new Howl({
src: ['dunaliya_mein_jung.mp3']
});
$('body').on('click','.play',function(){
sound.play();
})
})
</script>
</body>
</html>
code screenshot
Demo:
0 comments:
Post a Comment