Giter Site home page Giter Site logo

logreg-n-coffee / mediaelement Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mediaelement/mediaelement

1.0 0.0 0.0 185.46 MB

HTML5 <audio> or <video> player with Flash and Silverlight shims that mimics the HTML5 MediaElement API, enabling a consistent UI in all browsers.

Home Page: http://mediaelementjs.com/

mediaelement's Introduction

<video> and <audio> made easy.

One file. Any browser. Same UI.

Installation and Usage

MediaElementPlayer: HTML5 <video> and <audio> player

A complete HTML/CSS audio/video player built on top MediaElement.js and jQuery. Many great HTML5 players have a completely separate Flash UI in fallback mode, but MediaElementPlayer.js uses the same HTML/CSS for all players.

Change Log

Changes available at [changelog.md]

1. Add Script and Stylesheet

<script src="jquery.js"></script>
<script src="mediaelement-and-player.min.js"></script>
<link rel="stylesheet" href="mediaelementplayer.css" />

2. Add <video> or <audio> tags

If your users have JavaScript and/or Flash, the easist route for all browsers and mobile devices is to use a single MP4 or MP3 file.

<video src="myvideo.mp4" width="320" height="240"></video>
<video src="myaudio.mp3"></video>

Optional: multiple codecs

This includes multiple codecs for various browsers (H.264 for IE9+, Safari, and Chrome, WebM for Firefox 4 and Opera, Ogg for Firefox 3).

<video width="320" height="240" poster="poster.jpg" controls="controls" preload="none">
	<source type="video/mp4" src="myvideo.mp4" />
	<source type="video/webm" src="myvideo.webm" />
	<source type="video/ogg" src="myvideo.ogv" />
</video>

Optional: Browsers with JavaScript disabled

In very rare cases, you might have an non-HTML5 browser with Flash turned on and JavaScript turned off. In that specific case, you can also include the Flash <object> code.

<video width="320" height="240" poster="poster.jpg" controls="controls" preload="none">
	<source type="video/mp4" src="myvideo.mp4" />
	<source type="video/webm" src="myvideo.webm" />
	<source type="video/ogg" src="myvideo.ogv" />
	<object width="320" height="240" type="application/x-shockwave-flash" data="flashmediaelement.swf">
		<param name="movie" value="flashmediaelement.swf" /> 
		<param name="flashvars" value="controls=true&amp;poster=myvideo.jpg&amp;file=myvideo.mp4" /> 		
		<img src="myvideo.jpg" width="320" height="240" title="No video playback capabilities" />
	</object>
</video>

3. Startup

Automatic start

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>

Normal JavaScirpt

<script>
var player = new MediaElementPlayer('#player', {success: function(mediaElement, originalNode) {
	// do things
}});
</script>	

jQuery plugin

<script>
$('video').mediaelementplayer({success: function(mediaElement, originalNode) {
	// do things
}});
</script>

How it Works:

MediaElement.js: HTML5 <video> and <audio> shim

MediaElement.js is a set of custom Flash and Silverlight plugins that mimic the HTML5 MediaElement API for browsers that don't support HTML5 or don't support the media codecs you're using. Instead of using Flash as a fallback, Flash is used to make the browser seem HTML5 compliant and enable codecs like H.264 (via Flash) and even WMV (via Silverlight) on all browsers.

<script src="mediaelement.js"></script>
<video src="myvideo.mp4" width="320" height="240"></video>

<script>
var v = document.getElementsByTagName("video")[0];
new MediaElement(v, {success: function(media) {
	media.play();
}});
</script>

You can use this as a standalone library if you wish, or just stick with the full MediaElementPlayer.

mediaelement's People

Contributors

andyfowler avatar cj-jackson avatar dougwilson avatar fbuecklers avatar garrettjohnson avatar jaw-dev avatar jbdemonte avatar jeffreyatw avatar johndyer avatar kaichen avatar latzt avatar lehni avatar lennym avatar lereskp avatar mangui avatar markomarkovic avatar mattfarina avatar matthillmanbt avatar odnamrataizem avatar peterh-capella avatar romanbsd avatar rounce avatar sapientpants avatar seanhellwig avatar seb33300 avatar simonschuh avatar svoynow avatar sylvinus avatar tantalic avatar wizard13 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.