Reputation: 566
I'm using the mediaelement.js plugin as my media player for HTML5 audio tags.
I attach the player to the tags using $('audio, video').mediaelementplayer();
But I'd like to know how I can do this for dynamically created audio tags. Is there a solution like live or on like there is for events?
Upvotes: 0
Views: 957
Reputation: 2059
When you create the audio element dynamically can you create the mediaelement at the same time?
var audio = my new audio element
var player = new MediaElementPlayer('#id of new audio element',/* Options */);
// ... more code ...
player.pause();
player.setSrc('mynewfile.mp3');
player.play();
etc.
Upvotes: 2