You can use this as a standalone library if you wish, or just stick with the full MediaElementPlayer.
You can avoid running any startup scripts by added class="mejs-player"
to the <video>
or <audio>
tag. Options can be added using the data-mejsoptions
attribute.
<video src="myvideo.mp4" width="320" height="240"
class="mejs-player"
data-mejsoptions='{"alwaysShowControls": true}'></video>
<script>
var player = new MediaElementPlayer('#player', {success: function(mediaElement, originalNode) {
// do things
}});
</script>
<script>
$('#mediaplayer').mediaelementplayer({success: function(mediaElement, originalNode) {
// do things
}});
// To access player after its creation through jQuery use:
var player = $('#mediaplayer')[0].player;
// With iOS (iPhone), since it defaults always to QuickTime, you access the player directly;
// i.e., if you wanna exit fullscreen on iPhone using the player, use this:
var player = $('#mediaplayer')[0];
player.webkitExitFullScreen();
</script>