I have been playing with MediaElement.js for a long time and have a new application that uses 20 players on one page. I would like the songs to stop when the other played, and so that they do not overlap the tracks during the game. I can't find an easy way to hack this - maybe someone knows about the way?
Thank.
In jQuery you can do
$('video,audio').each(function() { $(this)[0].pause(); });
Let me know if this works.
Quick and dirty;)
$(".mejs-play").live('click',function(){ $(".mejs-pause").trigger('click'); });
MediaElement.js "mejs", "", , . mep_0, mep_1 ..
/lodash, -
_.each(mejs.players, function(player) { player.media.stop(); });
js, ""
for (var player in mejs.players) { mejs.players[player].media.stop(); }
The easiest one I found with jQuery:
$('video,audio').trigger('pause');
One liner to win! It also avoids JS errorssince it does not directly target elements, thanks to jQuery.
Source: https://habr.com/ru/post/1790200/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1790195/advice-for-supporting-both-mac-and-windows-desktops&usg=ALkJrhig7rIYmMLFe1QgYB4TG18DVdS1VAOpen the context menu by clicking on the menu item - androidUsing views instead of tables in stored procedures? - sqlstack location and vtable [re] - c ++Algorithm for checking quadrant horizontal symmetry? - algorithmhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1790201/too-many-pattern-matches-to-write-down-for-quadtrees&usg=ALkJrhh7jbiw8919yFv8WxRsiL-3gG4w6wflashvars does not work in android browser - androidHow to extract thin lines as separate loops / connected components using OpenCV? - image-processingString: replace the string containing the word - c #Problem with Xcode debugging device 4 - ios4All Articles