johndyer/mediaelement — Issue #408: .play() after previous player has ended doesn't work on FF & Opera unless wrapped in setTimeout
Author: alex-marandon
Created: 2012-02-29 13:38:22+00:00
State: open

I'm trying to write a little script so that when a page contains several ME audio players, when a player finishes playing, it automatically starts playing the next one. To do that I catch the 'ended' event and start playing the next one using the `.play()` method. The problem is that it doesn't work with Firefox 10 or Opera 11 (Linux). It works fine with Chrome. I found a workaround though: if I call `.play()` using setTimeout instead of calling it directly, it does work (even if timeout duration is 0!):

setTimeout($.proxy(player, 'play'), 0); // This always works

Here is a minimal page that shows the problem: http://dev.alexmarandon.com/tests/me.html