javascript - audio.js still creating more than 1 player -


i want add music source database ( soundcloud music srces) audiojs player.

but everytime i'm clicking on link button creates 1 more audioplayer audioplayer.

function get_song(url, title, img_url) {     $("#audio_url").attr("src", url);     $("#song_img").attr("src", img_url);     $('#song_title').text(title);     console.log(img_url);      var = audiojs.createall();     var audio = a[0];      this.preventdefault();     $(this).addclass('playing').siblings().removeclass('playing');     audio.load($('a', this).attr('data-src'));     audio.play();     removeclass('#audiojs');  } 
        </div>             <form method="post">              {% csrf_token %}                  <div class="songs_list">                      <ul>                         {% songs in playlist_songs %}                             <li  class="list_settings"> <a onclick="get_song('{{ songs.url }}', '{{ songs.title }}', '{{ songs.song_image_url }}')" class="song_set">{{ songs.title }}</a>  <button name="delete_song" value="{{ songs.id }}" class="btn_delete"><i class="fa fa-trash" aria-hidden="true"></i></button></li>                         {% endfor %}                       </ul>                 </div>             </form>         </div>     <!-- audio_player  -->  <audio >     <source id="audio_url" src=""> </audio>` 


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -