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

心不动则不痛 提交于 2019-11-29 05:10:51

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;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!