ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Play Audio file with Play Pause in HTML5 Audio example<p>Here I have created sample that full-fill your requirement.</p> <p><span style="text-decoration: underline;">HTML</span></p> <div class="demo_block"> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css&#34; /&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; function aud_play_pause() { var myAudio = document.getElementById(&#34;myTune&#34;); var musicStartTime = 25; var musicStopTime = 35; if (myAudio.paused) { $(&#39;#stateicon&#39;).removeClass(&#39;fa fa-play&#39;); $(&#39;#stateicon&#39;).addClass(&#39;fa fa-pause&#39;); myAudio.currentTime = musicStartTime; myAudio.play(); $(&#39;#stateicon&#39;).html(&#34;Pause&#34;); } else { $(&#39;#stateicon&#39;).removeClass(&#39;fa fa-pause&#39;); $(&#39;#stateicon&#39;).addClass(&#39;fa fa-play&#39;); myAudio.currentTime = musicStartTime; myAudio.pause(); $(&#39;#stateicon&#39;).html(&#34;Play&#34;); } } &lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; $(document).ready(function () { var myAudio = document.getElementById(&#34;myTune&#34;); var stateicon = document.getElementById(&#34;stateicon&#34;); $(myAudio).bind(&#39;timeupdate&#39;, function () { if (myAudio.currentTime &gt;= 45) { $(&#39;#stateicon&#39;).removeClass(&#39;fa fa-pause&#39;); $(&#39;#stateicon&#39;).addClass(&#39;fa fa-play&#39;); myAudio.pause(); $(&#39;#stateicon&#39;).html(&#34;Play&#34;); $(myAudio).unbind(&#39;timeupdate&#39;); } }); if (myAudio.currentTime &gt;= 35) { $(&#39;#stateicon&#39;).removeClass(&#39;fa fa-pause&#39;); $(&#39;#stateicon&#39;).addClass(&#39;fa fa-play&#39;); $(&#39;#stateicon&#39;).html(&#34;Play&#34;); myAudio.currentTime = 0; myAudio.pause(); } }); &lt;/script&gt; &lt;li class=&#34;pull-left&#34;&gt;&lt;a href=&#34;javascript:void(0)&#34; onclick=&#34;aud_play_pause()&#34;&gt;&lt;i id=&#34;stateicon&#34; class=&#34;fa fa-play&#34;&gt;Play&lt;/i&gt;&lt;/a&gt; &lt;audio id=&#34;myTune&#34;&gt; &lt;source src=&#34;https://s3-ap-southeast-1.amazonaws.com/gitaverses/ChapterVerse/Bhagavad-gita01.mp3&#34;/&gt; &lt;/audio&gt; &lt;/li&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p> <p>I hope this will help you out.</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/566744/Play-Audio-file-with-Play-Pause-in-HTML5-Audio-example/https://www.aspforums.net:443/Threads/566744/Play-Audio-file-with-Play-Pause-in-HTML5-Audio-example/Fri, 04 Sep 2015 03:56:26 GMT