I am building a website, in which there is a feature to play audio in a single ear headphone randomly, all of the code is working fine in Google Chrome, Firefox, Microsoft Edge, but not working in IE(11). I have been stuck in solving this bug but it's always showing the following error
SCRIPT445: Object doesn't support this action
the code Is there.
(document).ready(function(){
var clickCount=0;
var counterall=0;
var item;
$('#start_sample').click(function(){
clickCount=1;
$('audio#audio2')[0].play();
var items = Array(1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1);
item = items[Math.floor(Math.random() * items.length)];
if(item==-1){
//$('#audio2').prop('disabled', true);
$('#start_sample').css('background-color','lightgray');
var audioCtx = new (window.AudioContext || window.webkitAudioContext);
var myAudio = document.querySelector('audio');
var source = audioCtx.createMediaElementSource(myAudio);
var panNode = audioCtx.createStereoPanner();
panNode.pan.value = -1;
source.connect(panNode);
panNode.connect(audioCtx.destination);
var aud = document.getElementById("audio2");
aud.onended = function() {
$('#start_sample').css('background-color','#157eef');
audioend=0;
};
}
Kindly Help out me or give me a parallel solution so I can remove it.