Version Description
None
Download this release
Release Info
Developer | johndyer |
Plugin | MediaElement.js – HTML5 Video & Audio Player |
Version | 2.0.6 |
Comparing to | |
See all releases |
Version 2.0.6
- mediaelement-js-wp.php +326 -0
- mediaelement/background.png +0 -0
- mediaelement/bigplay.png +0 -0
- mediaelement/controls.png +0 -0
- mediaelement/flashmediaelement.swf +0 -0
- mediaelement/mediaelement-and-player.js +2310 -0
- mediaelement/mediaelement-and-player.min.js +93 -0
- mediaelement/mediaelementplayer.css +507 -0
- mediaelement/mediaelementplayer.min.css +1 -0
- mediaelement/silverlightmediaelement.xap +0 -0
- readme.txt +201 -0
- screenshot-1.jpg +0 -0
mediaelement-js-wp.php
ADDED
@@ -0,0 +1,326 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package MediaElementJS
|
4 |
+
* @version 2.0.6.1
|
5 |
+
*/
|
6 |
+
/*
|
7 |
+
Plugin Name: MediaElementJS - HTML5 Audio and Video
|
8 |
+
Plugin URI: http://mediaelementjs.com/
|
9 |
+
Description: A video and audio plugin for WordPress built on MediaElement HTML5 video and audio player library. Embeds video or audio in your post or page using HTML5 with Flash or Silverlight fallback support for non-HTML5 browsers. Video support: MP4, Ogg, WebM, WMV. Audio support: MP3, WMA, WAV
|
10 |
+
Author: John Dyer
|
11 |
+
Version: 2.0.6.1
|
12 |
+
Author URI: http://johndyer.me/
|
13 |
+
License: GPLv3, MIT
|
14 |
+
*/
|
15 |
+
|
16 |
+
/*
|
17 |
+
Adapted from: http://videojs.com/ plugin
|
18 |
+
*/
|
19 |
+
|
20 |
+
$mediaElementPlayerIndex = 1;
|
21 |
+
|
22 |
+
/* Runs when plugin is activated */
|
23 |
+
register_activation_hook(__FILE__,'mejs_install');
|
24 |
+
|
25 |
+
function mejs_install() {
|
26 |
+
add_option('mep_default_video_height', 270);
|
27 |
+
add_option('mep_default_video_width', 480);
|
28 |
+
add_option('mep_default_video_type', '');
|
29 |
+
add_option('mep_default_audio_type', '');
|
30 |
+
}
|
31 |
+
|
32 |
+
/* Runs on plugin deactivation*/
|
33 |
+
register_deactivation_hook( __FILE__, 'mejs_remove' );
|
34 |
+
function mejs_remove() {
|
35 |
+
delete_option('mep_default_video_height');
|
36 |
+
delete_option('mep_default_video_width');
|
37 |
+
delete_option('mep_default_video_type');
|
38 |
+
delete_option('mep_default_audio_type');
|
39 |
+
}
|
40 |
+
|
41 |
+
// create custom plugin settings menu
|
42 |
+
add_action('admin_menu', 'mejs_create_menu');
|
43 |
+
|
44 |
+
function mejs_create_menu() {
|
45 |
+
|
46 |
+
//create new top-level menu
|
47 |
+
add_options_page('MediaElement.js Settings', 'MediaElement.js Settings', 'administrator', __FILE__, 'mejs_settings_page');
|
48 |
+
|
49 |
+
//call register settings function
|
50 |
+
add_action( 'admin_init', 'mejs_register_settings' );
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
function mejs_register_settings() {
|
55 |
+
//register our settings
|
56 |
+
register_setting( 'mep_settings', 'mep_default_video_height' );
|
57 |
+
register_setting( 'mep_settings', 'mep_default_video_width' );
|
58 |
+
register_setting( 'mep_settings', 'mep_default_video_type' );
|
59 |
+
register_setting( 'mep_settings', 'mep_default_audio_type' );
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
function mejs_settings_page() {
|
64 |
+
?>
|
65 |
+
<div class="wrap">
|
66 |
+
<h2>MediaElement.js HTML5 Player Options</h2>
|
67 |
+
|
68 |
+
<p>See <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more details on how the HTML5 player and Flash fallbacks work.</p>
|
69 |
+
|
70 |
+
<form method="post" action="options.php">
|
71 |
+
<?php wp_nonce_field('update-options'); ?>
|
72 |
+
|
73 |
+
|
74 |
+
<h3 class="title"><span>Video Settings</span></h3>
|
75 |
+
|
76 |
+
<table class="form-table">
|
77 |
+
<tr valign="top">
|
78 |
+
<th scope="row">
|
79 |
+
<label for="mep_default_video_width">Default Width</label>
|
80 |
+
</th>
|
81 |
+
<td >
|
82 |
+
<input name="mep_default_video_width" type="text" id="mep_default_video_width" value="<?php echo get_option('mep_default_video_width'); ?>" />
|
83 |
+
</td>
|
84 |
+
</tr>
|
85 |
+
<tr valign="top">
|
86 |
+
<th scope="row">
|
87 |
+
<label for="mep_default_video_height">Default Height</label>
|
88 |
+
</th>
|
89 |
+
<td >
|
90 |
+
<input name="mep_default_video_height" type="text" id="mep_default_video_height" value="<?php echo get_option('mep_default_video_height'); ?>" />
|
91 |
+
</td>
|
92 |
+
</tr>
|
93 |
+
<tr valign="top">
|
94 |
+
<th scope="row">
|
95 |
+
<label for="mep_default_video_type">Default Type</label>
|
96 |
+
</th>
|
97 |
+
<td >
|
98 |
+
<input name="mep_default_video_type" type="text" id="mep_default_video_type" value="<?php echo get_option('mep_default_video_type'); ?>" /> <span class="description">such as "video/mp4"</span>
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
</table>
|
102 |
+
|
103 |
+
<h3 class="title"><span>Audio Settings</span></h3>
|
104 |
+
|
105 |
+
|
106 |
+
<table class="form-table">
|
107 |
+
<tr valign="top">
|
108 |
+
<th scope="row">
|
109 |
+
<label for="mep_default_audio_type">Default Type</label>
|
110 |
+
</th>
|
111 |
+
<td >
|
112 |
+
<input name="mep_default_audio_type" type="text" id="mep_default_audio_type" value="<?php echo get_option('mep_default_audio_type'); ?>" /> <span class="description">such as "audio/mp3"</span>
|
113 |
+
</td>
|
114 |
+
</tr>
|
115 |
+
</table>
|
116 |
+
|
117 |
+
<input type="hidden" name="action" value="update" />
|
118 |
+
<input type="hidden" name="page_options" value="mep_default_video_width,mep_default_video_height,mep_default_video_type,mep_default_audio_type" />
|
119 |
+
|
120 |
+
<p>
|
121 |
+
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
122 |
+
</p>
|
123 |
+
|
124 |
+
</div>
|
125 |
+
|
126 |
+
|
127 |
+
|
128 |
+
</form>
|
129 |
+
</div>
|
130 |
+
<?php
|
131 |
+
}
|
132 |
+
|
133 |
+
function mejs_add_header(){
|
134 |
+
|
135 |
+
|
136 |
+
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
|
137 |
+
|
138 |
+
echo <<<_end_
|
139 |
+
<link rel="stylesheet" href="{$dir}mediaelementplayer.min.css" type="text/css" />
|
140 |
+
<script src="{$dir}mediaelement-and-player.min.js" type="text/javascript"></script>
|
141 |
+
_end_;
|
142 |
+
}
|
143 |
+
|
144 |
+
// If this happens in the <head> tag it fails in iOS. Boo.
|
145 |
+
function mejs_add_footer(){
|
146 |
+
/*
|
147 |
+
$defaultVideoWidth = get_option('mep_default_video_width');
|
148 |
+
$defaultVideoHeight = get_option('mep_default_video_height');
|
149 |
+
|
150 |
+
echo <<<_end_
|
151 |
+
<script type="text/javascript">
|
152 |
+
jQuery(document).ready(function($) {
|
153 |
+
$('video[class=mep],audio[class=mep]').mediaelementplayer({defaultVideoWidth:{$defaultVideoWidth},defaultVideoHeight:{$defaultVideoHeight}});
|
154 |
+
});
|
155 |
+
</script>
|
156 |
+
_end_;
|
157 |
+
*/
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
add_action('wp_head','mejs_add_header');
|
162 |
+
add_action('wp_footer','mejs_add_footer');
|
163 |
+
|
164 |
+
function mejs_media_shortcode($tagName, $atts){
|
165 |
+
|
166 |
+
global $mediaElementPlayerIndex;
|
167 |
+
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
|
168 |
+
|
169 |
+
extract(shortcode_atts(array(
|
170 |
+
'src' => '',
|
171 |
+
'mp4' => '',
|
172 |
+
'mp3' => '',
|
173 |
+
'wmv' => '',
|
174 |
+
'webm' => '',
|
175 |
+
'flv' => '',
|
176 |
+
'ogg' => '',
|
177 |
+
'poster' => '',
|
178 |
+
'width' => get_option('mep_default_video_width'),
|
179 |
+
'height' => get_option('mep_default_video_height'),
|
180 |
+
'type' => get_option('mep_default_'.$tagName.'_type'),
|
181 |
+
'preload' => 'none',
|
182 |
+
'autoplay' => '',
|
183 |
+
'loop' => '',
|
184 |
+
|
185 |
+
// old ones
|
186 |
+
'duration' => 'true',
|
187 |
+
'progress' => 'true',
|
188 |
+
'fullscreen' => 'true',
|
189 |
+
'volume' => 'true',
|
190 |
+
|
191 |
+
// captions
|
192 |
+
'captions' => '',
|
193 |
+
'captionslang' => 'en'
|
194 |
+
), $atts));
|
195 |
+
|
196 |
+
if ($type) {
|
197 |
+
$type_attribute = 'type="'.$type.'"';
|
198 |
+
}
|
199 |
+
|
200 |
+
if ($src) {
|
201 |
+
$src_attribute = 'src="'.htmlspecialchars($src).'"';
|
202 |
+
$flash_src = htmlspecialchars($src);
|
203 |
+
}
|
204 |
+
|
205 |
+
if ($mp4) {
|
206 |
+
$mp4_source = '<source src="'.htmlspecialchars($mp4).'" type="'.$tagName.'/mp4" />';
|
207 |
+
$flash_src = htmlspecialchars($mp4);
|
208 |
+
}
|
209 |
+
|
210 |
+
if ($mp3) {
|
211 |
+
$mp3_source = '<source src="'.htmlspecialchars($mp3).'" type="'.$tagName.'/mp3" />';
|
212 |
+
$flash_src = htmlspecialchars($mp3);
|
213 |
+
}
|
214 |
+
|
215 |
+
if ($webm) {
|
216 |
+
$webm_source = '<source src="'.htmlspecialchars($webm).'" type="'.$tagName.'/webm" />';
|
217 |
+
}
|
218 |
+
|
219 |
+
if ($ogg) {
|
220 |
+
$ogg_source = '<source src="'.htmlspecialchars($ogg).'" type="'.$tagName.'/ogg" />';
|
221 |
+
}
|
222 |
+
|
223 |
+
if ($flv) {
|
224 |
+
$flv_source = '<source src="'.htmlspecialchars($flv).'" type="'.$tagName.'/flv" />';
|
225 |
+
}
|
226 |
+
|
227 |
+
if ($wmv) {
|
228 |
+
$wmv_source = '<source src="'.htmlspecialchars($wmv).'" type="'.$tagName.'/wmv" />';
|
229 |
+
}
|
230 |
+
|
231 |
+
|
232 |
+
if ($captions) {
|
233 |
+
$captions_source = '<track src="'.$captions.'" kind="subtitles" srclang="'.$captionslang.'" />';
|
234 |
+
}
|
235 |
+
|
236 |
+
if ($width && $tagName == 'video') {
|
237 |
+
$width_attribute = 'width="'.$width.'"';
|
238 |
+
}
|
239 |
+
|
240 |
+
if ($height && $tagName == 'video') {
|
241 |
+
$height_attribute = 'height="'.$height.'"';
|
242 |
+
}
|
243 |
+
|
244 |
+
if ($poster) {
|
245 |
+
$poster_attribute = 'poster="'.htmlspecialchars($poster).'"';
|
246 |
+
}
|
247 |
+
|
248 |
+
if ($preload) {
|
249 |
+
$preload_attribute = 'preload="'.$preload.'"';
|
250 |
+
}
|
251 |
+
|
252 |
+
if ($autoplay) {
|
253 |
+
$autoplay_attribute = 'autoplay="'.$autoplay.'"';
|
254 |
+
}
|
255 |
+
|
256 |
+
if ($loop) {
|
257 |
+
$loop_option = ', loop: ' . $loop;
|
258 |
+
}
|
259 |
+
|
260 |
+
// CONTROLS
|
261 |
+
$controls_option = ",features: ['playpause'";
|
262 |
+
if ($progress == 'true')
|
263 |
+
$controls_option .= ",'progress'";
|
264 |
+
if ($duration == 'true')
|
265 |
+
$controls_option .= ",'current','duration'";
|
266 |
+
if ($volume == 'true')
|
267 |
+
$controls_option .= ",'volume'";
|
268 |
+
$controls_option .= ",'tracks'";
|
269 |
+
if ($fullscreen == 'true')
|
270 |
+
$controls_option .= ",'fullscreen'";
|
271 |
+
$controls_option .= "]";
|
272 |
+
|
273 |
+
|
274 |
+
$videohtml .= <<<_end_
|
275 |
+
<{$tagName} id="wp_mep_{$mediaElementPlayerIndex}" {$src_attribute} {$type_attribute} {$width_attribute} {$height_attribute} {$poster_attribute} controls="controls" {$preload_attribute} {$autoplay_attribute}>
|
276 |
+
{$mp4_source}
|
277 |
+
{$mp3_source}
|
278 |
+
{$webm_source}
|
279 |
+
{$flv_source}
|
280 |
+
{$wmv_source}
|
281 |
+
{$ogg_source}
|
282 |
+
{$captions_source}
|
283 |
+
<object width="320" height="240" type="application/x-shockwave-flash" data="{$dir}flashmediaelement.swf">
|
284 |
+
<param name="movie" value="{$dir}flashmediaelement.swf" />
|
285 |
+
<param name="flashvars" value="controls=true&file={$flash_src}" />
|
286 |
+
</object>
|
287 |
+
</{$tagName}>
|
288 |
+
<script type="text/javascript">
|
289 |
+
jQuery(document).ready(function($) {
|
290 |
+
$('#wp_mep_$mediaElementPlayerIndex').mediaelementplayer({
|
291 |
+
m:1
|
292 |
+
{$loop_option}
|
293 |
+
{$controls_option}
|
294 |
+
});
|
295 |
+
});
|
296 |
+
</script>
|
297 |
+
|
298 |
+
_end_;
|
299 |
+
|
300 |
+
$mediaElementPlayerIndex++;
|
301 |
+
|
302 |
+
return $videohtml;
|
303 |
+
}
|
304 |
+
|
305 |
+
|
306 |
+
|
307 |
+
function mejs_audio_shortcode($atts){
|
308 |
+
return mejs_media_shortcode('audio',$atts);
|
309 |
+
}
|
310 |
+
function mejs_video_shortcode($atts){
|
311 |
+
return mejs_media_shortcode('video',$atts);
|
312 |
+
}
|
313 |
+
|
314 |
+
add_shortcode('audio', 'mejs_audio_shortcode');
|
315 |
+
add_shortcode('video', 'mejs_video_shortcode');
|
316 |
+
|
317 |
+
|
318 |
+
function mejs_init() {
|
319 |
+
|
320 |
+
wp_enqueue_script( 'jquery' );
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
add_action('init', 'mejs_init');
|
325 |
+
|
326 |
+
?>
|
mediaelement/background.png
ADDED
Binary file
|
mediaelement/bigplay.png
ADDED
Binary file
|
mediaelement/controls.png
ADDED
Binary file
|
mediaelement/flashmedi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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* MediaElement.js
|
3 |
+
* HTML5 <video> and <audio> shim and player
|
4 |
+
* http://mediaelementjs.com/
|
5 |
+
*
|
6 |
+
* Creates a JavaScript object that mimics HTML5 MediaElement API
|
7 |
+
* for browsers that don't understand HTML5 or can't play the provided codec
|
8 |
+
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
+
*
|
10 |
+
* Copyright 2010, John Dyer (http://johndyer.me)
|
11 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
// Namespace
|
15 |
+
var mejs = mejs || {};
|
16 |
+
|
17 |
+
// version number
|
18 |
+
mejs.version = '2.0.5';
|
19 |
+
|
20 |
+
// player number (for missing, same id attr)
|
21 |
+
mejs.meIndex = 0;
|
22 |
+
|
23 |
+
// media types accepted by plugins
|
24 |
+
mejs.plugins = {
|
25 |
+
silverlight: [
|
26 |
+
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav']}
|
27 |
+
],
|
28 |
+
flash: [
|
29 |
+
{version: [9,0,124], types: ['video/mp4','video/m4v','video/mov','video/flv','audio/flv','audio/mp3','audio/m4a']}
|
30 |
+
//,{version: [11,0], types: ['video/webm'} // for future reference
|
31 |
+
]
|
32 |
+
};
|
33 |
+
|
34 |
+
/*
|
35 |
+
Utility methods
|
36 |
+
*/
|
37 |
+
mejs.Utility = {
|
38 |
+
encodeUrl: function(url) {
|
39 |
+
return encodeURIComponent(url); //.replace(/\?/gi,'%3F').replace(/=/gi,'%3D').replace(/&/gi,'%26');
|
40 |
+
},
|
41 |
+
escapeHTML: function(s) {
|
42 |
+
return s.split('&').join('&').split('<').join('<').split('"').join('"');
|
43 |
+
},
|
44 |
+
absolutizeUrl: function(url) {
|
45 |
+
var el = document.createElement('div');
|
46 |
+
el.innerHTML = '<a href="' + this.escapeHTML(url) + '">x</a>';
|
47 |
+
return el.firstChild.href;
|
48 |
+
},
|
49 |
+
getScriptPath: function(scriptNames) {
|
50 |
+
var
|
51 |
+
i = 0,
|
52 |
+
j,
|
53 |
+
path = '',
|
54 |
+
name = '',
|
55 |
+
script,
|
56 |
+
scripts = document.getElementsByTagName('script');
|
57 |
+
|
58 |
+
for (; i < scripts.length; i++) {
|
59 |
+
script = scripts[i].src;
|
60 |
+
for (j = 0; j < scriptNames.length; j++) {
|
61 |
+
name = scriptNames[j];
|
62 |
+
if (script.indexOf(name) > -1) {
|
63 |
+
path = script.substring(0, script.indexOf(name));
|
64 |
+
break;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
if (path !== '') {
|
68 |
+
break;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
return path;
|
72 |
+
},
|
73 |
+
secondsToTimeCode: function(seconds) {
|
74 |
+
seconds = Math.round(seconds);
|
75 |
+
var minutes = Math.floor(seconds / 60);
|
76 |
+
minutes = (minutes >= 10) ? minutes : "0" + minutes;
|
77 |
+
seconds = Math.floor(seconds % 60);
|
78 |
+
seconds = (seconds >= 10) ? seconds : "0" + seconds;
|
79 |
+
return minutes + ":" + seconds;
|
80 |
+
}
|
81 |
+
};
|
82 |
+
|
83 |
+
|
84 |
+
// Core detector, plugins are added below
|
85 |
+
mejs.PluginDetector = {
|
86 |
+
|
87 |
+
// main public function to test a plug version number PluginDetector.hasPluginVersion('flash',[9,0,125]);
|
88 |
+
hasPluginVersion: function(plugin, v) {
|
89 |
+
var pv = this.plugins[plugin];
|
90 |
+
v[1] = v[1] || 0;
|
91 |
+
v[2] = v[2] || 0;
|
92 |
+
return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
|
93 |
+
},
|
94 |
+
|
95 |
+
// cached values
|
96 |
+
nav: window.navigator,
|
97 |
+
ua: window.navigator.userAgent.toLowerCase(),
|
98 |
+
|
99 |
+
// stored version numbers
|
100 |
+
plugins: [],
|
101 |
+
|
102 |
+
// runs detectPlugin() and stores the version number
|
103 |
+
addPlugin: function(p, pluginName, mimeType, activeX, axDetect) {
|
104 |
+
this.plugins[p] = this.detectPlugin(pluginName, mimeType, activeX, axDetect);
|
105 |
+
},
|
106 |
+
|
107 |
+
// get the version number from the mimetype (all but IE) or ActiveX (IE)
|
108 |
+
detectPlugin: function(pluginName, mimeType, activeX, axDetect) {
|
109 |
+
|
110 |
+
var version = [0,0,0],
|
111 |
+
description,
|
112 |
+
i,
|
113 |
+
ax;
|
114 |
+
|
115 |
+
// Firefox, Webkit, Opera
|
116 |
+
if (typeof(this.nav.plugins) != 'undefined' && typeof this.nav.plugins[pluginName] == 'object') {
|
117 |
+
description = this.nav.plugins[pluginName].description;
|
118 |
+
if (description && !(typeof this.nav.mimeTypes != 'undefined' && this.nav.mimeTypes[mimeType] && !this.nav.mimeTypes[mimeType].enabledPlugin)) {
|
119 |
+
version = description.replace(pluginName, '').replace(/^\s+/,'').replace(/\sr/gi,'.').split('.');
|
120 |
+
for (i=0; i<version.length; i++) {
|
121 |
+
version[i] = parseInt(version[i].match(/\d+/), 10);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
// Internet Explorer / ActiveX
|
125 |
+
} else if (typeof(window.ActiveXObject) != 'undefined') {
|
126 |
+
try {
|
127 |
+
ax = new ActiveXObject(activeX);
|
128 |
+
if (ax) {
|
129 |
+
version = axDetect(ax);
|
130 |
+
}
|
131 |
+
}
|
132 |
+
catch (e) { }
|
133 |
+
}
|
134 |
+
return version;
|
135 |
+
}
|
136 |
+
};
|
137 |
+
|
138 |
+
// Add Flash detection
|
139 |
+
mejs.PluginDetector.addPlugin('flash','Shockwave Flash','application/x-shockwave-flash','ShockwaveFlash.ShockwaveFlash', function(ax) {
|
140 |
+
// adapted from SWFObject
|
141 |
+
var version = [],
|
142 |
+
d = ax.GetVariable("$version");
|
143 |
+
if (d) {
|
144 |
+
d = d.split(" ")[1].split(",");
|
145 |
+
version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
|
146 |
+
}
|
147 |
+
return version;
|
148 |
+
});
|
149 |
+
|
150 |
+
// Add Silverlight detection
|
151 |
+
mejs.PluginDetector.addPlugin('silverlight','Silverlight Plug-In','application/x-silverlight-2','AgControl.AgControl', function (ax) {
|
152 |
+
// Silverlight cannot report its version number to IE
|
153 |
+
// but it does have a isVersionSupported function, so we have to loop through it to get a version number.
|
154 |
+
// adapted from http://www.silverlightversion.com/
|
155 |
+
var v = [0,0,0,0],
|
156 |
+
loopMatch = function(ax, v, i, n) {
|
157 |
+
while(ax.isVersionSupported(v[0]+ "."+ v[1] + "." + v[2] + "." + v[3])){
|
158 |
+
v[i]+=n;
|
159 |
+
}
|
160 |
+
v[i] -= n;
|
161 |
+
};
|
162 |
+
loopMatch(ax, v, 0, 1);
|
163 |
+
loopMatch(ax, v, 1, 1);
|
164 |
+
loopMatch(ax, v, 2, 10000); // the third place in the version number is usually 5 digits (4.0.xxxxx)
|
165 |
+
loopMatch(ax, v, 2, 1000);
|
166 |
+
loopMatch(ax, v, 2, 100);
|
167 |
+
loopMatch(ax, v, 2, 10);
|
168 |
+
loopMatch(ax, v, 2, 1);
|
169 |
+
loopMatch(ax, v, 3, 1);
|
170 |
+
|
171 |
+
return v;
|
172 |
+
});
|
173 |
+
// add adobe acrobat
|
174 |
+
/*
|
175 |
+
PluginDetector.addPlugin('acrobat','Adobe Acrobat','application/pdf','AcroPDF.PDF', function (ax) {
|
176 |
+
var version = [],
|
177 |
+
d = ax.GetVersions().split(',')[0].split('=')[1].split('.');
|
178 |
+
|
179 |
+
if (d) {
|
180 |
+
version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
|
181 |
+
}
|
182 |
+
return version;
|
183 |
+
});
|
184 |
+
*/
|
185 |
+
|
186 |
+
// special case for Android which sadly doesn't implement the canPlayType function (always returns '')
|
187 |
+
if (mejs.PluginDetector.ua.match(/Android 2\.[12]/) !== null) {
|
188 |
+
HTMLMediaElement.canPlayType = function(type) {
|
189 |
+
return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'probably' : '';
|
190 |
+
};
|
191 |
+
}
|
192 |
+
|
193 |
+
// necessary detection (fixes for <IE9)
|
194 |
+
mejs.MediaFeatures = {
|
195 |
+
init: function() {
|
196 |
+
var
|
197 |
+
nav = mejs.PluginDetector.nav,
|
198 |
+
ua = mejs.PluginDetector.ua,
|
199 |
+
i,
|
200 |
+
v,
|
201 |
+
html5Elements = ['source','track','audio','video'];
|
202 |
+
|
203 |
+
// detect browsers
|
204 |
+
this.isiPad = (ua.match(/iPad/i) !== null);
|
205 |
+
this.isiPhone = (ua.match(/iPhone/i) !== null);
|
206 |
+
this.isAndroid = (ua.match(/Android/i) !== null);
|
207 |
+
this.isIE = (nav.appName.indexOf("Microsoft") != -1);
|
208 |
+
this.isChrome = (ua.match(/Chrome/gi) !== null);
|
209 |
+
|
210 |
+
// create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
|
211 |
+
for (i=0; i<html5Elements.length; i++) {
|
212 |
+
v = document.createElement(html5Elements[i]);
|
213 |
+
}
|
214 |
+
|
215 |
+
// detect native JavaScript fullscreen (Safari only, Chrome fails)
|
216 |
+
this.hasNativeFullScreen = (typeof v.webkitEnterFullScreen !== 'undefined');
|
217 |
+
if (this.isChrome) {
|
218 |
+
this.hasNativeFullScreen = false;
|
219 |
+
}
|
220 |
+
}
|
221 |
+
};
|
222 |
+
mejs.MediaFeatures.init();
|
223 |
+
|
224 |
+
|
225 |
+
/*
|
226 |
+
extension methods to <video> or <audio> object to bring it into parity with PluginMediaElement (see below)
|
227 |
+
*/
|
228 |
+
mejs.HtmlMediaElement = {
|
229 |
+
pluginType: 'native',
|
230 |
+
|
231 |
+
setCurrentTime: function (time) {
|
232 |
+
this.currentTime = time;
|
233 |
+
},
|
234 |
+
|
235 |
+
setMuted: function (muted) {
|
236 |
+
this.muted = muted;
|
237 |
+
},
|
238 |
+
|
239 |
+
setVolume: function (volume) {
|
240 |
+
this.volume = volume;
|
241 |
+
},
|
242 |
+
|
243 |
+
// for parity with the plugin versions
|
244 |
+
stop: function () {
|
245 |
+
this.pause();
|
246 |
+
},
|
247 |
+
|
248 |
+
// This can be a url string
|
249 |
+
// or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
|
250 |
+
setSrc: function (url) {
|
251 |
+
if (typeof url == 'string') {
|
252 |
+
this.src = url;
|
253 |
+
} else {
|
254 |
+
var i, media;
|
255 |
+
|
256 |
+
for (i=0; i<url.length; i++) {
|
257 |
+
media = url[i];
|
258 |
+
if (this.canPlayType(media.type)) {
|
259 |
+
this.src = media.src;
|
260 |
+
}
|
261 |
+
}
|
262 |
+
}
|
263 |
+
},
|
264 |
+
|
265 |
+
setVideoSize: function (width, height) {
|
266 |
+
this.width = width;
|
267 |
+
this.height = height;
|
268 |
+
}
|
269 |
+
};
|
270 |
+
|
271 |
+
/*
|
272 |
+
Mimics the <video/audio> element by calling Flash's External Interface or Silverlights [ScriptableMember]
|
273 |
+
*/
|
274 |
+
mejs.PluginMediaElement = function (pluginid, pluginType, mediaUrl) {
|
275 |
+
this.id = pluginid;
|
276 |
+
this.pluginType = pluginType;
|
277 |
+
this.src = mediaUrl;
|
278 |
+
this.events = {};
|
279 |
+
};
|
280 |
+
|
281 |
+
// JavaScript values and ExternalInterface methods that match HTML5 video properties methods
|
282 |
+
// http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/fl/video/FLVPlayback.html
|
283 |
+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
|
284 |
+
mejs.PluginMediaElement.prototype = {
|
285 |
+
|
286 |
+
// special
|
287 |
+
pluginElement: null,
|
288 |
+
pluginType: '',
|
289 |
+
|
290 |
+
// not implemented :(
|
291 |
+
playbackRate: -1,
|
292 |
+
defaultPlaybackRate: -1,
|
293 |
+
seekable: [],
|
294 |
+
played: [],
|
295 |
+
|
296 |
+
// HTML5 read-only properties
|
297 |
+
paused: true,
|
298 |
+
ended: false,
|
299 |
+
seeking: false,
|
300 |
+
duration: 0,
|
301 |
+
|
302 |
+
// HTML5 get/set properties, but only set (updated by event handlers)
|
303 |
+
muted: false,
|
304 |
+
volume: 1,
|
305 |
+
currentTime: 0,
|
306 |
+
|
307 |
+
// HTML5 methods
|
308 |
+
play: function () {
|
309 |
+
if (this.pluginApi != null) {
|
310 |
+
this.pluginApi.playMedia();
|
311 |
+
this.paused = false;
|
312 |
+
}
|
313 |
+
},
|
314 |
+
load: function () {
|
315 |
+
if (this.pluginApi != null) {
|
316 |
+
this.pluginApi.loadMedia();
|
317 |
+
this.paused = false;
|
318 |
+
}
|
319 |
+
},
|
320 |
+
pause: function () {
|
321 |
+
if (this.pluginApi != null) {
|
322 |
+
this.pluginApi.pauseMedia();
|
323 |
+
this.paused = true;
|
324 |
+
}
|
325 |
+
},
|
326 |
+
stop: function () {
|
327 |
+
if (this.pluginApi != null) {
|
328 |
+
this.pluginApi.stopMedia();
|
329 |
+
this.paused = true;
|
330 |
+
}
|
331 |
+
},
|
332 |
+
canPlayType: function(type) {
|
333 |
+
var i,
|
334 |
+
j,
|
335 |
+
pluginInfo,
|
336 |
+
pluginVersions = mejs.plugins[this.pluginType];
|
337 |
+
|
338 |
+
for (i=0; i<pluginVersions.length; i++) {
|
339 |
+
pluginInfo = pluginVersions[i];
|
340 |
+
|
341 |
+
// test if user has the correct plugin version
|
342 |
+
if (mejs.PluginDetector.hasPluginVersion(this.pluginType, pluginInfo.version)) {
|
343 |
+
|
344 |
+
// test for plugin playback types
|
345 |
+
for (j=0; j<pluginInfo.types.length; j++) {
|
346 |
+
// find plugin that can play the type
|
347 |
+
if (type == pluginInfo.types[j]) {
|
348 |
+
return true;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
}
|
352 |
+
}
|
353 |
+
|
354 |
+
return false;
|
355 |
+
},
|
356 |
+
|
357 |
+
// custom methods since not all JavaScript implementations support get/set
|
358 |
+
|
359 |
+
// This can be a url string
|
360 |
+
// or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
|
361 |
+
setSrc: function (url) {
|
362 |
+
if (typeof url == 'string') {
|
363 |
+
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(url));
|
364 |
+
this.src = mejs.Utility.absolutizeUrl(url);
|
365 |
+
} else {
|
366 |
+
var i, media;
|
367 |
+
|
368 |
+
for (i=0; i<url.length; i++) {
|
369 |
+
media = url[i];
|
370 |
+
if (this.canPlayType(media.type)) {
|
371 |
+
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
|
372 |
+
this.src = mejs.Utility.absolutizeUrl(url);
|
373 |
+
}
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
},
|
378 |
+
setCurrentTime: function (time) {
|
379 |
+
if (this.pluginApi != null) {
|
380 |
+
this.pluginApi.setCurrentTime(time);
|
381 |
+
this.currentTime = time;
|
382 |
+
}
|
383 |
+
},
|
384 |
+
setVolume: function (volume) {
|
385 |
+
if (this.pluginApi != null) {
|
386 |
+
this.pluginApi.setVolume(volume);
|
387 |
+
this.volume = volume;
|
388 |
+
}
|
389 |
+
},
|
390 |
+
setMuted: function (muted) {
|
391 |
+
if (this.pluginApi != null) {
|
392 |
+
this.pluginApi.setMuted(muted);
|
393 |
+
this.muted = muted;
|
394 |
+
}
|
395 |
+
},
|
396 |
+
|
397 |
+
// additional non-HTML5 methods
|
398 |
+
setVideoSize: function (width, height) {
|
399 |
+
if ( this.pluginElement.style) {
|
400 |
+
this.pluginElement.style.width = width + 'px';
|
401 |
+
this.pluginElement.style.height = height + 'px';
|
402 |
+
}
|
403 |
+
if (this.pluginApi != null) {
|
404 |
+
this.pluginApi.setVideoSize(width, height);
|
405 |
+
}
|
406 |
+
},
|
407 |
+
|
408 |
+
setFullscreen: function (fullscreen) {
|
409 |
+
if (this.pluginApi != null) {
|
410 |
+
this.pluginApi.setFullscreen(fullscreen);
|
411 |
+
}
|
412 |
+
},
|
413 |
+
|
414 |
+
// start: fake events
|
415 |
+
addEventListener: function (eventName, callback, bubble) {
|
416 |
+
this.events[eventName] = this.events[eventName] || [];
|
417 |
+
this.events[eventName].push(callback);
|
418 |
+
},
|
419 |
+
dispatchEvent: function (eventName) {
|
420 |
+
var i,
|
421 |
+
args,
|
422 |
+
callbacks = this.events[eventName];
|
423 |
+
|
424 |
+
if (callbacks) {
|
425 |
+
args = Array.prototype.slice.call(arguments, 1);
|
426 |
+
for (i = 0; i < callbacks.length; i++) {
|
427 |
+
callbacks[i].apply(null, args);
|
428 |
+
}
|
429 |
+
}
|
430 |
+
}
|
431 |
+
// end: fake events
|
432 |
+
};
|
433 |
+
|
434 |
+
|
435 |
+
|
436 |
+
// Handles calls from Flash/Silverlight and reports them as native <video/audio> events and properties
|
437 |
+
mejs.MediaPluginBridge = {
|
438 |
+
|
439 |
+
pluginMediaElements:{},
|
440 |
+
htmlMediaElements:{},
|
441 |
+
|
442 |
+
registerPluginElement: function (id, pluginMediaElement, htmlMediaElement) {
|
443 |
+
this.pluginMediaElements[id] = pluginMediaElement;
|
444 |
+
this.htmlMediaElements[id] = htmlMediaElement;
|
445 |
+
},
|
446 |
+
|
447 |
+
// when Flash/Silverlight is ready, it calls out to this method
|
448 |
+
initPlugin: function (id) {
|
449 |
+
|
450 |
+
var pluginMediaElement = this.pluginMediaElements[id],
|
451 |
+
htmlMediaElement = this.htmlMediaElements[id];
|
452 |
+
|
453 |
+
// find the javascript bridge
|
454 |
+
switch (pluginMediaElement.pluginType) {
|
455 |
+
case "flash":
|
456 |
+
pluginMediaElement.pluginElement = pluginMediaElement.pluginApi = document.getElementById(id);
|
457 |
+
break;
|
458 |
+
case "silverlight":
|
459 |
+
pluginMediaElement.pluginElement = document.getElementById(pluginMediaElement.id);
|
460 |
+
pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
|
461 |
+
break;
|
462 |
+
}
|
463 |
+
|
464 |
+
if (pluginMediaElement.success) {
|
465 |
+
pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
|
466 |
+
}
|
467 |
+
},
|
468 |
+
|
469 |
+
// receives events from Flash/Silverlight and sends them out as HTML5 media events
|
470 |
+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
|
471 |
+
fireEvent: function (id, eventName, values) {
|
472 |
+
|
473 |
+
var
|
474 |
+
e,
|
475 |
+
i,
|
476 |
+
bufferedTime,
|
477 |
+
pluginMediaElement = this.pluginMediaElements[id];
|
478 |
+
|
479 |
+
pluginMediaElement.ended = false;
|
480 |
+
pluginMediaElement.paused = true;
|
481 |
+
|
482 |
+
// fake event object to mimic real HTML media event.
|
483 |
+
e = {
|
484 |
+
type: eventName,
|
485 |
+
target: pluginMediaElement
|
486 |
+
};
|
487 |
+
|
488 |
+
// attach all values to element and event object
|
489 |
+
for (i in values) {
|
490 |
+
pluginMediaElement[i] = values[i];
|
491 |
+
e[i] = values[i];
|
492 |
+
}
|
493 |
+
|
494 |
+
// fake the newer W3C buffered TimeRange (loaded and total have been removed)
|
495 |
+
bufferedTime = values.bufferedTime || 0;
|
496 |
+
|
497 |
+
e.target.buffered = e.buffered = {
|
498 |
+
start: function(index) {
|
499 |
+
return 0;
|
500 |
+
},
|
501 |
+
end: function (index) {
|
502 |
+
return bufferedTime;
|
503 |
+
},
|
504 |
+
length: 1
|
505 |
+
};
|
506 |
+
|
507 |
+
pluginMediaElement.dispatchEvent(e.type, e);
|
508 |
+
}
|
509 |
+
};
|
510 |
+
|
511 |
+
/*
|
512 |
+
Default options
|
513 |
+
*/
|
514 |
+
mejs.MediaElementDefaults = {
|
515 |
+
// shows debug errors on screen
|
516 |
+
enablePluginDebug: false,
|
517 |
+
// remove or reorder to change plugin priority
|
518 |
+
plugins: ['flash','silverlight'],
|
519 |
+
// specify to force MediaElement into a mode
|
520 |
+
type: '',
|
521 |
+
// path to Flash and Silverlight plugins
|
522 |
+
pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
|
523 |
+
// name of flash file
|
524 |
+
flashName: 'flashmediaelement.swf',
|
525 |
+
// turns on the smoothing filter in Flash
|
526 |
+
enablePluginSmoothing: false,
|
527 |
+
// name of silverlight file
|
528 |
+
silverlightName: 'silverlightmediaelement.xap',
|
529 |
+
// default if the <video width> is not specified
|
530 |
+
defaultVideoWidth: 480,
|
531 |
+
// default if the <video height> is not specified
|
532 |
+
defaultVideoHeight: 270,
|
533 |
+
// overrides <video width>
|
534 |
+
pluginWidth: -1,
|
535 |
+
// overrides <video height>
|
536 |
+
pluginHeight: -1,
|
537 |
+
// rate in milliseconds for Flash and Silverlight to fire the timeupdate event
|
538 |
+
// larger number is less accurate, but less strain on plugin->JavaScript bridge
|
539 |
+
timerRate: 250,
|
540 |
+
success: function () { },
|
541 |
+
error: function () { }
|
542 |
+
};
|
543 |
+
|
544 |
+
/*
|
545 |
+
Determines if a browser supports the <video> or <audio> element
|
546 |
+
and returns either the native element or a Flash/Silverlight version that
|
547 |
+
mimics HTML5 MediaElement
|
548 |
+
*/
|
549 |
+
mejs.MediaElement = function (el, o) {
|
550 |
+
mejs.HtmlMediaElementShim.create(el,o);
|
551 |
+
};
|
552 |
+
|
553 |
+
mejs.HtmlMediaElementShim = {
|
554 |
+
|
555 |
+
create: function(el, o) {
|
556 |
+
var
|
557 |
+
options = mejs.MediaElementDefaults,
|
558 |
+
htmlMediaElement = (typeof(el) == 'string') ? document.getElementById(el) : el,
|
559 |
+
isVideo = (htmlMediaElement.tagName.toLowerCase() == 'video'),
|
560 |
+
supportsMediaTag = (typeof(htmlMediaElement.canPlayType) != 'undefined'),
|
561 |
+
playback = {method:'', url:''},
|
562 |
+
poster = htmlMediaElement.getAttribute('poster'),
|
563 |
+
autoplay = htmlMediaElement.getAttribute('autoplay'),
|
564 |
+
preload = htmlMediaElement.getAttribute('preload'),
|
565 |
+
controls = htmlMediaElement.getAttribute('controls'),
|
566 |
+
prop;
|
567 |
+
|
568 |
+
// extend options
|
569 |
+
for (prop in o) {
|
570 |
+
options[prop] = o[prop];
|
571 |
+
}
|
572 |
+
|
573 |
+
// check for real poster
|
574 |
+
poster = (typeof poster == 'undefined' || poster === null) ? '' : poster;
|
575 |
+
preload = (typeof preload == 'undefined' || preload === null || preload === 'false') ? 'none' : preload;
|
576 |
+
autoplay = !(typeof autoplay == 'undefined' || autoplay === null || autoplay === 'false');
|
577 |
+
controls = !(typeof controls == 'undefined' || controls === null || controls === 'false');
|
578 |
+
|
579 |
+
// test for HTML5 and plugin capabilities
|
580 |
+
playback = this.determinePlayback(htmlMediaElement, options, isVideo, supportsMediaTag);
|
581 |
+
|
582 |
+
if (playback.method == 'native') {
|
583 |
+
// add methods to native HTMLMediaElement
|
584 |
+
this.updateNative( htmlMediaElement, options, autoplay, preload, playback);
|
585 |
+
} else if (playback.method !== '') {
|
586 |
+
// create plugin to mimic HTMLMediaElement
|
587 |
+
this.createPlugin( htmlMediaElement, options, isVideo, playback.method, (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '', poster, autoplay, preload, controls);
|
588 |
+
} else {
|
589 |
+
// boo, no HTML5, no Flash, no Silverlight.
|
590 |
+
this.createErrorMessage( htmlMediaElement, options, (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '', poster );
|
591 |
+
}
|
592 |
+
},
|
593 |
+
|
594 |
+
determinePlayback: function(htmlMediaElement, options, isVideo, supportsMediaTag) {
|
595 |
+
|
596 |
+
var
|
597 |
+
mediaFiles = [],
|
598 |
+
i,
|
599 |
+
j,
|
600 |
+
k,
|
601 |
+
l,
|
602 |
+
n,
|
603 |
+
url,
|
604 |
+
type,
|
605 |
+
result = { method: '', url: ''},
|
606 |
+
src = htmlMediaElement.getAttribute('src'),
|
607 |
+
pluginName,
|
608 |
+
pluginVersions,
|
609 |
+
pluginInfo;
|
610 |
+
|
611 |
+
// STEP 1: Get Files from <video src> or <source src>
|
612 |
+
|
613 |
+
// supplied type overrides all HTML
|
614 |
+
if (typeof (options.type) != 'undefined' && options.type !== '') {
|
615 |
+
mediaFiles.push({type:options.type, url:null});
|
616 |
+
|
617 |
+
// test for src attribute first
|
618 |
+
} else if (src != 'undefined' && src !== null) {
|
619 |
+
url = htmlMediaElement.getAttribute('src');
|
620 |
+
type = this.checkType(url, htmlMediaElement.getAttribute('type'), isVideo);
|
621 |
+
mediaFiles.push({type:type, url:url});
|
622 |
+
|
623 |
+
// then test for <source> elements
|
624 |
+
} else {
|
625 |
+
// test <source> types to see if they are usable
|
626 |
+
for (i = 0; i < htmlMediaElement.childNodes.length; i++) {
|
627 |
+
n = htmlMediaElement.childNodes[i];
|
628 |
+
if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
|
629 |
+
url = n.getAttribute('src');
|
630 |
+
type = this.checkType(url, n.getAttribute('type'), isVideo);
|
631 |
+
mediaFiles.push({type:type, url:url});
|
632 |
+
}
|
633 |
+
}
|
634 |
+
}
|
635 |
+
|
636 |
+
// STEP 2: Test for playback method
|
637 |
+
|
638 |
+
// test for native playback first
|
639 |
+
if (supportsMediaTag) {
|
640 |
+
for (i=0; i<mediaFiles.length; i++) {
|
641 |
+
if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== '') {
|
642 |
+
result.method = 'native';
|
643 |
+
result.url = mediaFiles[i].url;
|
644 |
+
return result;
|
645 |
+
}
|
646 |
+
}
|
647 |
+
}
|
648 |
+
|
649 |
+
|
650 |
+
// if native playback didn't work, then test plugins
|
651 |
+
for (i=0; i<mediaFiles.length; i++) {
|
652 |
+
type = mediaFiles[i].type;
|
653 |
+
|
654 |
+
// test all plugins in order of preference [silverlight, flash]
|
655 |
+
for (j=0; j<options.plugins.length; j++) {
|
656 |
+
|
657 |
+
pluginName = options.plugins[j];
|
658 |
+
|
659 |
+
// test version of plugin (for future features)
|
660 |
+
pluginVersions = mejs.plugins[pluginName];
|
661 |
+
for (k=0; k<pluginVersions.length; k++) {
|
662 |
+
pluginInfo = pluginVersions[k];
|
663 |
+
|
664 |
+
// test if user has the correct plugin version
|
665 |
+
if (mejs.PluginDetector.hasPluginVersion(pluginName, pluginInfo.version)) {
|
666 |
+
|
667 |
+
// test for plugin playback types
|
668 |
+
for (l=0; l<pluginInfo.types.length; l++) {
|
669 |
+
// find plugin that can play the type
|
670 |
+
if (type == pluginInfo.types[l]) {
|
671 |
+
result.method = pluginName;
|
672 |
+
result.url = mediaFiles[i].url;
|
673 |
+
return result;
|
674 |
+
}
|
675 |
+
}
|
676 |
+
}
|
677 |
+
}
|
678 |
+
}
|
679 |
+
}
|
680 |
+
|
681 |
+
// what if there's nothing to play? just grab the first available
|
682 |
+
if (result.method === '') {
|
683 |
+
result.url = mediaFiles[0].url;
|
684 |
+
}
|
685 |
+
|
686 |
+
return result;
|
687 |
+
|
688 |
+
},
|
689 |
+
|
690 |
+
checkType: function(url, type, isVideo) {
|
691 |
+
var ext;
|
692 |
+
|
693 |
+
// if no type is supplied, fake it with the extension
|
694 |
+
if (url && !type) {
|
695 |
+
ext = url.substring(url.lastIndexOf('.') + 1);
|
696 |
+
return ((isVideo) ? 'video' : 'audio') + '/' + ext;
|
697 |
+
} else {
|
698 |
+
return type;
|
699 |
+
}
|
700 |
+
},
|
701 |
+
|
702 |
+
createErrorMessage: function(htmlMediaElement, options, downloadUrl, poster) {
|
703 |
+
var errorContainer = document.createElement('div');
|
704 |
+
errorContainer.className = 'me-cannotplay';
|
705 |
+
|
706 |
+
try {
|
707 |
+
errorContainer.style.width = htmlMediaElement.width + 'px';
|
708 |
+
errorContainer.style.height = htmlMediaElement.height + 'px';
|
709 |
+
} catch (e) {}
|
710 |
+
|
711 |
+
errorContainer.innerHTML = (poster !== '') ?
|
712 |
+
'<a href="' + downloadUrl + '"><img src="' + poster + '" /></a>' :
|
713 |
+
'<a href="' + downloadUrl + '"><span>Download File</span></a>';
|
714 |
+
|
715 |
+
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
|
716 |
+
htmlMediaElement.style.display = 'none';
|
717 |
+
|
718 |
+
options.error(htmlMediaElement);
|
719 |
+
},
|
720 |
+
|
721 |
+
createPlugin:function(htmlMediaElement, options, isVideo, pluginType, mediaUrl, poster, autoplay, preload, controls) {
|
722 |
+
|
723 |
+
var width = 1,
|
724 |
+
height = 1,
|
725 |
+
pluginid = 'me_' + pluginType + '_' + (mejs.meIndex++),
|
726 |
+
pluginMediaElement = new mejs.PluginMediaElement(pluginid, pluginType, mediaUrl),
|
727 |
+
container = document.createElement('div'),
|
728 |
+
specialIEContainer,
|
729 |
+
node,
|
730 |
+
initVars;
|
731 |
+
|
732 |
+
// check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
|
733 |
+
node = htmlMediaElement.parentNode;
|
734 |
+
while (node !== null && node.tagName.toLowerCase() != 'body') {
|
735 |
+
if (node.parentNode.tagName.toLowerCase() == 'p') {
|
736 |
+
node.parentNode.parentNode.insertBefore(node, node.parentNode);
|
737 |
+
break;
|
738 |
+
}
|
739 |
+
node = node.parentNode;
|
740 |
+
}
|
741 |
+
|
742 |
+
if (isVideo) {
|
743 |
+
width = (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
|
744 |
+
height = (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
|
745 |
+
} else {
|
746 |
+
if (options.enablePluginDebug) {
|
747 |
+
width = 320;
|
748 |
+
height = 240;
|
749 |
+
}
|
750 |
+
}
|
751 |
+
|
752 |
+
// register plugin
|
753 |
+
pluginMediaElement.success = options.success;
|
754 |
+
mejs.MediaPluginBridge.registerPluginElement(pluginid, pluginMediaElement, htmlMediaElement);
|
755 |
+
|
756 |
+
// add container (must be added to DOM before inserting HTML for IE)
|
757 |
+
container.className = 'me-plugin';
|
758 |
+
htmlMediaElement.parentNode.insertBefore(container, htmlMediaElement);
|
759 |
+
|
760 |
+
// flash/silverlight vars
|
761 |
+
initVars = [
|
762 |
+
'id=' + pluginid,
|
763 |
+
'isvideo=' + ((isVideo) ? "true" : "false"),
|
764 |
+
'autoplay=' + ((autoplay) ? "true" : "false"),
|
765 |
+
'preload=' + preload,
|
766 |
+
'width=' + width,
|
767 |
+
'timerrate=' + options.timerRate,
|
768 |
+
'height=' + height];
|
769 |
+
|
770 |
+
if (mediaUrl !== null) {
|
771 |
+
if (pluginType == 'flash') {
|
772 |
+
initVars.push('file=' + mejs.Utility.encodeUrl(mediaUrl));
|
773 |
+
} else {
|
774 |
+
initVars.push('file=' + mediaUrl);
|
775 |
+
}
|
776 |
+
}
|
777 |
+
if (options.enablePluginDebug) {
|
778 |
+
initVars.push('debug=true');
|
779 |
+
}
|
780 |
+
if (options.enablePluginSmoothing) {
|
781 |
+
initVars.push('smoothing=true');
|
782 |
+
}
|
783 |
+
if (controls) {
|
784 |
+
initVars.push('controls=true'); // shows controls in the plugin if desired
|
785 |
+
}
|
786 |
+
|
787 |
+
switch (pluginType) {
|
788 |
+
case 'silverlight':
|
789 |
+
container.innerHTML =
|
790 |
+
'<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + pluginid + '" name="' + pluginid + '" width="' + width + '" height="' + height + '">' +
|
791 |
+
'<param name="initParams" value="' + initVars.join(',') + '" />' +
|
792 |
+
'<param name="windowless" value="true" />' +
|
793 |
+
'<param name="background" value="black" />' +
|
794 |
+
'<param name="minRuntimeVersion" value="3.0.0.0" />' +
|
795 |
+
'<param name="autoUpgrade" value="true" />' +
|
796 |
+
'<param name="source" value="' + options.pluginPath + options.silverlightName + '" />' +
|
797 |
+
'</object>';
|
798 |
+
break;
|
799 |
+
|
800 |
+
case 'flash':
|
801 |
+
|
802 |
+
if (mejs.MediaFeatures.isIE) {
|
803 |
+
specialIEContainer = document.createElement('div');
|
804 |
+
container.appendChild(specialIEContainer);
|
805 |
+
specialIEContainer.outerHTML =
|
806 |
+
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
|
807 |
+
'id="' + pluginid + '" width="' + width + '" height="' + height + '">' +
|
808 |
+
'<param name="movie" value="' + options.pluginPath + options.flashName + '?x=' + (new Date()) + '" />' +
|
809 |
+
'<param name="flashvars" value="' + initVars.join('&') + '" />' +
|
810 |
+
'<param name="quality" value="high" />' +
|
811 |
+
'<param name="bgcolor" value="#000000" />' +
|
812 |
+
'<param name="wmode" value="transparent" />' +
|
813 |
+
'<param name="allowScriptAccess" value="always" />' +
|
814 |
+
'<param name="allowFullScreen" value="true" />' +
|
815 |
+
'</object>';
|
816 |
+
|
817 |
+
} else {
|
818 |
+
|
819 |
+
container.innerHTML =
|
820 |
+
'<embed id="' + pluginid + '" name="' + pluginid + '" ' +
|
821 |
+
'play="true" ' +
|
822 |
+
'loop="false" ' +
|
823 |
+
'quality="high" ' +
|
824 |
+
'bgcolor="#000000" ' +
|
825 |
+
'wmode="transparent" ' +
|
826 |
+
'allowScriptAccess="always" ' +
|
827 |
+
'allowFullScreen="true" ' +
|
828 |
+
'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ' +
|
829 |
+
'src="' + options.pluginPath + options.flashName + '?' + initVars.join('&') + '" ' +
|
830 |
+
'width="' + width + '" ' +
|
831 |
+
'height="' + height + '"></embed>';
|
832 |
+
}
|
833 |
+
break;
|
834 |
+
}
|
835 |
+
// hide original element
|
836 |
+
htmlMediaElement.style.display = 'none';
|
837 |
+
|
838 |
+
// FYI: options.success will be fired by the MediaPluginBridge
|
839 |
+
},
|
840 |
+
|
841 |
+
updateNative: function(htmlMediaElement, options, autoplay, preload, playback) {
|
842 |
+
|
843 |
+
// add methods to video object to bring it into parity with Flash Object
|
844 |
+
for (var m in mejs.HtmlMediaElement) {
|
845 |
+
htmlMediaElement[m] = mejs.HtmlMediaElement[m];
|
846 |
+
}
|
847 |
+
|
848 |
+
// special case to enforce preload attribute (Chrome doesn't respect this)
|
849 |
+
if (mejs.MediaFeatures.isChrome && preload == 'none' && autoplay !== '') {
|
850 |
+
// forces the browser to stop loading
|
851 |
+
|
852 |
+
htmlMediaElement.src = '';
|
853 |
+
htmlMediaElement.load();
|
854 |
+
htmlMediaElement.canceledPreload = true;
|
855 |
+
|
856 |
+
htmlMediaElement.addEventListener('play',function() {
|
857 |
+
if (htmlMediaElement.canceledPreload) {
|
858 |
+
htmlMediaElement.src = playback.url;
|
859 |
+
htmlMediaElement.load();
|
860 |
+
htmlMediaElement.play();
|
861 |
+
htmlMediaElement.canceledPreload = false;
|
862 |
+
}
|
863 |
+
}, false);
|
864 |
+
}
|
865 |
+
|
866 |
+
|
867 |
+
// fire success code
|
868 |
+
options.success(htmlMediaElement, htmlMediaElement);
|
869 |
+
}
|
870 |
+
};
|
871 |
+
|
872 |
+
|
873 |
+
window.mejs = mejs;
|
874 |
+
window.MediaElement = mejs.MediaElement;
|
875 |
+
|
876 |
+
/*!
|
877 |
+
* MediaElementPlayer
|
878 |
+
* http://mediaelementjs.com/
|
879 |
+
*
|
880 |
+
* Creates a controller bar for HTML5 <video> add <audio> tags
|
881 |
+
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
882 |
+
*
|
883 |
+
* Copyright 2010, John Dyer (http://johndyer.me)
|
884 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
885 |
+
*
|
886 |
+
*/
|
887 |
+
(function ($) {
|
888 |
+
|
889 |
+
// default player values
|
890 |
+
mejs.MepDefaults = {
|
891 |
+
// url to poster (to fix iOS 3.x)
|
892 |
+
poster: '',
|
893 |
+
// default if the <video width> is not specified
|
894 |
+
defaultVideoWidth: 480,
|
895 |
+
// default if the <video height> is not specified
|
896 |
+
defaultVideoHeight: 270,
|
897 |
+
// if set, overrides <video width>
|
898 |
+
videoWidth: -1,
|
899 |
+
// if set, overrides <video height>
|
900 |
+
videoHeight: -1,
|
901 |
+
// width of audio player
|
902 |
+
audioWidth: 400,
|
903 |
+
// height of audio player
|
904 |
+
audioHeight: 30,
|
905 |
+
// initial volume when the player starts (overrided by user cookie)
|
906 |
+
startVolume: 0.8,
|
907 |
+
// useful for <audio> player loops
|
908 |
+
loop: false,
|
909 |
+
// resize to media dimensions
|
910 |
+
enableAutosize: true,
|
911 |
+
// features to show
|
912 |
+
features: ['playpause','current','progress','duration','tracks','volume','fullscreen']
|
913 |
+
};
|
914 |
+
|
915 |
+
mejs.mepIndex = 0;
|
916 |
+
|
917 |
+
// wraps a MediaElement object in player controls
|
918 |
+
mejs.MediaElementPlayer = function($media, o) {
|
919 |
+
// enforce object, even without "new" (via John Resig)
|
920 |
+
if ( !(this instanceof mejs.MediaElementPlayer) ) {
|
921 |
+
return new mejs.MediaElementPlayer($media, o);
|
922 |
+
}
|
923 |
+
|
924 |
+
var
|
925 |
+
t = this,
|
926 |
+
mf = mejs.MediaFeatures;
|
927 |
+
|
928 |
+
t.$media = $($media);
|
929 |
+
|
930 |
+
// check for existing player
|
931 |
+
if (t.$media[0].player) {
|
932 |
+
return t.$media[0].player;
|
933 |
+
} else {
|
934 |
+
t.$media[0].player = t;
|
935 |
+
}
|
936 |
+
|
937 |
+
t.options = $.extend({},mejs.MepDefaults,o);
|
938 |
+
t.isVideo = (t.$media[0].tagName.toLowerCase() == 'video');
|
939 |
+
|
940 |
+
|
941 |
+
if (mf.isiPad || mf.isiPhone) {
|
942 |
+
// add controls and stop
|
943 |
+
t.$media.attr('controls', 'controls');
|
944 |
+
|
945 |
+
// fix Apple bug
|
946 |
+
t.$media.removeAttr('poster');
|
947 |
+
|
948 |
+
// override Apple's autoplay override for iPads
|
949 |
+
if (mf.isiPad && t.$media[0].getAttribute('autoplay') !== null) {
|
950 |
+
t.$media[0].load();
|
951 |
+
t.$media[0].play();
|
952 |
+
}
|
953 |
+
|
954 |
+
// don't do the rest
|
955 |
+
return;
|
956 |
+
} else if (mf.isAndroid) {
|
957 |
+
|
958 |
+
if (t.isVideo) {
|
959 |
+
// Android fails when there are multiple types
|
960 |
+
// <video>
|
961 |
+
// <source src="file.mp4" type="video/mp4" />
|
962 |
+
// <source src="file.webm" type="video/webm" />
|
963 |
+
// </video>
|
964 |
+
if (t.$media.find('source').length > 0) {
|
965 |
+
// find an mp4 and make it the root element source
|
966 |
+
t.$media[0].src = t.$media.find('source[src$="mp4"]').attr('src');
|
967 |
+
}
|
968 |
+
|
969 |
+
// attach a click event to the video and hope Android can play it
|
970 |
+
t.$media.click(function() {
|
971 |
+
t.$media[0].play();
|
972 |
+
});
|
973 |
+
|
974 |
+
return;
|
975 |
+
} else {
|
976 |
+
// audio?
|
977 |
+
// 2.1 = no support
|
978 |
+
// 2.2 = Flash support
|
979 |
+
// 2.3 = Native HTML5
|
980 |
+
}
|
981 |
+
|
982 |
+
} else {
|
983 |
+
|
984 |
+
// remove native controls and use MEJS
|
985 |
+
t.$media.removeAttr('controls');
|
986 |
+
}
|
987 |
+
|
988 |
+
t.init();
|
989 |
+
|
990 |
+
return t;
|
991 |
+
};
|
992 |
+
|
993 |
+
// actual player
|
994 |
+
mejs.MediaElementPlayer.prototype = {
|
995 |
+
init: function() {
|
996 |
+
|
997 |
+
var
|
998 |
+
t = this,
|
999 |
+
meOptions = $.extend(true, {}, t.options, {
|
1000 |
+
success: function(media, domNode) { t.meReady(media, domNode); },
|
1001 |
+
error: function(e) { t.handleError(e);}
|
1002 |
+
});
|
1003 |
+
|
1004 |
+
// unique ID
|
1005 |
+
t.id = 'mep_' + mejs.mepIndex++;
|
1006 |
+
|
1007 |
+
// build container
|
1008 |
+
t.container =
|
1009 |
+
$('<div id="' + t.id + '" class="mejs-container">'+
|
1010 |
+
'<div class="mejs-inner">'+
|
1011 |
+
'<div class="mejs-mediaelement"></div>'+
|
1012 |
+
'<div class="mejs-layers"></div>'+
|
1013 |
+
'<div class="mejs-controls"></div>'+
|
1014 |
+
'<div class="mejs-clear"></div>'+
|
1015 |
+
'</div>' +
|
1016 |
+
'</div>')
|
1017 |
+
.addClass(t.$media[0].className)
|
1018 |
+
.insertBefore(t.$media);
|
1019 |
+
|
1020 |
+
// move the <video/video> tag into the right spot
|
1021 |
+
t.container.find('.mejs-mediaelement').append(t.$media);
|
1022 |
+
|
1023 |
+
// find parts
|
1024 |
+
t.controls = t.container.find('.mejs-controls');
|
1025 |
+
t.layers = t.container.find('.mejs-layers');
|
1026 |
+
|
1027 |
+
// determine the size
|
1028 |
+
if (t.isVideo) {
|
1029 |
+
// priority = videoWidth (forced), width attribute, defaultVideoWidth
|
1030 |
+
t.width = (t.options.videoWidth > 0) ? t.options.videoWidth : (t.$media[0].getAttribute('width') !== null) ? t.$media.attr('width') : t.options.defaultVideoWidth;
|
1031 |
+
t.height = (t.options.videoHeight > 0) ? t.options.videoHeight : (t.$media[0].getAttribute('height') !== null) ? t.$media.attr('height') : t.options.defaultVideoHeight;
|
1032 |
+
} else {
|
1033 |
+
t.width = t.options.audioWidth;
|
1034 |
+
t.height = t.options.audioHeight;
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
// set the size, while we wait for the plugins to load below
|
1038 |
+
t.setPlayerSize(t.width, t.height);
|
1039 |
+
|
1040 |
+
// create MediaElementShim
|
1041 |
+
meOptions.pluginWidth = t.height;
|
1042 |
+
meOptions.pluginHeight = t.width;
|
1043 |
+
mejs.MediaElement(t.$media[0], meOptions);
|
1044 |
+
},
|
1045 |
+
|
1046 |
+
// Sets up all controls and events
|
1047 |
+
meReady: function(media, domNode) {
|
1048 |
+
|
1049 |
+
var t = this,
|
1050 |
+
f,
|
1051 |
+
feature;
|
1052 |
+
|
1053 |
+
// make sure it can't create itself again if a plugin reloads
|
1054 |
+
if (this.created)
|
1055 |
+
return;
|
1056 |
+
else
|
1057 |
+
this.created = true;
|
1058 |
+
|
1059 |
+
t.media = media;
|
1060 |
+
t.domNode = domNode;
|
1061 |
+
|
1062 |
+
// two built in features
|
1063 |
+
t.buildposter(t, t.controls, t.layers, t.media);
|
1064 |
+
t.buildoverlay(t, t.controls, t.layers, t.media);
|
1065 |
+
|
1066 |
+
// grab for use by feautres
|
1067 |
+
t.findTracks();
|
1068 |
+
|
1069 |
+
// add user-defined features/controls
|
1070 |
+
for (f in t.options.features) {
|
1071 |
+
feature = t.options.features[f];
|
1072 |
+
if (t['build' + feature]) {
|
1073 |
+
try {
|
1074 |
+
t['build' + feature](t, t.controls, t.layers, t.media);
|
1075 |
+
} catch (e) {
|
1076 |
+
// TODO: report control error
|
1077 |
+
}
|
1078 |
+
}
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
// reset all layers and controls
|
1082 |
+
t.setPlayerSize(t.width, t.height);
|
1083 |
+
t.setControlsSize();
|
1084 |
+
|
1085 |
+
// controls fade
|
1086 |
+
if (t.isVideo) {
|
1087 |
+
// show/hide controls
|
1088 |
+
t.container
|
1089 |
+
.bind('mouseenter', function () {
|
1090 |
+
t.controls.css('visibility','visible');
|
1091 |
+
t.controls.stop(true, true).fadeIn(200);
|
1092 |
+
})
|
1093 |
+
.bind('mouseleave', function () {
|
1094 |
+
if (!t.media.paused) {
|
1095 |
+
t.controls.stop(true, true).fadeOut(200, function() {
|
1096 |
+
$(this).css('visibility','hidden');
|
1097 |
+
$(this).css('display','block');
|
1098 |
+
});
|
1099 |
+
}
|
1100 |
+
});
|
1101 |
+
|
1102 |
+
// resizer
|
1103 |
+
if (t.options.enableAutosize) {
|
1104 |
+
t.media.addEventListener('loadedmetadata', function(e) {
|
1105 |
+
// if the <video height> was not set and the options.videoHeight was not set
|
1106 |
+
// then resize to the real dimensions
|
1107 |
+
if (t.options.videoHeight <= 0 && t.$media[0].getAttribute('height') === null && !isNaN(e.target.videoHeight)) {
|
1108 |
+
t.setPlayerSize(e.target.videoWidth, e.target.videoHeight);
|
1109 |
+
t.setControlsSize();
|
1110 |
+
t.media.setVideoSize(e.target.videoWidth, e.target.videoHeight);
|
1111 |
+
}
|
1112 |
+
}, false);
|
1113 |
+
}
|
1114 |
+
}
|
1115 |
+
|
1116 |
+
// ended for all
|
1117 |
+
t.media.addEventListener('ended', function (e) {
|
1118 |
+
t.media.setCurrentTime(0);
|
1119 |
+
t.media.pause();
|
1120 |
+
|
1121 |
+
if (t.options.loop) {
|
1122 |
+
t.media.play();
|
1123 |
+
} else {
|
1124 |
+
t.controls.css('visibility','visible');
|
1125 |
+
}
|
1126 |
+
}, true);
|
1127 |
+
|
1128 |
+
|
1129 |
+
// webkit has trouble doing this without a delay
|
1130 |
+
setTimeout(function () {
|
1131 |
+
t.setControlsSize();
|
1132 |
+
t.setPlayerSize(t.width, t.height);
|
1133 |
+
}, 50);
|
1134 |
+
|
1135 |
+
|
1136 |
+
if (t.options.success) {
|
1137 |
+
t.options.success(t.media, t.domNode);
|
1138 |
+
}
|
1139 |
+
},
|
1140 |
+
|
1141 |
+
handleError: function(e) {
|
1142 |
+
// Tell user that the file cannot be played
|
1143 |
+
if (this.options.error) {
|
1144 |
+
this.options.error(e);
|
1145 |
+
}
|
1146 |
+
},
|
1147 |
+
|
1148 |
+
setPlayerSize: function(width,height) {
|
1149 |
+
var t = this;
|
1150 |
+
|
1151 |
+
// ie9 appears to need this (jQuery bug?)
|
1152 |
+
t.width = parseInt(width, 10);
|
1153 |
+
t.height = parseInt(height, 10);
|
1154 |
+
|
1155 |
+
t.container
|
1156 |
+
.width(t.width)
|
1157 |
+
.height(t.height);
|
1158 |
+
|
1159 |
+
t.layers.children('div.mejs-layer')
|
1160 |
+
.width(t.width)
|
1161 |
+
.height(t.height);
|
1162 |
+
},
|
1163 |
+
|
1164 |
+
setControlsSize: function() {
|
1165 |
+
var t = this,
|
1166 |
+
usedWidth = 0,
|
1167 |
+
railWidth = 0,
|
1168 |
+
rail = t.controls.find('.mejs-time-rail'),
|
1169 |
+
total = t.controls.find('.mejs-time-total'),
|
1170 |
+
others = rail.siblings();
|
1171 |
+
|
1172 |
+
// find the size of all the other controls besides the rail
|
1173 |
+
others.each(function() {
|
1174 |
+
if ($(this).css('position') != 'absolute') {
|
1175 |
+
usedWidth += $(this).outerWidth(true);
|
1176 |
+
}
|
1177 |
+
});
|
1178 |
+
// fit the rail into the remaining space
|
1179 |
+
railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.outerWidth(false));
|
1180 |
+
|
1181 |
+
rail.width(railWidth);
|
1182 |
+
total.width(railWidth - (total.outerWidth(true) - total.width()));
|
1183 |
+
},
|
1184 |
+
|
1185 |
+
|
1186 |
+
buildposter: function(player, controls, layers, media) {
|
1187 |
+
var poster =
|
1188 |
+
$('<div class="mejs-poster mejs-layer">'+
|
1189 |
+
'<img />'+
|
1190 |
+
'</div>')
|
1191 |
+
.appendTo(layers),
|
1192 |
+
posterUrl = player.$media.attr('poster');
|
1193 |
+
|
1194 |
+
if (player.options.poster != '') {
|
1195 |
+
poster.find('img').attr('src',player.options.poster);
|
1196 |
+
} else if (posterUrl !== '' && posterUrl != null) {
|
1197 |
+
poster.find('img').attr('src',posterUrl);
|
1198 |
+
} else {
|
1199 |
+
poster.hide();
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
media.addEventListener('play',function() {
|
1203 |
+
poster.hide();
|
1204 |
+
}, false);
|
1205 |
+
},
|
1206 |
+
|
1207 |
+
buildoverlay: function(player, controls, layers, media) {
|
1208 |
+
if (!player.isVideo)
|
1209 |
+
return;
|
1210 |
+
|
1211 |
+
var overlay =
|
1212 |
+
$('<div class="mejs-overlay mejs-layer">'+
|
1213 |
+
'<div class="mejs-overlay-button"></div>'+
|
1214 |
+
'</div>')
|
1215 |
+
.appendTo(layers)
|
1216 |
+
.click(function() {
|
1217 |
+
if (media.paused) {
|
1218 |
+
media.play();
|
1219 |
+
} else {
|
1220 |
+
media.pause();
|
1221 |
+
}
|
1222 |
+
});
|
1223 |
+
|
1224 |
+
media.addEventListener('play',function() {
|
1225 |
+
overlay.hide();
|
1226 |
+
}, false);
|
1227 |
+
media.addEventListener('pause',function() {
|
1228 |
+
overlay.show();
|
1229 |
+
}, false);
|
1230 |
+
},
|
1231 |
+
|
1232 |
+
findTracks: function() {
|
1233 |
+
var t = this,
|
1234 |
+
tracktags = t.$media.find('track');
|
1235 |
+
|
1236 |
+
// store for use by plugins
|
1237 |
+
t.tracks = [];
|
1238 |
+
tracktags.each(function() {
|
1239 |
+
t.tracks.push({
|
1240 |
+
srclang: $(this).attr('srclang').toLowerCase(),
|
1241 |
+
src: $(this).attr('src'),
|
1242 |
+
kind: $(this).attr('kind'),
|
1243 |
+
entries: [],
|
1244 |
+
isLoaded: false
|
1245 |
+
});
|
1246 |
+
});
|
1247 |
+
},
|
1248 |
+
changeSkin: function(className) {
|
1249 |
+
this.container[0].className = 'mejs-container ' + className;
|
1250 |
+
this.setPlayerSize();
|
1251 |
+
this.setControlsSize();
|
1252 |
+
},
|
1253 |
+
play: function() {
|
1254 |
+
this.media.play();
|
1255 |
+
},
|
1256 |
+
pause: function() {
|
1257 |
+
this.media.pause();
|
1258 |
+
},
|
1259 |
+
load: function() {
|
1260 |
+
this.media.load();
|
1261 |
+
},
|
1262 |
+
setMuted: function(muted) {
|
1263 |
+
this.media.setMuted(muted);
|
1264 |
+
},
|
1265 |
+
setCurrentTime: function(time) {
|
1266 |
+
this.media.setCurrentTime(time);
|
1267 |
+
},
|
1268 |
+
getCurrentTime: function() {
|
1269 |
+
return this.media.currentTime;
|
1270 |
+
},
|
1271 |
+
setVolume: function(volume) {
|
1272 |
+
this.media.setVolume(volume);
|
1273 |
+
},
|
1274 |
+
getVolume: function() {
|
1275 |
+
return this.media.volume;
|
1276 |
+
},
|
1277 |
+
setSrc: function(src) {
|
1278 |
+
this.media.setSrc(src);
|
1279 |
+
}
|
1280 |
+
};
|
1281 |
+
|
1282 |
+
// turn into jQuery plugin
|
1283 |
+
jQuery.fn.mediaelementplayer = function (options) {
|
1284 |
+
return this.each(function () {
|
1285 |
+
new mejs.MediaElementPlayer($(this), options);
|
1286 |
+
});
|
1287 |
+
};
|
1288 |
+
|
1289 |
+
// push out to window
|
1290 |
+
window.MediaElementPlayer = mejs.MediaElementPlayer;
|
1291 |
+
|
1292 |
+
})(jQuery);
|
1293 |
+
|
1294 |
+
(function($) {
|
1295 |
+
// PLAY/pause BUTTON
|
1296 |
+
MediaElementPlayer.prototype.buildplaypause = function(player, controls, layers, media) {
|
1297 |
+
var play =
|
1298 |
+
$('<div class="mejs-button mejs-playpause-button mejs-play">' +
|
1299 |
+
'<span></span>' +
|
1300 |
+
'</div>')
|
1301 |
+
.appendTo(controls)
|
1302 |
+
.click(function() {
|
1303 |
+
if (media.paused) {
|
1304 |
+
media.play();
|
1305 |
+
} else {
|
1306 |
+
media.pause();
|
1307 |
+
}
|
1308 |
+
});
|
1309 |
+
|
1310 |
+
media.addEventListener('play',function() {
|
1311 |
+
play.removeClass('mejs-play').addClass('mejs-pause');
|
1312 |
+
}, false);
|
1313 |
+
media.addEventListener('playing',function() {
|
1314 |
+
play.removeClass('mejs-play').addClass('mejs-pause');
|
1315 |
+
}, false);
|
1316 |
+
|
1317 |
+
|
1318 |
+
media.addEventListener('pause',function() {
|
1319 |
+
play.removeClass('mejs-pause').addClass('mejs-play');
|
1320 |
+
}, false);
|
1321 |
+
media.addEventListener('paused',function() {
|
1322 |
+
play.removeClass('mejs-pause').addClass('mejs-play');
|
1323 |
+
}, false);
|
1324 |
+
|
1325 |
+
|
1326 |
+
|
1327 |
+
}
|
1328 |
+
})(jQuery);
|
1329 |
+
(function($) {
|
1330 |
+
// progress/loaded bar
|
1331 |
+
MediaElementPlayer.prototype.buildprogress = function(player, controls, layers, media) {
|
1332 |
+
|
1333 |
+
$('<div class="mejs-time-rail">'+
|
1334 |
+
'<span class="mejs-time-total">'+
|
1335 |
+
'<span class="mejs-time-loaded"></span>'+
|
1336 |
+
'<span class="mejs-time-current"></span>'+
|
1337 |
+
'<span class="mejs-time-handle"></span>'+
|
1338 |
+
'<span class="mejs-time-float">' +
|
1339 |
+
'<span class="mejs-time-float-current">00:00</span>' +
|
1340 |
+
'<span class="mejs-time-float-corner"></span>' +
|
1341 |
+
'</span>'+
|
1342 |
+
'</span>'+
|
1343 |
+
'</div>')
|
1344 |
+
.appendTo(controls);
|
1345 |
+
|
1346 |
+
var total = controls.find('.mejs-time-total'),
|
1347 |
+
loaded = controls.find('.mejs-time-loaded'),
|
1348 |
+
current = controls.find('.mejs-time-current'),
|
1349 |
+
handle = controls.find('.mejs-time-handle'),
|
1350 |
+
timefloat = controls.find('.mejs-time-float'),
|
1351 |
+
timefloatcurrent = controls.find('.mejs-time-float-current'),
|
1352 |
+
setProgress = function(e) {
|
1353 |
+
if (!e) {
|
1354 |
+
return;
|
1355 |
+
}
|
1356 |
+
|
1357 |
+
var
|
1358 |
+
target = e.target,
|
1359 |
+
percent = null;
|
1360 |
+
|
1361 |
+
// newest HTML5 spec has buffered array (FF4, Webkit)
|
1362 |
+
if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
|
1363 |
+
// TODO: account for a real array with multiple values (only Firefox 4 has this so far)
|
1364 |
+
percent = target.buffered.end(0) / target.duration;
|
1365 |
+
}
|
1366 |
+
// Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
|
1367 |
+
// to be anything other than 0. If the byte count is available we use this instead.
|
1368 |
+
// Browsers that support the else if do not seem to have the bufferedBytes value and
|
1369 |
+
// should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
|
1370 |
+
else if (target && target.bytesTotal != undefined && target.bytesTotal > 0 && target.bufferedBytes != undefined) {
|
1371 |
+
percent = target.bufferedBytes / target.bytesTotal;
|
1372 |
+
}
|
1373 |
+
// Firefox 3 with an Ogg file seems to go this way
|
1374 |
+
else if (e.lengthComputable && e.total != 0) {
|
1375 |
+
percent = e.loaded/e.total;
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
// finally update the progress bar
|
1379 |
+
if (percent !== null) {
|
1380 |
+
percent = Math.min(1, Math.max(0, percent));
|
1381 |
+
// update loaded bar
|
1382 |
+
loaded.width(total.width() * percent);
|
1383 |
+
}
|
1384 |
+
},
|
1385 |
+
setCurrentTime = function(e) {
|
1386 |
+
|
1387 |
+
if (media.currentTime && media.duration) {
|
1388 |
+
|
1389 |
+
// update bar and handle
|
1390 |
+
var
|
1391 |
+
newWidth = total.width() * media.currentTime / media.duration,
|
1392 |
+
handlePos = newWidth - (handle.outerWidth(true) / 2);
|
1393 |
+
|
1394 |
+
current.width(newWidth);
|
1395 |
+
handle.css('left', handlePos);
|
1396 |
+
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
},
|
1400 |
+
handleMouseMove = function (e) {
|
1401 |
+
// mouse position relative to the object
|
1402 |
+
var x = e.pageX,
|
1403 |
+
offset = total.offset(),
|
1404 |
+
width = total.outerWidth(),
|
1405 |
+
percentage = 0,
|
1406 |
+
newTime = 0;
|
1407 |
+
|
1408 |
+
|
1409 |
+
if (x > offset.left && x <= width + offset.left && media.duration) {
|
1410 |
+
percentage = ((x - offset.left) / width);
|
1411 |
+
newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
|
1412 |
+
|
1413 |
+
// seek to where the mouse is
|
1414 |
+
if (mouseIsDown) {
|
1415 |
+
media.setCurrentTime(newTime);
|
1416 |
+
}
|
1417 |
+
|
1418 |
+
// position floating time box
|
1419 |
+
var pos = x - offset.left;
|
1420 |
+
timefloat.css('left', pos);
|
1421 |
+
timefloatcurrent.html( mejs.Utility.secondsToTimeCode(newTime) );
|
1422 |
+
}
|
1423 |
+
},
|
1424 |
+
mouseIsDown = false,
|
1425 |
+
mouseIsOver = false;
|
1426 |
+
|
1427 |
+
// handle clicks
|
1428 |
+
//controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
|
1429 |
+
total
|
1430 |
+
.bind('mousedown', function (e) {
|
1431 |
+
mouseIsDown = true;
|
1432 |
+
handleMouseMove(e);
|
1433 |
+
return false;
|
1434 |
+
});
|
1435 |
+
|
1436 |
+
controls.find('.mejs-time-rail')
|
1437 |
+
.bind('mouseenter', function(e) {
|
1438 |
+
mouseIsOver = true;
|
1439 |
+
})
|
1440 |
+
.bind('mouseleave',function(e) {
|
1441 |
+
mouseIsOver = false;
|
1442 |
+
});
|
1443 |
+
|
1444 |
+
$(document)
|
1445 |
+
.bind('mouseup', function (e) {
|
1446 |
+
mouseIsDown = false;
|
1447 |
+
//handleMouseMove(e);
|
1448 |
+
})
|
1449 |
+
.bind('mousemove', function (e) {
|
1450 |
+
if (mouseIsDown || mouseIsOver) {
|
1451 |
+
handleMouseMove(e);
|
1452 |
+
}
|
1453 |
+
});
|
1454 |
+
|
1455 |
+
// loading
|
1456 |
+
media.addEventListener('progress', function (e) {
|
1457 |
+
setProgress(e);
|
1458 |
+
}, false);
|
1459 |
+
|
1460 |
+
// current time
|
1461 |
+
media.addEventListener('timeupdate', function(e) {
|
1462 |
+
setProgress(e);
|
1463 |
+
setCurrentTime(e);
|
1464 |
+
}, false);
|
1465 |
+
}
|
1466 |
+
|
1467 |
+
})(jQuery);
|
1468 |
+
(function($) {
|
1469 |
+
// current and duration 00:00 / 00:00
|
1470 |
+
MediaElementPlayer.prototype.buildcurrent = function(player, controls, layers, media) {
|
1471 |
+
$('<div class="mejs-time">'+
|
1472 |
+
'<span class="mejs-currenttime">00:00</span>'+
|
1473 |
+
'</div>')
|
1474 |
+
.appendTo(controls);
|
1475 |
+
|
1476 |
+
media.addEventListener('timeupdate',function() {
|
1477 |
+
if (media.currentTime) {
|
1478 |
+
controls.find('.mejs-currenttime').html(mejs.Utility.secondsToTimeCode(media.currentTime));
|
1479 |
+
}
|
1480 |
+
}, false);
|
1481 |
+
};
|
1482 |
+
|
1483 |
+
MediaElementPlayer.prototype.buildduration = function(player, controls, layers, media) {
|
1484 |
+
if (controls.children().last().find('.mejs-currenttime').length > 0) {
|
1485 |
+
$(' <span> | </span> '+
|
1486 |
+
'<span class="mejs-duration">00:00</span>')
|
1487 |
+
.appendTo(controls.find('.mejs-time'));
|
1488 |
+
} else {
|
1489 |
+
|
1490 |
+
$('<div class="mejs-time">'+
|
1491 |
+
'<span class="mejs-duration">00:00</span>'+
|
1492 |
+
'</div>')
|
1493 |
+
.appendTo(controls);
|
1494 |
+
}
|
1495 |
+
|
1496 |
+
media.addEventListener('timeupdate',function() {
|
1497 |
+
if (media.duration) {
|
1498 |
+
controls.find('.mejs-duration').html(mejs.Utility.secondsToTimeCode(media.duration));
|
1499 |
+
}
|
1500 |
+
}, false);
|
1501 |
+
};
|
1502 |
+
|
1503 |
+
})(jQuery);
|
1504 |
+
(function($) {
|
1505 |
+
MediaElementPlayer.prototype.buildvolume = function(player, controls, layers, media) {
|
1506 |
+
var mute =
|
1507 |
+
$('<div class="mejs-button mejs-volume-button mejs-mute">'+
|
1508 |
+
'<span></span>'+
|
1509 |
+
'<div class="mejs-volume-slider">'+ // outer background
|
1510 |
+
'<div class="mejs-volume-total"></div>'+ // line background
|
1511 |
+
'<div class="mejs-volume-current"></div>'+ // current volume
|
1512 |
+
'<div class="mejs-volume-handle"></div>'+ // handle
|
1513 |
+
'</div>'+
|
1514 |
+
'</div>')
|
1515 |
+
.appendTo(controls),
|
1516 |
+
volumeSlider = mute.find('.mejs-volume-slider'),
|
1517 |
+
volumeTotal = mute.find('.mejs-volume-total'),
|
1518 |
+
volumeCurrent = mute.find('.mejs-volume-current'),
|
1519 |
+
volumeHandle = mute.find('.mejs-volume-handle'),
|
1520 |
+
|
1521 |
+
positionVolumeHandle = function(volume) {
|
1522 |
+
|
1523 |
+
var
|
1524 |
+
top = volumeTotal.height() - (volumeTotal.height() * volume);
|
1525 |
+
|
1526 |
+
// handle
|
1527 |
+
volumeHandle.css('top', top - (volumeHandle.height() / 2));
|
1528 |
+
|
1529 |
+
// show the current visibility
|
1530 |
+
volumeCurrent.height(volumeTotal.height() - top + parseInt(volumeTotal.css('top').replace(/px/,''),10));
|
1531 |
+
volumeCurrent.css('top', top);
|
1532 |
+
},
|
1533 |
+
handleVolumeMove = function(e) {
|
1534 |
+
var
|
1535 |
+
railHeight = volumeTotal.height(),
|
1536 |
+
totalOffset = volumeTotal.offset(),
|
1537 |
+
totalTop = parseInt(volumeTotal.css('top').replace(/px/,''),10),
|
1538 |
+
newY = e.pageY - totalOffset.top,
|
1539 |
+
volume = (railHeight - newY) / railHeight
|
1540 |
+
|
1541 |
+
// TODO: handle vertical and horizontal CSS
|
1542 |
+
// only allow it to move within the rail
|
1543 |
+
if (newY < 0)
|
1544 |
+
newY = 0;
|
1545 |
+
else if (newY > railHeight)
|
1546 |
+
newY = railHeight;
|
1547 |
+
|
1548 |
+
// move the handle to match the mouse
|
1549 |
+
volumeHandle.css('top', newY - (volumeHandle.height() / 2) + totalTop );
|
1550 |
+
|
1551 |
+
// show the current visibility
|
1552 |
+
volumeCurrent.height(railHeight-newY);
|
1553 |
+
volumeCurrent.css('top',newY+totalTop);
|
1554 |
+
|
1555 |
+
// set mute status
|
1556 |
+
if (volume == 0) {
|
1557 |
+
media.setMuted(true);
|
1558 |
+
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
1559 |
+
} else {
|
1560 |
+
media.setMuted(false);
|
1561 |
+
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
1562 |
+
}
|
1563 |
+
|
1564 |
+
volume = Math.max(0,volume);
|
1565 |
+
volume = Math.min(volume,1);
|
1566 |
+
|
1567 |
+
// set the volume
|
1568 |
+
media.setVolume(volume);
|
1569 |
+
},
|
1570 |
+
mouseIsDown = false;
|
1571 |
+
|
1572 |
+
// SLIDER
|
1573 |
+
volumeSlider
|
1574 |
+
.bind('mousedown', function (e) {
|
1575 |
+
handleVolumeMove(e);
|
1576 |
+
mouseIsDown = true;
|
1577 |
+
return false;
|
1578 |
+
});
|
1579 |
+
$(document)
|
1580 |
+
.bind('mouseup', function (e) {
|
1581 |
+
mouseIsDown = false;
|
1582 |
+
})
|
1583 |
+
.bind('mousemove', function (e) {
|
1584 |
+
if (mouseIsDown) {
|
1585 |
+
handleVolumeMove(e);
|
1586 |
+
}
|
1587 |
+
});
|
1588 |
+
|
1589 |
+
|
1590 |
+
// MUTE button
|
1591 |
+
mute.find('span').click(function() {
|
1592 |
+
if (media.muted) {
|
1593 |
+
media.setMuted(false);
|
1594 |
+
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
1595 |
+
positionVolumeHandle(1);
|
1596 |
+
} else {
|
1597 |
+
media.setMuted(true);
|
1598 |
+
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
1599 |
+
positionVolumeHandle(0);
|
1600 |
+
}
|
1601 |
+
});
|
1602 |
+
|
1603 |
+
// listen for volume change events from other sources
|
1604 |
+
media.addEventListener('volumechange', function(e) {
|
1605 |
+
if (!mouseIsDown) {
|
1606 |
+
positionVolumeHandle(e.target.volume);
|
1607 |
+
}
|
1608 |
+
}, true);
|
1609 |
+
|
1610 |
+
// set initial volume
|
1611 |
+
//player.options.startVolume = Math.min(Math.max(0,player.options.startVolume),1);
|
1612 |
+
positionVolumeHandle(player.options.startVolume);
|
1613 |
+
media.setVolume(player.options.startVolume);
|
1614 |
+
}
|
1615 |
+
|
1616 |
+
})(jQuery);
|
1617 |
+
(function($) {
|
1618 |
+
MediaElementPlayer.prototype.buildfullscreen = function(player, controls, layers, media) {
|
1619 |
+
|
1620 |
+
if (!player.isVideo)
|
1621 |
+
return;
|
1622 |
+
|
1623 |
+
var
|
1624 |
+
isFullScreen = false,
|
1625 |
+
normalHeight = 0,
|
1626 |
+
normalWidth = 0,
|
1627 |
+
container = player.container,
|
1628 |
+
fullscreenBtn =
|
1629 |
+
$('<div class="mejs-button mejs-fullscreen-button"><span></span></div>')
|
1630 |
+
.appendTo(controls)
|
1631 |
+
.click(function() {
|
1632 |
+
setFullScreen(!isFullScreen);
|
1633 |
+
}),
|
1634 |
+
setFullScreen = function(goFullScreen) {
|
1635 |
+
switch (media.pluginType) {
|
1636 |
+
case 'flash':
|
1637 |
+
case 'silverlight':
|
1638 |
+
media.setFullscreen(goFullScreen);
|
1639 |
+
break;
|
1640 |
+
case 'native':
|
1641 |
+
|
1642 |
+
if (mejs.MediaFeatures.hasNativeFullScreen) {
|
1643 |
+
if (goFullScreen) {
|
1644 |
+
media.webkitEnterFullScreen();
|
1645 |
+
} else {
|
1646 |
+
media.webkitExitFullScreen();
|
1647 |
+
}
|
1648 |
+
} else {
|
1649 |
+
if (goFullScreen) {
|
1650 |
+
|
1651 |
+
// store
|
1652 |
+
normalHeight = player.$media.height();
|
1653 |
+
normalWidth = player.$media.width();
|
1654 |
+
|
1655 |
+
// make full size
|
1656 |
+
container
|
1657 |
+
.addClass('mejs-container-fullscreen')
|
1658 |
+
.width('100%')
|
1659 |
+
.height('100%')
|
1660 |
+
.css('z-index', 1000);
|
1661 |
+
|
1662 |
+
player.$media
|
1663 |
+
.width('100%')
|
1664 |
+
.height('100%');
|
1665 |
+
|
1666 |
+
|
1667 |
+
layers.children('div')
|
1668 |
+
.width('100%')
|
1669 |
+
.height('100%');
|
1670 |
+
|
1671 |
+
fullscreenBtn
|
1672 |
+
.removeClass('mejs-fullscreen')
|
1673 |
+
.addClass('mejs-unfullscreen');
|
1674 |
+
|
1675 |
+
player.setControlsSize();
|
1676 |
+
} else {
|
1677 |
+
|
1678 |
+
container
|
1679 |
+
.removeClass('mejs-container-fullscreen')
|
1680 |
+
.width(normalWidth)
|
1681 |
+
.height(normalHeight)
|
1682 |
+
.css('z-index', 1);
|
1683 |
+
|
1684 |
+
player.$media
|
1685 |
+
.width(normalWidth)
|
1686 |
+
.height(normalHeight);
|
1687 |
+
|
1688 |
+
layers.children('div')
|
1689 |
+
.width(normalWidth)
|
1690 |
+
.height(normalHeight);
|
1691 |
+
|
1692 |
+
fullscreenBtn
|
1693 |
+
.removeClass('mejs-unfullscreen')
|
1694 |
+
.addClass('mejs-fullscreen');
|
1695 |
+
|
1696 |
+
player.setControlsSize();
|
1697 |
+
}
|
1698 |
+
}
|
1699 |
+
}
|
1700 |
+
isFullScreen = goFullScreen;
|
1701 |
+
};
|
1702 |
+
|
1703 |
+
$(document).bind('keydown',function (e) {
|
1704 |
+
if (isFullScreen && e.keyCode == 27) {
|
1705 |
+
setFullScreen(false);
|
1706 |
+
}
|
1707 |
+
});
|
1708 |
+
|
1709 |
+
}
|
1710 |
+
|
1711 |
+
|
1712 |
+
})(jQuery);
|
1713 |
+
(function($) {
|
1714 |
+
|
1715 |
+
// add extra default options
|
1716 |
+
$.extend(mejs.MepDefaults, {
|
1717 |
+
// this will automatically turn on a <track>
|
1718 |
+
startLanguage: '',
|
1719 |
+
// a list of languages to auto-translate via Google
|
1720 |
+
translations: [],
|
1721 |
+
// a dropdownlist of automatic translations
|
1722 |
+
translationSelector: false,
|
1723 |
+
// key for tranlsations
|
1724 |
+
googleApiKey: ''
|
1725 |
+
});
|
1726 |
+
|
1727 |
+
$.extend(MediaElementPlayer.prototype, {
|
1728 |
+
|
1729 |
+
buildtracks: function(player, controls, layers, media) {
|
1730 |
+
if (!player.isVideo)
|
1731 |
+
return;
|
1732 |
+
|
1733 |
+
if (player.tracks.length == 0)
|
1734 |
+
return;
|
1735 |
+
|
1736 |
+
var i, options = '';
|
1737 |
+
|
1738 |
+
player.chapters =
|
1739 |
+
$('<div class="mejs-chapters mejs-layer"></div>')
|
1740 |
+
.prependTo(layers).hide();
|
1741 |
+
player.captions =
|
1742 |
+
$('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position"><span class="mejs-captions-text"></span></div></div>')
|
1743 |
+
.prependTo(layers).hide();
|
1744 |
+
player.captionsText = player.captions.find('.mejs-captions-text');
|
1745 |
+
player.captionsButton =
|
1746 |
+
$('<div class="mejs-button mejs-captions-button">'+
|
1747 |
+
'<span></span>'+
|
1748 |
+
'<div class="mejs-captions-selector">'+
|
1749 |
+
'<ul>'+
|
1750 |
+
'<li>'+
|
1751 |
+
'<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
|
1752 |
+
'<label for="' + player.id + '_captions_none">None</label>'+
|
1753 |
+
'</li>' +
|
1754 |
+
'</ul>'+
|
1755 |
+
'</div>'+
|
1756 |
+
'</div>')
|
1757 |
+
.appendTo(controls)
|
1758 |
+
// handle clicks to the language radio buttons
|
1759 |
+
.delegate('input[type=radio]','click',function() {
|
1760 |
+
lang = this.value;
|
1761 |
+
|
1762 |
+
if (lang == 'none') {
|
1763 |
+
player.selectedTrack = null;
|
1764 |
+
} else {
|
1765 |
+
for (i=0; i<player.tracks.length; i++) {
|
1766 |
+
if (player.tracks[i].srclang == lang) {
|
1767 |
+
player.selectedTrack = player.tracks[i];
|
1768 |
+
player.captions.attr('lang', player.selectedTrack.srclang);
|
1769 |
+
player.displayCaptions();
|
1770 |
+
break;
|
1771 |
+
}
|
1772 |
+
}
|
1773 |
+
}
|
1774 |
+
});
|
1775 |
+
//.bind('mouseenter', function() {
|
1776 |
+
// player.captionsButton.find('.mejs-captions-selector').css('visibility','visible')
|
1777 |
+
//});
|
1778 |
+
// move with controls
|
1779 |
+
player.container
|
1780 |
+
.bind('mouseenter', function () {
|
1781 |
+
// push captions above controls
|
1782 |
+
var p = player.container.find('.mejs-captions-position');
|
1783 |
+
p.css('bottom', (parseInt(p.css('bottom').replace(/px/,''), 10) + player.controls.height()) + 'px');
|
1784 |
+
|
1785 |
+
})
|
1786 |
+
.bind('mouseleave', function () {
|
1787 |
+
if (!media.paused) {
|
1788 |
+
// move back to normal place
|
1789 |
+
player.container.find('.mejs-captions-position').css('bottom','');
|
1790 |
+
}
|
1791 |
+
});
|
1792 |
+
|
1793 |
+
|
1794 |
+
|
1795 |
+
|
1796 |
+
player.trackToLoad = -1;
|
1797 |
+
player.selectedTrack = null;
|
1798 |
+
player.isLoadingTrack = false;
|
1799 |
+
|
1800 |
+
// add user-defined translations
|
1801 |
+
if (player.tracks.length > 0 && player.options.translations.length > 0) {
|
1802 |
+
for (i=0; i<player.options.translations.length; i++) {
|
1803 |
+
player.tracks.push({
|
1804 |
+
srclang: player.options.translations[i].toLowerCase(),
|
1805 |
+
src: null,
|
1806 |
+
kind: 'subtitles',
|
1807 |
+
entries: [],
|
1808 |
+
isLoaded: false,
|
1809 |
+
isTranslation: true
|
1810 |
+
});
|
1811 |
+
}
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
// add to list
|
1815 |
+
for (i=0; i<player.tracks.length; i++) {
|
1816 |
+
if (player.tracks[i].kind == 'subtitles') {
|
1817 |
+
player.addTrackButton(player.tracks[i].srclang, player.tracks[i].isTranslation);
|
1818 |
+
}
|
1819 |
+
}
|
1820 |
+
|
1821 |
+
player.loadNextTrack();
|
1822 |
+
|
1823 |
+
|
1824 |
+
media.addEventListener('timeupdate',function(e) {
|
1825 |
+
player.displayCaptions();
|
1826 |
+
}, false);
|
1827 |
+
|
1828 |
+
media.addEventListener('loadedmetadata', function(e) {
|
1829 |
+
player.displayChapters();
|
1830 |
+
}, false);
|
1831 |
+
|
1832 |
+
player.container.hover(
|
1833 |
+
function () {
|
1834 |
+
// chapters
|
1835 |
+
player.chapters.css('visibility','visible');
|
1836 |
+
player.chapters.fadeIn(200);
|
1837 |
+
},
|
1838 |
+
function () {
|
1839 |
+
if (!media.paused) {
|
1840 |
+
player.chapters.fadeOut(200, function() {
|
1841 |
+
$(this).css('visibility','hidden');
|
1842 |
+
$(this).css('display','block');
|
1843 |
+
});
|
1844 |
+
}
|
1845 |
+
});
|
1846 |
+
|
1847 |
+
// auto selector
|
1848 |
+
if (player.options.translationSelector) {
|
1849 |
+
for (i in mejs.language.codes) {
|
1850 |
+
options += '<option value="' + i + '">' + mejs.language.codes[i] + '</option>';
|
1851 |
+
}
|
1852 |
+
player.container.find('.mejs-captions-selector ul').before($(
|
1853 |
+
'<select class="mejs-captions-translations">' +
|
1854 |
+
'<option value="">--Add Translation--</option>' +
|
1855 |
+
options +
|
1856 |
+
'</select>'
|
1857 |
+
));
|
1858 |
+
// add clicks
|
1859 |
+
player.container.find('.mejs-captions-translations').change(function() {
|
1860 |
+
var
|
1861 |
+
option = $(this);
|
1862 |
+
lang = option.val();
|
1863 |
+
// add this language to the tracks list
|
1864 |
+
if (lang != '') {
|
1865 |
+
player.tracks.push({
|
1866 |
+
srclang: lang,
|
1867 |
+
src: null,
|
1868 |
+
entries: [],
|
1869 |
+
isLoaded: false,
|
1870 |
+
isTranslation: true
|
1871 |
+
});
|
1872 |
+
|
1873 |
+
if (!player.isLoadingTrack) {
|
1874 |
+
player.trackToLoad--;
|
1875 |
+
player.addTrackButton(lang,true);
|
1876 |
+
player.options.startLanguage = lang;
|
1877 |
+
player.loadNextTrack();
|
1878 |
+
}
|
1879 |
+
}
|
1880 |
+
});
|
1881 |
+
}
|
1882 |
+
|
1883 |
+
},
|
1884 |
+
|
1885 |
+
loadNextTrack: function() {
|
1886 |
+
var t = this;
|
1887 |
+
|
1888 |
+
t.trackToLoad++;
|
1889 |
+
if (t.trackToLoad < t.tracks.length) {
|
1890 |
+
t.isLoadingTrack = true;
|
1891 |
+
t.loadTrack(t.trackToLoad);
|
1892 |
+
} else {
|
1893 |
+
// add done?
|
1894 |
+
t.isLoadingTrack = false;
|
1895 |
+
}
|
1896 |
+
},
|
1897 |
+
|
1898 |
+
loadTrack: function(index){
|
1899 |
+
var
|
1900 |
+
t = this,
|
1901 |
+
track = t.tracks[index],
|
1902 |
+
after = function() {
|
1903 |
+
|
1904 |
+
track.isLoaded = true;
|
1905 |
+
|
1906 |
+
// create button
|
1907 |
+
//t.addTrackButton(track.srclang);
|
1908 |
+
t.enableTrackButton(track.srclang);
|
1909 |
+
|
1910 |
+
t.loadNextTrack();
|
1911 |
+
|
1912 |
+
};
|
1913 |
+
|
1914 |
+
if (track.isTranslation) {
|
1915 |
+
|
1916 |
+
// translate the first track
|
1917 |
+
mejs.SrtParser.translateSrt(t.tracks[0].entries, t.tracks[0].srclang, track.srclang, t.options.googleApiKey, function(newOne) {
|
1918 |
+
|
1919 |
+
// store the new translation
|
1920 |
+
track.entries = newOne;
|
1921 |
+
|
1922 |
+
after();
|
1923 |
+
});
|
1924 |
+
|
1925 |
+
} else {
|
1926 |
+
$.ajax({
|
1927 |
+
url: track.src,
|
1928 |
+
success: function(d) {
|
1929 |
+
|
1930 |
+
// parse the loaded file
|
1931 |
+
track.entries = mejs.SrtParser.parse(d);
|
1932 |
+
after();
|
1933 |
+
|
1934 |
+
if (track.kind == 'chapters' && t.media.duration > 0) {
|
1935 |
+
t.drawChapters(track);
|
1936 |
+
}
|
1937 |
+
},
|
1938 |
+
error: function() {
|
1939 |
+
t.loadNextTrack();
|
1940 |
+
}
|
1941 |
+
});
|
1942 |
+
}
|
1943 |
+
},
|
1944 |
+
|
1945 |
+
enableTrackButton: function(lang) {
|
1946 |
+
var t = this;
|
1947 |
+
|
1948 |
+
t.captionsButton
|
1949 |
+
.find('input[value=' + lang + ']')
|
1950 |
+
.attr('disabled','')
|
1951 |
+
.siblings('label')
|
1952 |
+
.html( mejs.language.codes[lang] || lang );
|
1953 |
+
|
1954 |
+
// auto select
|
1955 |
+
if (t.options.startLanguage == lang) {
|
1956 |
+
$('#' + t.id + '_captions_' + lang).click();
|
1957 |
+
}
|
1958 |
+
|
1959 |
+
t.adjustLanguageBox();
|
1960 |
+
},
|
1961 |
+
|
1962 |
+
addTrackButton: function(lang, isTranslation) {
|
1963 |
+
var t = this,
|
1964 |
+
l = mejs.language.codes[lang] || lang;
|
1965 |
+
|
1966 |
+
t.captionsButton.find('ul').append(
|
1967 |
+
$('<li>'+
|
1968 |
+
'<input type="radio" name="' + t.id + '_captions" id="' + t.id + '_captions_' + lang + '" value="' + lang + '" disabled="disabled" />' +
|
1969 |
+
'<label for="' + t.id + '_captions_' + lang + '">' + l + ((isTranslation) ? ' (translating)' : ' (loading)') + '</label>'+
|
1970 |
+
'</li>')
|
1971 |
+
);
|
1972 |
+
|
1973 |
+
t.adjustLanguageBox();
|
1974 |
+
|
1975 |
+
// remove this from the dropdownlist (if it exists)
|
1976 |
+
t.container.find('.mejs-captions-translations option[value=' + lang + ']').remove();
|
1977 |
+
},
|
1978 |
+
|
1979 |
+
adjustLanguageBox:function() {
|
1980 |
+
var t = this;
|
1981 |
+
// adjust the size of the outer box
|
1982 |
+
t.captionsButton.find('.mejs-captions-selector').height(
|
1983 |
+
t.captionsButton.find('.mejs-captions-selector ul').outerHeight(true) +
|
1984 |
+
t.captionsButton.find('.mejs-captions-translations').outerHeight(true)
|
1985 |
+
);
|
1986 |
+
},
|
1987 |
+
|
1988 |
+
displayCaptions: function() {
|
1989 |
+
|
1990 |
+
if (typeof this.tracks == 'undefined')
|
1991 |
+
return;
|
1992 |
+
|
1993 |
+
var
|
1994 |
+
t = this,
|
1995 |
+
i,
|
1996 |
+
track = t.selectedTrack;
|
1997 |
+
|
1998 |
+
if (track != null && track.isLoaded) {
|
1999 |
+
for (i=0; i<track.entries.times.length; i++) {
|
2000 |
+
if (t.media.currentTime >= track.entries.times[i].start && t.media.currentTime <= track.entries.times[i].stop){
|
2001 |
+
t.captionsText.html(track.entries.text[i]);
|
2002 |
+
t.captions.show();
|
2003 |
+
return; // exit out if one is visible;
|
2004 |
+
}
|
2005 |
+
}
|
2006 |
+
t.captions.hide();
|
2007 |
+
} else {
|
2008 |
+
t.captions.hide();
|
2009 |
+
}
|
2010 |
+
},
|
2011 |
+
|
2012 |
+
displayChapters: function() {
|
2013 |
+
var
|
2014 |
+
t = this,
|
2015 |
+
i;
|
2016 |
+
|
2017 |
+
for (i=0; i<t.tracks.length; i++) {
|
2018 |
+
if (t.tracks[i].kind == 'chapters' && t.tracks[i].isLoaded) {
|
2019 |
+
t.drawChapters(t.tracks[i]);
|
2020 |
+
break;
|
2021 |
+
}
|
2022 |
+
}
|
2023 |
+
},
|
2024 |
+
|
2025 |
+
drawChapters: function(chapters) {
|
2026 |
+
var
|
2027 |
+
t = this,
|
2028 |
+
i,
|
2029 |
+
dur,
|
2030 |
+
//width,
|
2031 |
+
//left,
|
2032 |
+
percent = 0,
|
2033 |
+
usedPercent = 0;
|
2034 |
+
|
2035 |
+
t.chapters.empty();
|
2036 |
+
|
2037 |
+
for (i=0; i<chapters.entries.times.length; i++) {
|
2038 |
+
dur = chapters.entries.times[i].stop - chapters.entries.times[i].start;
|
2039 |
+
percent = Math.floor(dur / t.media.duration * 100);
|
2040 |
+
if (percent + usedPercent > 100 || // too large
|
2041 |
+
i == chapters.entries.times.length-1 && percent + usedPercent < 100) // not going to fill it in
|
2042 |
+
{
|
2043 |
+
percent = 100 - usedPercent;
|
2044 |
+
}
|
2045 |
+
//width = Math.floor(t.width * dur / t.media.duration);
|
2046 |
+
//left = Math.floor(t.width * chapters.entries.times[i].start / t.media.duration);
|
2047 |
+
//if (left + width > t.width) {
|
2048 |
+
// width = t.width - left;
|
2049 |
+
//}
|
2050 |
+
|
2051 |
+
t.chapters.append( $(
|
2052 |
+
'<div class="mejs-chapter" rel="' + chapters.entries.times[i].start + '" style="left: ' + usedPercent.toString() + '%;width: ' + percent.toString() + '%;">' +
|
2053 |
+
'<div class="mejs-chapter-block' + ((i==chapters.entries.times.length-1) ? ' mejs-chapter-block-last' : '') + '">' +
|
2054 |
+
'<span class="ch-title">' + chapters.entries.text[i] + '</span>' +
|
2055 |
+
'<span class="ch-time">' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].start) + '–' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].stop) + '</span>' +
|
2056 |
+
'</div>' +
|
2057 |
+
'</div>'));
|
2058 |
+
usedPercent += percent;
|
2059 |
+
}
|
2060 |
+
|
2061 |
+
t.chapters.find('div.mejs-chapter').click(function() {
|
2062 |
+
t.media.setCurrentTime( parseFloat( $(this).attr('rel') ) );
|
2063 |
+
if (t.media.paused) {
|
2064 |
+
t.media.play();
|
2065 |
+
}
|
2066 |
+
});
|
2067 |
+
|
2068 |
+
t.chapters.show();
|
2069 |
+
}
|
2070 |
+
});
|
2071 |
+
|
2072 |
+
|
2073 |
+
|
2074 |
+
mejs.language = {
|
2075 |
+
codes: {
|
2076 |
+
af:'Afrikaans',
|
2077 |
+
sq:'Albanian',
|
2078 |
+
ar:'Arabic',
|
2079 |
+
be:'Belarusian',
|
2080 |
+
bg:'Bulgarian',
|
2081 |
+
ca:'Catalan',
|
2082 |
+
zh:'Chinese',
|
2083 |
+
'zh-cn':'Chinese Simplified',
|
2084 |
+
'zh-tw':'Chinese Traditional',
|
2085 |
+
hr:'Croatian',
|
2086 |
+
cs:'Czech',
|
2087 |
+
da:'Danish',
|
2088 |
+
nl:'Dutch',
|
2089 |
+
en:'English',
|
2090 |
+
et:'Estonian',
|
2091 |
+
tl:'Filipino',
|
2092 |
+
fi:'Finnish',
|
2093 |
+
fr:'French',
|
2094 |
+
gl:'Galician',
|
2095 |
+
de:'German',
|
2096 |
+
el:'Greek',
|
2097 |
+
ht:'Haitian Creole',
|
2098 |
+
iw:'Hebrew',
|
2099 |
+
hi:'Hindi',
|
2100 |
+
hu:'Hungarian',
|
2101 |
+
is:'Icelandic',
|
2102 |
+
id:'Indonesian',
|
2103 |
+
ga:'Irish',
|
2104 |
+
it:'Italian',
|
2105 |
+
ja:'Japanese',
|
2106 |
+
ko:'Korean',
|
2107 |
+
lv:'Latvian',
|
2108 |
+
lt:'Lithuanian',
|
2109 |
+
mk:'Macedonian',
|
2110 |
+
ms:'Malay',
|
2111 |
+
mt:'Maltese',
|
2112 |
+
no:'Norwegian',
|
2113 |
+
fa:'Persian',
|
2114 |
+
pl:'Polish',
|
2115 |
+
pt:'Portuguese',
|
2116 |
+
//'pt-pt':'Portuguese (Portugal)',
|
2117 |
+
ro:'Romanian',
|
2118 |
+
ru:'Russian',
|
2119 |
+
sr:'Serbian',
|
2120 |
+
sk:'Slovak',
|
2121 |
+
sl:'Slovenian',
|
2122 |
+
es:'Spanish',
|
2123 |
+
sw:'Swahili',
|
2124 |
+
sv:'Swedish',
|
2125 |
+
tl:'Tagalog',
|
2126 |
+
th:'Thai',
|
2127 |
+
tr:'Turkish',
|
2128 |
+
uk:'Ukrainian',
|
2129 |
+
vi:'Vietnamese',
|
2130 |
+
cy:'Welsh',
|
2131 |
+
yi:'Yiddish'
|
2132 |
+
}
|
2133 |
+
};
|
2134 |
+
|
2135 |
+
/*
|
2136 |
+
Parses SRT format which should be formatted as
|
2137 |
+
1
|
2138 |
+
00:00:01,1 --> 00:00:05,000
|
2139 |
+
A line of text
|
2140 |
+
|
2141 |
+
2
|
2142 |
+
00:01:15,1 --> 00:02:05,000
|
2143 |
+
A second line of text
|
2144 |
+
|
2145 |
+
Adapted from: http://www.delphiki.com/html5/playr
|
2146 |
+
*/
|
2147 |
+
mejs.SrtParser = {
|
2148 |
+
pattern_identifier: /^[0-9]+$/,
|
2149 |
+
pattern_timecode: /^([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{3})?)(.*)$/,
|
2150 |
+
timecodeToSeconds: function(timecode){
|
2151 |
+
var tab = timecode.split(':');
|
2152 |
+
return tab[0]*60*60 + tab[1]*60 + parseFloat(tab[2].replace(',','.'));
|
2153 |
+
},
|
2154 |
+
split2: function (text, regex) {
|
2155 |
+
// normal version for compliant browsers
|
2156 |
+
// see below for IE fix
|
2157 |
+
return text.split(regex);
|
2158 |
+
},
|
2159 |
+
parse: function(srtText) {
|
2160 |
+
var
|
2161 |
+
i = 0,
|
2162 |
+
lines = this.split2(srtText, /\r?\n/),
|
2163 |
+
entries = {text:[], times:[]},
|
2164 |
+
timecode,
|
2165 |
+
text;
|
2166 |
+
|
2167 |
+
for(; i<lines.length; i++) {
|
2168 |
+
// check for the line number
|
2169 |
+
if (this.pattern_identifier.exec(lines[i])){
|
2170 |
+
// skip to the next line where the start --> end time code should be
|
2171 |
+
i++;
|
2172 |
+
timecode = this.pattern_timecode.exec(lines[i]);
|
2173 |
+
if (timecode && i<lines.length){
|
2174 |
+
i++;
|
2175 |
+
// grab all the (possibly multi-line) text that follows
|
2176 |
+
text = lines[i];
|
2177 |
+
i++;
|
2178 |
+
while(lines[i] !== '' && i<lines.length){
|
2179 |
+
text = text + '\n' + lines[i];
|
2180 |
+
i++;
|
2181 |
+
}
|
2182 |
+
|
2183 |
+
// Text is in a different array so I can use .join
|
2184 |
+
entries.text.push(text);
|
2185 |
+
entries.times.push(
|
2186 |
+
{
|
2187 |
+
start: this.timecodeToSeconds(timecode[1]),
|
2188 |
+
stop: this.timecodeToSeconds(timecode[3]),
|
2189 |
+
settings: timecode[5]
|
2190 |
+
});
|
2191 |
+
}
|
2192 |
+
}
|
2193 |
+
}
|
2194 |
+
|
2195 |
+
return entries;
|
2196 |
+
},
|
2197 |
+
|
2198 |
+
translateSrt: function(srtData, fromLang, toLang, googleApiKey, callback) {
|
2199 |
+
|
2200 |
+
var
|
2201 |
+
entries = {text:[], times:[]},
|
2202 |
+
lines,
|
2203 |
+
i
|
2204 |
+
|
2205 |
+
this.translateText( srtData.text.join(' <a></a>'), fromLang, toLang, googleApiKey, function(result) {
|
2206 |
+
// split on separators
|
2207 |
+
lines = result.split('<a></a>');
|
2208 |
+
|
2209 |
+
// create new entries
|
2210 |
+
for (i=0;i<srtData.text.length; i++) {
|
2211 |
+
// add translated line
|
2212 |
+
entries.text[i] = lines[i];
|
2213 |
+
// copy existing times
|
2214 |
+
entries.times[i] = {
|
2215 |
+
start: srtData.times[i].start,
|
2216 |
+
stop: srtData.times[i].stop,
|
2217 |
+
settings: srtData.times[i].settings
|
2218 |
+
};
|
2219 |
+
}
|
2220 |
+
|
2221 |
+
callback(entries);
|
2222 |
+
});
|
2223 |
+
},
|
2224 |
+
|
2225 |
+
translateText: function(text, fromLang, toLang, googleApiKey, callback) {
|
2226 |
+
|
2227 |
+
var
|
2228 |
+
separatorIndex,
|
2229 |
+
chunks = [],
|
2230 |
+
chunk,
|
2231 |
+
maxlength = 1000,
|
2232 |
+
result = '',
|
2233 |
+
nextChunk= function() {
|
2234 |
+
if (chunks.length > 0) {
|
2235 |
+
chunk = chunks.shift();
|
2236 |
+
mejs.SrtParser.translateChunk(chunk, fromLang, toLang, googleApiKey, function(r) {
|
2237 |
+
if (r != 'undefined') {
|
2238 |
+
result += r;
|
2239 |
+
}
|
2240 |
+
nextChunk();
|
2241 |
+
});
|
2242 |
+
} else {
|
2243 |
+
callback(result);
|
2244 |
+
}
|
2245 |
+
};
|
2246 |
+
|
2247 |
+
// split into chunks
|
2248 |
+
while (text.length > 0) {
|
2249 |
+
if (text.length > maxlength) {
|
2250 |
+
separatorIndex = text.lastIndexOf('.', maxlength);
|
2251 |
+
chunks.push(text.substring(0, separatorIndex));
|
2252 |
+
text = text.substring(separatorIndex+1);
|
2253 |
+
} else {
|
2254 |
+
chunks.push(text);
|
2255 |
+
text = '';
|
2256 |
+
}
|
2257 |
+
}
|
2258 |
+
|
2259 |
+
// start handling the chunks
|
2260 |
+
nextChunk();
|
2261 |
+
},
|
2262 |
+
translateChunk: function(text, fromLang, toLang, googleApiKey, callback) {
|
2263 |
+
|
2264 |
+
var data = {
|
2265 |
+
q: text,
|
2266 |
+
langpair: fromLang + '|' + toLang,
|
2267 |
+
v: '1.0'
|
2268 |
+
};
|
2269 |
+
if (googleApiKey !== '' && googleApiKey !== null) {
|
2270 |
+
data.key = googleApiKey;
|
2271 |
+
}
|
2272 |
+
|
2273 |
+
$.ajax({
|
2274 |
+
url: 'https://ajax.googleapis.com/ajax/services/language/translate', // 'https://www.google.com/uds/Gtranslate', //'https://ajax.googleapis.com/ajax/services/language/translate', //
|
2275 |
+
data: data,
|
2276 |
+
type: 'GET',
|
2277 |
+
dataType: 'jsonp',
|
2278 |
+
success: function(d) {
|
2279 |
+
callback(d.responseData.translatedText);
|
2280 |
+
},
|
2281 |
+
error: function(e) {
|
2282 |
+
callback(null);
|
2283 |
+
}
|
2284 |
+
});
|
2285 |
+
}
|
2286 |
+
};
|
2287 |
+
// test for browsers with bad String.split method.
|
2288 |
+
if ('x\n\ny'.split(/\n/gi).length != 3) {
|
2289 |
+
// add super slow IE8 and below version
|
2290 |
+
mejs.SrtParser.split2 = function(text, regex) {
|
2291 |
+
var
|
2292 |
+
parts = [],
|
2293 |
+
chunk = '',
|
2294 |
+
i;
|
2295 |
+
|
2296 |
+
for (i=0; i<text.length; i++) {
|
2297 |
+
chunk += text.substring(i,i+1);
|
2298 |
+
if (regex.test(chunk)) {
|
2299 |
+
parts.push(chunk.replace(regex, ''));
|
2300 |
+
chunk = '';
|
2301 |
+
}
|
2302 |
+
}
|
2303 |
+
parts.push(chunk);
|
2304 |
+
return parts;
|
2305 |
+
}
|
2306 |
+
}
|
2307 |
+
|
2308 |
+
|
2309 |
+
})(jQuery);
|
2310 |
+
|
mediaelement/mediaelement-and-player.min.js
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* MediaElement.js
|
3 |
+
* HTML5 <video> and <audio> shim and player
|
4 |
+
* http://mediaelementjs.com/
|
5 |
+
*
|
6 |
+
* Creates a JavaScript object that mimics HTML5 MediaElement API
|
7 |
+
* for browsers that don't understand HTML5 or can't play the provided codec
|
8 |
+
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
+
*
|
10 |
+
* Copyright 2010, John Dyer (http://johndyer.me)
|
11 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
12 |
+
*
|
13 |
+
*/var mejs=mejs||{};mejs.version="2.0.6";mejs.meIndex=0;mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","audio/flv","audio/mp3","audio/m4a"]}]};
|
14 |
+
mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.split("&").join("&").split("<").join("<").split('"').join(""")},absolutizeUrl:function(a){var b=document.createElement("div");b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>';return b.firstChild.href},getScriptPath:function(a){for(var b=0,c,d="",e="",f,g=document.getElementsByTagName("script");b<g.length;b++){f=g[b].src;for(c=0;c<a.length;c++){e=a[c];if(f.indexOf(e)>-1){d=f.substring(0,
|
15 |
+
f.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a){a=Math.round(a);var b=Math.floor(a/60);b=b>=10?b:"0"+b;a=Math.floor(a%60);a=a>=10?a:"0"+a;return b+":"+a}};
|
16 |
+
mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],f;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
|
17 |
+
!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(f=new ActiveXObject(c))e=d(f)}catch(g){}return e}};
|
18 |
+
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
|
19 |
+
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,f,g){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[f]+=g;e[f]-=g};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
|
20 |
+
if(mejs.PluginDetector.ua.match(/Android 2\.[12]/)!==null)HTMLMediaElement.canPlayType=function(a){return a.match(/video\/(mp4|m4v)/gi)!==null?"probably":""};
|
21 |
+
mejs.MediaFeatures={init:function(){var a=mejs.PluginDetector.nav,b=mejs.PluginDetector.ua,c,d=["source","track","audio","video"];this.isiPad=b.match(/iPad/i)!==null;this.isiPhone=b.match(/iPhone/i)!==null;this.isAndroid=b.match(/Android/i)!==null;this.isIE=a.appName.indexOf("Microsoft")!=-1;this.isChrome=b.match(/Chrome/gi)!==null;for(a=0;a<d.length;a++)c=document.createElement(d[a]);this.hasNativeFullScreen=typeof c.webkitEnterFullScreen!=="undefined";if(this.isChrome)this.hasNativeFullScreen=false}};
|
22 |
+
mejs.MediaFeatures.init();mejs.HtmlMediaElement={pluginType:"native",setCurrentTime:function(a){this.currentTime=a},setMuted:function(a){this.muted=a},setVolume:function(a){this.volume=a},stop:function(){this.pause()},setSrc:function(a){if(typeof a=="string")this.src=a;else{var b,c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type))this.src=c.src}}},setVideoSize:function(a,b){this.width=a;this.height=b}};
|
23 |
+
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={}};
|
24 |
+
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginApi.loadMedia();this.paused=false}},pause:function(){if(this.pluginApi!=null){this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=
|
25 |
+
null){this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return true}return false},setSrc:function(a){if(typeof a=="string"){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a));this.src=mejs.Utility.absolutizeUrl(a)}else{var b,c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src));
|
26 |
+
this.src=mejs.Utility.absolutizeUrl(a)}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){this.pluginApi.setMuted(a);this.muted=a}},setVideoSize:function(a,b){if(this.pluginElement.style){this.pluginElement.style.width=a+"px";this.pluginElement.style.height=b+"px"}this.pluginApi!=null&&this.pluginApi.setVideoSize(a,
|
27 |
+
b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen(a)},addEventListener:function(a,b){this.events[a]=this.events[a]||[];this.events[a].push(b)},dispatchEvent:function(a){var b,c,d=this.events[a];if(d){c=Array.prototype.slice.call(arguments,1);for(b=0;b<d.length;b++)d[b].apply(null,c)}}};
|
28 |
+
mejs.MediaPluginBridge={pluginMediaElements:{},htmlMediaElements:{},registerPluginElement:function(a,b,c){this.pluginMediaElements[a]=b;this.htmlMediaElements[a]=c},initPlugin:function(a){var b=this.pluginMediaElements[a],c=this.htmlMediaElements[a];switch(b.pluginType){case "flash":b.pluginElement=b.pluginApi=document.getElementById(a);break;case "silverlight":b.pluginElement=document.getElementById(b.id);b.pluginApi=b.pluginElement.Content.MediaElementJS}b.pluginApi!=null&&b.success&&b.success(b,
|
29 |
+
c)},fireEvent:function(a,b,c){var d,e;a=this.pluginMediaElements[a];a.ended=false;a.paused=true;b={type:b,target:a};for(d in c){a[d]=c[d];b[d]=c[d]}e=c.bufferedTime||0;b.target.buffered=b.buffered={start:function(){return 0},end:function(){return e},length:1};a.dispatchEvent(b.type,b)}};
|
30 |
+
mejs.MediaElementDefaults={enablePluginDebug:false,plugins:["flash","silverlight"],type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",enablePluginSmoothing:false,silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,timerRate:250,success:function(){},error:function(){}};
|
31 |
+
mejs.MediaElement=function(a,b){mejs.HtmlMediaElementShim.create(a,b)};
|
32 |
+
mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase()=="video",f=typeof d.canPlayType!="undefined",g={method:"",url:""},j=d.getAttribute("poster"),h=d.getAttribute("autoplay"),k=d.getAttribute("preload"),i=d.getAttribute("controls"),m;for(m in b)c[m]=b[m];j=typeof j=="undefined"||j===null?"":j;k=typeof k=="undefined"||k===null||k==="false"?"none":k;h=!(typeof h=="undefined"||h===null||h==="false");
|
33 |
+
i=!(typeof i=="undefined"||i===null||i==="false");g=this.determinePlayback(d,c,e,f);if(g.method=="native")this.updateNative(d,c,h,k,g);else g.method!==""?this.createPlugin(d,c,e,g.method,g.url!==null?mejs.Utility.absolutizeUrl(g.url):"",j,h,k,i):this.createErrorMessage(d,c,g.url!==null?mejs.Utility.absolutizeUrl(g.url):"",j)},determinePlayback:function(a,b,c,d){var e=[],f,g,j={method:"",url:""},h=a.getAttribute("src"),k,i;if(typeof b.type!="undefined"&&b.type!=="")e.push({type:b.type,url:null});else if(h!=
|
34 |
+
"undefined"&&h!==null){g=this.checkType(h,a.getAttribute("type"),c);e.push({type:g,url:h})}else for(f=0;f<a.childNodes.length;f++){g=a.childNodes[f];if(g.nodeType==1&&g.tagName.toLowerCase()=="source"){h=g.getAttribute("src");g=this.checkType(h,g.getAttribute("type"),c);e.push({type:g,url:h})}}if(d)for(f=0;f<e.length;f++)if(a.canPlayType(e[f].type).replace(/no/,"")!==""){j.method="native";j.url=e[f].url;return j}for(f=0;f<e.length;f++){g=e[f].type;for(a=0;a<b.plugins.length;a++){h=b.plugins[a];k=
|
35 |
+
mejs.plugins[h];for(c=0;c<k.length;c++){i=k[c];if(mejs.PluginDetector.hasPluginVersion(h,i.version))for(d=0;d<i.types.length;d++)if(g==i.types[d]){j.method=h;j.url=e[f].url;return j}}}}if(j.method==="")j.url=e[0].url;return j},checkType:function(a,b,c){if(a&&!b){a=a.substring(a.lastIndexOf(".")+1);return(c?"video":"audio")+"/"+a}else return b},createErrorMessage:function(a,b,c,d){var e=document.createElement("div");e.className="me-cannotplay";try{e.style.width=a.width+"px";e.style.height=a.height+
|
36 |
+
"px"}catch(f){}e.innerHTML=d!==""?'<a href="'+c+'"><img src="'+d+'" /></a>':'<a href="'+c+'"><span>Download File</span></a>';a.parentNode.insertBefore(e,a);a.style.display="none";b.error(a)},createPlugin:function(a,b,c,d,e,f,g,j,h){var k=f=1,i="me_"+d+"_"+mejs.meIndex++,m=new mejs.PluginMediaElement(i,d,e),n=document.createElement("div"),l;for(l=a.parentNode;l!==null&&l.tagName.toLowerCase()!="body";){if(l.parentNode.tagName.toLowerCase()=="p"){l.parentNode.parentNode.insertBefore(l,l.parentNode);
|
37 |
+
break}l=l.parentNode}if(c){f=b.videoWidth>0?b.videoWidth:a.getAttribute("width")!==null?a.getAttribute("width"):b.defaultVideoWidth;k=b.videoHeight>0?b.videoHeight:a.getAttribute("height")!==null?a.getAttribute("height"):b.defaultVideoHeight}else if(b.enablePluginDebug){f=320;k=240}m.success=b.success;mejs.MediaPluginBridge.registerPluginElement(i,m,a);n.className="me-plugin";a.parentNode.insertBefore(n,a);c=["id="+i,"isvideo="+(c?"true":"false"),"autoplay="+(g?"true":"false"),"preload="+j,"width="+
|
38 |
+
f,"timerrate="+b.timerRate,"height="+k];if(e!==null)d=="flash"?c.push("file="+mejs.Utility.encodeUrl(e)):c.push("file="+e);b.enablePluginDebug&&c.push("debug=true");b.enablePluginSmoothing&&c.push("smoothing=true");h&&c.push("controls=true");switch(d){case "silverlight":n.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+i+'" name="'+i+'" width="'+f+'" height="'+k+'"><param name="initParams" value="'+c.join(",")+'" /><param name="windowless" value="true" /><param name="background" value="black" /><param name="minRuntimeVersion" value="3.0.0.0" /><param name="autoUpgrade" value="true" /><param name="source" value="'+
|
39 |
+
b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){d=document.createElement("div");n.appendChild(d);d.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+i+'" width="'+f+'" height="'+k+'"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+c.join("&")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else n.innerHTML=
|
40 |
+
'<embed id="'+i+'" name="'+i+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+"?"+c.join("&")+'" width="'+f+'" height="'+k+'"></embed>'}a.style.display="none"},updateNative:function(a,b,c,d,e){for(var f in mejs.HtmlMediaElement)a[f]=mejs.HtmlMediaElement[f];if(mejs.MediaFeatures.isChrome&&d==
|
41 |
+
"none"&&c!==""){a.src="";a.load();a.canceledPreload=true;a.addEventListener("play",function(){if(a.canceledPreload){a.src=e.url;a.load();a.play();a.canceledPreload=false}},false)}b.success(a,a)}};window.mejs=mejs;window.MediaElement=mejs.MediaElement;
|
42 |
+
|
43 |
+
/*!
|
44 |
+
* MediaElementPlayer
|
45 |
+
* http://mediaelementjs.com/
|
46 |
+
*
|
47 |
+
* Creates a controller bar for HTML5 <video> add <audio> tags
|
48 |
+
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
49 |
+
*
|
50 |
+
* Copyright 2010, John Dyer (http://johndyer.me)
|
51 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
52 |
+
*
|
53 |
+
*/(function(f){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,audioWidth:400,audioHeight:30,startVolume:0.8,loop:false,enableAutosize:true,features:["playpause","current","progress","duration","tracks","volume","fullscreen"]};mejs.mepIndex=0;mejs.MediaElementPlayer=function(a,c){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,c);var b=this,d=mejs.MediaFeatures;b.$media=f(a);if(b.$media[0].player)return b.$media[0].player;
|
54 |
+
else b.$media[0].player=b;b.options=f.extend({},mejs.MepDefaults,c);b.isVideo=b.$media[0].tagName.toLowerCase()=="video";if(d.isiPad||d.isiPhone){b.$media.attr("controls","controls");b.$media.removeAttr("poster");if(d.isiPad&&b.$media[0].getAttribute("autoplay")!==null){b.$media[0].load();b.$media[0].play()}}else{if(d.isAndroid){if(b.isVideo){if(b.$media.find("source").length>0)b.$media[0].src=b.$media.find('source[src$="mp4"]').attr("src");b.$media.click(function(){b.$media[0].play()});return}}else b.$media.removeAttr("controls");
|
55 |
+
b.init();return b}};mejs.MediaElementPlayer.prototype={init:function(){var a=this,c=f.extend(true,{},a.options,{success:function(b,d){a.meReady(b,d)},error:function(b){a.handleError(b)}});a.id="mep_"+mejs.mepIndex++;a.container=f('<div id="'+a.id+'" class="mejs-container"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(a.$media[0].className).insertBefore(a.$media);a.container.find(".mejs-mediaelement").append(a.$media);
|
56 |
+
a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");if(a.isVideo){a.width=a.options.videoWidth>0?a.options.videoWidth:a.$media[0].getAttribute("width")!==null?a.$media.attr("width"):a.options.defaultVideoWidth;a.height=a.options.videoHeight>0?a.options.videoHeight:a.$media[0].getAttribute("height")!==null?a.$media.attr("height"):a.options.defaultVideoHeight}else{a.width=a.options.audioWidth;a.height=a.options.audioHeight}a.setPlayerSize(a.width,a.height);c.pluginWidth=
|
57 |
+
a.height;c.pluginHeight=a.width;mejs.MediaElement(a.$media[0],c)},meReady:function(a,c){var b=this,d,e;if(!this.created){this.created=true;b.media=a;b.domNode=c;b.buildposter(b,b.controls,b.layers,b.media);b.buildoverlay(b,b.controls,b.layers,b.media);b.findTracks();for(d in b.options.features){e=b.options.features[d];if(b["build"+e])try{b["build"+e](b,b.controls,b.layers,b.media)}catch(g){}}b.setPlayerSize(b.width,b.height);b.setControlsSize();if(b.isVideo){b.container.bind("mouseenter",function(){b.controls.css("visibility",
|
58 |
+
"visible");b.controls.stop(true,true).fadeIn(200)}).bind("mouseleave",function(){b.media.paused||b.controls.stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});b.options.enableAutosize&&b.media.addEventListener("loadedmetadata",function(h){if(b.options.videoHeight<=0&&b.$media[0].getAttribute("height")===null&&!isNaN(h.target.videoHeight)){b.setPlayerSize(h.target.videoWidth,h.target.videoHeight);b.setControlsSize();b.media.setVideoSize(h.target.videoWidth,
|
59 |
+
h.target.videoHeight)}},false)}b.media.addEventListener("ended",function(){b.media.setCurrentTime(0);b.media.pause();b.options.loop?b.media.play():b.controls.css("visibility","visible")},true);setTimeout(function(){b.setControlsSize();b.setPlayerSize(b.width,b.height)},50);b.options.success&&b.options.success(b.media,b.domNode)}},handleError:function(a){this.options.error&&this.options.error(a)},setPlayerSize:function(a,c){this.width=parseInt(a,10);this.height=parseInt(c,10);this.container.width(this.width).height(this.height);
|
60 |
+
this.layers.children("div.mejs-layer").width(this.width).height(this.height)},setControlsSize:function(){var a=0,c=0,b=this.controls.find(".mejs-time-rail"),d=this.controls.find(".mejs-time-total");b.siblings().each(function(){if(f(this).css("position")!="absolute")a+=f(this).outerWidth(true)});c=this.controls.width()-a-(b.outerWidth(true)-b.outerWidth(false));b.width(c);d.width(c-(d.outerWidth(true)-d.width()))},buildposter:function(a,c,b,d){var e=f('<div class="mejs-poster mejs-layer"><img /></div>').appendTo(b);
|
61 |
+
c=a.$media.attr("poster");if(a.options.poster!="")e.find("img").attr("src",a.options.poster);else c!==""&&c!=null?e.find("img").attr("src",c):e.hide();d.addEventListener("play",function(){e.hide()},false)},buildoverlay:function(a,c,b,d){if(a.isVideo){var e=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-button"></div></div>').appendTo(b).click(function(){d.paused?d.play():d.pause()});d.addEventListener("play",function(){e.hide()},false);d.addEventListener("pause",function(){e.show()},
|
62 |
+
false)}},findTracks:function(){var a=this,c=a.$media.find("track");a.tracks=[];c.each(function(){a.tracks.push({srclang:f(this).attr("srclang").toLowerCase(),src:f(this).attr("src"),kind:f(this).attr("kind"),entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize();this.setControlsSize()},play:function(){this.media.play()},pause:function(){this.media.pause()},load:function(){this.media.load()},setMuted:function(a){this.media.setMuted(a)},
|
63 |
+
setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)}};jQuery.fn.mediaelementplayer=function(a){return this.each(function(){new mejs.MediaElementPlayer(f(this),a)})};window.MediaElementPlayer=mejs.MediaElementPlayer})(jQuery);
|
64 |
+
(function(f){MediaElementPlayer.prototype.buildplaypause=function(a,c,b,d){var e=f('<div class="mejs-button mejs-playpause-button mejs-play"><span></span></div>').appendTo(c).click(function(){d.paused?d.play():d.pause()});d.addEventListener("play",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);d.addEventListener("playing",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);d.addEventListener("pause",function(){e.removeClass("mejs-pause").addClass("mejs-play")},
|
65 |
+
false);d.addEventListener("paused",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false)}})(jQuery);
|
66 |
+
(function(f){MediaElementPlayer.prototype.buildprogress=function(a,c,b,d){f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></span></div>').appendTo(c);var e=c.find(".mejs-time-total"),g=c.find(".mejs-time-loaded"),h=c.find(".mejs-time-current"),
|
67 |
+
k=c.find(".mejs-time-handle"),n=c.find(".mejs-time-float"),p=c.find(".mejs-time-float-current"),m=function(i){if(i){var l=i.target,q=null;if(l&&l.buffered&&l.buffered.length>0&&l.buffered.end&&l.duration)q=l.buffered.end(0)/l.duration;else if(l&&l.bytesTotal!=undefined&&l.bytesTotal>0&&l.bufferedBytes!=undefined)q=l.bufferedBytes/l.bytesTotal;else if(i.lengthComputable&&i.total!=0)q=i.loaded/i.total;if(q!==null){q=Math.min(1,Math.max(0,q));g.width(e.width()*q)}}},j=function(i){i=i.pageX;var l=e.offset(),
|
68 |
+
q=e.outerWidth(),s=0;s=0;if(i>l.left&&i<=q+l.left&&d.duration){s=(i-l.left)/q;s=s<=0.02?0:s*d.duration;r&&d.setCurrentTime(s);n.css("left",i-l.left);p.html(mejs.Utility.secondsToTimeCode(s))}},r=false,o=false;e.bind("mousedown",function(i){r=true;j(i);return false});c.find(".mejs-time-rail").bind("mouseenter",function(){o=true}).bind("mouseleave",function(){o=false});f(document).bind("mouseup",function(){r=false}).bind("mousemove",function(i){if(r||o)j(i)});d.addEventListener("progress",function(i){m(i)},
|
69 |
+
false);d.addEventListener("timeupdate",function(i){m(i);if(d.currentTime&&d.duration){i=e.width()*d.currentTime/d.duration;var l=i-k.outerWidth(true)/2;h.width(i);k.css("left",l)}},false)}})(jQuery);
|
70 |
+
(function(f){MediaElementPlayer.prototype.buildcurrent=function(a,c,b,d){f('<div class="mejs-time"><span class="mejs-currenttime">00:00</span></div>').appendTo(c);d.addEventListener("timeupdate",function(){d.currentTime&&c.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(d.currentTime))},false)};MediaElementPlayer.prototype.buildduration=function(a,c,b,d){c.children().last().find(".mejs-currenttime").length>0?f(' <span> | </span> <span class="mejs-duration">00:00</span>').appendTo(c.find(".mejs-time")):
|
71 |
+
f('<div class="mejs-time"><span class="mejs-duration">00:00</span></div>').appendTo(c);d.addEventListener("timeupdate",function(){d.duration&&c.find(".mejs-duration").html(mejs.Utility.secondsToTimeCode(d.duration))},false)}})(jQuery);
|
72 |
+
(function(f){MediaElementPlayer.prototype.buildvolume=function(a,c,b,d){var e=f('<div class="mejs-button mejs-volume-button mejs-mute"><span></span><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></div></div>').appendTo(c);c=e.find(".mejs-volume-slider");var g=e.find(".mejs-volume-total"),h=e.find(".mejs-volume-current"),k=e.find(".mejs-volume-handle"),n=function(j){j=g.height()-g.height()*j;k.css("top",
|
73 |
+
j-k.height()/2);h.height(g.height()-j+parseInt(g.css("top").replace(/px/,""),10));h.css("top",j)},p=function(j){var r=g.height(),o=g.offset(),i=parseInt(g.css("top").replace(/px/,""),10);j=j.pageY-o.top;o=(r-j)/r;if(j<0)j=0;else if(j>r)j=r;k.css("top",j-k.height()/2+i);h.height(r-j);h.css("top",j+i);if(o==0){d.setMuted(true);e.removeClass("mejs-mute").addClass("mejs-unmute")}else{d.setMuted(false);e.removeClass("mejs-unmute").addClass("mejs-mute")}o=Math.max(0,o);o=Math.min(o,1);d.setVolume(o)},m=
|
74 |
+
false;c.bind("mousedown",function(j){p(j);m=true;return false});f(document).bind("mouseup",function(){m=false}).bind("mousemove",function(j){m&&p(j)});e.find("span").click(function(){if(d.muted){d.setMuted(false);e.removeClass("mejs-unmute").addClass("mejs-mute");n(1)}else{d.setMuted(true);e.removeClass("mejs-mute").addClass("mejs-unmute");n(0)}});d.addEventListener("volumechange",function(j){m||n(j.target.volume)},true);n(a.options.startVolume);d.setVolume(a.options.startVolume)}})(jQuery);
|
75 |
+
(function(f){MediaElementPlayer.prototype.buildfullscreen=function(a,c,b,d){if(a.isVideo){var e=false,g=0,h=0,k=a.container,n=f('<div class="mejs-button mejs-fullscreen-button"><span></span></div>').appendTo(c).click(function(){p(!e)}),p=function(m){switch(d.pluginType){case "flash":case "silverlight":d.setFullscreen(m);break;case "native":if(mejs.MediaFeatures.hasNativeFullScreen)m?d.webkitEnterFullScreen():d.webkitExitFullScreen();else{if(m){g=a.$media.height();h=a.$media.width();k.addClass("mejs-container-fullscreen").width("100%").height("100%").css("z-index",
|
76 |
+
1E3);a.$media.width("100%").height("100%");b.children("div").width("100%").height("100%");n.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen")}else{k.removeClass("mejs-container-fullscreen").width(h).height(g).css("z-index",1);a.$media.width(h).height(g);b.children("div").width(h).height(g);n.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen")}a.setControlsSize()}}e=m};f(document).bind("keydown",function(m){e&&m.keyCode==27&&p(false)})}}})(jQuery);
|
77 |
+
(function(f){f.extend(mejs.MepDefaults,{startLanguage:"",translations:[],translationSelector:false,googleApiKey:""});f.extend(MediaElementPlayer.prototype,{buildtracks:function(a,c,b,d){if(a.isVideo)if(a.tracks.length!=0){var e,g="";a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(b).hide();a.captions=f('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position"><span class="mejs-captions-text"></span></div></div>').prependTo(b).hide();a.captionsText=a.captions.find(".mejs-captions-text");
|
78 |
+
a.captionsButton=f('<div class="mejs-button mejs-captions-button"><span></span><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+a.id+'_captions" id="'+a.id+'_captions_none" value="none" checked="checked" /><label for="'+a.id+'_captions_none">None</label></li></ul></div></div>').appendTo(c).delegate("input[type=radio]","click",function(){lang=this.value;if(lang=="none")a.selectedTrack=null;else for(e=0;e<a.tracks.length;e++)if(a.tracks[e].srclang==lang){a.selectedTrack=a.tracks[e];
|
79 |
+
a.captions.attr("lang",a.selectedTrack.srclang);a.displayCaptions();break}});a.container.bind("mouseenter",function(){var h=a.container.find(".mejs-captions-position");h.css("bottom",parseInt(h.css("bottom").replace(/px/,""),10)+a.controls.height()+"px")}).bind("mouseleave",function(){d.paused||a.container.find(".mejs-captions-position").css("bottom","")});a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;if(a.tracks.length>0&&a.options.translations.length>0)for(e=0;e<a.options.translations.length;e++)a.tracks.push({srclang:a.options.translations[e].toLowerCase(),
|
80 |
+
src:null,kind:"subtitles",entries:[],isLoaded:false,isTranslation:true});for(e=0;e<a.tracks.length;e++)a.tracks[e].kind=="subtitles"&&a.addTrackButton(a.tracks[e].srclang,a.tracks[e].isTranslation);a.loadNextTrack();d.addEventListener("timeupdate",function(){a.displayCaptions()},false);d.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){a.chapters.css("visibility","visible");a.chapters.fadeIn(200)},function(){d.paused||a.chapters.fadeOut(200,function(){f(this).css("visibility",
|
81 |
+
"hidden");f(this).css("display","block")})});if(a.options.translationSelector){for(e in mejs.language.codes)g+='<option value="'+e+'">'+mejs.language.codes[e]+"</option>";a.container.find(".mejs-captions-selector ul").before(f('<select class="mejs-captions-translations"><option value="">--Add Translation--</option>'+g+"</select>"));a.container.find(".mejs-captions-translations").change(function(){lang=f(this).val();if(lang!=""){a.tracks.push({srclang:lang,src:null,entries:[],isLoaded:false,isTranslation:true});
|
82 |
+
if(!a.isLoadingTrack){a.trackToLoad--;a.addTrackButton(lang,true);a.options.startLanguage=lang;a.loadNextTrack()}}})}}},loadNextTrack:function(){this.trackToLoad++;if(this.trackToLoad<this.tracks.length){this.isLoadingTrack=true;this.loadTrack(this.trackToLoad)}else this.isLoadingTrack=false},loadTrack:function(a){var c=this,b=c.tracks[a],d=function(){b.isLoaded=true;c.enableTrackButton(b.srclang);c.loadNextTrack()};b.isTranslation?mejs.SrtParser.translateSrt(c.tracks[0].entries,c.tracks[0].srclang,
|
83 |
+
b.srclang,c.options.googleApiKey,function(e){b.entries=e;d()}):f.ajax({url:b.src,success:function(e){b.entries=mejs.SrtParser.parse(e);d();b.kind=="chapters"&&c.media.duration>0&&c.drawChapters(b)},error:function(){c.loadNextTrack()}})},enableTrackButton:function(a){this.captionsButton.find("input[value="+a+"]").attr("disabled","").siblings("label").html(mejs.language.codes[a]||a);this.options.startLanguage==a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,
|
84 |
+
c){var b=mejs.language.codes[a]||a;this.captionsButton.find("ul").append(f('<li><input type="radio" name="'+this.id+'_captions" id="'+this.id+"_captions_"+a+'" value="'+a+'" disabled="disabled" /><label for="'+this.id+"_captions_"+a+'">'+b+(c?" (translating)":" (loading)")+"</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+a+"]").remove()},adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+
|
85 |
+
this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},displayCaptions:function(){if(typeof this.tracks!="undefined"){var a,c=this.selectedTrack;if(c!=null&&c.isLoaded)for(a=0;a<c.entries.times.length;a++)if(this.media.currentTime>=c.entries.times[a].start&&this.media.currentTime<=c.entries.times[a].stop){this.captionsText.html(c.entries.text[a]);this.captions.show();return}this.captions.hide()}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind==
|
86 |
+
"chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);break}},drawChapters:function(a){var c=this,b,d,e=d=0;c.chapters.empty();for(b=0;b<a.entries.times.length;b++){d=a.entries.times[b].stop-a.entries.times[b].start;d=Math.floor(d/c.media.duration*100);if(d+e>100||b==a.entries.times.length-1&&d+e<100)d=100-e;c.chapters.append(f('<div class="mejs-chapter" rel="'+a.entries.times[b].start+'" style="left: '+e.toString()+"%;width: "+d.toString()+'%;"><div class="mejs-chapter-block'+(b==
|
87 |
+
a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[b]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[b].start)+"–"+mejs.Utility.secondsToTimeCode(a.entries.times[b].stop)+"</span></div></div>"));e+=d}c.chapters.find("div.mejs-chapter").click(function(){c.media.setCurrentTime(parseFloat(f(this).attr("rel")));c.media.paused&&c.media.play()});c.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",
|
88 |
+
be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",tl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",
|
89 |
+
pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.SrtParser={pattern_identifier:/^[0-9]+$/,pattern_timecode:/^([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{3})?)(.*)$/,timecodeToSeconds:function(a){a=a.split(":");return a[0]*60*60+a[1]*60+parseFloat(a[2].replace(",","."))},split2:function(a,
|
90 |
+
c){return a.split(c)},parse:function(a){var c=0;a=this.split2(a,/\r?\n/);for(var b={text:[],times:[]},d,e;c<a.length;c++)if(this.pattern_identifier.exec(a[c])){c++;if((d=this.pattern_timecode.exec(a[c]))&&c<a.length){c++;e=a[c];for(c++;a[c]!==""&&c<a.length;){e=e+"\n"+a[c];c++}b.text.push(e);b.times.push({start:this.timecodeToSeconds(d[1]),stop:this.timecodeToSeconds(d[3]),settings:d[5]})}}return b},translateSrt:function(a,c,b,d,e){var g={text:[],times:[]},h,k;this.translateText(a.text.join(" <a></a>"),
|
91 |
+
c,b,d,function(n){h=n.split("<a></a>");for(k=0;k<a.text.length;k++){g.text[k]=h[k];g.times[k]={start:a.times[k].start,stop:a.times[k].stop,settings:a.times[k].settings}}e(g)})},translateText:function(a,c,b,d,e){for(var g,h=[],k,n="",p=function(){if(h.length>0){k=h.shift();mejs.SrtParser.translateChunk(k,c,b,d,function(m){if(m!="undefined")n+=m;p()})}else e(n)};a.length>0;)if(a.length>1E3){g=a.lastIndexOf(".",1E3);h.push(a.substring(0,g));a=a.substring(g+1)}else{h.push(a);a=""}p()},translateChunk:function(a,
|
92 |
+
c,b,d,e){a={q:a,langpair:c+"|"+b,v:"1.0"};if(d!==""&&d!==null)a.key=d;f.ajax({url:"https://ajax.googleapis.com/ajax/services/language/translate",data:a,type:"GET",dataType:"jsonp",success:function(g){e(g.responseData.translatedText)},error:function(){e(null)}})}};if("x\n\ny".split(/\n/gi).length!=3)mejs.SrtParser.split2=function(a,c){var b=[],d="",e;for(e=0;e<a.length;e++){d+=a.substring(e,e+1);if(c.test(d)){b.push(d.replace(c,""));d=""}}b.push(d);return b}})(jQuery);
|
93 |
+
|
mediaelement/mediaelementplayer.css
ADDED
@@ -0,0 +1,507 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.mejs-container {
|
3 |
+
position: relative;
|
4 |
+
background: #000;
|
5 |
+
font-family: Helvetica, Arial;
|
6 |
+
}
|
7 |
+
|
8 |
+
.mejs-container-fullscreen {
|
9 |
+
position: fixed;
|
10 |
+
left: 0;
|
11 |
+
top: 0;
|
12 |
+
right: 0;
|
13 |
+
bottom: 0;
|
14 |
+
overflow: hidden;
|
15 |
+
}
|
16 |
+
.mejs-container-fullscreen .mejs-mediaelement,
|
17 |
+
.mejs-container-fullscreen video {
|
18 |
+
width: 100%;
|
19 |
+
height: 100%;
|
20 |
+
}
|
21 |
+
|
22 |
+
/* Start: LAYERS */
|
23 |
+
.mejs-background {
|
24 |
+
position: absolute;
|
25 |
+
top: 0;
|
26 |
+
left: 0;
|
27 |
+
}
|
28 |
+
.mejs-mediaelement {
|
29 |
+
position: absolute;
|
30 |
+
top: 0;
|
31 |
+
left: 0;
|
32 |
+
}
|
33 |
+
.mejs-poster {
|
34 |
+
position: absolute;
|
35 |
+
top: 0;
|
36 |
+
left: 0;
|
37 |
+
}
|
38 |
+
.mejs-overlay {
|
39 |
+
position: absolute;
|
40 |
+
top: 0;
|
41 |
+
left: 0;
|
42 |
+
cursor: pointer;
|
43 |
+
}
|
44 |
+
.mejs-overlay-button {
|
45 |
+
position: absolute;
|
46 |
+
top: 50%;
|
47 |
+
left: 50%;
|
48 |
+
width: 100px;
|
49 |
+
height: 100px;
|
50 |
+
margin: -50px 0 0 -50px;
|
51 |
+
background: url(bigplay.png) top left no-repeat;
|
52 |
+
}
|
53 |
+
.mejs-overlay:hover .mejs-overlay-button{
|
54 |
+
background-position: 0 -100px ;
|
55 |
+
}
|
56 |
+
/* End: LAYERS */
|
57 |
+
|
58 |
+
/* Start: CONTROL BAR */
|
59 |
+
.mejs-container .mejs-controls {
|
60 |
+
position: absolute;
|
61 |
+
background: none;
|
62 |
+
list-style-type: none;
|
63 |
+
margin: 0;
|
64 |
+
padding: 0;
|
65 |
+
bottom: 0;
|
66 |
+
left: 0;
|
67 |
+
background: url(background.png);
|
68 |
+
background: rgba(0, 0, 0, 0.7);
|
69 |
+
height: 30px;
|
70 |
+
width: 100%;
|
71 |
+
}
|
72 |
+
.mejs-container .mejs-controls div {
|
73 |
+
list-style-type: none;
|
74 |
+
background-image: none;
|
75 |
+
display: block;
|
76 |
+
float: left;
|
77 |
+
margin: 0;
|
78 |
+
padding: 0;
|
79 |
+
width: 26px;
|
80 |
+
height: 26px;
|
81 |
+
font-size: 11px;
|
82 |
+
line-height: 11px;
|
83 |
+
font-family: Helvetica, Arial;
|
84 |
+
}
|
85 |
+
.mejs-controls .mejs-button span {
|
86 |
+
cursor: pointer;
|
87 |
+
display: block;
|
88 |
+
font-size: 0px;
|
89 |
+
line-height: 0;
|
90 |
+
text-decoration: none;
|
91 |
+
margin: 7px 5px;
|
92 |
+
height: 16px;
|
93 |
+
width: 16px;
|
94 |
+
background: transparent url(controls.png) 0 0 no-repeat;
|
95 |
+
}
|
96 |
+
/* End: CONTROL BAR */
|
97 |
+
|
98 |
+
/* Start: Time (current / duration) */
|
99 |
+
.mejs-container .mejs-controls .mejs-time {
|
100 |
+
color: #fff;
|
101 |
+
display: block;
|
102 |
+
height: 17px;
|
103 |
+
width: auto;
|
104 |
+
padding: 8px 3px 0 3px ;
|
105 |
+
overflow: hidden;
|
106 |
+
text-align: center;
|
107 |
+
padding: auto 4px;
|
108 |
+
}
|
109 |
+
.mejs-container .mejs-controls .mejs-time span {
|
110 |
+
font-size: 11px;
|
111 |
+
color: #fff;
|
112 |
+
line-height: 12px;
|
113 |
+
display: block;
|
114 |
+
float: left;
|
115 |
+
margin: 1px 2px 0 0;
|
116 |
+
width: auto;
|
117 |
+
}
|
118 |
+
/* End: Time (current / duration) */
|
119 |
+
|
120 |
+
|
121 |
+
/* Start: Play/pause */
|
122 |
+
.mejs-controls .mejs-play span {
|
123 |
+
background-position:0 0;
|
124 |
+
}
|
125 |
+
.mejs-controls .mejs-pause span {
|
126 |
+
background-position:0 -16px;
|
127 |
+
}
|
128 |
+
/* End: Play/pause */
|
129 |
+
|
130 |
+
|
131 |
+
/* Start: Progress bar */
|
132 |
+
.mejs-controls div.mejs-time-rail {
|
133 |
+
width: 200px;
|
134 |
+
padding-top: 5px;
|
135 |
+
}
|
136 |
+
.mejs-controls .mejs-time-rail span {
|
137 |
+
display: block;
|
138 |
+
position: absolute;
|
139 |
+
width: 180px;
|
140 |
+
height: 10px;
|
141 |
+
-webkit-border-radius: 2px;
|
142 |
+
-moz-border-radius: 2px;
|
143 |
+
border-radius: 2px;
|
144 |
+
cursor: pointer;
|
145 |
+
}
|
146 |
+
.mejs-controls .mejs-time-rail .mejs-time-total {
|
147 |
+
margin: 5px;
|
148 |
+
background: #333;
|
149 |
+
background: rgba(50,50,50,.8);
|
150 |
+
}
|
151 |
+
.mejs-controls .mejs-time-rail .mejs-time-loaded {
|
152 |
+
background: #3caac8;
|
153 |
+
background: rgba(60,170,200,0.8);
|
154 |
+
width: 0;
|
155 |
+
}
|
156 |
+
.mejs-controls .mejs-time-rail .mejs-time-current {
|
157 |
+
width: 0;
|
158 |
+
background: #fff;
|
159 |
+
background: rgba(255,255,255,0.8);
|
160 |
+
}
|
161 |
+
|
162 |
+
.mejs-controls .mejs-time-rail .mejs-time-handle {
|
163 |
+
display: none;
|
164 |
+
position: absolute;
|
165 |
+
margin: 0;
|
166 |
+
width: 10px;
|
167 |
+
background: #fff;
|
168 |
+
-webkit-border-radius: 5px;
|
169 |
+
-moz-border-radius: 5px;
|
170 |
+
border-radius: 5px;
|
171 |
+
cursor: pointer;
|
172 |
+
border: solid 2px #333;
|
173 |
+
top: -2px;
|
174 |
+
text-align: center;
|
175 |
+
}
|
176 |
+
|
177 |
+
.mejs-controls .mejs-time-rail .mejs-time-float {
|
178 |
+
visibility: hidden;
|
179 |
+
position: absolute;
|
180 |
+
display: block;
|
181 |
+
background: #eee;
|
182 |
+
width: 36px;
|
183 |
+
height: 17px;
|
184 |
+
border: solid 1px #333;
|
185 |
+
top: -26px;
|
186 |
+
margin-left: -18px;
|
187 |
+
text-align: center;
|
188 |
+
color: #111;
|
189 |
+
}
|
190 |
+
.mejs-controls .mejs-time-rail:hover .mejs-time-float {
|
191 |
+
visibility: visible;
|
192 |
+
}
|
193 |
+
.mejs-controls .mejs-time-rail .mejs-time-float-current {
|
194 |
+
margin: 2px;
|
195 |
+
width: 30px;
|
196 |
+
display: block;
|
197 |
+
text-align: center;
|
198 |
+
}
|
199 |
+
.mejs-controls .mejs-time-rail .mejs-time-float-corner {
|
200 |
+
position: absolute;
|
201 |
+
display: block;
|
202 |
+
width: 0;
|
203 |
+
height: 0;
|
204 |
+
line-height: 0;
|
205 |
+
border: solid 5px #eee;
|
206 |
+
border-color: #eee transparent transparent transparent;
|
207 |
+
-webkit-border-radius: 0;
|
208 |
+
-moz-border-radius: 0;
|
209 |
+
border-radius: 0;
|
210 |
+
top: 15px;
|
211 |
+
left: 13px;
|
212 |
+
|
213 |
+
}
|
214 |
+
|
215 |
+
|
216 |
+
|
217 |
+
|
218 |
+
/*
|
219 |
+
.mejs-controls .mejs-time-rail:hover .mejs-time-handle {
|
220 |
+
visibility:visible;
|
221 |
+
}
|
222 |
+
*/
|
223 |
+
/* End: Progress bar */
|
224 |
+
|
225 |
+
/* Start: Fullscreen */
|
226 |
+
.mejs-controls .mejs-fullscreen-button span {
|
227 |
+
background-position:-32px 0;
|
228 |
+
}
|
229 |
+
.mejs-controls .mejs-unfullscreen span {
|
230 |
+
background-position:-32px -16px;
|
231 |
+
}
|
232 |
+
/* End: Fullscreen */
|
233 |
+
|
234 |
+
|
235 |
+
/* Start: Mute/Volume */
|
236 |
+
.mejs-controls .mejs-volume-button {
|
237 |
+
}
|
238 |
+
|
239 |
+
.mejs-controls .mejs-mute span {
|
240 |
+
background-position:-16px -16px;
|
241 |
+
}
|
242 |
+
|
243 |
+
.mejs-controls .mejs-unmute span {
|
244 |
+
background-position:-16px 0;
|
245 |
+
}
|
246 |
+
|
247 |
+
.mejs-controls .mejs-volume-button {
|
248 |
+
position: relative;
|
249 |
+
}
|
250 |
+
|
251 |
+
.mejs-controls .mejs-volume-button .mejs-volume-slider {
|
252 |
+
display: none;
|
253 |
+
height: 115px;
|
254 |
+
width: 25px;
|
255 |
+
background: url(background.png);
|
256 |
+
background: rgba(0, 0, 0, 0.7);
|
257 |
+
-webkit-border-radius: 0;
|
258 |
+
-moz-border-radius: 0;
|
259 |
+
border-radius: 0;
|
260 |
+
top: -115px;
|
261 |
+
left: 0;
|
262 |
+
z-index: 1;
|
263 |
+
position: absolute;
|
264 |
+
margin: 0;
|
265 |
+
}
|
266 |
+
.mejs-controls .mejs-volume-button:hover {
|
267 |
+
-webkit-border-radius: 0 0 4px 4px ;
|
268 |
+
-moz-border-radius: 0 0 4px 4px ;
|
269 |
+
border-radius: 0 0 4px 4px ;
|
270 |
+
}
|
271 |
+
.mejs-controls .mejs-volume-button:hover .mejs-volume-slider {
|
272 |
+
display: block;
|
273 |
+
}
|
274 |
+
|
275 |
+
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total {
|
276 |
+
position: absolute;
|
277 |
+
left: 11px;
|
278 |
+
top: 8px;
|
279 |
+
width: 2px;
|
280 |
+
height: 100px;
|
281 |
+
background: #ddd;
|
282 |
+
background: rgba(255, 255, 255, 0.5);
|
283 |
+
margin: 0;
|
284 |
+
}
|
285 |
+
|
286 |
+
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current {
|
287 |
+
position: absolute;
|
288 |
+
left: 11px;
|
289 |
+
top: 8px;
|
290 |
+
width: 2px;
|
291 |
+
height: 100px;
|
292 |
+
background: #ddd;
|
293 |
+
background: rgba(255, 255, 255, 0.9);
|
294 |
+
margin: 0;
|
295 |
+
}
|
296 |
+
|
297 |
+
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle {
|
298 |
+
position: absolute;
|
299 |
+
left: 4px;
|
300 |
+
top: -3px;
|
301 |
+
width: 16px;
|
302 |
+
height: 6px;
|
303 |
+
background: #ddd;
|
304 |
+
background: rgba(255, 255, 255, 0.9);
|
305 |
+
cursor: N-resize;
|
306 |
+
-webkit-border-radius: 1px;
|
307 |
+
-moz-border-radius: 1px;
|
308 |
+
border-radius: 1px;
|
309 |
+
margin: 0;
|
310 |
+
}
|
311 |
+
|
312 |
+
/* End: Mute/Volume */
|
313 |
+
|
314 |
+
|
315 |
+
|
316 |
+
|
317 |
+
/* Start: TRACK (Captions and Chapters) */
|
318 |
+
.mejs-controls .mejs-captions-button {
|
319 |
+
position: relative;
|
320 |
+
}
|
321 |
+
|
322 |
+
.mejs-controls .mejs-captions-button span {
|
323 |
+
background-position:-48px 0;
|
324 |
+
}
|
325 |
+
.mejs-controls .mejs-captions-button .mejs-captions-selector {
|
326 |
+
visibility: hidden;
|
327 |
+
position: absolute;
|
328 |
+
bottom: 25px;
|
329 |
+
right: -10px;
|
330 |
+
width: 130px;
|
331 |
+
height: 100px;
|
332 |
+
background: url(background.png);
|
333 |
+
background: rgba(0,0,0,0.8);
|
334 |
+
border: solid 1px #fff;
|
335 |
+
padding: 10px;
|
336 |
+
overflow: hidden;
|
337 |
+
-webkit-border-radius: 0;
|
338 |
+
-moz-border-radius: 0;
|
339 |
+
border-radius: 0;
|
340 |
+
}
|
341 |
+
.mejs-controls .mejs-captions-button:hover .mejs-captions-selector {
|
342 |
+
visibility: visible;
|
343 |
+
}
|
344 |
+
|
345 |
+
.mejs-controls .mejs-captions-button .mejs-captions-selector ul {
|
346 |
+
margin: 0;
|
347 |
+
padding: 0;
|
348 |
+
display: block;
|
349 |
+
list-style-type: none !important;
|
350 |
+
overflow: hidden;
|
351 |
+
}
|
352 |
+
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li{
|
353 |
+
margin: 0 0 6px 0;
|
354 |
+
padding: 0;
|
355 |
+
list-style-type: none !important;
|
356 |
+
display:block;
|
357 |
+
color: #fff;
|
358 |
+
overflow: hidden;
|
359 |
+
}
|
360 |
+
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li input{
|
361 |
+
clear: both;
|
362 |
+
float: left;
|
363 |
+
margin: 3px 3px 0px 5px;
|
364 |
+
}
|
365 |
+
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li label{
|
366 |
+
width: 100px;
|
367 |
+
float: left;
|
368 |
+
padding: 4px 0 0 0;
|
369 |
+
line-height: 15px;
|
370 |
+
font-family: helvetica, arial;
|
371 |
+
font-size: 10px;
|
372 |
+
}
|
373 |
+
|
374 |
+
.mejs-controls .mejs-captions-button .mejs-captions-translations {
|
375 |
+
font-size: 10px;
|
376 |
+
margin: 0 0 5px 0;
|
377 |
+
}
|
378 |
+
|
379 |
+
|
380 |
+
.mejs-chapters {
|
381 |
+
position: absolute;
|
382 |
+
top: 0;
|
383 |
+
left: 0;
|
384 |
+
-xborder-right: solid 1px #fff;
|
385 |
+
width: 10000px;
|
386 |
+
}
|
387 |
+
.mejs-chapters .mejs-chapter {
|
388 |
+
position: absolute;
|
389 |
+
float: left;
|
390 |
+
background: url(background.png);
|
391 |
+
background: rgba(0,0,0,0.8);
|
392 |
+
overflow: hidden;
|
393 |
+
border: 0;
|
394 |
+
}
|
395 |
+
.mejs-chapters .mejs-chapter .mejs-chapter-block {
|
396 |
+
font-size: 11px;
|
397 |
+
color: #fff;
|
398 |
+
padding: 5px;
|
399 |
+
display: block;
|
400 |
+
border-right: solid 1px #999;
|
401 |
+
border-bottom: solid 1px #999;
|
402 |
+
cursor: pointer;
|
403 |
+
}
|
404 |
+
.mejs-chapters .mejs-chapter .mejs-chapter-block-last {
|
405 |
+
border-right: none;
|
406 |
+
}
|
407 |
+
|
408 |
+
.mejs-chapters .mejs-chapter .mejs-chapter-block:hover {
|
409 |
+
background: #333;
|
410 |
+
}
|
411 |
+
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{
|
412 |
+
font-size: 12px;
|
413 |
+
font-weight: bold;
|
414 |
+
display: block;
|
415 |
+
white-space:nowrap;
|
416 |
+
text-overflow: ellipsis;
|
417 |
+
margin: 0 0 3px 0;
|
418 |
+
line-height: 12px;
|
419 |
+
}
|
420 |
+
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{
|
421 |
+
font-size: 12px;
|
422 |
+
line-height: 12px;
|
423 |
+
margin: 3px 0 4px 0;
|
424 |
+
display: block;
|
425 |
+
white-space:nowrap;
|
426 |
+
text-overflow: ellipsis;
|
427 |
+
}
|
428 |
+
|
429 |
+
|
430 |
+
.mejs-captions-layer {
|
431 |
+
position: absolute;
|
432 |
+
bottom: 0;
|
433 |
+
left: 0;
|
434 |
+
text-align:center;
|
435 |
+
/*font-weight: bold;*/
|
436 |
+
line-height: 22px;
|
437 |
+
font-size: 12px;
|
438 |
+
color: #fff;
|
439 |
+
}
|
440 |
+
.mejs-captions-layer a {
|
441 |
+
color: #fff;
|
442 |
+
text-decoration: underline;
|
443 |
+
}
|
444 |
+
.mejs-captions-layer[lang=ar] {
|
445 |
+
font-size: 20px;
|
446 |
+
font-weight: normal;
|
447 |
+
}
|
448 |
+
|
449 |
+
.mejs-captions-position {
|
450 |
+
position: absolute;
|
451 |
+
width: 100%;
|
452 |
+
bottom: 15px;
|
453 |
+
}
|
454 |
+
|
455 |
+
.mejs-captions-text {
|
456 |
+
padding: 3px 5px;
|
457 |
+
|
458 |
+
background: url(background.png);
|
459 |
+
background: rgba(0, 0, 0, 0.8);
|
460 |
+
|
461 |
+
}
|
462 |
+
/* End: TRACK (Captions and Chapters) */
|
463 |
+
|
464 |
+
|
465 |
+
|
466 |
+
.mejs-clear {
|
467 |
+
clear: both;
|
468 |
+
}
|
469 |
+
|
470 |
+
/* Start: ERROR */
|
471 |
+
.me-cannotplay {
|
472 |
+
}
|
473 |
+
.me-cannotplay a {
|
474 |
+
color: #fff;
|
475 |
+
font-weight: bold;
|
476 |
+
}
|
477 |
+
.me-cannotplay span {
|
478 |
+
padding: 15px;
|
479 |
+
display: block;
|
480 |
+
}
|
481 |
+
/* End: ERROR */
|
482 |
+
|
483 |
+
|
484 |
+
/* Start: Loop */
|
485 |
+
.mejs-controls .mejs-loop-off span{
|
486 |
+
background-position: -64px -16px;
|
487 |
+
}
|
488 |
+
.mejs-controls .mejs-loop-on span {
|
489 |
+
background-position: -64px 0;
|
490 |
+
}
|
491 |
+
/* End: Loop */
|
492 |
+
|
493 |
+
/* Start: backlight */
|
494 |
+
.mejs-controls .mejs-backlight-off span{
|
495 |
+
background-position: -80px -16px;
|
496 |
+
}
|
497 |
+
.mejs-controls .mejs-backlight-on span {
|
498 |
+
background-position: -80px 0;
|
499 |
+
}
|
500 |
+
/* End: backlight */
|
501 |
+
|
502 |
+
|
503 |
+
/* Start: picture controls */
|
504 |
+
.mejs-controls .mejs-picturecontrols-button{
|
505 |
+
background-position: -96px 0;
|
506 |
+
}
|
507 |
+
/* End: picture controls */
|
mediaelement/mediaelementplayer.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.mejs-container{position:relative;background:#000;font-family:Helvetica,Arial;}.mejs-container-fullscreen{position:fixed;left:0;top:0;right:0;bottom:0;overflow:hidden;}.mejs-container-fullscreen .mejs-mediaelement,.mejs-container-fullscreen video{width:100%;height:100%;}.mejs-background{position:absolute;top:0;left:0;}.mejs-mediaelement{position:absolute;top:0;left:0;}.mejs-poster{position:absolute;top:0;left:0;}.mejs-overlay{position:absolute;top:0;left:0;cursor:pointer;}.mejs-overlay-button{position:absolute;top:50%;left:50%;width:100px;height:100px;margin:-50px 0 0 -50px;background:url(bigplay.png) top left no-repeat;}.mejs-overlay:hover .mejs-overlay-button{background-position:0 -100px;}.mejs-container .mejs-controls{position:absolute;background:none;list-style-type:none;margin:0;padding:0;bottom:0;left:0;background:url(background.png);background:rgba(0,0,0,0.7);height:30px;width:100%;}.mejs-container .mejs-controls div{list-style-type:none;background-image:none;display:block;float:left;margin:0;padding:0;width:26px;height:26px;font-size:11px;line-height:11px;font-family:Helvetica,Arial;}.mejs-controls .mejs-button span{cursor:pointer;display:block;font-size:0;line-height:0;text-decoration:none;margin:7px 5px;height:16px;width:16px;background:transparent url(controls.png) 0 0 no-repeat;}.mejs-container .mejs-controls .mejs-time{color:#fff;display:block;height:17px;width:auto;padding:8px 3px 0 3px;overflow:hidden;text-align:center;padding:auto 4px;}.mejs-container .mejs-controls .mejs-time span{font-size:11px;color:#fff;line-height:12px;display:block;float:left;margin:1px 2px 0 0;width:auto;}.mejs-controls .mejs-play span{background-position:0 0;}.mejs-controls .mejs-pause span{background-position:0 -16px;}.mejs-controls div.mejs-time-rail{width:200px;padding-top:5px;}.mejs-controls .mejs-time-rail span{display:block;position:absolute;width:180px;height:10px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;cursor:pointer;}.mejs-controls .mejs-time-rail .mejs-time-total{margin:5px;background:#333;background:rgba(50,50,50,.8);}.mejs-controls .mejs-time-rail .mejs-time-loaded{background:#3caac8;background:rgba(60,170,200,0.8);width:0;}.mejs-controls .mejs-time-rail .mejs-time-current{width:0;background:#fff;background:rgba(255,255,255,0.8);}.mejs-controls .mejs-time-rail .mejs-time-handle{display:none;position:absolute;margin:0;width:10px;background:#fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;cursor:pointer;border:solid 2px #333;top:-2px;text-align:center;}.mejs-controls .mejs-time-rail .mejs-time-float{visibility:hidden;position:absolute;display:block;background:#eee;width:36px;height:17px;border:solid 1px #333;top:-26px;margin-left:-18px;text-align:center;color:#111;}.mejs-controls .mejs-time-rail:hover .mejs-time-float{visibility:visible;}.mejs-controls .mejs-time-rail .mejs-time-float-current{margin:2px;width:30px;display:block;text-align:center;}.mejs-controls .mejs-time-rail .mejs-time-float-corner{position:absolute;display:block;width:0;height:0;line-height:0;border:solid 5px #eee;border-color:#eee transparent transparent transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;top:15px;left:13px;}.mejs-controls .mejs-fullscreen-button span{background-position:-32px 0;}.mejs-controls .mejs-unfullscreen span{background-position:-32px -16px;}.mejs-controls .mejs-mute span{background-position:-16px -16px;}.mejs-controls .mejs-unmute span{background-position:-16px 0;}.mejs-controls .mejs-volume-button{position:relative;}.mejs-controls .mejs-volume-button .mejs-volume-slider{display:none;height:115px;width:25px;background:url(background.png);background:rgba(0,0,0,0.7);-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;top:-115px;left:0;z-index:1;position:absolute;margin:0;}.mejs-controls .mejs-volume-button:hover{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;}.mejs-controls .mejs-volume-button:hover .mejs-volume-slider{display:block;}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total{position:absolute;left:11px;top:8px;width:2px;height:100px;background:#ddd;background:rgba(255,255,255,0.5);margin:0;}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current{position:absolute;left:11px;top:8px;width:2px;height:100px;background:#ddd;background:rgba(255,255,255,0.9);margin:0;}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle{position:absolute;left:4px;top:-3px;width:16px;height:6px;background:#ddd;background:rgba(255,255,255,0.9);cursor:N-resize;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;margin:0;}.mejs-controls .mejs-captions-button{position:relative;}.mejs-controls .mejs-captions-button span{background-position:-48px 0;}.mejs-controls .mejs-captions-button .mejs-captions-selector{visibility:hidden;position:absolute;bottom:25px;right:-10px;width:130px;height:100px;background:url(background.png);background:rgba(0,0,0,0.8);border:solid 1px #fff;padding:10px;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}.mejs-controls .mejs-captions-button:hover .mejs-captions-selector{visibility:visible;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li{margin:0 0 6px 0;padding:0;list-style-type:none!important;display:block;color:#fff;overflow:hidden;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li label{width:100px;float:left;padding:4px 0 0 0;line-height:15px;font-family:helvetica,arial;font-size:10px;}.mejs-controls .mejs-captions-button .mejs-captions-translations{font-size:10px;margin:0 0 5px 0;}.mejs-chapters{position:absolute;top:0;left:0;-xborder-right:solid 1px #fff;width:10000px;}.mejs-chapters .mejs-chapter{position:absolute;float:left;background:url(background.png);background:rgba(0,0,0,0.8);overflow:hidden;border:0;}.mejs-chapters .mejs-chapter .mejs-chapter-block{font-size:11px;color:#fff;padding:5px;display:block;border-right:solid 1px #999;border-bottom:solid 1px #999;cursor:pointer;}.mejs-chapters .mejs-chapter .mejs-chapter-block-last{border-right:none;}.mejs-chapters .mejs-chapter .mejs-chapter-block:hover{background:#333;}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{font-size:12px;font-weight:bold;display:block;white-space:nowrap;text-overflow:ellipsis;margin:0 0 3px 0;line-height:12px;}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{font-size:12px;line-height:12px;margin:3px 0 4px 0;display:block;white-space:nowrap;text-overflow:ellipsis;}.mejs-captions-layer{position:absolute;bottom:0;left:0;text-align:center;line-height:22px;font-size:12px;color:#fff;}.mejs-captions-layer a{color:#fff;text-decoration:underline;}.mejs-captions-layer[lang=ar]{font-size:20px;font-weight:normal;}.mejs-captions-position{position:absolute;width:100%;bottom:15px;}.mejs-captions-text{padding:3px 5px;background:url(background.png);background:rgba(0,0,0,0.8);}.mejs-clear{clear:both;}.me-cannotplay a{color:#fff;font-weight:bold;}.me-cannotplay span{padding:15px;display:block;}.mejs-controls .mejs-loop-off span{background-position:-64px -16px;}.mejs-controls .mejs-loop-on span{background-position:-64px 0;}.mejs-controls .mejs-backlight-off span{background-position:-80px -16px;}.mejs-controls .mejs-backlight-on span{background-position:-80px 0;}.mejs-controls .mejs-picturecontrols-button{background-position:-96px 0;}
|
mediaelement/silverlightmediaelement.xap
ADDED
Binary file
|
readme.txt
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== MediaElement.js - HTML5 Video & Audio Player ===
|
2 |
+
Contributors: johndyer
|
3 |
+
Donate link: http://mediaelementjs.com/
|
4 |
+
Tags: html5, video, audio, player, flash, mp4, mp3, ogg, webm, wmv, captions, subtitles, websrt, srt, accessible, Silverlight, javascript,
|
5 |
+
Requires at least: 2.8
|
6 |
+
Tested up to: 3.0.4
|
7 |
+
Stable tag: 2.0.6.1
|
8 |
+
|
9 |
+
MediaElement.js is an HTML5 video and audio player with Flash fallback and captions. Supports IE, Firefox, Opera, Safari, Chrome and iPhone, iPad, Android.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
A video plugin for WordPress built on the MediaElement.js HTML5 video and audio player library. Provides Flash or Silverlight fallback players for non-HTML5 browsers and also supports iPhone, iPad, and Andriod.
|
14 |
+
Supports MP4, OGG, WebM, WMV, MP3, WAV, WMA files as well as captions with WebSRT files.
|
15 |
+
|
16 |
+
Check out <a href="http://mediaelementjs.com/">mediaElementjs.com</a> for more information and examples.
|
17 |
+
|
18 |
+
### Typical Usage for video
|
19 |
+
|
20 |
+
[video src="http://mysite.com/mymedia.mp4" width="640" height="360"]
|
21 |
+
|
22 |
+
### Typical Usage for audio
|
23 |
+
|
24 |
+
[audio src="http://mysite.com/mymedia.mp3"]
|
25 |
+
|
26 |
+
### Shortcode Options
|
27 |
+
|
28 |
+
= src =
|
29 |
+
This location of any audio or video file
|
30 |
+
|
31 |
+
[video src="http://mysite.com/mymedia.mp4"]
|
32 |
+
|
33 |
+
= type =
|
34 |
+
The media type of the resource
|
35 |
+
|
36 |
+
[video src="http://mysite.com/mymedia?xyz" type="video/mp4"]
|
37 |
+
|
38 |
+
= mp4 =
|
39 |
+
The location of the h.264/MP4 source for the video.
|
40 |
+
|
41 |
+
[video mp4="http://mysite.com/mymedia.mp4"]
|
42 |
+
|
43 |
+
= mp3 =
|
44 |
+
The location of an MP3 file for video
|
45 |
+
|
46 |
+
[audio mp3="http://mysite.com/mymedia.mp3"]
|
47 |
+
|
48 |
+
= ogg =
|
49 |
+
The location of the Theora/Ogg source for the video.
|
50 |
+
|
51 |
+
[video ogg="http://mysite.com/mymedia.ogg"]
|
52 |
+
|
53 |
+
= webm =
|
54 |
+
The location of the VP8/WebM source for the video.
|
55 |
+
|
56 |
+
[video ogg="http://mysite.com/mymedia.webm"]
|
57 |
+
|
58 |
+
= poster =
|
59 |
+
The location of the poster frame for the video.
|
60 |
+
|
61 |
+
[video poster="http://mysite.com/mymedia.png"]
|
62 |
+
|
63 |
+
= width =
|
64 |
+
The width of the video
|
65 |
+
|
66 |
+
[video width="640"]
|
67 |
+
|
68 |
+
= height =
|
69 |
+
The height of the video
|
70 |
+
|
71 |
+
[video height="264"]
|
72 |
+
|
73 |
+
= loop =
|
74 |
+
Loops the video or audio when it ends
|
75 |
+
|
76 |
+
[video src="http://mysite.com/mymedia.mp4" loop="true"]
|
77 |
+
|
78 |
+
= preload =
|
79 |
+
Start loading the video as soon as possible, before the user clicks play.
|
80 |
+
|
81 |
+
[video preload="true"]
|
82 |
+
|
83 |
+
= autoplay =
|
84 |
+
Start playing the video as soon as it's ready.
|
85 |
+
|
86 |
+
[video autoplay="true"]
|
87 |
+
|
88 |
+
= fullscreen =
|
89 |
+
Disables the fullscreen button
|
90 |
+
|
91 |
+
[video src="http://mysite.com/mymedia.mp4" fullscreen="false"]
|
92 |
+
|
93 |
+
= duration =
|
94 |
+
Disables the duration output
|
95 |
+
|
96 |
+
[video src="http://mysite.com/mymedia.mp4" duration="false"]
|
97 |
+
|
98 |
+
= volume =
|
99 |
+
Disables the volume slider
|
100 |
+
|
101 |
+
[video src="http://mysite.com/mymedia.mp4" volume="false"]
|
102 |
+
|
103 |
+
= progress =
|
104 |
+
Disables the progress bar
|
105 |
+
|
106 |
+
[video src="http://mysite.com/mymedia.mp4" progress="false"]
|
107 |
+
|
108 |
+
= captions =
|
109 |
+
URL to a WebSRT captions file
|
110 |
+
|
111 |
+
[video src="http://mysite.com/mymedia.mp4" captions="http://mysite.com/mymedia.srt"]
|
112 |
+
|
113 |
+
= Simple Video =
|
114 |
+
Basic playback options
|
115 |
+
|
116 |
+
[video src="http://mysite.com/mymedia.mp4" width="640" height="360"]
|
117 |
+
|
118 |
+
= All Attributes Video =
|
119 |
+
All options enabled
|
120 |
+
|
121 |
+
[video mp4="http://mysite.com/mymedia.mp4" ogg="http://mysite.com/mymedia.ogg" webm="http://mysite.com/mymedia.webm" poster="http://mysite.com/mymedia.png" preload="true" autoplay="true" width="640" height="264"]
|
122 |
+
|
123 |
+
= Simple Audio =
|
124 |
+
Basic playback options
|
125 |
+
|
126 |
+
[audio src="http://mysite.com/mymedia.mp3"]
|
127 |
+
|
128 |
+
= All Attributes Audio =
|
129 |
+
All options enabled
|
130 |
+
|
131 |
+
[audio mp3="http://mysite.com/mymedia.mp3" ogg="http://mysite.com/mymedia.ogg" preload="true" autoplay="true"]
|
132 |
+
|
133 |
+
== Installation ==
|
134 |
+
|
135 |
+
View <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more information.
|
136 |
+
|
137 |
+
1. Upload the `media-element-html5-video-and-audio-player` folder to the `/wp-content/plugins/` directory
|
138 |
+
2. Activate the plugin through the `Plugins` menu in WordPress
|
139 |
+
3. Use the `[video]` or `[audio]` shortcode in your post or page with the options on the front page.
|
140 |
+
|
141 |
+
== Changelog ==
|
142 |
+
|
143 |
+
= 2.0.5 =
|
144 |
+
* Lots of minor changes to JS code
|
145 |
+
* better IE6 support
|
146 |
+
|
147 |
+
= 2.0.4 =
|
148 |
+
* Plugin fix
|
149 |
+
|
150 |
+
= 2.0.3 =
|
151 |
+
* Silverlight fix
|
152 |
+
|
153 |
+
= 2.0.2 =
|
154 |
+
* Updated to 2.0.2 MEjs code
|
155 |
+
|
156 |
+
= 2.0.1.2 =
|
157 |
+
* Loop fix
|
158 |
+
* Video for Everybody Syntax (Works even when JavaScript is turned off)
|
159 |
+
|
160 |
+
= 2.0.1.1 =
|
161 |
+
* Autoplay fix
|
162 |
+
|
163 |
+
= 2.0.1 =
|
164 |
+
* Updated to 2.0.1 version
|
165 |
+
|
166 |
+
= 1.1.5 =
|
167 |
+
* Updated to 1.1.5 version
|
168 |
+
* Added options to turn controls on/off
|
169 |
+
* Added loop option
|
170 |
+
|
171 |
+
= 1.1.2 =
|
172 |
+
* Updated to 1.1.2 version
|
173 |
+
* adds captions support and new style
|
174 |
+
|
175 |
+
= 1.1.0 =
|
176 |
+
* Updated to 1.1 of player
|
177 |
+
|
178 |
+
= 1.0.1 =
|
179 |
+
* Fixed URL bug
|
180 |
+
* Fixed non-src bugs
|
181 |
+
|
182 |
+
= 1.0 =
|
183 |
+
* First release.
|
184 |
+
|
185 |
+
== Upgrade Notice ==
|
186 |
+
|
187 |
+
None
|
188 |
+
|
189 |
+
== Frequently Asked Questions ==
|
190 |
+
|
191 |
+
= Where can I find out more? =
|
192 |
+
|
193 |
+
Check out <a href="http://mediaelementjs.com/">mediaElementjs.com</a> for more examples
|
194 |
+
|
195 |
+
= What does this get me over other HTML5 players? =
|
196 |
+
|
197 |
+
See original blog post at <a href="http://johndyer.name/post/MediaElement-js-a-magic-unicorn-HTML5-video-library.aspx">johndyer.name</a> for a full explanation of MediaElement.js
|
198 |
+
|
199 |
+
== Screenshots ==
|
200 |
+
|
201 |
+
1. Video player
|
screenshot-1.jpg
ADDED
Binary file
|