Boost your player with Chromecast, Google Analytics and more
<script>
// You can use either a string for the player ID (i.e., `player`),
// or `document.querySelector()` for any selector
var player = new MediaElement('player', {
pluginPath: "/path/to/shims/",
success: function(mediaElement, originalNode) {
// do things
}
});
</script>
Automatic start
You can avoid running any startup scripts by adding
class="mejs__player"
to the
<video>
or
<audio>
tag. All the player configuration can be added through
data-mejsoptions
attribute.
<video src="myvideo.mp4" width="320" height="240"
class="mejs__player"
data-mejsoptions='{"pluginPath": "/path/to/shims/", "alwaysShowControls": "true"}'></video>
Vanilla JavaScript
<script>
// You can use either a string for the player ID (i.e., `player`),
// or `document.querySelector()` for any selector
var player = new MediaElementPlayer('player', {
pluginPath: "/path/to/shims/",
// When using `MediaElementPlayer`, an `instance` argument
// is available in the `success` callback
success: function(mediaElement, originalNode, instance) {
// do things
}
});
</script>
jQuery
<script>
$('#mediaplayer').mediaelementplayer({
pluginPath: "/path/to/shims/",
// When using jQuery's `mediaelementplayer`, an `instance` argument
// is available in the `success` callback
success: function(mediaElement, originalNode, instance) {
// do things
}
});
</script>
Website