I have a list of music I want When I click image of music opened media player with ajax, I Use this code in HTML:
<div class="container ">
<div class="row center">
@foreach($singles as $single)
<div class="col-md-2 folio-thumb">
<a href="#" data-value="http://media.w3.org/2010/07/bunny/04-
Death_Becomes_Fur.oga"><img class="img-responsive"
src={{asset($single->Single_Image)}} /></a>
<h6 style="color:white" id="music">
{{$single>Single_Name}}<a href="/"></a></h6>
</div>
@endforeach
</div>
</div>
<audio id="audio" controls="controls" style="margin-left:150px;">
<source id="audioSource" src="">
Your browser does not support the audio format.
</audio>
And Ajax Code:
$('.folio-thumb').click(function (e) {
e.preventDefault();
var elm = e.target;
var audio = document.getElementById('audio');
var source = document.getElementById('audioSource');
source.src = elm.getAttribute('data-value');
audio.load();
audio.play();
});
But I Give this Error in console:
GET http://127.0.0.1:8000/null net::ERR_ABORTED
home:288 Uncaught (in promise) DOMException: The play() request was interrupted by a new load request.