| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 |
<title>HTML5 MediaElement</title> |
| 6 |
|
| 7 |
<script src="../build/jquery.js"></script> |
| 8 |
<script src="../build/mediaelement-and-player.min.js"></script> |
| 9 |
<script src="testforfiles.js"></script> |
| 10 |
<link rel="stylesheet" href="../build/mediaelementplayer.min.css" /> |
| 11 |
</head> |
| 12 |
<body> |
| 13 |
|
| 14 |
<h1>MediaElementPlayer.js</h1> |
| 15 |
|
| 16 |
<h2>1. Single MP4 File</h2> |
| 17 |
|
| 18 |
<code><pre> |
| 19 |
<video width="640" height="360" src="../media/echo-hereweare.mp4" type="video/mp4" |
| 20 |
id="player1" poster="../media/echo-hereweare.jpg" |
| 21 |
controls="controls" preload="none"></video> |
| 22 |
</pre></code> |
| 23 |
|
| 24 |
<!-- simple single file method --> |
| 25 |
<video width="640" height="360" src="../media/echo-hereweare.mp4" type="video/mp4" |
| 26 |
id="player1" poster="../media/echo-hereweare.jpg" |
| 27 |
controls="controls" preload="none"></video> |
| 28 |
|
| 29 |
<span id="player1-mode"></span> |
| 30 |
|
| 31 |
<p><b>Note</b>: if you are working with local files, you'll need to add your working directory |
| 32 |
to the <a href="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html">Flash Global Security Settings</a>.</p> |
| 33 |
|
| 34 |
<h2>2. Multi-Codec with no JavaScript fallback player</h2> |
| 35 |
|
| 36 |
<code><pre> |
| 37 |
<video width="640" height="360" id="player2" poster="../media/echo-hereweare.jpg" controls="controls" preload="none"> |
| 38 |
<!-- MP4 source must come first for iOS --> |
| 39 |
<source type="video/mp4" src="../media/echo-hereweare.mp4" /> |
| 40 |
<!-- WebM for Firefox 4 and Opera --> |
| 41 |
<source type="video/webm" src="../media/echo-hereweare.webm" /> |
| 42 |
<!-- OGG for Firefox 3 --> |
| 43 |
<source type="video/ogg" src="../media/echo-hereweare.ogv" /> |
| 44 |
<!-- Fallback flash player for no-HTML5 browsers with JavaScript turned off --> |
| 45 |
<object width="640" height="360" type="application/x-shockwave-flash" data="../build/flashmediaelement.swf"> |
| 46 |
<param name="movie" value="../build/flashmediaelement.swf" /> |
| 47 |
<param name="flashvars" value="controls=true&poster=../media/echo-hereweare.jpg&file=../media/echo-hereweare.mp4" /> |
| 48 |
<!-- Image fall back for non-HTML5 browser with JavaScript turned off and no Flash player installed --> |
| 49 |
<img src="../media/echo-hereweare.jpg" width="640" height="360" alt="Here we are" |
| 50 |
title="No video playback capabilities" /> |
| 51 |
</object> |
| 52 |
</video> |
| 53 |
</pre></code> |
| 54 |
|
| 55 |
<video width="640" height="360" id="player2" poster="../media/echo-hereweare.jpg" controls="controls" preload="none"> |
| 56 |
<!-- MP4 source must come first for iOS --> |
| 57 |
<source type="video/mp4" src="../media/echo-hereweare.mp4" /> |
| 58 |
<!-- WebM for Firefox 4 and Opera --> |
| 59 |
<source type="video/webm" src="../media/echo-hereweare.webm" /> |
| 60 |
<!-- OGG for Firefox 3 --> |
| 61 |
<source type="video/ogg" src="../media/echo-hereweare.ogv" /> |
| 62 |
<!-- Fallback flash player for no-HTML5 browsers with JavaScript turned off --> |
| 63 |
<object width="640" height="360" type="application/x-shockwave-flash" data="../build/flashmediaelement.swf"> |
| 64 |
<param name="movie" value="../build/flashmediaelement.swf" /> |
| 65 |
<param name="flashvars" value="controls=true&file=../media/echo-hereweare.mp4" /> |
| 66 |
<!-- Image fall back for non-HTML5 browser with JavaScript turned off and no Flash player installed --> |
| 67 |
<img src="../media/echo-hereweare.jpg" width="640" height="360" alt="Here we are" |
| 68 |
title="No video playback capabilities" /> |
| 69 |
</object> |
| 70 |
</video> |
| 71 |
|
| 72 |
<span id="player2-mode"></span> |
| 73 |
|
| 74 |
<script> |
| 75 |
|
| 76 |
$('audio,video').mediaelementplayer({ |
| 77 |
mode: 'shim', |
| 78 |
success: function(player, node) { |
| 79 |
$('#' + node.id + '-mode').html('mode: ' + player.pluginType); |
| 80 |
} |
| 81 |
}); |
| 82 |
|
| 83 |
</script> |
| 84 |
|
| 85 |
<input type="button" id="stopall" value="Stop all"> |
| 86 |
|
| 87 |
<script> |
| 88 |
$('#stopall').click(function() { |
| 89 |
$('video, audio').each(function() { |
| 90 |
$(this)[0].player.pause(); |
| 91 |
}); |
| 92 |
}); |
| 93 |
</script> |
| 94 |
|
| 95 |
|
| 96 |
</body> |
| 97 |
</html> |