Nertil
Nertil

Reputation: 21

MediaElement.js jquery bug

I have an gwt application and I use MediaElement.js to show multimedia contents. If I put on the main page this script

<script> // using jQuery   
    $('video,audio').mediaelementplayer();
</script>

to convert and tags in MediaElement.js and it doesn't work.

  1. First because this script convert only one tag or in MediaElement.js
  2. Second this tag must be before the script. If it is after it doesn't work.

So my problem is that I have more than one tag and this tags are created runtime so they will be after the script. I think that the correct work of the script should be: Convert all and tags within the page and not the only one before the script.

Thanks

Upvotes: 2

Views: 1147

Answers (1)

John Dyer
John Dyer

Reputation: 1005

If you can't move the script until after the tags, then you should either do

<script>
jQuery(document).ready(function($) {
    $('video').mediaelementplayer();
});
</script>

or

<script>
// your code
gwtCode();
$('video').mediaelementplayer();    
</script>

Upvotes: 4

Related Questions