I use Jupyter to listen to a large number of audio snippets and then categorize them. It worked fine until recently. I think something changed in Chrome. Now after listening to maybe 40 or 50 snippets the HTML5 audio player stops playing more snippets. When I look in Chrome developer tools console I see a message saying that I have reached a limit of the number of audio players I can running at any one point in time. I would be happy to clean up old audio players after I have listened to their snippets, but I don’t know how to get a handle to the element in the DOM.
Here is an example of what I am doing now:
from IPython.display import Audio, display
i = 0
for snipfile_local in list_of_snips:
i += 1
elem_id = 'aud_file_'+str(i)
display(Audio(filename=snipfile_local,element_id=elem_id))
choice = input('Enter a, b, or c:')
# do something based on choice
# remove old audio player from DOM - Need to figure out how to call this
#var element = document.getElementById(elem_id);
#element.parentNode.removeChild(element);