Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- // generalized script
- // should only be included once in the page
- jQuery(function() {
- $(.audio-panel').on('click', function() {
- $(this).find('audio').get(0).play();
- });
- function checkStatus() {
- var audioElements = $('.audio-panel audio');
- audioElements.forEach(function() {
- var displayElement = $(this).closest('.panel-body').find('.display-status'),
- buffered = this.buffered,
- loaded;
- if (buffered.length) {
- loaded = 100 * buffered.end(0) / this.duration;
- if (loaded.toFixed(2) !== '0.00') {
- displayElement.text('Loading: ' + loaded.toFixed(2) + '%');
- }
- if (loaded >= 1) {$(this).removeClass('un-buffered');}
- } else {
- displayElement.text('Loading...')
- }
- });
- }
- setInterval(checkStatus, 50);
- });
- </script>
- <!--
- following html structure to work with above script
- should remove ID properties and add the classes
- -->
- <div class="panel-group audio-panel" id="accordion8o" type="button">
- <div class="panel panel-default" data-toggle="collapse" data-parent="#accordion8o" href="#eight1">
- <div class="panel-heading">
- <h4 class="panel-title">
- ऑडियो नंबर 8 वसुमती(२)
- </h4>
- </div>
- <div id="eight1" class="panel-collapse collapse">
- <div class="panel-body">
- <audio controls="controls">
- <source src="https://docs.google.com/uc?export=download&id=19TMRZ1wM-XNuDIkZzSDF3Y8tf1piKoMv">
- </audio>
- <p><span class="display-status"></span></p>
- </div>
- </div>
- </div>
- </div>
- <script>
Advertisement
Add Comment
Please, Sign In to add comment