How do I get mediaelement.js player state (paused, volume, etc.)?

后端 未结 1 1411
故里飘歌
故里飘歌 2020-12-17 04:47

According to what is stated on mediaelement.js website it should be easy to get player state. But I cannot figure out how to do it.

I\'m creating player like this an

相关标签:
1条回答
  • 2020-12-17 05:49

    OK, John Dyer answered me on the Github support page: https://github.com/johndyer/mediaelement/issues/497

    It's needed to get mediaelement itself media

    new MediaElementPlayer('.player_1', {success: function(media, node, player) {
      // this will be undefined since it's the player with buttons
      alert(player.paused);
      // this will be a real value since it's the underlying mediaelement
      alert(media.paused);
    }
    });
    

    http://jsfiddle.net/H7X7X/2/

    ​To get media element later you can use following code

    $('player')[0].player.media;
    
    0 讨论(0)
提交回复
热议问题