Multiple players playing simultaneously #285

ghost opened this Issue Oct 31, 2011 · 4 comments


None yet

3 participants

ghost commented Oct 31, 2011

thanks for the great plugin. However, I have a small problem.
I have several video elements on the same page. If I click play on one video and then click play on another and so on, all videos are playing simultaneously. How can I automatically pause current player if another one is clicked?


mtomasz commented Nov 10, 2011

I have same problem and looking for solution too. Any ideas?


This might be a nice feature to implement. Anyone want to take it on?

ecurtis commented Nov 21, 2011

I found the basis for this on stackoverflow and hacked it until it worked:

/ make an array for the mediaelement players
mediaElementPlayers = new Array();

    audioWidth: 25,
    audioHeight: 25,
    startVolume: 0.8,
    features: ['playpause'],
    success: function (mediaElement, domObject) {

          // add this mediaelement to the mediaElementPlayers array

          // bind the play event to the pauseAllPlayers function
          mediaElement.addEventListener('play', function(e) {
              pauseAllPlayers(; }, false); }

// iterate through the mediaElementPlayers array, pause all players except the one that triggered the event.
function pauseAllPlayers(currentPlayer){
for(i=0; i<mediaElementPlayers.length; i++){
    if(mediaElementPlayers[i] != currentPlayer){
johndyer commented Dec 6, 2011

This will be in 2.4.2

@johndyer johndyer closed this Dec 6, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment