Version Description
- Updating to final version of 2.x line (Wordpress 4.9 will have the 4.x branch)
- Updated screenshot
Download this release
Release Info
Developer | johndyer |
Plugin | MediaElement.js – HTML5 Video & Audio Player |
Version | 2.23.5 |
Comparing to | |
See all releases |
Code changes from version 2.10.3 to 2.23.5
- mediaelement-js-wp.php +481 -481
- mediaelement/background.png +0 -0
- mediaelement/bigplay.png +0 -0
- mediaelement/controls-ted.png +0 -0
- mediaelement/controls-wmp-bg.png +0 -0
- mediaelement/controls-wmp.png +0 -0
- mediaelement/controls.png +0 -0
- mediaelement/controls.svg +172 -1
- mediaelement/flashmediaelement.swf +0 -0
- mediaelement/loading.gif +0 -0
- mediaelement/mediaelement-and-player.js +3607 -1631
- mediaelement/mediaelement-and-player.min.js +34 -151
- mediaelement/mediaelement.js +1124 -489
- mediaelement/mediaelement.min.js +29 -63
- mediaelement/mediaelementplayer.css +265 -108
- mediaelement/mediaelementplayer.js +2458 -1116
- mediaelement/mediaelementplayer.min.css +1 -1
- mediaelement/mediaelementplayer.min.js +5 -85
- mediaelement/mejs-skins.css +6 -0
- mediaelement/silverlightmediaelement.xap +0 -0
- readme.txt +246 -242
- screenshot-1.jpg +0 -0
mediaelement-js-wp.php
CHANGED
@@ -1,481 +1,481 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package MediaElementJS
|
4 |
-
* @version 2.
|
5 |
-
*/
|
6 |
-
|
7 |
-
/*
|
8 |
-
Plugin Name: MediaElement.js - HTML5 Audio and Video
|
9 |
-
Plugin URI: http://mediaelementjs.com/
|
10 |
-
Description: Video and audio plugin for WordPress built on MediaElement.js HTML5 video and audio player library. Embeds media 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
|
11 |
-
Author: John Dyer
|
12 |
-
Version: 2.
|
13 |
-
Author URI: http://j.hn/
|
14 |
-
License: MIT
|
15 |
-
*/
|
16 |
-
|
17 |
-
/*
|
18 |
-
Adapted from: http://videojs.com/ plugin
|
19 |
-
*/
|
20 |
-
|
21 |
-
$mediaElementPlayerIndex = 1;
|
22 |
-
|
23 |
-
/* Runs when plugin is activated */
|
24 |
-
register_activation_hook(__FILE__,'mejs_install');
|
25 |
-
|
26 |
-
function mejs_install() {
|
27 |
-
add_option('mep_video_skin', '');
|
28 |
-
|
29 |
-
add_option('mep_default_video_height', 270);
|
30 |
-
add_option('mep_default_video_width', 480);
|
31 |
-
add_option('mep_default_video_type', '');
|
32 |
-
|
33 |
-
add_option('mep_default_audio_height', 30);
|
34 |
-
add_option('mep_default_audio_width', 400);
|
35 |
-
add_option('mep_default_audio_type', '');
|
36 |
-
}
|
37 |
-
|
38 |
-
/* Runs on plugin deactivation*/
|
39 |
-
register_deactivation_hook( __FILE__, 'mejs_remove' );
|
40 |
-
function mejs_remove() {
|
41 |
-
delete_option('mep_video_skin');
|
42 |
-
|
43 |
-
delete_option('mep_default_video_height');
|
44 |
-
delete_option('mep_default_video_width');
|
45 |
-
delete_option('mep_default_video_type');
|
46 |
-
|
47 |
-
delete_option('mep_default_audio_height');
|
48 |
-
delete_option('mep_default_audio_width');
|
49 |
-
delete_option('mep_default_audio_type');
|
50 |
-
}
|
51 |
-
|
52 |
-
// create custom plugin settings menu
|
53 |
-
add_action('admin_menu', 'mejs_create_menu');
|
54 |
-
|
55 |
-
function mejs_create_menu() {
|
56 |
-
|
57 |
-
//create new top-level menu
|
58 |
-
add_options_page('MediaElement.js', 'MediaElement.js', 'administrator', __FILE__, 'mejs_settings_page');
|
59 |
-
|
60 |
-
//call register settings function
|
61 |
-
add_action( 'admin_init', 'mejs_register_settings' );
|
62 |
-
}
|
63 |
-
|
64 |
-
|
65 |
-
function mejs_register_settings() {
|
66 |
-
//register our settings
|
67 |
-
register_setting( 'mep_settings', 'mep_video_skin' );
|
68 |
-
|
69 |
-
register_setting( 'mep_settings', 'mep_default_video_height' );
|
70 |
-
register_setting( 'mep_settings', 'mep_default_video_width' );
|
71 |
-
register_setting( 'mep_settings', 'mep_default_video_type' );
|
72 |
-
|
73 |
-
register_setting( 'mep_settings', 'mep_default_audio_height' );
|
74 |
-
register_setting( 'mep_settings', 'mep_default_audio_width' );
|
75 |
-
register_setting( 'mep_settings', 'mep_default_audio_type' );
|
76 |
-
}
|
77 |
-
|
78 |
-
|
79 |
-
function mejs_settings_page() {
|
80 |
-
?>
|
81 |
-
<div class="wrap">
|
82 |
-
<h2>MediaElement.js HTML5 Player Options</h2>
|
83 |
-
|
84 |
-
<p>See <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more details on how the HTML5 player and Flash fallbacks work.</p>
|
85 |
-
|
86 |
-
<form method="post" action="options.php">
|
87 |
-
<?php wp_nonce_field('update-options'); ?>
|
88 |
-
|
89 |
-
|
90 |
-
<h3 class="title"><span>Video Settings</span></h3>
|
91 |
-
|
92 |
-
<table class="form-table">
|
93 |
-
<tr valign="top">
|
94 |
-
<th scope="row">
|
95 |
-
<label for="mep_default_video_width">Default Width</label>
|
96 |
-
</th>
|
97 |
-
<td >
|
98 |
-
<input name="mep_default_video_width" type="text" id="mep_default_video_width" value="<?php echo get_option('mep_default_video_width'); ?>" />
|
99 |
-
</td>
|
100 |
-
</tr>
|
101 |
-
<tr valign="top">
|
102 |
-
<th scope="row">
|
103 |
-
<label for="mep_default_video_height">Default Height</label>
|
104 |
-
</th>
|
105 |
-
<td >
|
106 |
-
<input name="mep_default_video_height" type="text" id="mep_default_video_height" value="<?php echo get_option('mep_default_video_height'); ?>" />
|
107 |
-
</td>
|
108 |
-
</tr>
|
109 |
-
<tr valign="top">
|
110 |
-
<th scope="row">
|
111 |
-
<label for="mep_default_video_type">Default Type</label>
|
112 |
-
</th>
|
113 |
-
<td >
|
114 |
-
<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>
|
115 |
-
</td>
|
116 |
-
</tr>
|
117 |
-
<tr valign="top">
|
118 |
-
<th scope="row">
|
119 |
-
<label for="mep_video_skin">Video Skin</label>
|
120 |
-
</th>
|
121 |
-
<td >
|
122 |
-
<select name="mep_video_skin" id="mep_video_skin">
|
123 |
-
<option value="" <?php echo (get_option('mep_video_skin') == '') ? ' selected' : ''; ?>>Default</option>
|
124 |
-
<option value="wmp" <?php echo (get_option('mep_video_skin') == 'wmp') ? ' selected' : ''; ?>>WMP</option>
|
125 |
-
<option value="ted" <?php echo (get_option('mep_video_skin') == 'ted') ? ' selected' : ''; ?>>TED</option>
|
126 |
-
</select>
|
127 |
-
</td>
|
128 |
-
</tr>
|
129 |
-
</table>
|
130 |
-
|
131 |
-
<h3 class="title"><span>Audio Settings</span></h3>
|
132 |
-
|
133 |
-
|
134 |
-
<table class="form-table">
|
135 |
-
<tr valign="top">
|
136 |
-
<tr valign="top">
|
137 |
-
<th scope="row">
|
138 |
-
<label for="mep_default_audio_width">Default Width</label>
|
139 |
-
</th>
|
140 |
-
<td >
|
141 |
-
<input name="mep_default_audio_width" type="text" id="mep_default_audio_width" value="<?php echo get_option('mep_default_audio_width'); ?>" />
|
142 |
-
</td>
|
143 |
-
</tr>
|
144 |
-
<tr valign="top">
|
145 |
-
<th scope="row">
|
146 |
-
<label for="mep_default_audio_height">Default Height</label>
|
147 |
-
</th>
|
148 |
-
<td >
|
149 |
-
<input name="mep_default_audio_height" type="text" id="mep_default_audio_height" value="<?php echo get_option('mep_default_audio_height'); ?>" />
|
150 |
-
</td>
|
151 |
-
</tr>
|
152 |
-
<th scope="row">
|
153 |
-
<label for="mep_default_audio_type">Default Type</label>
|
154 |
-
</th>
|
155 |
-
<td >
|
156 |
-
<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>
|
157 |
-
</td>
|
158 |
-
</tr>
|
159 |
-
</table>
|
160 |
-
|
161 |
-
<input type="hidden" name="action" value="update" />
|
162 |
-
<input type="hidden" name="page_options" value="mep_default_video_width,mep_default_video_height,mep_default_video_type,mep_default_audio_type,mep_default_audio_width,mep_default_audio_height,mep_video_skin" />
|
163 |
-
|
164 |
-
<p>
|
165 |
-
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
166 |
-
</p>
|
167 |
-
|
168 |
-
</div>
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
</form>
|
173 |
-
</div>
|
174 |
-
<?php
|
175 |
-
}
|
176 |
-
|
177 |
-
|
178 |
-
define('MEDIAELEMENTJS_DIR', WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/');
|
179 |
-
// Javascript
|
180 |
-
function mejs_add_scripts(){
|
181 |
-
if (!is_admin()){
|
182 |
-
// the scripts
|
183 |
-
wp_enqueue_script("mediaelementjs-scripts", MEDIAELEMENTJS_DIR ."mediaelement-and-player.min.js", array('jquery'), "2.1.3", false);
|
184 |
-
}
|
185 |
-
}
|
186 |
-
add_action('wp_print_scripts', 'mejs_add_scripts');
|
187 |
-
|
188 |
-
// css
|
189 |
-
function mejs_add_styles(){
|
190 |
-
if (!is_admin()){
|
191 |
-
// the style
|
192 |
-
wp_enqueue_style("mediaelementjs-styles", MEDIAELEMENTJS_DIR ."mediaelementplayer.css");
|
193 |
-
|
194 |
-
if (get_option('mep_video_skin') != '') {
|
195 |
-
wp_enqueue_style("mediaelementjs-skins", MEDIAELEMENTJS_DIR ."mejs-skins.css");
|
196 |
-
}
|
197 |
-
}
|
198 |
-
}
|
199 |
-
add_action('wp_print_styles', 'mejs_add_styles');
|
200 |
-
|
201 |
-
function mejs_add_header(){
|
202 |
-
/*
|
203 |
-
|
204 |
-
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
|
205 |
-
|
206 |
-
echo <<<_end_
|
207 |
-
<link rel="stylesheet" href="{$dir}mediaelementplayer.min.css" type="text/css" />
|
208 |
-
<script src="{$dir}mediaelement-and-player.min.js" type="text/javascript"></script>
|
209 |
-
_end_;
|
210 |
-
*/
|
211 |
-
|
212 |
-
}
|
213 |
-
|
214 |
-
// If this happens in the <head> tag it fails in iOS. Boo.
|
215 |
-
function mejs_add_footer(){
|
216 |
-
/*
|
217 |
-
$defaultVideoWidth = get_option('mep_default_video_width');
|
218 |
-
$defaultVideoHeight = get_option('mep_default_video_height');
|
219 |
-
|
220 |
-
echo <<<_end_
|
221 |
-
<script type="text/javascript">
|
222 |
-
jQuery(document).ready(function($) {
|
223 |
-
$('video[class=mep],audio[class=mep]').mediaelementplayer({defaultVideoWidth:{$defaultVideoWidth},defaultVideoHeight:{$defaultVideoHeight}});
|
224 |
-
});
|
225 |
-
</script>
|
226 |
-
_end_;
|
227 |
-
*/
|
228 |
-
}
|
229 |
-
|
230 |
-
add_action('wp_head','mejs_add_header');
|
231 |
-
add_action('wp_footer','mejs_add_footer');
|
232 |
-
|
233 |
-
function mejs_media_shortcode($tagName, $atts){
|
234 |
-
|
235 |
-
global $mediaElementPlayerIndex;
|
236 |
-
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
|
237 |
-
|
238 |
-
extract(shortcode_atts(array(
|
239 |
-
'src' => '',
|
240 |
-
'mp4' => '',
|
241 |
-
'mp3' => '',
|
242 |
-
'wmv' => '',
|
243 |
-
'webm' => '',
|
244 |
-
'flv' => '',
|
245 |
-
'ogg' => '',
|
246 |
-
'poster' => '',
|
247 |
-
'width' => get_option('mep_default_'.$tagName.'_width'),
|
248 |
-
'height' => get_option('mep_default_'.$tagName.'_height'),
|
249 |
-
'type' => get_option('mep_default_'.$tagName.'_type'),
|
250 |
-
'preload' => 'none',
|
251 |
-
'skin' => get_option('mep_video_skin'),
|
252 |
-
'autoplay' => '',
|
253 |
-
'loop' => '',
|
254 |
-
|
255 |
-
// old ones
|
256 |
-
'duration' => 'true',
|
257 |
-
'progress' => 'true',
|
258 |
-
'fullscreen' => 'true',
|
259 |
-
'volume' => 'true',
|
260 |
-
|
261 |
-
// captions
|
262 |
-
'captions' => '',
|
263 |
-
'captionslang' => 'en'
|
264 |
-
), $atts));
|
265 |
-
|
266 |
-
if ($type) {
|
267 |
-
$type_attribute = 'type="'.$type.'"';
|
268 |
-
}
|
269 |
-
|
270 |
-
/*
|
271 |
-
if ($src) {
|
272 |
-
$src_attribute = 'src="'.htmlspecialchars($src).'"';
|
273 |
-
$flash_src = htmlspecialchars($src);
|
274 |
-
}
|
275 |
-
*/
|
276 |
-
|
277 |
-
if ($src) {
|
278 |
-
|
279 |
-
// does it have an extension?
|
280 |
-
if (substr($src, strlen($src)-4, 1)=='.') {
|
281 |
-
$src_attribute = 'src="'.htmlspecialchars($src).'"';
|
282 |
-
$flash_src = htmlspecialchars($src);
|
283 |
-
} else {
|
284 |
-
|
285 |
-
// for missing extension, we try to find all possible files in the system
|
286 |
-
|
287 |
-
if (substr($src, 0, 4)!='http')
|
288 |
-
$filename = WP_CONTENT_DIR . substr($src, strlen(WP_CONTENT_DIR)-strrpos(WP_CONTENT_DIR, '/'));
|
289 |
-
else
|
290 |
-
$filename = WP_CONTENT_DIR . substr($src, strlen(WP_CONTENT_URL));
|
291 |
-
|
292 |
-
if ($tagName == 'video') {
|
293 |
-
// MP4
|
294 |
-
if (file_exists($filename.'.mp4')) {
|
295 |
-
$mp4=$src.'.mp4';
|
296 |
-
} elseif (file_exists($filename.'.m4v')) {
|
297 |
-
$mp4=$src.'.m4v';
|
298 |
-
}
|
299 |
-
|
300 |
-
// WEBM
|
301 |
-
if (file_exists($filename.'.webm')) {
|
302 |
-
$webm=$src.'.webm';
|
303 |
-
}
|
304 |
-
|
305 |
-
// OGG
|
306 |
-
if (file_exists($filename.'.ogg')) {
|
307 |
-
$ogg=$src.'.ogg';
|
308 |
-
} elseif (file_exists($filename.'.ogv')) {
|
309 |
-
$ogg=$src.'.ogv';
|
310 |
-
}
|
311 |
-
|
312 |
-
// FLV
|
313 |
-
if (file_exists($filename.'.flv')) {
|
314 |
-
$flv=$src.'.flv';
|
315 |
-
}
|
316 |
-
|
317 |
-
// WMV
|
318 |
-
if (file_exists($filename.'.wmv')) {
|
319 |
-
$wmv=$src.'.wmv';
|
320 |
-
}
|
321 |
-
|
322 |
-
// POSTER
|
323 |
-
if (file_exists($filename.'.jpg')) {
|
324 |
-
$poster=$src.'.jpg';
|
325 |
-
}
|
326 |
-
|
327 |
-
} elseif ($tagName == 'audio') {
|
328 |
-
|
329 |
-
// MP3
|
330 |
-
if (file_exists($filename.'.mp3')) {
|
331 |
-
$mp3=$src.'.mp3';
|
332 |
-
}
|
333 |
-
|
334 |
-
// OGG
|
335 |
-
if (file_exists($filename.'.ogg')) {
|
336 |
-
$ogg=$src.'.ogg';
|
337 |
-
} elseif (file_exists($filename.'.oga')) {
|
338 |
-
$ogg=$src.'.oga';
|
339 |
-
}
|
340 |
-
|
341 |
-
}
|
342 |
-
}
|
343 |
-
}
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
if ($mp4) {
|
348 |
-
$mp4_source = '<source src="'.htmlspecialchars($mp4).'" type="'.$tagName.'/mp4" />';
|
349 |
-
$flash_src = htmlspecialchars($mp4);
|
350 |
-
}
|
351 |
-
|
352 |
-
if ($mp3) {
|
353 |
-
$mp3_source = '<source src="'.htmlspecialchars($mp3).'" type="'.$tagName.'/mp3" />';
|
354 |
-
$flash_src = htmlspecialchars($mp3);
|
355 |
-
}
|
356 |
-
|
357 |
-
if ($webm) {
|
358 |
-
$webm_source = '<source src="'.htmlspecialchars($webm).'" type="'.$tagName.'/webm" />';
|
359 |
-
}
|
360 |
-
|
361 |
-
if ($ogg) {
|
362 |
-
$ogg_source = '<source src="'.htmlspecialchars($ogg).'" type="'.$tagName.'/ogg" />';
|
363 |
-
}
|
364 |
-
|
365 |
-
if ($flv) {
|
366 |
-
$flv_source = '<source src="'.htmlspecialchars($flv).'" type="'.$tagName.'/flv" />';
|
367 |
-
}
|
368 |
-
|
369 |
-
if ($wmv) {
|
370 |
-
$wmv_source = '<source src="'.htmlspecialchars($wmv).'" type="'.$tagName.'/wmv" />';
|
371 |
-
}
|
372 |
-
|
373 |
-
|
374 |
-
if ($captions) {
|
375 |
-
$captions_source = '<track src="'.$captions.'" kind="subtitles" srclang="'.$captionslang.'" />';
|
376 |
-
}
|
377 |
-
|
378 |
-
if ($width && $tagName == 'video') {
|
379 |
-
$width_attribute = 'width="'.$width.'"';
|
380 |
-
}
|
381 |
-
|
382 |
-
if ($height && $tagName == 'video') {
|
383 |
-
$height_attribute = 'height="'.$height.'"';
|
384 |
-
}
|
385 |
-
|
386 |
-
if ($poster) {
|
387 |
-
$poster_attribute = 'poster="'.htmlspecialchars($poster).'"';
|
388 |
-
}
|
389 |
-
|
390 |
-
if ($preload) {
|
391 |
-
$preload_attribute = 'preload="'.$preload.'"';
|
392 |
-
}
|
393 |
-
|
394 |
-
if ($autoplay) {
|
395 |
-
$autoplay_attribute = 'autoplay="'.$autoplay.'"';
|
396 |
-
}
|
397 |
-
|
398 |
-
if ($loop) {
|
399 |
-
$loop_option = ', loop: ' . $loop;
|
400 |
-
}
|
401 |
-
|
402 |
-
// CONTROLS
|
403 |
-
$controls_option = ",features: ['playpause'";
|
404 |
-
if ($progress == 'true')
|
405 |
-
$controls_option .= ",'current','progress'";
|
406 |
-
if ($duration == 'true')
|
407 |
-
$controls_option .= ",'duration'";
|
408 |
-
if ($volume == 'true')
|
409 |
-
$controls_option .= ",'volume'";
|
410 |
-
$controls_option .= ",'tracks'";
|
411 |
-
if ($fullscreen == 'true')
|
412 |
-
$controls_option .= ",'fullscreen'";
|
413 |
-
$controls_option .= "]";
|
414 |
-
|
415 |
-
// AUDIO SIZE
|
416 |
-
$audio_size = '';
|
417 |
-
if ($tagName == 'audio') {
|
418 |
-
$audio_size = ',audioWidth:'.$width.',audioHeight:'.$height;
|
419 |
-
}
|
420 |
-
|
421 |
-
// VIDEO class (skin)
|
422 |
-
$video_skin_attribute = '';
|
423 |
-
if ($skin != '' && $tagName == 'video') {
|
424 |
-
$video_skin_attribute = 'class="mejs-'.$skin.'"';
|
425 |
-
}
|
426 |
-
|
427 |
-
$mediahtml .= <<<_end_
|
428 |
-
<{$tagName} id="wp_mep_{$mediaElementPlayerIndex}" {$src_attribute} {$type_attribute} {$width_attribute} {$height_attribute} {$poster_attribute} controls="controls" {$preload_attribute} {$autoplay_attribute} $video_skin_attribute>
|
429 |
-
{$mp4_source}
|
430 |
-
{$mp3_source}
|
431 |
-
{$webm_source}
|
432 |
-
{$flv_source}
|
433 |
-
{$wmv_source}
|
434 |
-
{$ogg_source}
|
435 |
-
{$captions_source}
|
436 |
-
<object width="{$width}" height="{$height}" type="application/x-shockwave-flash" data="{$dir}flashmediaelement.swf">
|
437 |
-
<param name="movie" value="{$dir}flashmediaelement.swf" />
|
438 |
-
<param name="flashvars" value="controls=true&file={$flash_src}" />
|
439 |
-
</object>
|
440 |
-
</{$tagName}>
|
441 |
-
<script type="text/javascript">
|
442 |
-
jQuery(document).ready(function($) {
|
443 |
-
$('#wp_mep_$mediaElementPlayerIndex').mediaelementplayer({
|
444 |
-
m:1
|
445 |
-
{$loop_option}
|
446 |
-
{$controls_option}
|
447 |
-
{$audio_size}
|
448 |
-
});
|
449 |
-
});
|
450 |
-
</script>
|
451 |
-
|
452 |
-
_end_;
|
453 |
-
|
454 |
-
$mediaElementPlayerIndex++;
|
455 |
-
|
456 |
-
return $mediahtml;
|
457 |
-
}
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
function mejs_audio_shortcode($atts){
|
462 |
-
return mejs_media_shortcode('audio',$atts);
|
463 |
-
}
|
464 |
-
function mejs_video_shortcode($atts){
|
465 |
-
return mejs_media_shortcode('video',$atts);
|
466 |
-
}
|
467 |
-
|
468 |
-
add_shortcode('audio', 'mejs_audio_shortcode');
|
469 |
-
add_shortcode('mejsaudio', 'mejs_audio_shortcode');
|
470 |
-
add_shortcode('video', 'mejs_video_shortcode');
|
471 |
-
add_shortcode('mejsvideo', 'mejs_video_shortcode');
|
472 |
-
|
473 |
-
function mejs_init() {
|
474 |
-
|
475 |
-
wp_enqueue_script( 'jquery' );
|
476 |
-
|
477 |
-
}
|
478 |
-
|
479 |
-
add_action('init', 'mejs_init');
|
480 |
-
|
481 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package MediaElementJS
|
4 |
+
* @version 2.23.5
|
5 |
+
*/
|
6 |
+
|
7 |
+
/*
|
8 |
+
Plugin Name: MediaElement.js - HTML5 Audio and Video
|
9 |
+
Plugin URI: http://mediaelementjs.com/
|
10 |
+
Description: Video and audio plugin for WordPress built on MediaElement.js HTML5 video and audio player library. Embeds media 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
|
11 |
+
Author: John Dyer
|
12 |
+
Version: 2.23.5
|
13 |
+
Author URI: http://j.hn/
|
14 |
+
License: MIT
|
15 |
+
*/
|
16 |
+
|
17 |
+
/*
|
18 |
+
Adapted from: http://videojs.com/ plugin
|
19 |
+
*/
|
20 |
+
|
21 |
+
$mediaElementPlayerIndex = 1;
|
22 |
+
|
23 |
+
/* Runs when plugin is activated */
|
24 |
+
register_activation_hook(__FILE__,'mejs_install');
|
25 |
+
|
26 |
+
function mejs_install() {
|
27 |
+
add_option('mep_video_skin', '');
|
28 |
+
|
29 |
+
add_option('mep_default_video_height', 270);
|
30 |
+
add_option('mep_default_video_width', 480);
|
31 |
+
add_option('mep_default_video_type', '');
|
32 |
+
|
33 |
+
add_option('mep_default_audio_height', 30);
|
34 |
+
add_option('mep_default_audio_width', 400);
|
35 |
+
add_option('mep_default_audio_type', '');
|
36 |
+
}
|
37 |
+
|
38 |
+
/* Runs on plugin deactivation*/
|
39 |
+
register_deactivation_hook( __FILE__, 'mejs_remove' );
|
40 |
+
function mejs_remove() {
|
41 |
+
delete_option('mep_video_skin');
|
42 |
+
|
43 |
+
delete_option('mep_default_video_height');
|
44 |
+
delete_option('mep_default_video_width');
|
45 |
+
delete_option('mep_default_video_type');
|
46 |
+
|
47 |
+
delete_option('mep_default_audio_height');
|
48 |
+
delete_option('mep_default_audio_width');
|
49 |
+
delete_option('mep_default_audio_type');
|
50 |
+
}
|
51 |
+
|
52 |
+
// create custom plugin settings menu
|
53 |
+
add_action('admin_menu', 'mejs_create_menu');
|
54 |
+
|
55 |
+
function mejs_create_menu() {
|
56 |
+
|
57 |
+
//create new top-level menu
|
58 |
+
add_options_page('MediaElement.js', 'MediaElement.js', 'administrator', __FILE__, 'mejs_settings_page');
|
59 |
+
|
60 |
+
//call register settings function
|
61 |
+
add_action( 'admin_init', 'mejs_register_settings' );
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
function mejs_register_settings() {
|
66 |
+
//register our settings
|
67 |
+
register_setting( 'mep_settings', 'mep_video_skin' );
|
68 |
+
|
69 |
+
register_setting( 'mep_settings', 'mep_default_video_height' );
|
70 |
+
register_setting( 'mep_settings', 'mep_default_video_width' );
|
71 |
+
register_setting( 'mep_settings', 'mep_default_video_type' );
|
72 |
+
|
73 |
+
register_setting( 'mep_settings', 'mep_default_audio_height' );
|
74 |
+
register_setting( 'mep_settings', 'mep_default_audio_width' );
|
75 |
+
register_setting( 'mep_settings', 'mep_default_audio_type' );
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
function mejs_settings_page() {
|
80 |
+
?>
|
81 |
+
<div class="wrap">
|
82 |
+
<h2>MediaElement.js HTML5 Player Options</h2>
|
83 |
+
|
84 |
+
<p>See <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more details on how the HTML5 player and Flash fallbacks work.</p>
|
85 |
+
|
86 |
+
<form method="post" action="options.php">
|
87 |
+
<?php wp_nonce_field('update-options'); ?>
|
88 |
+
|
89 |
+
|
90 |
+
<h3 class="title"><span>Video Settings</span></h3>
|
91 |
+
|
92 |
+
<table class="form-table">
|
93 |
+
<tr valign="top">
|
94 |
+
<th scope="row">
|
95 |
+
<label for="mep_default_video_width">Default Width</label>
|
96 |
+
</th>
|
97 |
+
<td >
|
98 |
+
<input name="mep_default_video_width" type="text" id="mep_default_video_width" value="<?php echo get_option('mep_default_video_width'); ?>" />
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
<tr valign="top">
|
102 |
+
<th scope="row">
|
103 |
+
<label for="mep_default_video_height">Default Height</label>
|
104 |
+
</th>
|
105 |
+
<td >
|
106 |
+
<input name="mep_default_video_height" type="text" id="mep_default_video_height" value="<?php echo get_option('mep_default_video_height'); ?>" />
|
107 |
+
</td>
|
108 |
+
</tr>
|
109 |
+
<tr valign="top">
|
110 |
+
<th scope="row">
|
111 |
+
<label for="mep_default_video_type">Default Type</label>
|
112 |
+
</th>
|
113 |
+
<td >
|
114 |
+
<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>
|
115 |
+
</td>
|
116 |
+
</tr>
|
117 |
+
<tr valign="top">
|
118 |
+
<th scope="row">
|
119 |
+
<label for="mep_video_skin">Video Skin</label>
|
120 |
+
</th>
|
121 |
+
<td >
|
122 |
+
<select name="mep_video_skin" id="mep_video_skin">
|
123 |
+
<option value="" <?php echo (get_option('mep_video_skin') == '') ? ' selected' : ''; ?>>Default</option>
|
124 |
+
<option value="wmp" <?php echo (get_option('mep_video_skin') == 'wmp') ? ' selected' : ''; ?>>WMP</option>
|
125 |
+
<option value="ted" <?php echo (get_option('mep_video_skin') == 'ted') ? ' selected' : ''; ?>>TED</option>
|
126 |
+
</select>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
+
</table>
|
130 |
+
|
131 |
+
<h3 class="title"><span>Audio Settings</span></h3>
|
132 |
+
|
133 |
+
|
134 |
+
<table class="form-table">
|
135 |
+
<tr valign="top">
|
136 |
+
<tr valign="top">
|
137 |
+
<th scope="row">
|
138 |
+
<label for="mep_default_audio_width">Default Width</label>
|
139 |
+
</th>
|
140 |
+
<td >
|
141 |
+
<input name="mep_default_audio_width" type="text" id="mep_default_audio_width" value="<?php echo get_option('mep_default_audio_width'); ?>" />
|
142 |
+
</td>
|
143 |
+
</tr>
|
144 |
+
<tr valign="top">
|
145 |
+
<th scope="row">
|
146 |
+
<label for="mep_default_audio_height">Default Height</label>
|
147 |
+
</th>
|
148 |
+
<td >
|
149 |
+
<input name="mep_default_audio_height" type="text" id="mep_default_audio_height" value="<?php echo get_option('mep_default_audio_height'); ?>" />
|
150 |
+
</td>
|
151 |
+
</tr>
|
152 |
+
<th scope="row">
|
153 |
+
<label for="mep_default_audio_type">Default Type</label>
|
154 |
+
</th>
|
155 |
+
<td >
|
156 |
+
<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>
|
157 |
+
</td>
|
158 |
+
</tr>
|
159 |
+
</table>
|
160 |
+
|
161 |
+
<input type="hidden" name="action" value="update" />
|
162 |
+
<input type="hidden" name="page_options" value="mep_default_video_width,mep_default_video_height,mep_default_video_type,mep_default_audio_type,mep_default_audio_width,mep_default_audio_height,mep_video_skin" />
|
163 |
+
|
164 |
+
<p>
|
165 |
+
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
166 |
+
</p>
|
167 |
+
|
168 |
+
</div>
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
</form>
|
173 |
+
</div>
|
174 |
+
<?php
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
define('MEDIAELEMENTJS_DIR', WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/');
|
179 |
+
// Javascript
|
180 |
+
function mejs_add_scripts(){
|
181 |
+
if (!is_admin()){
|
182 |
+
// the scripts
|
183 |
+
wp_enqueue_script("mediaelementjs-scripts", MEDIAELEMENTJS_DIR ."mediaelement-and-player.min.js", array('jquery'), "2.1.3", false);
|
184 |
+
}
|
185 |
+
}
|
186 |
+
add_action('wp_print_scripts', 'mejs_add_scripts');
|
187 |
+
|
188 |
+
// css
|
189 |
+
function mejs_add_styles(){
|
190 |
+
if (!is_admin()){
|
191 |
+
// the style
|
192 |
+
wp_enqueue_style("mediaelementjs-styles", MEDIAELEMENTJS_DIR ."mediaelementplayer.css");
|
193 |
+
|
194 |
+
if (get_option('mep_video_skin') != '') {
|
195 |
+
wp_enqueue_style("mediaelementjs-skins", MEDIAELEMENTJS_DIR ."mejs-skins.css");
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
add_action('wp_print_styles', 'mejs_add_styles');
|
200 |
+
|
201 |
+
function mejs_add_header(){
|
202 |
+
/*
|
203 |
+
|
204 |
+
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
|
205 |
+
|
206 |
+
echo <<<_end_
|
207 |
+
<link rel="stylesheet" href="{$dir}mediaelementplayer.min.css" type="text/css" />
|
208 |
+
<script src="{$dir}mediaelement-and-player.min.js" type="text/javascript"></script>
|
209 |
+
_end_;
|
210 |
+
*/
|
211 |
+
|
212 |
+
}
|
213 |
+
|
214 |
+
// If this happens in the <head> tag it fails in iOS. Boo.
|
215 |
+
function mejs_add_footer(){
|
216 |
+
/*
|
217 |
+
$defaultVideoWidth = get_option('mep_default_video_width');
|
218 |
+
$defaultVideoHeight = get_option('mep_default_video_height');
|
219 |
+
|
220 |
+
echo <<<_end_
|
221 |
+
<script type="text/javascript">
|
222 |
+
jQuery(document).ready(function($) {
|
223 |
+
$('video[class=mep],audio[class=mep]').mediaelementplayer({defaultVideoWidth:{$defaultVideoWidth},defaultVideoHeight:{$defaultVideoHeight}});
|
224 |
+
});
|
225 |
+
</script>
|
226 |
+
_end_;
|
227 |
+
*/
|
228 |
+
}
|
229 |
+
|
230 |
+
add_action('wp_head','mejs_add_header');
|
231 |
+
add_action('wp_footer','mejs_add_footer');
|
232 |
+
|
233 |
+
function mejs_media_shortcode($tagName, $atts){
|
234 |
+
|
235 |
+
global $mediaElementPlayerIndex;
|
236 |
+
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
|
237 |
+
|
238 |
+
extract(shortcode_atts(array(
|
239 |
+
'src' => '',
|
240 |
+
'mp4' => '',
|
241 |
+
'mp3' => '',
|
242 |
+
'wmv' => '',
|
243 |
+
'webm' => '',
|
244 |
+
'flv' => '',
|
245 |
+
'ogg' => '',
|
246 |
+
'poster' => '',
|
247 |
+
'width' => get_option('mep_default_'.$tagName.'_width'),
|
248 |
+
'height' => get_option('mep_default_'.$tagName.'_height'),
|
249 |
+
'type' => get_option('mep_default_'.$tagName.'_type'),
|
250 |
+
'preload' => 'none',
|
251 |
+
'skin' => get_option('mep_video_skin'),
|
252 |
+
'autoplay' => '',
|
253 |
+
'loop' => '',
|
254 |
+
|
255 |
+
// old ones
|
256 |
+
'duration' => 'true',
|
257 |
+
'progress' => 'true',
|
258 |
+
'fullscreen' => 'true',
|
259 |
+
'volume' => 'true',
|
260 |
+
|
261 |
+
// captions
|
262 |
+
'captions' => '',
|
263 |
+
'captionslang' => 'en'
|
264 |
+
), $atts));
|
265 |
+
|
266 |
+
if ($type) {
|
267 |
+
$type_attribute = 'type="'.$type.'"';
|
268 |
+
}
|
269 |
+
|
270 |
+
/*
|
271 |
+
if ($src) {
|
272 |
+
$src_attribute = 'src="'.htmlspecialchars($src).'"';
|
273 |
+
$flash_src = htmlspecialchars($src);
|
274 |
+
}
|
275 |
+
*/
|
276 |
+
|
277 |
+
if ($src) {
|
278 |
+
|
279 |
+
// does it have an extension?
|
280 |
+
if (substr($src, strlen($src)-4, 1)=='.') {
|
281 |
+
$src_attribute = 'src="'.htmlspecialchars($src).'"';
|
282 |
+
$flash_src = htmlspecialchars($src);
|
283 |
+
} else {
|
284 |
+
|
285 |
+
// for missing extension, we try to find all possible files in the system
|
286 |
+
|
287 |
+
if (substr($src, 0, 4)!='http')
|
288 |
+
$filename = WP_CONTENT_DIR . substr($src, strlen(WP_CONTENT_DIR)-strrpos(WP_CONTENT_DIR, '/'));
|
289 |
+
else
|
290 |
+
$filename = WP_CONTENT_DIR . substr($src, strlen(WP_CONTENT_URL));
|
291 |
+
|
292 |
+
if ($tagName == 'video') {
|
293 |
+
// MP4
|
294 |
+
if (file_exists($filename.'.mp4')) {
|
295 |
+
$mp4=$src.'.mp4';
|
296 |
+
} elseif (file_exists($filename.'.m4v')) {
|
297 |
+
$mp4=$src.'.m4v';
|
298 |
+
}
|
299 |
+
|
300 |
+
// WEBM
|
301 |
+
if (file_exists($filename.'.webm')) {
|
302 |
+
$webm=$src.'.webm';
|
303 |
+
}
|
304 |
+
|
305 |
+
// OGG
|
306 |
+
if (file_exists($filename.'.ogg')) {
|
307 |
+
$ogg=$src.'.ogg';
|
308 |
+
} elseif (file_exists($filename.'.ogv')) {
|
309 |
+
$ogg=$src.'.ogv';
|
310 |
+
}
|
311 |
+
|
312 |
+
// FLV
|
313 |
+
if (file_exists($filename.'.flv')) {
|
314 |
+
$flv=$src.'.flv';
|
315 |
+
}
|
316 |
+
|
317 |
+
// WMV
|
318 |
+
if (file_exists($filename.'.wmv')) {
|
319 |
+
$wmv=$src.'.wmv';
|
320 |
+
}
|
321 |
+
|
322 |
+
// POSTER
|
323 |
+
if (file_exists($filename.'.jpg')) {
|
324 |
+
$poster=$src.'.jpg';
|
325 |
+
}
|
326 |
+
|
327 |
+
} elseif ($tagName == 'audio') {
|
328 |
+
|
329 |
+
// MP3
|
330 |
+
if (file_exists($filename.'.mp3')) {
|
331 |
+
$mp3=$src.'.mp3';
|
332 |
+
}
|
333 |
+
|
334 |
+
// OGG
|
335 |
+
if (file_exists($filename.'.ogg')) {
|
336 |
+
$ogg=$src.'.ogg';
|
337 |
+
} elseif (file_exists($filename.'.oga')) {
|
338 |
+
$ogg=$src.'.oga';
|
339 |
+
}
|
340 |
+
|
341 |
+
}
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
|
346 |
+
|
347 |
+
if ($mp4) {
|
348 |
+
$mp4_source = '<source src="'.htmlspecialchars($mp4).'" type="'.$tagName.'/mp4" />';
|
349 |
+
$flash_src = htmlspecialchars($mp4);
|
350 |
+
}
|
351 |
+
|
352 |
+
if ($mp3) {
|
353 |
+
$mp3_source = '<source src="'.htmlspecialchars($mp3).'" type="'.$tagName.'/mp3" />';
|
354 |
+
$flash_src = htmlspecialchars($mp3);
|
355 |
+
}
|
356 |
+
|
357 |
+
if ($webm) {
|
358 |
+
$webm_source = '<source src="'.htmlspecialchars($webm).'" type="'.$tagName.'/webm" />';
|
359 |
+
}
|
360 |
+
|
361 |
+
if ($ogg) {
|
362 |
+
$ogg_source = '<source src="'.htmlspecialchars($ogg).'" type="'.$tagName.'/ogg" />';
|
363 |
+
}
|
364 |
+
|
365 |
+
if ($flv) {
|
366 |
+
$flv_source = '<source src="'.htmlspecialchars($flv).'" type="'.$tagName.'/flv" />';
|
367 |
+
}
|
368 |
+
|
369 |
+
if ($wmv) {
|
370 |
+
$wmv_source = '<source src="'.htmlspecialchars($wmv).'" type="'.$tagName.'/wmv" />';
|
371 |
+
}
|
372 |
+
|
373 |
+
|
374 |
+
if ($captions) {
|
375 |
+
$captions_source = '<track src="'.$captions.'" kind="subtitles" srclang="'.$captionslang.'" />';
|
376 |
+
}
|
377 |
+
|
378 |
+
if ($width && $tagName == 'video') {
|
379 |
+
$width_attribute = 'width="'.$width.'"';
|
380 |
+
}
|
381 |
+
|
382 |
+
if ($height && $tagName == 'video') {
|
383 |
+
$height_attribute = 'height="'.$height.'"';
|
384 |
+
}
|
385 |
+
|
386 |
+
if ($poster) {
|
387 |
+
$poster_attribute = 'poster="'.htmlspecialchars($poster).'"';
|
388 |
+
}
|
389 |
+
|
390 |
+
if ($preload) {
|
391 |
+
$preload_attribute = 'preload="'.$preload.'"';
|
392 |
+
}
|
393 |
+
|
394 |
+
if ($autoplay) {
|
395 |
+
$autoplay_attribute = 'autoplay="'.$autoplay.'"';
|
396 |
+
}
|
397 |
+
|
398 |
+
if ($loop) {
|
399 |
+
$loop_option = ', loop: ' . $loop;
|
400 |
+
}
|
401 |
+
|
402 |
+
// CONTROLS
|
403 |
+
$controls_option = ",features: ['playpause'";
|
404 |
+
if ($progress == 'true')
|
405 |
+
$controls_option .= ",'current','progress'";
|
406 |
+
if ($duration == 'true')
|
407 |
+
$controls_option .= ",'duration'";
|
408 |
+
if ($volume == 'true')
|
409 |
+
$controls_option .= ",'volume'";
|
410 |
+
$controls_option .= ",'tracks'";
|
411 |
+
if ($fullscreen == 'true')
|
412 |
+
$controls_option .= ",'fullscreen'";
|
413 |
+
$controls_option .= "]";
|
414 |
+
|
415 |
+
// AUDIO SIZE
|
416 |
+
$audio_size = '';
|
417 |
+
if ($tagName == 'audio') {
|
418 |
+
$audio_size = ',audioWidth:'.$width.',audioHeight:'.$height;
|
419 |
+
}
|
420 |
+
|
421 |
+
// VIDEO class (skin)
|
422 |
+
$video_skin_attribute = '';
|
423 |
+
if ($skin != '' && $tagName == 'video') {
|
424 |
+
$video_skin_attribute = 'class="mejs-'.$skin.'"';
|
425 |
+
}
|
426 |
+
|
427 |
+
$mediahtml .= <<<_end_
|
428 |
+
<{$tagName} id="wp_mep_{$mediaElementPlayerIndex}" {$src_attribute} {$type_attribute} {$width_attribute} {$height_attribute} {$poster_attribute} controls="controls" {$preload_attribute} {$autoplay_attribute} $video_skin_attribute>
|
429 |
+
{$mp4_source}
|
430 |
+
{$mp3_source}
|
431 |
+
{$webm_source}
|
432 |
+
{$flv_source}
|
433 |
+
{$wmv_source}
|
434 |
+
{$ogg_source}
|
435 |
+
{$captions_source}
|
436 |
+
<object width="{$width}" height="{$height}" type="application/x-shockwave-flash" data="{$dir}flashmediaelement.swf">
|
437 |
+
<param name="movie" value="{$dir}flashmediaelement.swf" />
|
438 |
+
<param name="flashvars" value="controls=true&file={$flash_src}" />
|
439 |
+
</object>
|
440 |
+
</{$tagName}>
|
441 |
+
<script type="text/javascript">
|
442 |
+
jQuery(document).ready(function($) {
|
443 |
+
$('#wp_mep_$mediaElementPlayerIndex').mediaelementplayer({
|
444 |
+
m:1
|
445 |
+
{$loop_option}
|
446 |
+
{$controls_option}
|
447 |
+
{$audio_size}
|
448 |
+
});
|
449 |
+
});
|
450 |
+
</script>
|
451 |
+
|
452 |
+
_end_;
|
453 |
+
|
454 |
+
$mediaElementPlayerIndex++;
|
455 |
+
|
456 |
+
return $mediahtml;
|
457 |
+
}
|
458 |
+
|
459 |
+
|
460 |
+
|
461 |
+
function mejs_audio_shortcode($atts){
|
462 |
+
return mejs_media_shortcode('audio',$atts);
|
463 |
+
}
|
464 |
+
function mejs_video_shortcode($atts){
|
465 |
+
return mejs_media_shortcode('video',$atts);
|
466 |
+
}
|
467 |
+
|
468 |
+
add_shortcode('audio', 'mejs_audio_shortcode');
|
469 |
+
add_shortcode('mejsaudio', 'mejs_audio_shortcode');
|
470 |
+
add_shortcode('video', 'mejs_video_shortcode');
|
471 |
+
add_shortcode('mejsvideo', 'mejs_video_shortcode');
|
472 |
+
|
473 |
+
function mejs_init() {
|
474 |
+
|
475 |
+
wp_enqueue_script( 'jquery' );
|
476 |
+
|
477 |
+
}
|
478 |
+
|
479 |
+
add_action('init', 'mejs_init');
|
480 |
+
|
481 |
+
?>
|
mediaelement/background.png
CHANGED
File without changes
|
mediaelement/bigplay.png
CHANGED
File without changes
|
mediaelement/controls-ted.png
CHANGED
Binary file
|
mediaelement/controls-wmp-bg.png
CHANGED
Binary file
|
mediaelement/controls-wmp.png
CHANGED
Binary file
|
mediaelement/controls.png
CHANGED
File without changes
|
mediaelement/controls.svg
CHANGED
@@ -1 +1,172 @@
|
|
1 |
-
<?xml version="1.0" standalone="no"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!-- Generator: Adobe Fireworks CS6, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 -->
|
3 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4 |
+
<svg id="controls.fw-Page%201" viewBox="0 0 144 32" style="background-color:#ffffff00" version="1.1"
|
5 |
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
|
6 |
+
x="0px" y="0px" width="144px" height="32px"
|
7 |
+
>
|
8 |
+
<defs>
|
9 |
+
<radialGradient id="gradient1" cx="50%" cy="50%" r="50%">
|
10 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
11 |
+
<stop stop-color="#f2f2f2" stop-opacity="0.2" offset="100%"/>
|
12 |
+
</radialGradient>
|
13 |
+
<linearGradient id="gradient2" x1="50%" y1="-7.8652%" x2="50%" y2="249.6629%">
|
14 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
15 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
16 |
+
</linearGradient>
|
17 |
+
<linearGradient id="gradient3" x1="50%" y1="0%" x2="50%" y2="238.75%">
|
18 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
19 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
20 |
+
</linearGradient>
|
21 |
+
<linearGradient id="gradient4" x1="50%" y1="0%" x2="50%" y2="100%">
|
22 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
23 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
24 |
+
</linearGradient>
|
25 |
+
<linearGradient id="gradient5" x1="50%" y1="-33.3333%" x2="50%" y2="152.0833%">
|
26 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
27 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
28 |
+
</linearGradient>
|
29 |
+
<linearGradient id="gradient6" x1="50%" y1="0%" x2="50%" y2="100%">
|
30 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
31 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
32 |
+
</linearGradient>
|
33 |
+
<linearGradient id="gradient7" x1="50%" y1="-33.3333%" x2="50%" y2="152.0833%">
|
34 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
35 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
36 |
+
</linearGradient>
|
37 |
+
<linearGradient id="gradient8" x1="50%" y1="0%" x2="50%" y2="100%">
|
38 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
39 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
40 |
+
</linearGradient>
|
41 |
+
<linearGradient id="gradient9" x1="50%" y1="0%" x2="50%" y2="100%">
|
42 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
43 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
44 |
+
</linearGradient>
|
45 |
+
<linearGradient id="gradient10" x1="50%" y1="0%" x2="50%" y2="100%">
|
46 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
47 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
48 |
+
</linearGradient>
|
49 |
+
<linearGradient id="gradient11" x1="50%" y1="0%" x2="50%" y2="100%">
|
50 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
51 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
52 |
+
</linearGradient>
|
53 |
+
<linearGradient id="gradient12" x1="50%" y1="0%" x2="50%" y2="238.75%">
|
54 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
55 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
56 |
+
</linearGradient>
|
57 |
+
<linearGradient id="gradient13" x1="40%" y1="-140%" x2="40%" y2="98.75%">
|
58 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
59 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
60 |
+
</linearGradient>
|
61 |
+
<linearGradient id="gradient14" x1="50%" y1="0%" x2="50%" y2="238.75%">
|
62 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
63 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
64 |
+
</linearGradient>
|
65 |
+
<linearGradient id="gradient15" x1="60%" y1="-140%" x2="60%" y2="98.75%">
|
66 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
67 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
68 |
+
</linearGradient>
|
69 |
+
<linearGradient id="gradient16" x1="50%" y1="0%" x2="50%" y2="298.4375%">
|
70 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
71 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
72 |
+
</linearGradient>
|
73 |
+
<linearGradient id="gradient17" x1="50%" y1="0%" x2="50%" y2="238.75%">
|
74 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
75 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
76 |
+
</linearGradient>
|
77 |
+
<linearGradient id="gradient18" x1="50%" y1="-200%" x2="50%" y2="100%">
|
78 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
79 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
80 |
+
</linearGradient>
|
81 |
+
<linearGradient id="gradient19" x1="50%" y1="-200%" x2="50%" y2="110.9375%">
|
82 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
83 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
84 |
+
</linearGradient>
|
85 |
+
<linearGradient id="gradient20" x1="55%" y1="0%" x2="55%" y2="100%">
|
86 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
87 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
|
88 |
+
</linearGradient>
|
89 |
+
<linearGradient id="gradient21" x1="50%" y1="0%" x2="50%" y2="100%">
|
90 |
+
<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
|
91 |
+
<stop stop-color="#c8c8c8" stop-opacity="1" offset="99.4444%"/>
|
92 |
+
</linearGradient>
|
93 |
+
</defs>
|
94 |
+
<g id="BG">
|
95 |
+
</g>
|
96 |
+
<g id="controls">
|
97 |
+
<path id="Line" d="M 98.5 7.5 L 109.5 7.5 " stroke="#ffffff" stroke-width="1" fill="none"/>
|
98 |
+
<path id="Line2" d="M 98.5 3.5 L 109.5 3.5 " stroke="#ffffff" stroke-width="1" fill="none"/>
|
99 |
+
<path id="Line3" d="M 98.5 11.5 L 109.5 11.5 " stroke="#ffffff" stroke-width="1" fill="none"/>
|
100 |
+
<path id="Ellipse" d="M 108 11.5 C 108 10.6716 108.4477 10 109 10 C 109.5523 10 110 10.6716 110 11.5 C 110 12.3284 109.5523 13 109 13 C 108.4477 13 108 12.3284 108 11.5 Z" fill="#ffffff"/>
|
101 |
+
<path id="Ellipse2" d="M 104 7.5 C 104 6.6716 104.4477 6 105 6 C 105.5523 6 106 6.6716 106 7.5 C 106 8.3284 105.5523 9 105 9 C 104.4477 9 104 8.3284 104 7.5 Z" fill="#ffffff"/>
|
102 |
+
<path id="Ellipse3" d="M 108 3.5 C 108 2.6716 108.4477 2 109 2 C 109.5523 2 110 2.6716 110 3.5 C 110 4.3284 109.5523 5 109 5 C 108.4477 5 108 4.3284 108 3.5 Z" fill="#ffffff"/>
|
103 |
+
</g>
|
104 |
+
<g id="backlight">
|
105 |
+
<g id="off">
|
106 |
+
<rect x="83" y="21" width="10" height="6" stroke="#ffffff" stroke-width="1" fill="#333333"/>
|
107 |
+
</g>
|
108 |
+
<g id="on">
|
109 |
+
<path id="Ellipse4" d="M 81 8 C 81 5.2385 84.134 3 88 3 C 91.866 3 95 5.2385 95 8 C 95 10.7615 91.866 13 88 13 C 84.134 13 81 10.7615 81 8 Z" fill="url(#gradient1)"/>
|
110 |
+
<rect x="83" y="5" width="10" height="6" stroke="#ffffff" stroke-width="1" fill="#333333"/>
|
111 |
+
</g>
|
112 |
+
</g>
|
113 |
+
<g id="loop">
|
114 |
+
<g id="on2">
|
115 |
+
<path d="M 73.795 4.205 C 75.2155 4.8785 76.2 6.3234 76.2 8 C 76.2 10.3196 74.3196 12.2 72 12.2 C 69.6804 12.2 67.8 10.3196 67.8 8 C 67.8 6.3234 68.7845 4.8785 70.205 4.205 L 68.875 2.875 C 67.1501 3.9289 66 5.8306 66 8 C 66 11.3138 68.6862 14 72 14 C 75.3138 14 78 11.3138 78 8 C 78 5.8306 76.8499 3.9289 75.125 2.875 L 73.795 4.205 Z" fill="url(#gradient2)"/>
|
116 |
+
<path d="M 71 2 L 66 2 L 71 7 L 71 2 Z" fill="url(#gradient3)"/>
|
117 |
+
</g>
|
118 |
+
<g id="off2">
|
119 |
+
<path d="M 73.795 20.205 C 75.2155 20.8785 76.2 22.3234 76.2 24 C 76.2 26.3196 74.3196 28.2 72 28.2 C 69.6804 28.2 67.8 26.3196 67.8 24 C 67.8 22.3234 68.7845 20.8785 70.205 20.205 L 68.875 18.875 C 67.1501 19.9289 66 21.8306 66 24 C 66 27.3138 68.6862 30 72 30 C 75.3138 30 78 27.3138 78 24 C 78 21.8306 76.8499 19.9289 75.125 18.875 L 73.795 20.205 Z" fill="#a8a8b7"/>
|
120 |
+
<path d="M 71 18 L 66 18 L 71 23 L 71 18 Z" fill="#a8a8b7"/>
|
121 |
+
</g>
|
122 |
+
</g>
|
123 |
+
<g id="cc">
|
124 |
+
<rect visibility="hidden" x="49" y="2" width="14" height="12" stroke="#b0b0b0" stroke-width="1" fill="none"/>
|
125 |
+
<text visibility="hidden" x="49" y="17" width="14" fill="#ffffff" style="font-size: 10px; color: #ffffff; font-family: Arial; text-align: center; "><tspan><![CDATA[cc]]></tspan></text>
|
126 |
+
<path d="M 55 7 C 50.2813 3.7813 50.063 12.9405 55 10 " stroke="#ffffff" stroke-width="1" fill="none"/>
|
127 |
+
<path d="M 60 7 C 55.2813 3.7813 55.063 12.9405 60 10 " stroke="#ffffff" stroke-width="1" fill="none"/>
|
128 |
+
<path d="M 50 3 L 62 3 L 62 13 L 50 13 L 50 3 ZM 49 2 L 49 14 L 63 14 L 63 2 L 49 2 Z" fill="url(#gradient4)"/>
|
129 |
+
<rect x="49" y="2" width="14" height="12" fill="none"/>
|
130 |
+
</g>
|
131 |
+
<g id="volume">
|
132 |
+
<g id="no%20sound">
|
133 |
+
<rect x="17" y="5" width="5" height="6" fill="url(#gradient5)"/>
|
134 |
+
<path d="M 21 5 L 25 2 L 25 14 L 21 11.0625 L 21 5 Z" fill="url(#gradient6)"/>
|
135 |
+
</g>
|
136 |
+
<g id="sound%20bars">
|
137 |
+
<rect x="17" y="21" width="5" height="6" fill="url(#gradient7)"/>
|
138 |
+
<path d="M 21 21 L 25 18 L 25 30 L 21 27.0625 L 21 21 Z" fill="url(#gradient8)"/>
|
139 |
+
<path d="M 27 18 C 27 18 30.0625 17.375 30 24 C 29.9375 30.625 27 30 27 30 " stroke="#ffffff" stroke-width="1" fill="none"/>
|
140 |
+
<path d="M 26 21.0079 C 26 21.0079 28.041 20.6962 27.9994 24 C 27.9577 27.3038 26 26.9921 26 26.9921 " stroke="#ffffff" stroke-width="1" fill="none"/>
|
141 |
+
</g>
|
142 |
+
</g>
|
143 |
+
<g id="play/pause">
|
144 |
+
<g id="play">
|
145 |
+
<path id="Polygon" d="M 14 8.5 L 3 14 L 3 3 L 14 8.5 Z" fill="url(#gradient9)"/>
|
146 |
+
</g>
|
147 |
+
<g id="pause">
|
148 |
+
<rect x="3" y="18" width="3" height="12" fill="url(#gradient10)"/>
|
149 |
+
<rect x="10" y="18" width="3" height="12" fill="url(#gradient11)"/>
|
150 |
+
</g>
|
151 |
+
</g>
|
152 |
+
<g id="fullscreen">
|
153 |
+
<g id="enter%201">
|
154 |
+
<path d="M 34 2 L 39 2 L 34 7 L 34 2 Z" fill="url(#gradient12)"/>
|
155 |
+
<path d="M 34 14 L 39 14 L 34 9 L 34 14 Z" fill="url(#gradient13)"/>
|
156 |
+
<path d="M 46 2 L 41 2 L 46 7 L 46 2 Z" fill="url(#gradient14)"/>
|
157 |
+
<path d="M 46 14 L 41 14 L 46 9 L 46 14 Z" fill="url(#gradient15)"/>
|
158 |
+
</g>
|
159 |
+
<g id="exit">
|
160 |
+
<path d="M 42 22 L 46 22 L 42 18 L 42 22 Z" fill="url(#gradient16)"/>
|
161 |
+
<path d="M 38 22 L 38 18 L 34 22 L 38 22 Z" fill="url(#gradient17)"/>
|
162 |
+
<path d="M 38 26 L 34 26 L 38 30 L 38 26 Z" fill="url(#gradient18)"/>
|
163 |
+
<path d="M 42 26 L 42 30 L 46 26 L 42 26 Z" fill="url(#gradient19)"/>
|
164 |
+
</g>
|
165 |
+
</g>
|
166 |
+
<g id="stop">
|
167 |
+
<rect x="115" y="3" width="10" height="10" fill="url(#gradient20)"/>
|
168 |
+
</g>
|
169 |
+
<g id="chooser">
|
170 |
+
<path d="M 135.2346 6.1522 C 136.2551 5.7295 137.4251 6.2141 137.8478 7.2346 C 138.2704 8.2551 137.7859 9.425 136.7654 9.8478 C 135.7449 10.2705 134.5749 9.7859 134.1522 8.7654 C 133.7295 7.7449 134.2141 6.5749 135.2346 6.1522 ZM 133.2735 1.4176 L 136 4.0054 L 138.7265 1.4176 L 138.8246 5.1754 L 142.5824 5.2735 L 139.9946 8 L 142.5824 10.7265 L 138.8246 10.8246 L 138.7265 14.5824 L 136 11.9946 L 133.2735 14.5824 L 133.1754 10.8246 L 129.4176 10.7265 L 132.0054 8 L 129.4176 5.2735 L 133.1754 5.1754 L 133.2735 1.4176 Z" fill="url(#gradient21)"/>
|
171 |
+
</g>
|
172 |
+
</svg>
|
mediaelement/flashmediaelement.swf
CHANGED
Binary file
|
mediaelement/loading.gif
CHANGED
File without changes
|
mediaelement/mediaelement-and-player.js
CHANGED
@@ -1,21 +1,23 @@
|
|
1 |
/*!
|
2 |
-
*
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
|
|
|
14 |
// Namespace
|
15 |
var mejs = mejs || {};
|
16 |
|
17 |
// version number
|
18 |
-
mejs.version = '2.
|
|
|
19 |
|
20 |
// player number (for missing, same id attr)
|
21 |
mejs.meIndex = 0;
|
@@ -26,11 +28,12 @@ mejs.plugins = {
|
|
26 |
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','audio/mpeg']}
|
27 |
],
|
28 |
flash: [
|
29 |
-
{version: [9,0,124], types: ['video/mp4','video/m4v','video/mov','video/flv','video/rtmp','video/x-flv','audio/flv','audio/x-flv','audio/mp3','audio/m4a','audio/mpeg', 'video/
|
30 |
-
|
|
|
31 |
],
|
32 |
youtube: [
|
33 |
-
{version: null, types: ['video/youtube', 'video/x-youtube']}
|
34 |
],
|
35 |
vimeo: [
|
36 |
{version: null, types: ['video/vimeo', 'video/x-vimeo']}
|
@@ -56,47 +59,165 @@ mejs.Utility = {
|
|
56 |
var
|
57 |
i = 0,
|
58 |
j,
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
scripts = document.getElementsByTagName('script'),
|
63 |
il = scripts.length,
|
64 |
jl = scriptNames.length;
|
65 |
-
|
|
|
66 |
for (; i < il; i++) {
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
for (j = 0; j < jl; j++) {
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
72 |
break;
|
73 |
}
|
74 |
}
|
75 |
-
|
|
|
|
|
76 |
break;
|
77 |
}
|
78 |
}
|
79 |
-
|
|
|
|
|
80 |
},
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
fps = 25;
|
87 |
}
|
88 |
-
|
89 |
-
var
|
|
|
|
|
|
|
|
|
|
|
90 |
minutes = Math.floor(time / 60) % 60,
|
91 |
seconds = Math.floor(time % 60),
|
92 |
frames = Math.floor(((time % 1)*fps).toFixed(3)),
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
},
|
101 |
|
102 |
timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
|
@@ -148,7 +269,7 @@ mejs.Utility = {
|
|
148 |
/* borrowed from SWFObject: http://code.google.com/p/swfobject/source/browse/trunk/swfobject/src/swfobject.js#474 */
|
149 |
removeSwf: function(id) {
|
150 |
var obj = document.getElementById(id);
|
151 |
-
if (obj && obj.nodeName
|
152 |
if (mejs.MediaFeatures.isIE) {
|
153 |
obj.style.display = "none";
|
154 |
(function(){
|
@@ -173,6 +294,42 @@ mejs.Utility = {
|
|
173 |
}
|
174 |
obj.parentNode.removeChild(obj);
|
175 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
};
|
178 |
|
@@ -296,83 +453,145 @@ mejs.MediaFeatures = {
|
|
296 |
t.isiOS = t.isiPhone || t.isiPad;
|
297 |
t.isAndroid = (ua.match(/android/i) !== null);
|
298 |
t.isBustedAndroid = (ua.match(/android 2\.[12]/) !== null);
|
299 |
-
t.
|
|
|
300 |
t.isChrome = (ua.match(/chrome/gi) !== null);
|
|
|
301 |
t.isFirefox = (ua.match(/firefox/gi) !== null);
|
302 |
t.isWebkit = (ua.match(/webkit/gi) !== null);
|
303 |
-
t.isGecko = (ua.match(/gecko/gi) !== null) && !t.isWebkit;
|
304 |
t.isOpera = (ua.match(/opera/gi) !== null);
|
305 |
-
t.hasTouch = ('ontouchstart' in window);
|
306 |
-
|
307 |
-
//
|
308 |
-
|
309 |
-
|
|
|
310 |
|
311 |
// create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
|
312 |
for (i=0; i<html5Elements.length; i++) {
|
313 |
v = document.createElement(html5Elements[i]);
|
314 |
}
|
315 |
-
|
316 |
t.supportsMediaTag = (typeof v.canPlayType !== 'undefined' || t.isBustedAndroid);
|
317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
// detect native JavaScript fullscreen (Safari/Firefox only, Chrome still fails)
|
319 |
-
|
320 |
// iOS
|
321 |
-
t.
|
322 |
-
|
323 |
-
//
|
|
|
|
|
|
|
324 |
t.hasWebkitNativeFullScreen = (typeof v.webkitRequestFullScreen !== 'undefined');
|
325 |
t.hasMozNativeFullScreen = (typeof v.mozRequestFullScreen !== 'undefined');
|
326 |
-
|
327 |
-
|
|
|
328 |
t.nativeFullScreenEnabled = t.hasTrueNativeFullScreen;
|
|
|
|
|
329 |
if (t.hasMozNativeFullScreen) {
|
330 |
-
t.nativeFullScreenEnabled =
|
|
|
|
|
331 |
}
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
t.hasSemiNativeFullScreen = false;
|
336 |
}
|
337 |
-
|
338 |
if (t.hasTrueNativeFullScreen) {
|
339 |
-
|
340 |
-
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
t.isFullScreen = function() {
|
343 |
-
if (
|
344 |
return d.mozFullScreen;
|
345 |
-
|
|
|
346 |
return d.webkitIsFullScreen;
|
|
|
|
|
|
|
347 |
}
|
348 |
}
|
349 |
-
|
350 |
t.requestFullScreen = function(el) {
|
351 |
-
|
352 |
if (t.hasWebkitNativeFullScreen) {
|
353 |
el.webkitRequestFullScreen();
|
|
|
354 |
} else if (t.hasMozNativeFullScreen) {
|
355 |
el.mozRequestFullScreen();
|
|
|
|
|
|
|
|
|
356 |
}
|
357 |
}
|
358 |
-
|
359 |
-
t.cancelFullScreen = function() {
|
360 |
if (t.hasWebkitNativeFullScreen) {
|
361 |
document.webkitCancelFullScreen();
|
|
|
362 |
} else if (t.hasMozNativeFullScreen) {
|
363 |
document.mozCancelFullScreen();
|
|
|
|
|
|
|
|
|
364 |
}
|
365 |
-
}
|
366 |
-
|
367 |
}
|
368 |
-
|
369 |
-
|
370 |
// OS X 10.5 can't do this even if it says it can :(
|
371 |
-
if (t.
|
372 |
t.hasNativeFullScreen = false;
|
373 |
-
t.
|
374 |
}
|
375 |
-
|
376 |
}
|
377 |
};
|
378 |
mejs.MediaFeatures.init();
|
@@ -476,7 +695,7 @@ mejs.PluginMediaElement.prototype = {
|
|
476 |
// HTML5 methods
|
477 |
play: function () {
|
478 |
if (this.pluginApi != null) {
|
479 |
-
if (this.pluginType == 'youtube') {
|
480 |
this.pluginApi.playVideo();
|
481 |
} else {
|
482 |
this.pluginApi.playMedia();
|
@@ -486,7 +705,7 @@ mejs.PluginMediaElement.prototype = {
|
|
486 |
},
|
487 |
load: function () {
|
488 |
if (this.pluginApi != null) {
|
489 |
-
if (this.pluginType == 'youtube') {
|
490 |
} else {
|
491 |
this.pluginApi.loadMedia();
|
492 |
}
|
@@ -496,8 +715,10 @@ mejs.PluginMediaElement.prototype = {
|
|
496 |
},
|
497 |
pause: function () {
|
498 |
if (this.pluginApi != null) {
|
499 |
-
if (this.pluginType == 'youtube') {
|
500 |
-
|
|
|
|
|
501 |
} else {
|
502 |
this.pluginApi.pauseMedia();
|
503 |
}
|
@@ -508,7 +729,7 @@ mejs.PluginMediaElement.prototype = {
|
|
508 |
},
|
509 |
stop: function () {
|
510 |
if (this.pluginApi != null) {
|
511 |
-
if (this.pluginType == 'youtube') {
|
512 |
this.pluginApi.stopVideo();
|
513 |
} else {
|
514 |
this.pluginApi.stopMedia();
|
@@ -532,18 +753,18 @@ mejs.PluginMediaElement.prototype = {
|
|
532 |
for (j=0; j<pluginInfo.types.length; j++) {
|
533 |
// find plugin that can play the type
|
534 |
if (type == pluginInfo.types[j]) {
|
535 |
-
return
|
536 |
}
|
537 |
}
|
538 |
}
|
539 |
}
|
540 |
|
541 |
-
return
|
542 |
},
|
543 |
|
544 |
positionFullscreenButton: function(x,y,visibleAndAbove) {
|
545 |
if (this.pluginApi != null && this.pluginApi.positionFullscreenButton) {
|
546 |
-
this.pluginApi.positionFullscreenButton(x,y,visibleAndAbove);
|
547 |
}
|
548 |
},
|
549 |
|
@@ -569,7 +790,7 @@ mejs.PluginMediaElement.prototype = {
|
|
569 |
media = url[i];
|
570 |
if (this.canPlayType(media.type)) {
|
571 |
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
|
572 |
-
this.src = mejs.Utility.absolutizeUrl(
|
573 |
break;
|
574 |
}
|
575 |
}
|
@@ -578,7 +799,7 @@ mejs.PluginMediaElement.prototype = {
|
|
578 |
},
|
579 |
setCurrentTime: function (time) {
|
580 |
if (this.pluginApi != null) {
|
581 |
-
if (this.pluginType == 'youtube') {
|
582 |
this.pluginApi.seekTo(time);
|
583 |
} else {
|
584 |
this.pluginApi.setCurrentTime(time);
|
@@ -609,7 +830,7 @@ mejs.PluginMediaElement.prototype = {
|
|
609 |
this.pluginApi.unMute();
|
610 |
}
|
611 |
this.muted = muted;
|
612 |
-
this.dispatchEvent('volumechange');
|
613 |
} else {
|
614 |
this.pluginApi.setMuted(muted);
|
615 |
}
|
@@ -621,7 +842,7 @@ mejs.PluginMediaElement.prototype = {
|
|
621 |
setVideoSize: function (width, height) {
|
622 |
|
623 |
//if (this.pluginType == 'flash' || this.pluginType == 'silverlight') {
|
624 |
-
if ( this.pluginElement.style) {
|
625 |
this.pluginElement.style.width = width + 'px';
|
626 |
this.pluginElement.style.height = height + 'px';
|
627 |
}
|
@@ -660,7 +881,7 @@ mejs.PluginMediaElement.prototype = {
|
|
660 |
var callbacks = this.events[eventName];
|
661 |
if (!callbacks) return true;
|
662 |
if (!callback) { this.events[eventName] = []; return true; }
|
663 |
-
for (i = 0; i < callbacks.length; i++) {
|
664 |
if (callbacks[i] === callback) {
|
665 |
this.events[eventName].splice(i, 1);
|
666 |
return true;
|
@@ -668,15 +889,14 @@ mejs.PluginMediaElement.prototype = {
|
|
668 |
}
|
669 |
return false;
|
670 |
},
|
671 |
-
dispatchEvent: function (
|
672 |
var i,
|
673 |
args,
|
674 |
-
callbacks = this.events[
|
675 |
|
676 |
if (callbacks) {
|
677 |
-
args = Array.prototype.slice.call(arguments, 1);
|
678 |
for (i = 0; i < callbacks.length; i++) {
|
679 |
-
callbacks[i].apply(
|
680 |
}
|
681 |
}
|
682 |
},
|
@@ -693,7 +913,7 @@ mejs.PluginMediaElement.prototype = {
|
|
693 |
if (this.hasAttribute(name)) {
|
694 |
return this.attributes[name];
|
695 |
}
|
696 |
-
return
|
697 |
},
|
698 |
setAttribute: function(name, value){
|
699 |
this.attributes[name] = value;
|
@@ -704,80 +924,6 @@ mejs.PluginMediaElement.prototype = {
|
|
704 |
}
|
705 |
};
|
706 |
|
707 |
-
// Handles calls from Flash/Silverlight and reports them as native <video/audio> events and properties
|
708 |
-
mejs.MediaPluginBridge = {
|
709 |
-
|
710 |
-
pluginMediaElements:{},
|
711 |
-
htmlMediaElements:{},
|
712 |
-
|
713 |
-
registerPluginElement: function (id, pluginMediaElement, htmlMediaElement) {
|
714 |
-
this.pluginMediaElements[id] = pluginMediaElement;
|
715 |
-
this.htmlMediaElements[id] = htmlMediaElement;
|
716 |
-
},
|
717 |
-
|
718 |
-
// when Flash/Silverlight is ready, it calls out to this method
|
719 |
-
initPlugin: function (id) {
|
720 |
-
|
721 |
-
var pluginMediaElement = this.pluginMediaElements[id],
|
722 |
-
htmlMediaElement = this.htmlMediaElements[id];
|
723 |
-
|
724 |
-
if (pluginMediaElement) {
|
725 |
-
// find the javascript bridge
|
726 |
-
switch (pluginMediaElement.pluginType) {
|
727 |
-
case "flash":
|
728 |
-
pluginMediaElement.pluginElement = pluginMediaElement.pluginApi = document.getElementById(id);
|
729 |
-
break;
|
730 |
-
case "silverlight":
|
731 |
-
pluginMediaElement.pluginElement = document.getElementById(pluginMediaElement.id);
|
732 |
-
pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
|
733 |
-
break;
|
734 |
-
}
|
735 |
-
|
736 |
-
if (pluginMediaElement.pluginApi != null && pluginMediaElement.success) {
|
737 |
-
pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
|
738 |
-
}
|
739 |
-
}
|
740 |
-
},
|
741 |
-
|
742 |
-
// receives events from Flash/Silverlight and sends them out as HTML5 media events
|
743 |
-
// http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
|
744 |
-
fireEvent: function (id, eventName, values) {
|
745 |
-
|
746 |
-
var
|
747 |
-
e,
|
748 |
-
i,
|
749 |
-
bufferedTime,
|
750 |
-
pluginMediaElement = this.pluginMediaElements[id];
|
751 |
-
|
752 |
-
// fake event object to mimic real HTML media event.
|
753 |
-
e = {
|
754 |
-
type: eventName,
|
755 |
-
target: pluginMediaElement
|
756 |
-
};
|
757 |
-
|
758 |
-
// attach all values to element and event object
|
759 |
-
for (i in values) {
|
760 |
-
pluginMediaElement[i] = values[i];
|
761 |
-
e[i] = values[i];
|
762 |
-
}
|
763 |
-
|
764 |
-
// fake the newer W3C buffered TimeRange (loaded and total have been removed)
|
765 |
-
bufferedTime = values.bufferedTime || 0;
|
766 |
-
|
767 |
-
e.target.buffered = e.buffered = {
|
768 |
-
start: function(index) {
|
769 |
-
return 0;
|
770 |
-
},
|
771 |
-
end: function (index) {
|
772 |
-
return bufferedTime;
|
773 |
-
},
|
774 |
-
length: 1
|
775 |
-
};
|
776 |
-
|
777 |
-
pluginMediaElement.dispatchEvent(e.type, e);
|
778 |
-
}
|
779 |
-
};
|
780 |
-
|
781 |
/*
|
782 |
Default options
|
783 |
*/
|
@@ -793,6 +939,8 @@ mejs.MediaElementDefaults = {
|
|
793 |
plugins: ['flash','silverlight','youtube','vimeo'],
|
794 |
// shows debug errors on screen
|
795 |
enablePluginDebug: false,
|
|
|
|
|
796 |
// overrides the type specified, useful for dynamic instantiation
|
797 |
type: '',
|
798 |
// path to Flash and Silverlight plugins
|
@@ -801,8 +949,14 @@ mejs.MediaElementDefaults = {
|
|
801 |
flashName: 'flashmediaelement.swf',
|
802 |
// streamer for RTMP streaming
|
803 |
flashStreamer: '',
|
|
|
|
|
804 |
// turns on the smoothing filter in Flash
|
805 |
enablePluginSmoothing: false,
|
|
|
|
|
|
|
|
|
806 |
// name of silverlight file
|
807 |
silverlightName: 'silverlightmediaelement.xap',
|
808 |
// default if the <video width> is not specified
|
@@ -820,6 +974,9 @@ mejs.MediaElementDefaults = {
|
|
820 |
timerRate: 250,
|
821 |
// initial volume for player
|
822 |
startVolume: 0.8,
|
|
|
|
|
|
|
823 |
success: function () { },
|
824 |
error: function () { }
|
825 |
};
|
@@ -837,7 +994,7 @@ mejs.HtmlMediaElementShim = {
|
|
837 |
|
838 |
create: function(el, o) {
|
839 |
var
|
840 |
-
options =
|
841 |
htmlMediaElement = (typeof(el) == 'string') ? document.getElementById(el) : el,
|
842 |
tagName = htmlMediaElement.tagName.toLowerCase(),
|
843 |
isMediaTag = (tagName === 'audio' || tagName === 'video'),
|
@@ -850,9 +1007,13 @@ mejs.HtmlMediaElementShim = {
|
|
850 |
prop;
|
851 |
|
852 |
// extend options
|
|
|
|
|
|
|
853 |
for (prop in o) {
|
854 |
options[prop] = o[prop];
|
855 |
-
}
|
|
|
856 |
|
857 |
// clean up attributes
|
858 |
src = (typeof src == 'undefined' || src === null || src == '') ? null : src;
|
@@ -864,6 +1025,7 @@ mejs.HtmlMediaElementShim = {
|
|
864 |
// test for HTML5 and plugin capabilities
|
865 |
playback = this.determinePlayback(htmlMediaElement, options, mejs.MediaFeatures.supportsMediaTag, isMediaTag, src);
|
866 |
playback.url = (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '';
|
|
|
867 |
|
868 |
if (playback.method == 'native') {
|
869 |
// second fix for android
|
@@ -897,7 +1059,7 @@ mejs.HtmlMediaElementShim = {
|
|
897 |
l,
|
898 |
n,
|
899 |
type,
|
900 |
-
result = { method: '', url: '', htmlMediaElement: htmlMediaElement, isVideo: (htmlMediaElement.tagName.toLowerCase()
|
901 |
pluginName,
|
902 |
pluginVersions,
|
903 |
pluginInfo,
|
@@ -951,15 +1113,21 @@ mejs.HtmlMediaElementShim = {
|
|
951 |
// STEP 2: Test for playback method
|
952 |
|
953 |
// special case for Android which sadly doesn't implement the canPlayType function (always returns '')
|
954 |
-
if (mejs.MediaFeatures.isBustedAndroid) {
|
955 |
htmlMediaElement.canPlayType = function(type) {
|
956 |
return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'maybe' : '';
|
957 |
};
|
958 |
}
|
959 |
|
|
|
|
|
|
|
|
|
|
|
|
|
960 |
|
961 |
// test for native playback first
|
962 |
-
if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'auto_plugin' || options.mode === 'native')) {
|
963 |
|
964 |
if (!isMediaTag) {
|
965 |
|
@@ -974,9 +1142,11 @@ mejs.HtmlMediaElementShim = {
|
|
974 |
|
975 |
for (i=0; i<mediaFiles.length; i++) {
|
976 |
// normal check
|
977 |
-
if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
|
978 |
// special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
|
979 |
-
|| htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== ''
|
|
|
|
|
980 |
result.method = 'native';
|
981 |
result.url = mediaFiles[i].url;
|
982 |
break;
|
@@ -1021,7 +1191,7 @@ mejs.HtmlMediaElementShim = {
|
|
1021 |
// test for plugin playback types
|
1022 |
for (l=0; l<pluginInfo.types.length; l++) {
|
1023 |
// find plugin that can play the type
|
1024 |
-
if (type == pluginInfo.types[l]) {
|
1025 |
result.method = pluginName;
|
1026 |
result.url = mediaFiles[i].url;
|
1027 |
return result;
|
@@ -1048,8 +1218,6 @@ mejs.HtmlMediaElementShim = {
|
|
1048 |
},
|
1049 |
|
1050 |
formatType: function(url, type) {
|
1051 |
-
var ext;
|
1052 |
-
|
1053 |
// if no type is supplied, fake it with the extension
|
1054 |
if (url && !type) {
|
1055 |
return this.getTypeFromFile(url);
|
@@ -1068,33 +1236,46 @@ mejs.HtmlMediaElementShim = {
|
|
1068 |
|
1069 |
getTypeFromFile: function(url) {
|
1070 |
url = url.split('?')[0];
|
1071 |
-
var
|
1072 |
-
|
|
|
|
|
1073 |
},
|
1074 |
|
1075 |
-
getTypeFromExtension: function(ext) {
|
|
|
1076 |
|
1077 |
switch (ext) {
|
1078 |
case 'mp4':
|
1079 |
case 'm4v':
|
1080 |
-
|
|
|
|
|
|
|
|
|
|
|
1081 |
case 'webm':
|
1082 |
case 'webma':
|
1083 |
case 'webmv':
|
1084 |
-
return 'webm';
|
1085 |
case 'ogg':
|
1086 |
case 'oga':
|
1087 |
case 'ogv':
|
1088 |
-
return 'ogg';
|
|
|
|
|
|
|
|
|
1089 |
default:
|
1090 |
-
return ext;
|
1091 |
}
|
1092 |
},
|
1093 |
|
1094 |
createErrorMessage: function(playback, options, poster) {
|
1095 |
var
|
1096 |
htmlMediaElement = playback.htmlMediaElement,
|
1097 |
-
errorContainer = document.createElement('div')
|
|
|
1098 |
|
1099 |
errorContainer.className = 'me-cannotplay';
|
1100 |
|
@@ -1103,9 +1284,17 @@ mejs.HtmlMediaElementShim = {
|
|
1103 |
errorContainer.style.height = htmlMediaElement.height + 'px';
|
1104 |
} catch (e) {}
|
1105 |
|
1106 |
-
|
1107 |
-
'<a href="' + playback.url + '"
|
1108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1109 |
|
1110 |
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
|
1111 |
htmlMediaElement.style.display = 'none';
|
@@ -1126,20 +1315,22 @@ mejs.HtmlMediaElementShim = {
|
|
1126 |
initVars;
|
1127 |
|
1128 |
// copy tagName from html media element
|
1129 |
-
pluginMediaElement.tagName = htmlMediaElement.tagName
|
1130 |
|
1131 |
// copy attributes from html media element to plugin media element
|
1132 |
for (var i = 0; i < htmlMediaElement.attributes.length; i++) {
|
1133 |
var attribute = htmlMediaElement.attributes[i];
|
1134 |
-
if (attribute.specified
|
1135 |
pluginMediaElement.setAttribute(attribute.name, attribute.value);
|
1136 |
}
|
1137 |
}
|
1138 |
|
1139 |
// check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
|
1140 |
node = htmlMediaElement.parentNode;
|
1141 |
-
|
1142 |
-
|
|
|
|
|
1143 |
node.parentNode.parentNode.insertBefore(node, node.parentNode);
|
1144 |
break;
|
1145 |
}
|
@@ -1147,8 +1338,8 @@ mejs.HtmlMediaElementShim = {
|
|
1147 |
}
|
1148 |
|
1149 |
if (playback.isVideo) {
|
1150 |
-
width = (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
|
1151 |
-
height = (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
|
1152 |
|
1153 |
// in case of '%' make sure it's encoded
|
1154 |
width = mejs.Utility.encodeUrl(width);
|
@@ -1163,8 +1354,7 @@ mejs.HtmlMediaElementShim = {
|
|
1163 |
|
1164 |
// register plugin
|
1165 |
pluginMediaElement.success = options.success;
|
1166 |
-
|
1167 |
-
|
1168 |
// add container (must be added to DOM before inserting HTML for IE)
|
1169 |
container.className = 'me-plugin';
|
1170 |
container.id = pluginid + '_container';
|
@@ -1174,43 +1364,116 @@ mejs.HtmlMediaElementShim = {
|
|
1174 |
} else {
|
1175 |
document.body.insertBefore(container, document.body.childNodes[0]);
|
1176 |
}
|
|
|
|
|
1177 |
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
'flashstreamer=' + options.flashStreamer,
|
1188 |
-
'height=' + height];
|
1189 |
-
|
1190 |
-
if (playback.url !== null) {
|
1191 |
-
if (playback.method == 'flash') {
|
1192 |
-
initVars.push('file=' + mejs.Utility.encodeUrl(playback.url));
|
1193 |
-
} else {
|
1194 |
-
initVars.push('file=' + playback.url);
|
1195 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1196 |
}
|
1197 |
-
if (options.enablePluginDebug) {
|
1198 |
-
initVars.push('debug=true');
|
1199 |
-
}
|
1200 |
-
if (options.enablePluginSmoothing) {
|
1201 |
-
initVars.push('smoothing=true');
|
1202 |
-
}
|
1203 |
-
if (controls) {
|
1204 |
-
initVars.push('controls=true'); // shows controls in the plugin if desired
|
1205 |
-
}
|
1206 |
-
if (options.pluginVars) {
|
1207 |
-
initVars = initVars.concat(options.pluginVars);
|
1208 |
-
}
|
1209 |
|
1210 |
switch (playback.method) {
|
1211 |
case 'silverlight':
|
1212 |
container.innerHTML =
|
1213 |
-
'<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + pluginid + '" name="' + pluginid + '" width="' + width + '" height="' + height + '">' +
|
1214 |
'<param name="initParams" value="' + initVars.join(',') + '" />' +
|
1215 |
'<param name="windowless" value="true" />' +
|
1216 |
'<param name="background" value="black" />' +
|
@@ -1227,14 +1490,15 @@ mejs.HtmlMediaElementShim = {
|
|
1227 |
container.appendChild(specialIEContainer);
|
1228 |
specialIEContainer.outerHTML =
|
1229 |
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
|
1230 |
-
'id="' + pluginid + '" width="' + width + '" height="' + height + '">' +
|
1231 |
-
'<param name="movie" value="' + options.pluginPath + options.flashName + '?
|
1232 |
'<param name="flashvars" value="' + initVars.join('&') + '" />' +
|
1233 |
'<param name="quality" value="high" />' +
|
1234 |
'<param name="bgcolor" value="#000000" />' +
|
1235 |
'<param name="wmode" value="transparent" />' +
|
1236 |
-
'<param name="allowScriptAccess" value="
|
1237 |
'<param name="allowFullScreen" value="true" />' +
|
|
|
1238 |
'</object>';
|
1239 |
|
1240 |
} else {
|
@@ -1246,64 +1510,154 @@ mejs.HtmlMediaElementShim = {
|
|
1246 |
'quality="high" ' +
|
1247 |
'bgcolor="#000000" ' +
|
1248 |
'wmode="transparent" ' +
|
1249 |
-
'allowScriptAccess="
|
1250 |
'allowFullScreen="true" ' +
|
1251 |
'type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" ' +
|
1252 |
'src="' + options.pluginPath + options.flashName + '" ' +
|
1253 |
'flashvars="' + initVars.join('&') + '" ' +
|
1254 |
'width="' + width + '" ' +
|
1255 |
-
'height="' + height + '"
|
|
|
|
|
1256 |
}
|
1257 |
break;
|
1258 |
|
1259 |
case 'youtube':
|
1260 |
|
1261 |
|
1262 |
-
var
|
1263 |
-
|
1264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1265 |
container: container,
|
1266 |
containerId: container.id,
|
1267 |
pluginMediaElement: pluginMediaElement,
|
1268 |
pluginId: pluginid,
|
1269 |
videoId: videoId,
|
1270 |
height: height,
|
1271 |
-
width: width
|
|
|
|
|
1272 |
};
|
1273 |
|
1274 |
-
|
1275 |
-
|
1276 |
-
} else {
|
1277 |
mejs.YouTubeApi.enqueueIframe(youtubeSettings);
|
|
|
|
|
1278 |
}
|
1279 |
-
|
1280 |
break;
|
1281 |
|
1282 |
// DEMO Code. Does NOT work.
|
1283 |
case 'vimeo':
|
1284 |
-
|
1285 |
-
|
1286 |
pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1287 |
|
1288 |
-
container.innerHTML ='<iframe src="
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1301 |
break;
|
1302 |
}
|
1303 |
// hide original element
|
1304 |
htmlMediaElement.style.display = 'none';
|
1305 |
-
|
1306 |
-
|
1307 |
|
1308 |
return pluginMediaElement;
|
1309 |
},
|
@@ -1364,10 +1718,10 @@ mejs.HtmlMediaElementShim = {
|
|
1364 |
mejs.YouTubeApi = {
|
1365 |
isIframeStarted: false,
|
1366 |
isIframeLoaded: false,
|
1367 |
-
loadIframeApi: function() {
|
1368 |
if (!this.isIframeStarted) {
|
1369 |
var tag = document.createElement('script');
|
1370 |
-
tag.src = "
|
1371 |
var firstScriptTag = document.getElementsByTagName('script')[0];
|
1372 |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
1373 |
this.isIframeStarted = true;
|
@@ -1379,32 +1733,45 @@ mejs.YouTubeApi = {
|
|
1379 |
if (this.isLoaded) {
|
1380 |
this.createIframe(yt);
|
1381 |
} else {
|
1382 |
-
this.loadIframeApi();
|
1383 |
this.iframeQueue.push(yt);
|
1384 |
}
|
1385 |
},
|
1386 |
createIframe: function(settings) {
|
1387 |
-
|
1388 |
var
|
1389 |
-
pluginMediaElement = settings.pluginMediaElement,
|
|
|
1390 |
player = new YT.Player(settings.containerId, {
|
1391 |
height: settings.height,
|
1392 |
width: settings.width,
|
1393 |
videoId: settings.videoId,
|
1394 |
-
playerVars: {
|
1395 |
events: {
|
1396 |
-
'onReady': function() {
|
|
|
|
|
|
|
|
|
|
|
1397 |
|
1398 |
// hook up iframe object to MEjs
|
1399 |
settings.pluginMediaElement.pluginApi = player;
|
|
|
1400 |
|
1401 |
// init mejs
|
1402 |
-
|
|
|
|
|
1403 |
|
1404 |
// create timer
|
1405 |
setInterval(function() {
|
1406 |
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
|
1407 |
-
}, 250);
|
|
|
|
|
|
|
|
|
1408 |
},
|
1409 |
'onStateChange': function(e) {
|
1410 |
|
@@ -1416,7 +1783,7 @@ mejs.YouTubeApi = {
|
|
1416 |
},
|
1417 |
|
1418 |
createEvent: function (player, pluginMediaElement, eventName) {
|
1419 |
-
var
|
1420 |
type: eventName,
|
1421 |
target: pluginMediaElement
|
1422 |
};
|
@@ -1424,25 +1791,25 @@ mejs.YouTubeApi = {
|
|
1424 |
if (player && player.getDuration) {
|
1425 |
|
1426 |
// time
|
1427 |
-
pluginMediaElement.currentTime =
|
1428 |
-
pluginMediaElement.duration =
|
1429 |
|
1430 |
// state
|
1431 |
-
|
1432 |
-
|
1433 |
|
1434 |
// sound
|
1435 |
-
|
1436 |
-
|
1437 |
|
1438 |
// progress
|
1439 |
-
|
1440 |
-
|
1441 |
|
1442 |
// fake the W3C buffered TimeRange
|
1443 |
-
var bufferedTime =
|
1444 |
|
1445 |
-
|
1446 |
start: function(index) {
|
1447 |
return 0;
|
1448 |
},
|
@@ -1451,11 +1818,11 @@ mejs.YouTubeApi = {
|
|
1451 |
},
|
1452 |
length: 1
|
1453 |
};
|
1454 |
-
|
1455 |
}
|
1456 |
|
1457 |
// send event up the chain
|
1458 |
-
pluginMediaElement.dispatchEvent(
|
1459 |
},
|
1460 |
|
1461 |
iFrameReady: function() {
|
@@ -1477,32 +1844,32 @@ mejs.YouTubeApi = {
|
|
1477 |
|
1478 |
/*
|
1479 |
settings.container.innerHTML =
|
1480 |
-
'<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="
|
1481 |
-
'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; ">' +
|
1482 |
-
'<param name="allowScriptAccess" value="
|
1483 |
'<param name="wmode" value="transparent">' +
|
1484 |
'</object>';
|
1485 |
*/
|
1486 |
|
1487 |
var specialIEContainer,
|
1488 |
-
youtubeUrl = '
|
1489 |
|
1490 |
if (mejs.MediaFeatures.isIE) {
|
1491 |
|
1492 |
specialIEContainer = document.createElement('div');
|
1493 |
settings.container.appendChild(specialIEContainer);
|
1494 |
-
specialIEContainer.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
|
1495 |
-
'id="' + settings.pluginId + '" width="' + settings.width + '" height="' + settings.height + '">' +
|
1496 |
'<param name="movie" value="' + youtubeUrl + '" />' +
|
1497 |
'<param name="wmode" value="transparent" />' +
|
1498 |
-
'<param name="allowScriptAccess" value="
|
1499 |
'<param name="allowFullScreen" value="true" />' +
|
1500 |
'</object>';
|
1501 |
} else {
|
1502 |
settings.container.innerHTML =
|
1503 |
'<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="' + youtubeUrl + '" ' +
|
1504 |
-
'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; ">' +
|
1505 |
-
'<param name="allowScriptAccess" value="
|
1506 |
'<param name="wmode" value="transparent">' +
|
1507 |
'</object>';
|
1508 |
}
|
@@ -1518,7 +1885,8 @@ mejs.YouTubeApi = {
|
|
1518 |
// hook up and return to MediaELementPlayer.success
|
1519 |
pluginMediaElement.pluginApi =
|
1520 |
pluginMediaElement.pluginElement = player;
|
1521 |
-
|
|
|
1522 |
|
1523 |
// load the youtube video
|
1524 |
player.cueVideoById(settings.videoId);
|
@@ -1527,13 +1895,15 @@ mejs.YouTubeApi = {
|
|
1527 |
|
1528 |
window[callbackName] = function(e) {
|
1529 |
mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
|
1530 |
-
}
|
1531 |
|
1532 |
player.addEventListener('onStateChange', callbackName);
|
1533 |
|
1534 |
setInterval(function() {
|
1535 |
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
|
1536 |
}, 250);
|
|
|
|
|
1537 |
},
|
1538 |
|
1539 |
handleStateChange: function(youTubeState, player, pluginMediaElement) {
|
@@ -1572,219 +1942,437 @@ mejs.YouTubeApi = {
|
|
1572 |
}
|
1573 |
}
|
1574 |
// IFRAME
|
1575 |
-
function
|
1576 |
mejs.YouTubeApi.iFrameReady();
|
1577 |
-
}
|
1578 |
// FLASH
|
1579 |
-
function
|
1580 |
mejs.YouTubeApi.flashReady(id);
|
1581 |
-
}
|
1582 |
|
1583 |
window.mejs = mejs;
|
1584 |
window.MediaElement = mejs.MediaElement;
|
1585 |
|
1586 |
-
|
1587 |
-
*
|
1588 |
-
*
|
1589 |
-
* What is the concept beyond i18n?
|
1590 |
-
* http://en.wikipedia.org/wiki/Internationalization_and_localization
|
1591 |
-
*
|
1592 |
-
*
|
1593 |
-
* This file both i18n methods and locale which is used to translate
|
1594 |
-
* strings into other languages.
|
1595 |
-
*
|
1596 |
-
* Default translations are not available, you have to add them
|
1597 |
-
* through locale objects which are named exactly as the langcode
|
1598 |
-
* they stand for. The default language is always english (en).
|
1599 |
-
*
|
1600 |
-
*
|
1601 |
-
* Wrapper built to be able to attach the i18n object to
|
1602 |
-
* other objects without changing more than one line.
|
1603 |
-
*
|
1604 |
-
*
|
1605 |
-
* LICENSE:
|
1606 |
-
*
|
1607 |
-
* The i18n file uses methods from the Drupal project (drupal.js):
|
1608 |
-
* - i18n.methods.t() (modified)
|
1609 |
-
* - i18n.methods.checkPlain() (full copy)
|
1610 |
-
* - i18n.methods.formatString() (full copy)
|
1611 |
-
*
|
1612 |
-
* The Drupal project is (like mediaelementjs) licensed under GPLv2.
|
1613 |
-
* - http://drupal.org/licensing/faq/#q1
|
1614 |
-
* - https://github.com/johndyer/mediaelement
|
1615 |
-
* - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
1616 |
-
*
|
1617 |
-
*
|
1618 |
-
* @author
|
1619 |
-
* Tim Latz (latz.tim@gmail.com)
|
1620 |
-
*
|
1621 |
-
* @see
|
1622 |
-
* me-i18n-locale.js
|
1623 |
*
|
1624 |
-
*
|
1625 |
-
* - $ - zepto || jQuery ..
|
1626 |
-
* - context - document, iframe ..
|
1627 |
-
* - exports - CommonJS, window ..
|
1628 |
*
|
1629 |
*/
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
*/
|
1646 |
-
i18n.locale.getLanguage = function () {
|
1647 |
-
return {
|
1648 |
-
"language" : navigator.language
|
1649 |
-
};
|
1650 |
-
};
|
1651 |
-
|
1652 |
-
/**
|
1653 |
-
* Store the language the locale object was initialized with
|
1654 |
-
*/
|
1655 |
-
i18n.locale.INIT_LANGUAGE = i18n.locale.getLanguage();
|
1656 |
-
|
1657 |
-
|
1658 |
-
/**
|
1659 |
-
* Encode special characters in a plain-text string for display as HTML.
|
1660 |
-
*/
|
1661 |
-
i18n.methods.checkPlain = function (str) {
|
1662 |
-
var character, regex,
|
1663 |
-
replace = {
|
1664 |
-
'&': '&',
|
1665 |
-
'"': '"',
|
1666 |
-
'<': '<',
|
1667 |
-
'>': '>'
|
1668 |
-
};
|
1669 |
-
str = String(str);
|
1670 |
-
for (character in replace) {
|
1671 |
-
if (replace.hasOwnProperty(character)) {
|
1672 |
-
regex = new RegExp(character, 'g');
|
1673 |
-
str = str.replace(regex, replace[character]);
|
1674 |
-
}
|
1675 |
-
}
|
1676 |
-
return str;
|
1677 |
-
};
|
1678 |
-
|
1679 |
-
/**
|
1680 |
-
* Replace placeholders with sanitized values in a string.
|
1681 |
-
*
|
1682 |
-
* @param str
|
1683 |
-
* A string with placeholders.
|
1684 |
-
* @param args
|
1685 |
-
* An object of replacements pairs to make. Incidences of any key in this
|
1686 |
-
* array are replaced with the corresponding value. Based on the first
|
1687 |
-
* character of the key, the value is escaped and/or themed:
|
1688 |
-
* - !variable: inserted as is
|
1689 |
-
* - @variable: escape plain text to HTML (i18n.methods.checkPlain)
|
1690 |
-
* - %variable: escape text and theme as a placeholder for user-submitted
|
1691 |
-
* content (checkPlain + <em class="placeholder" > )
|
1692 |
-
*
|
1693 |
-
* @see i18n.methods.t()
|
1694 |
-
*/
|
1695 |
-
i18n.methods.formatString = function(str, args) {
|
1696 |
-
// Transform arguments before inserting them.
|
1697 |
-
for (var key in args) {
|
1698 |
-
switch (key.charAt(0)) {
|
1699 |
-
// Escaped only.
|
1700 |
-
case '@':
|
1701 |
-
args[key] = i18n.methods.checkPlain(args[key]);
|
1702 |
-
break;
|
1703 |
-
// Pass-through.
|
1704 |
-
case '!':
|
1705 |
-
break;
|
1706 |
-
// Escaped and placeholder.
|
1707 |
-
case '%':
|
1708 |
-
default:
|
1709 |
-
args[key] = '<em class="placeholder">' + i18n.methods.checkPlain(args[key]) + '</em>';
|
1710 |
-
break;
|
1711 |
-
}
|
1712 |
-
str = str.replace(key, args[key]);
|
1713 |
-
}
|
1714 |
-
return str;
|
1715 |
-
};
|
1716 |
-
|
1717 |
-
/**
|
1718 |
-
* Translate strings to the page language or a given language.
|
1719 |
-
*
|
1720 |
-
* See the documentation of the server-side t() function for further details.
|
1721 |
-
*
|
1722 |
-
* @param str
|
1723 |
-
* A string containing the English string to translate.
|
1724 |
-
* @param args
|
1725 |
-
* An object of replacements pairs to make after translation. Incidences
|
1726 |
-
* of any key in this array are replaced with the corresponding value.
|
1727 |
-
* See i18n.methods.formatString().
|
1728 |
-
*
|
1729 |
-
* @param options
|
1730 |
-
* - 'context' (defaults to the default context): The context the source string
|
1731 |
-
* belongs to.
|
1732 |
-
*
|
1733 |
-
* @return
|
1734 |
-
* The translated string.
|
1735 |
-
*/
|
1736 |
-
i18n.methods.t = function (str, args, options) {
|
1737 |
-
|
1738 |
-
// Fetch the localized version of the string.
|
1739 |
-
if (i18n.locale.strings && i18n.locale.strings[options.context] && i18n.locale.strings[options.context][str]) {
|
1740 |
-
str = i18n.locale.strings[options.context][str];
|
1741 |
-
}
|
1742 |
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1748 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1749 |
|
1750 |
-
|
1751 |
-
* Wrapper for i18n.methods.t()
|
1752 |
-
*
|
1753 |
-
* @see i18n.methods.t()
|
1754 |
-
* @throws InvalidArgumentException
|
1755 |
-
*/
|
1756 |
-
i18n.t = function(str, args, options) {
|
1757 |
|
1758 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1759 |
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1763 |
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
|
|
|
|
|
|
1767 |
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1777 |
|
1778 |
-
//
|
1779 |
-
|
1780 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1781 |
/*!
|
1782 |
* This is a i18n.locale language object.
|
1783 |
*
|
1784 |
-
|
1785 |
*
|
1786 |
* @author
|
1787 |
-
*
|
|
|
1788 |
*
|
1789 |
* @see
|
1790 |
* me-i18n.js
|
@@ -1792,32 +2380,93 @@ window.MediaElement = mejs.MediaElement;
|
|
1792 |
* @params
|
1793 |
* - exports - CommonJS, window ..
|
1794 |
*/
|
1795 |
-
|
1796 |
-
|
1797 |
"use strict";
|
1798 |
|
1799 |
-
exports.
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1805 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1806 |
}(mejs.i18n.locale.strings));
|
1807 |
|
1808 |
/*!
|
|
|
1809 |
* MediaElementPlayer
|
1810 |
* http://mediaelementjs.com/
|
1811 |
*
|
1812 |
* Creates a controller bar for HTML5 <video> add <audio> tags
|
1813 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
1814 |
*
|
1815 |
-
* Copyright 2010-
|
1816 |
* License: MIT
|
1817 |
*
|
1818 |
*/
|
1819 |
if (typeof jQuery != 'undefined') {
|
1820 |
mejs.$ = jQuery;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1821 |
} else if (typeof ender != 'undefined') {
|
1822 |
mejs.$ = ender;
|
1823 |
}
|
@@ -1827,6 +2476,8 @@ if (typeof jQuery != 'undefined') {
|
|
1827 |
mejs.MepDefaults = {
|
1828 |
// url to poster (to fix iOS 3.x)
|
1829 |
poster: '',
|
|
|
|
|
1830 |
// default if the <video width> is not specified
|
1831 |
defaultVideoWidth: 480,
|
1832 |
// default if the <video height> is not specified
|
@@ -1839,84 +2490,120 @@ if (typeof jQuery != 'undefined') {
|
|
1839 |
defaultAudioWidth: 400,
|
1840 |
// default if the user doesn't specify
|
1841 |
defaultAudioHeight: 30,
|
1842 |
-
|
1843 |
-
// default amount to move back when back key is pressed
|
1844 |
defaultSeekBackwardInterval: function(media) {
|
1845 |
return (media.duration * 0.05);
|
1846 |
-
},
|
1847 |
-
// default amount to move forward when forward key is pressed
|
1848 |
defaultSeekForwardInterval: function(media) {
|
1849 |
return (media.duration * 0.05);
|
1850 |
-
},
|
1851 |
-
|
|
|
1852 |
// width of audio player
|
1853 |
audioWidth: -1,
|
1854 |
// height of audio player
|
1855 |
-
audioHeight: -1,
|
1856 |
// initial volume when the player starts (overrided by user cookie)
|
1857 |
startVolume: 0.8,
|
1858 |
// useful for <audio> player loops
|
1859 |
loop: false,
|
1860 |
// rewind to beginning when media ends
|
1861 |
-
|
1862 |
// resize to media dimensions
|
1863 |
enableAutosize: true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1864 |
// forces the hour marker (##:00:00)
|
1865 |
alwaysShowHours: false,
|
1866 |
-
|
1867 |
// show framecount in timecode (##:00:00:00)
|
1868 |
showTimecodeFrameCount: false,
|
1869 |
// used when showTimecodeFrameCount is set to true
|
1870 |
framesPerSecond: 25,
|
1871 |
-
|
1872 |
// automatically calculate the width of the progress bar based on the sizes of other elements
|
1873 |
autosizeProgress : true,
|
1874 |
// Hide controls when playing and mouse is not over the video
|
1875 |
alwaysShowControls: false,
|
1876 |
-
|
1877 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1878 |
// force iPad's native controls
|
1879 |
iPadUseNativeControls: false,
|
1880 |
// force iPhone's native controls
|
1881 |
-
iPhoneUseNativeControls: false,
|
1882 |
// force Android's native controls
|
1883 |
-
AndroidUseNativeControls: false,
|
1884 |
// features to show
|
1885 |
features: ['playpause','current','progress','duration','tracks','volume','fullscreen'],
|
1886 |
// only for dynamic
|
1887 |
isVideo: true,
|
1888 |
-
|
|
|
1889 |
// turns keyboard support on and off for this instance
|
1890 |
enableKeyboard: true,
|
1891 |
-
|
1892 |
-
// whenthis player starts, it will pause other players
|
1893 |
pauseOtherPlayers: true,
|
1894 |
-
|
1895 |
// array of keyboard actions such as play pause
|
1896 |
keyActions: [
|
1897 |
{
|
1898 |
keys: [
|
1899 |
32, // SPACE
|
1900 |
179 // GOOGLE play/pause button
|
1901 |
-
|
1902 |
-
action: function(player, media) {
|
|
|
|
|
1903 |
if (media.paused || media.ended) {
|
1904 |
-
|
1905 |
} else {
|
1906 |
-
|
1907 |
-
}
|
|
|
1908 |
}
|
1909 |
},
|
1910 |
{
|
1911 |
keys: [38], // UP
|
1912 |
-
action: function(player, media) {
|
|
|
|
|
|
|
|
|
|
|
|
|
1913 |
var newVolume = Math.min(media.volume + 0.1, 1);
|
1914 |
media.setVolume(newVolume);
|
1915 |
}
|
1916 |
},
|
1917 |
{
|
1918 |
keys: [40], // DOWN
|
1919 |
-
action: function(player, media) {
|
|
|
|
|
|
|
|
|
|
|
|
|
1920 |
var newVolume = Math.max(media.volume - 0.1, 0);
|
1921 |
media.setVolume(newVolume);
|
1922 |
}
|
@@ -1926,13 +2613,13 @@ if (typeof jQuery != 'undefined') {
|
|
1926 |
37, // LEFT
|
1927 |
227 // Google TV rewind
|
1928 |
],
|
1929 |
-
action: function(player, media) {
|
1930 |
if (!isNaN(media.duration) && media.duration > 0) {
|
1931 |
if (player.isVideo) {
|
1932 |
player.showControls();
|
1933 |
player.startControlsTimer();
|
1934 |
}
|
1935 |
-
|
1936 |
// 5%
|
1937 |
var newTime = Math.max(media.currentTime - player.options.defaultSeekBackwardInterval(media), 0);
|
1938 |
media.setCurrentTime(newTime);
|
@@ -1943,23 +2630,23 @@ if (typeof jQuery != 'undefined') {
|
|
1943 |
keys: [
|
1944 |
39, // RIGHT
|
1945 |
228 // Google TV forward
|
1946 |
-
],
|
1947 |
-
action: function(player, media) {
|
1948 |
if (!isNaN(media.duration) && media.duration > 0) {
|
1949 |
if (player.isVideo) {
|
1950 |
player.showControls();
|
1951 |
player.startControlsTimer();
|
1952 |
}
|
1953 |
-
|
1954 |
// 5%
|
1955 |
-
var newTime = Math.min(media.currentTime + player.options.defaultSeekForwardInterval(media), media.duration);
|
1956 |
media.setCurrentTime(newTime);
|
1957 |
}
|
1958 |
}
|
1959 |
},
|
1960 |
{
|
1961 |
-
keys: [70], //
|
1962 |
-
action: function(player, media) {
|
1963 |
if (typeof player.enterFullScreen != 'undefined') {
|
1964 |
if (player.isFullScreen) {
|
1965 |
player.exitFullScreen();
|
@@ -1968,47 +2655,79 @@ if (typeof jQuery != 'undefined') {
|
|
1968 |
}
|
1969 |
}
|
1970 |
}
|
1971 |
-
}
|
1972 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1973 |
};
|
1974 |
|
1975 |
mejs.mepIndex = 0;
|
1976 |
-
|
1977 |
-
mejs.players =
|
1978 |
|
1979 |
// wraps a MediaElement object in player controls
|
1980 |
mejs.MediaElementPlayer = function(node, o) {
|
1981 |
// enforce object, even without "new" (via John Resig)
|
1982 |
if ( !(this instanceof mejs.MediaElementPlayer) ) {
|
1983 |
return new mejs.MediaElementPlayer(node, o);
|
1984 |
-
}
|
1985 |
|
1986 |
var t = this;
|
1987 |
-
|
1988 |
// these will be reset after the MediaElement.success fires
|
1989 |
t.$media = t.$node = $(node);
|
1990 |
-
t.node = t.media = t.$media[0];
|
1991 |
-
|
|
|
|
|
|
|
|
|
1992 |
// check for existing player
|
1993 |
if (typeof t.node.player != 'undefined') {
|
1994 |
return t.node.player;
|
1995 |
-
} else {
|
1996 |
-
// attach player to DOM node for reference
|
1997 |
-
t.node.player = t;
|
1998 |
}
|
1999 |
-
|
2000 |
-
|
2001 |
// try to get options from data-mejsoptions
|
2002 |
if (typeof o == 'undefined') {
|
2003 |
-
o = t.$node.data('mejsoptions');
|
2004 |
}
|
2005 |
-
|
2006 |
// extend default options
|
2007 |
t.options = $.extend({},mejs.MepDefaults,o);
|
2008 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009 |
// add to player array (for focus events)
|
2010 |
-
mejs.players.
|
2011 |
-
|
2012 |
// start up
|
2013 |
t.init();
|
2014 |
|
@@ -2017,11 +2736,11 @@ if (typeof jQuery != 'undefined') {
|
|
2017 |
|
2018 |
// actual player
|
2019 |
mejs.MediaElementPlayer.prototype = {
|
2020 |
-
|
2021 |
hasFocus: false,
|
2022 |
-
|
2023 |
controlsAreVisible: true,
|
2024 |
-
|
2025 |
init: function() {
|
2026 |
|
2027 |
var
|
@@ -2033,49 +2752,49 @@ if (typeof jQuery != 'undefined') {
|
|
2033 |
error: function(e) { t.handleError(e);}
|
2034 |
}),
|
2035 |
tagName = t.media.tagName.toLowerCase();
|
2036 |
-
|
2037 |
t.isDynamic = (tagName !== 'audio' && tagName !== 'video');
|
2038 |
-
|
2039 |
-
if (t.isDynamic) {
|
2040 |
-
// get video from src or href?
|
2041 |
-
t.isVideo = t.options.isVideo;
|
2042 |
} else {
|
2043 |
t.isVideo = (tagName !== 'audio' && t.options.isVideo);
|
2044 |
}
|
2045 |
-
|
2046 |
-
// use native controls in iPad, iPhone, and Android
|
2047 |
if ((mf.isiPad && t.options.iPadUseNativeControls) || (mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
2048 |
-
|
2049 |
// add controls and stop
|
2050 |
t.$media.attr('controls', 'controls');
|
2051 |
|
2052 |
// attempt to fix iOS 3 bug
|
2053 |
//t.$media.removeAttr('poster');
|
2054 |
-
|
2055 |
|
2056 |
// override Apple's autoplay override for iPads
|
2057 |
if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
|
2058 |
-
t.
|
2059 |
-
t.media.play();
|
2060 |
}
|
2061 |
-
|
2062 |
-
} else if (mf.isAndroid && t.AndroidUseNativeControls) {
|
2063 |
-
|
2064 |
// leave default player
|
2065 |
|
2066 |
-
} else {
|
2067 |
|
2068 |
// DESKTOP: use MediaElementPlayer controls
|
2069 |
-
|
2070 |
-
// remove native controls
|
2071 |
-
t.$media.removeAttr('controls');
|
2072 |
-
|
2073 |
-
// unique ID
|
2074 |
-
t.id = 'mep_' + mejs.mepIndex++;
|
2075 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2076 |
// build container
|
2077 |
t.container =
|
2078 |
-
$('<div id="' + t.id + '" class="mejs-container ' + (mejs.MediaFeatures.
|
|
|
2079 |
'<div class="mejs-inner">'+
|
2080 |
'<div class="mejs-mediaelement"></div>'+
|
2081 |
'<div class="mejs-layers"></div>'+
|
@@ -2084,8 +2803,39 @@ if (typeof jQuery != 'undefined') {
|
|
2084 |
'</div>' +
|
2085 |
'</div>')
|
2086 |
.addClass(t.$media[0].className)
|
2087 |
-
.insertBefore(t.$media)
|
2088 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2089 |
// add classes for user and content
|
2090 |
t.container.addClass(
|
2091 |
(mf.isAndroid ? 'mejs-android ' : '') +
|
@@ -2093,174 +2843,167 @@ if (typeof jQuery != 'undefined') {
|
|
2093 |
(mf.isiPad ? 'mejs-ipad ' : '') +
|
2094 |
(mf.isiPhone ? 'mejs-iphone ' : '') +
|
2095 |
(t.isVideo ? 'mejs-video ' : 'mejs-audio ')
|
2096 |
-
);
|
2097 |
-
|
2098 |
|
2099 |
// move the <video/video> tag into the right spot
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
t.container.find('.mejs-mediaelement').append($newMedia);
|
2106 |
-
|
2107 |
-
t.$media.remove();
|
2108 |
-
t.$node = t.$media = $newMedia;
|
2109 |
-
t.node = t.media = $newMedia[0]
|
2110 |
-
|
2111 |
-
} else {
|
2112 |
-
|
2113 |
-
// normal way of moving it into place (doesn't work on iOS)
|
2114 |
-
t.container.find('.mejs-mediaelement').append(t.$media);
|
2115 |
-
}
|
2116 |
-
|
2117 |
// find parts
|
2118 |
t.controls = t.container.find('.mejs-controls');
|
2119 |
t.layers = t.container.find('.mejs-layers');
|
2120 |
|
2121 |
// determine the size
|
2122 |
-
|
2123 |
/* size priority:
|
2124 |
-
(1) videoWidth (forced),
|
2125 |
(2) style="width;height;"
|
2126 |
(3) width attribute,
|
2127 |
(4) defaultVideoWidth (for unspecified cases)
|
2128 |
*/
|
2129 |
-
|
2130 |
var tagType = (t.isVideo ? 'video' : 'audio'),
|
2131 |
capsTagName = tagType.substring(0,1).toUpperCase() + tagType.substring(1);
|
2132 |
-
|
2133 |
-
|
|
|
2134 |
if (t.options[tagType + 'Width'] > 0 || t.options[tagType + 'Width'].toString().indexOf('%') > -1) {
|
2135 |
t.width = t.options[tagType + 'Width'];
|
2136 |
} else if (t.media.style.width !== '' && t.media.style.width !== null) {
|
2137 |
-
t.width = t.media.style.width;
|
2138 |
} else if (t.media.getAttribute('width') !== null) {
|
2139 |
t.width = t.$media.attr('width');
|
2140 |
} else {
|
2141 |
t.width = t.options['default' + capsTagName + 'Width'];
|
2142 |
}
|
2143 |
-
|
2144 |
if (t.options[tagType + 'Height'] > 0 || t.options[tagType + 'Height'].toString().indexOf('%') > -1) {
|
2145 |
t.height = t.options[tagType + 'Height'];
|
2146 |
} else if (t.media.style.height !== '' && t.media.style.height !== null) {
|
2147 |
t.height = t.media.style.height;
|
2148 |
} else if (t.$media[0].getAttribute('height') !== null) {
|
2149 |
-
t.height = t.$media.attr('height');
|
2150 |
} else {
|
2151 |
t.height = t.options['default' + capsTagName + 'Height'];
|
2152 |
}
|
2153 |
|
2154 |
// set the size, while we wait for the plugins to load below
|
2155 |
t.setPlayerSize(t.width, t.height);
|
2156 |
-
|
2157 |
// create MediaElementShim
|
2158 |
-
meOptions.pluginWidth = t.
|
2159 |
-
meOptions.pluginHeight = t.
|
|
|
|
|
|
|
|
|
2160 |
}
|
2161 |
-
|
2162 |
-
|
2163 |
|
2164 |
// create MediaElement shim
|
2165 |
mejs.MediaElement(t.$media[0], meOptions);
|
2166 |
|
2167 |
-
|
2168 |
-
|
|
|
|
|
2169 |
},
|
2170 |
-
|
2171 |
showControls: function(doAnimation) {
|
2172 |
var t = this;
|
2173 |
-
|
2174 |
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
2175 |
-
|
2176 |
if (t.controlsAreVisible)
|
2177 |
return;
|
2178 |
-
|
2179 |
if (doAnimation) {
|
2180 |
t.controls
|
2181 |
-
.
|
2182 |
.stop(true, true).fadeIn(200, function() {
|
2183 |
-
|
2184 |
-
|
2185 |
});
|
2186 |
-
|
2187 |
// any additional controls people might add and want to hide
|
2188 |
t.container.find('.mejs-control')
|
2189 |
-
.
|
2190 |
-
.stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
|
2191 |
-
|
2192 |
} else {
|
2193 |
t.controls
|
2194 |
-
.
|
2195 |
.css('display','block');
|
2196 |
-
|
2197 |
// any additional controls people might add and want to hide
|
2198 |
t.container.find('.mejs-control')
|
2199 |
-
.
|
2200 |
.css('display','block');
|
2201 |
-
|
2202 |
t.controlsAreVisible = true;
|
2203 |
t.container.trigger('controlsshown');
|
2204 |
}
|
2205 |
-
|
2206 |
t.setControlsSize();
|
2207 |
-
|
2208 |
},
|
2209 |
|
2210 |
hideControls: function(doAnimation) {
|
2211 |
var t = this;
|
2212 |
-
|
2213 |
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
2214 |
-
|
2215 |
-
if (!t.controlsAreVisible)
|
2216 |
return;
|
2217 |
-
|
2218 |
if (doAnimation) {
|
2219 |
// fade out main controls
|
2220 |
t.controls.stop(true, true).fadeOut(200, function() {
|
2221 |
$(this)
|
2222 |
-
.
|
2223 |
.css('display','block');
|
2224 |
-
|
2225 |
t.controlsAreVisible = false;
|
2226 |
t.container.trigger('controlshidden');
|
2227 |
-
});
|
2228 |
-
|
2229 |
// any additional controls people might add and want to hide
|
2230 |
t.container.find('.mejs-control').stop(true, true).fadeOut(200, function() {
|
2231 |
$(this)
|
2232 |
-
.
|
2233 |
.css('display','block');
|
2234 |
-
});
|
2235 |
} else {
|
2236 |
-
|
2237 |
// hide main controls
|
2238 |
t.controls
|
2239 |
-
.
|
2240 |
-
.css('display','block');
|
2241 |
-
|
2242 |
// hide others
|
2243 |
t.container.find('.mejs-control')
|
2244 |
-
.
|
2245 |
.css('display','block');
|
2246 |
-
|
2247 |
t.controlsAreVisible = false;
|
2248 |
t.container.trigger('controlshidden');
|
2249 |
}
|
2250 |
-
},
|
2251 |
|
2252 |
controlsTimer: null,
|
2253 |
|
2254 |
startControlsTimer: function(timeout) {
|
2255 |
|
2256 |
var t = this;
|
2257 |
-
|
2258 |
-
timeout = typeof timeout != 'undefined' ? timeout :
|
2259 |
|
2260 |
t.killControlsTimer('start');
|
2261 |
|
2262 |
t.controlsTimer = setTimeout(function() {
|
2263 |
-
//
|
2264 |
t.hideControls();
|
2265 |
t.killControlsTimer('hide');
|
2266 |
}, timeout);
|
@@ -2275,32 +3018,31 @@ if (typeof jQuery != 'undefined') {
|
|
2275 |
delete t.controlsTimer;
|
2276 |
t.controlsTimer = null;
|
2277 |
}
|
2278 |
-
},
|
2279 |
-
|
2280 |
controlsEnabled: true,
|
2281 |
-
|
2282 |
disableControls: function() {
|
2283 |
var t= this;
|
2284 |
-
|
2285 |
t.killControlsTimer();
|
2286 |
t.hideControls(false);
|
2287 |
this.controlsEnabled = false;
|
2288 |
},
|
2289 |
-
|
2290 |
enableControls: function() {
|
2291 |
var t= this;
|
2292 |
-
|
2293 |
t.showControls(false);
|
2294 |
-
|
2295 |
t.controlsEnabled = true;
|
2296 |
-
},
|
2297 |
-
|
2298 |
|
2299 |
// Sets up all controls and events
|
2300 |
-
meReady: function(media, domNode) {
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
mf = mejs.MediaFeatures,
|
2305 |
autoplayAttr = domNode.getAttribute('autoplay'),
|
2306 |
autoplay = !(typeof autoplayAttr == 'undefined' || autoplayAttr === null || autoplayAttr === 'false'),
|
@@ -2308,16 +3050,40 @@ if (typeof jQuery != 'undefined') {
|
|
2308 |
feature;
|
2309 |
|
2310 |
// make sure it can't create itself again if a plugin reloads
|
2311 |
-
if (t.created)
|
2312 |
return;
|
2313 |
-
else
|
2314 |
-
t.created = true;
|
|
|
2315 |
|
2316 |
t.media = media;
|
2317 |
t.domNode = domNode;
|
2318 |
-
|
2319 |
-
if (!(mf.isAndroid && t.options.AndroidUseNativeControls) && !(mf.isiPad && t.options.iPadUseNativeControls) && !(mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
2320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2321 |
// two built in features
|
2322 |
t.buildposter(t, t.controls, t.layers, t.media);
|
2323 |
t.buildkeyboard(t, t.controls, t.layers, t.media);
|
@@ -2335,30 +3101,29 @@ if (typeof jQuery != 'undefined') {
|
|
2335 |
} catch (e) {
|
2336 |
// TODO: report control error
|
2337 |
//throw e;
|
2338 |
-
|
2339 |
-
|
2340 |
}
|
2341 |
}
|
2342 |
}
|
2343 |
|
2344 |
t.container.trigger('controlsready');
|
2345 |
-
|
2346 |
// reset all layers and controls
|
2347 |
t.setPlayerSize(t.width, t.height);
|
2348 |
t.setControlsSize();
|
2349 |
-
|
2350 |
|
2351 |
// controls fade
|
2352 |
if (t.isVideo) {
|
2353 |
-
|
2354 |
-
if (mejs.MediaFeatures.hasTouch) {
|
2355 |
-
|
2356 |
// for touch devices (iOS, Android)
|
2357 |
// show/hide without animation on touch
|
2358 |
-
|
2359 |
t.$media.bind('touchstart', function() {
|
2360 |
-
|
2361 |
-
|
2362 |
// toggle controls
|
2363 |
if (t.controlsAreVisible) {
|
2364 |
t.hideControls(false);
|
@@ -2367,28 +3132,39 @@ if (typeof jQuery != 'undefined') {
|
|
2367 |
t.showControls(false);
|
2368 |
}
|
2369 |
}
|
2370 |
-
});
|
2371 |
-
|
2372 |
} else {
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2384 |
// show/hide controls
|
2385 |
t.container
|
2386 |
-
.bind('mouseenter
|
2387 |
if (t.controlsEnabled) {
|
2388 |
-
if (!t.options.alwaysShowControls) {
|
2389 |
t.killControlsTimer('enter');
|
2390 |
t.showControls();
|
2391 |
-
t.startControlsTimer(
|
2392 |
}
|
2393 |
}
|
2394 |
})
|
@@ -2397,21 +3173,24 @@ if (typeof jQuery != 'undefined') {
|
|
2397 |
if (!t.controlsAreVisible) {
|
2398 |
t.showControls();
|
2399 |
}
|
2400 |
-
//t.killControlsTimer('move');
|
2401 |
if (!t.options.alwaysShowControls) {
|
2402 |
-
t.startControlsTimer(
|
2403 |
}
|
2404 |
}
|
2405 |
})
|
2406 |
.bind('mouseleave', function () {
|
2407 |
if (t.controlsEnabled) {
|
2408 |
if (!t.media.paused && !t.options.alwaysShowControls) {
|
2409 |
-
t.startControlsTimer(
|
2410 |
}
|
2411 |
}
|
2412 |
});
|
2413 |
}
|
2414 |
-
|
|
|
|
|
|
|
|
|
2415 |
// check for autoplay
|
2416 |
if (autoplay && !t.options.alwaysShowControls) {
|
2417 |
t.hideControls();
|
@@ -2430,110 +3209,159 @@ if (typeof jQuery != 'undefined') {
|
|
2430 |
}, false);
|
2431 |
}
|
2432 |
}
|
2433 |
-
|
2434 |
// EVENTS
|
2435 |
|
2436 |
-
// FOCUS: when a video starts playing, it takes focus from other players (
|
2437 |
-
media.addEventListener('play', function() {
|
2438 |
-
|
2439 |
-
|
2440 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
|
2445 |
-
p.hasFocus = false;
|
2446 |
}
|
2447 |
-
|
2448 |
-
|
|
|
|
|
2449 |
},false);
|
2450 |
-
|
2451 |
|
2452 |
// ended for all
|
2453 |
t.media.addEventListener('ended', function (e) {
|
2454 |
if(t.options.autoRewind) {
|
2455 |
try{
|
2456 |
t.media.setCurrentTime(0);
|
|
|
|
|
|
|
|
|
2457 |
} catch (exp) {
|
2458 |
-
|
2459 |
}
|
2460 |
}
|
2461 |
-
t.media.
|
2462 |
-
|
2463 |
-
|
|
|
|
|
|
|
|
|
2464 |
t.setProgressRail();
|
2465 |
-
|
2466 |
-
|
|
|
|
|
2467 |
|
2468 |
if (t.options.loop) {
|
2469 |
-
t.
|
2470 |
} else if (!t.options.alwaysShowControls && t.controlsEnabled) {
|
2471 |
t.showControls();
|
2472 |
}
|
2473 |
}, false);
|
2474 |
-
|
2475 |
// resize on the first play
|
2476 |
-
t.media.addEventListener('loadedmetadata', function(
|
|
|
|
|
|
|
2477 |
if (t.updateDuration) {
|
2478 |
t.updateDuration();
|
2479 |
}
|
2480 |
if (t.updateCurrent) {
|
2481 |
t.updateCurrent();
|
2482 |
}
|
2483 |
-
|
2484 |
if (!t.isFullScreen) {
|
2485 |
t.setPlayerSize(t.width, t.height);
|
2486 |
t.setControlsSize();
|
2487 |
}
|
2488 |
}, false);
|
2489 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2490 |
|
2491 |
// webkit has trouble doing this without a delay
|
2492 |
setTimeout(function () {
|
2493 |
t.setPlayerSize(t.width, t.height);
|
2494 |
t.setControlsSize();
|
2495 |
}, 50);
|
2496 |
-
|
2497 |
// adjust controls whenever window sizes (used to be in fullscreen only)
|
2498 |
-
|
2499 |
-
|
2500 |
-
// don't resize for fullscreen mode
|
2501 |
if ( !(t.isFullScreen || (mejs.MediaFeatures.hasTrueNativeFullScreen && document.webkitIsFullScreen)) ) {
|
2502 |
t.setPlayerSize(t.width, t.height);
|
2503 |
}
|
2504 |
-
|
2505 |
// always adjust controls
|
2506 |
t.setControlsSize();
|
2507 |
-
});
|
2508 |
|
2509 |
-
//
|
2510 |
-
|
2511 |
-
|
|
|
|
|
|
|
2512 |
}
|
2513 |
}
|
2514 |
-
|
2515 |
// force autoplay for HTML5
|
2516 |
if (autoplay && media.pluginType == 'native') {
|
2517 |
-
|
2518 |
-
media.play();
|
2519 |
}
|
2520 |
|
2521 |
|
2522 |
if (t.options.success) {
|
2523 |
-
|
2524 |
if (typeof t.options.success == 'string') {
|
2525 |
-
|
2526 |
} else {
|
2527 |
-
|
2528 |
}
|
2529 |
}
|
2530 |
},
|
2531 |
|
2532 |
handleError: function(e) {
|
2533 |
var t = this;
|
2534 |
-
|
2535 |
-
t.controls
|
2536 |
-
|
|
|
|
|
2537 |
// Tell user that the file cannot be played
|
2538 |
if (t.options.error) {
|
2539 |
t.options.error(e);
|
@@ -2543,117 +3371,255 @@ if (typeof jQuery != 'undefined') {
|
|
2543 |
setPlayerSize: function(width,height) {
|
2544 |
var t = this;
|
2545 |
|
2546 |
-
if
|
|
|
|
|
|
|
|
|
2547 |
t.width = width;
|
2548 |
-
|
2549 |
-
if (typeof height != 'undefined')
|
2550 |
-
t.height = height;
|
2551 |
|
2552 |
-
|
2553 |
-
|
2554 |
-
|
2555 |
-
|
2556 |
-
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
newHeight = t.isVideo || !t.options.autosizeProgress ? parseInt(parentWidth * nativeHeight/nativeWidth, 10) : nativeHeight;
|
2561 |
-
|
2562 |
-
if (t.container.parent()[0].tagName.toLowerCase() === 'body') { // && t.container.siblings().count == 0) {
|
2563 |
-
parentWidth = $(window).width();
|
2564 |
-
newHeight = $(window).height();
|
2565 |
-
}
|
2566 |
-
|
2567 |
-
if ( newHeight != 0 && parentWidth != 0 ) {
|
2568 |
-
// set outer container size
|
2569 |
-
t.container
|
2570 |
-
.width(parentWidth)
|
2571 |
-
.height(newHeight);
|
2572 |
-
|
2573 |
-
// set native <video> or <audio>
|
2574 |
-
t.$media
|
2575 |
-
.width('100%')
|
2576 |
-
.height('100%');
|
2577 |
-
|
2578 |
-
// set shims
|
2579 |
-
t.container.find('object, embed, iframe')
|
2580 |
-
.width('100%')
|
2581 |
-
.height('100%');
|
2582 |
-
|
2583 |
-
// if shim is ready, send the size to the embeded plugin
|
2584 |
if (t.isVideo) {
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
}
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
2592 |
-
|
2593 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2594 |
}
|
|
|
|
|
|
|
|
|
|
|
2595 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2596 |
|
2597 |
-
|
2598 |
-
|
2599 |
t.container
|
2600 |
-
.width(
|
2601 |
-
.height(
|
2602 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2603 |
t.layers.children('.mejs-layer')
|
2604 |
-
.width(
|
2605 |
-
.height(
|
2606 |
-
|
2607 |
}
|
2608 |
},
|
2609 |
-
|
2610 |
-
|
2611 |
var t = this,
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
current = t.controls.find('.mejs-time-current'),
|
2617 |
-
loaded = t.controls.find('.mejs-time-loaded'),
|
2618 |
-
others = rail.siblings();
|
2619 |
-
|
2620 |
-
|
2621 |
-
// allow the size to come from custom CSS
|
2622 |
-
if (t.options && !t.options.autosizeProgress) {
|
2623 |
-
// Also, frontends devs can be more flexible
|
2624 |
-
// due the opportunity of absolute positioning.
|
2625 |
-
railWidth = parseInt(rail.css('width'));
|
2626 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2627 |
|
2628 |
-
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2634 |
usedWidth += $(this).outerWidth(true);
|
2635 |
}
|
2636 |
});
|
2637 |
-
|
2638 |
// fit the rail into the remaining space
|
2639 |
railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.width());
|
2640 |
}
|
2641 |
|
2642 |
-
//
|
2643 |
-
|
2644 |
-
//
|
2645 |
-
|
2646 |
-
|
2647 |
-
|
2648 |
-
|
2649 |
-
|
2650 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2651 |
},
|
2652 |
|
2653 |
|
2654 |
buildposter: function(player, controls, layers, media) {
|
2655 |
var t = this,
|
2656 |
-
poster =
|
2657 |
$('<div class="mejs-poster mejs-layer">' +
|
2658 |
'</div>')
|
2659 |
.appendTo(layers),
|
@@ -2662,10 +3628,10 @@ if (typeof jQuery != 'undefined') {
|
|
2662 |
// prioriy goes to option (this is useful if you need to support iOS 3.x (iOS completely fails with poster)
|
2663 |
if (player.options.poster !== '') {
|
2664 |
posterUrl = player.options.poster;
|
2665 |
-
}
|
2666 |
-
|
2667 |
// second, try the real poster
|
2668 |
-
if (
|
2669 |
t.setPoster(posterUrl);
|
2670 |
} else {
|
2671 |
poster.hide();
|
@@ -2674,61 +3640,70 @@ if (typeof jQuery != 'undefined') {
|
|
2674 |
media.addEventListener('play',function() {
|
2675 |
poster.hide();
|
2676 |
}, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
2677 |
},
|
2678 |
-
|
2679 |
setPoster: function(url) {
|
2680 |
var t = this,
|
2681 |
posterDiv = t.container.find('.mejs-poster'),
|
2682 |
posterImg = posterDiv.find('img');
|
2683 |
-
|
2684 |
-
if (posterImg.length
|
2685 |
-
posterImg = $('<img width="100%" height="100%" />').appendTo(posterDiv);
|
2686 |
-
}
|
2687 |
-
|
2688 |
posterImg.attr('src', url);
|
|
|
2689 |
},
|
2690 |
|
2691 |
buildoverlays: function(player, controls, layers, media) {
|
2692 |
-
|
2693 |
if (!player.isVideo)
|
2694 |
return;
|
2695 |
|
2696 |
-
var
|
2697 |
-
loading =
|
2698 |
$('<div class="mejs-overlay mejs-layer">'+
|
2699 |
'<div class="mejs-overlay-loading"><span></span></div>'+
|
2700 |
'</div>')
|
2701 |
.hide() // start out hidden
|
2702 |
.appendTo(layers),
|
2703 |
-
error =
|
2704 |
$('<div class="mejs-overlay mejs-layer">'+
|
2705 |
'<div class="mejs-overlay-error"></div>'+
|
2706 |
'</div>')
|
2707 |
.hide() // start out hidden
|
2708 |
.appendTo(layers),
|
2709 |
// this needs to come last so it's on top
|
2710 |
-
bigPlay =
|
2711 |
$('<div class="mejs-overlay mejs-layer mejs-overlay-play">'+
|
2712 |
-
'<div class="mejs-overlay-button"></div>'+
|
2713 |
'</div>')
|
2714 |
.appendTo(layers)
|
2715 |
-
.click
|
2716 |
-
|
2717 |
-
|
2718 |
-
|
2719 |
-
|
2720 |
-
|
2721 |
-
|
2722 |
-
|
|
|
|
|
2723 |
});
|
2724 |
-
|
2725 |
/*
|
2726 |
if (mejs.MediaFeatures.isiOS || mejs.MediaFeatures.isAndroid) {
|
2727 |
bigPlay.remove();
|
2728 |
loading.remove();
|
2729 |
}
|
2730 |
*/
|
2731 |
-
|
2732 |
|
2733 |
// show/hide big play button
|
2734 |
media.addEventListener('play',function() {
|
@@ -2736,13 +3711,13 @@ if (typeof jQuery != 'undefined') {
|
|
2736 |
loading.hide();
|
2737 |
controls.find('.mejs-time-buffering').hide();
|
2738 |
error.hide();
|
2739 |
-
}, false);
|
2740 |
-
|
2741 |
media.addEventListener('playing', function() {
|
2742 |
bigPlay.hide();
|
2743 |
loading.hide();
|
2744 |
controls.find('.mejs-time-buffering').hide();
|
2745 |
-
error.hide();
|
2746 |
}, false);
|
2747 |
|
2748 |
media.addEventListener('seeking', function() {
|
@@ -2754,75 +3729,99 @@ if (typeof jQuery != 'undefined') {
|
|
2754 |
loading.hide();
|
2755 |
controls.find('.mejs-time-buffering').hide();
|
2756 |
}, false);
|
2757 |
-
|
2758 |
media.addEventListener('pause',function() {
|
2759 |
if (!mejs.MediaFeatures.isiPhone) {
|
2760 |
bigPlay.show();
|
2761 |
}
|
2762 |
}, false);
|
2763 |
-
|
2764 |
media.addEventListener('waiting', function() {
|
2765 |
-
loading.show();
|
2766 |
controls.find('.mejs-time-buffering').show();
|
2767 |
-
}, false);
|
2768 |
-
|
2769 |
-
|
2770 |
-
// show/hide loading
|
2771 |
media.addEventListener('loadeddata',function() {
|
2772 |
// for some reason Chrome is firing this event
|
2773 |
//if (mejs.MediaFeatures.isChrome && media.getAttribute && media.getAttribute('preload') === 'none')
|
2774 |
// return;
|
2775 |
-
|
2776 |
loading.show();
|
2777 |
controls.find('.mejs-time-buffering').show();
|
2778 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2779 |
media.addEventListener('canplay',function() {
|
2780 |
loading.hide();
|
2781 |
controls.find('.mejs-time-buffering').hide();
|
2782 |
-
|
|
|
2783 |
|
2784 |
// error handling
|
2785 |
-
media.addEventListener('error',function() {
|
|
|
2786 |
loading.hide();
|
2787 |
-
|
2788 |
error.show();
|
2789 |
-
error.find('mejs-overlay-error').html("Error loading this resource");
|
2790 |
-
}, false);
|
|
|
|
|
|
|
|
|
2791 |
},
|
2792 |
-
|
2793 |
buildkeyboard: function(player, controls, layers, media) {
|
2794 |
|
2795 |
var t = this;
|
2796 |
-
|
|
|
|
|
|
|
|
|
2797 |
// listen for key presses
|
2798 |
-
|
2799 |
-
|
2800 |
-
|
2801 |
-
|
2802 |
-
// find a matching key
|
2803 |
-
for (var i=0, il=player.options.keyActions.length; i<il; i++) {
|
2804 |
-
var keyAction = player.options.keyActions[i];
|
2805 |
-
|
2806 |
-
for (var j=0, jl=keyAction.keys.length; j<jl; j++) {
|
2807 |
-
if (e.keyCode == keyAction.keys[j]) {
|
2808 |
-
e.preventDefault();
|
2809 |
-
keyAction.action(player, media, e.keyCode);
|
2810 |
-
return false;
|
2811 |
-
}
|
2812 |
-
}
|
2813 |
-
}
|
2814 |
-
}
|
2815 |
-
|
2816 |
-
return true;
|
2817 |
});
|
2818 |
-
|
|
|
2819 |
// check if someone clicked outside a player region, then kill its focus
|
2820 |
-
|
2821 |
-
|
2822 |
-
player.hasFocus = false;
|
2823 |
-
}
|
2824 |
});
|
2825 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2826 |
},
|
2827 |
|
2828 |
findTracks: function() {
|
@@ -2832,11 +3831,11 @@ if (typeof jQuery != 'undefined') {
|
|
2832 |
// store for use by plugins
|
2833 |
t.tracks = [];
|
2834 |
tracktags.each(function(index, track) {
|
2835 |
-
|
2836 |
track = $(track);
|
2837 |
-
|
2838 |
t.tracks.push({
|
2839 |
-
srclang: track.attr('srclang').toLowerCase(),
|
2840 |
src: track.attr('src'),
|
2841 |
kind: track.attr('kind'),
|
2842 |
label: track.attr('label') || '',
|
@@ -2851,13 +3850,20 @@ if (typeof jQuery != 'undefined') {
|
|
2851 |
this.setControlsSize();
|
2852 |
},
|
2853 |
play: function() {
|
|
|
2854 |
this.media.play();
|
2855 |
},
|
2856 |
pause: function() {
|
2857 |
-
|
|
|
|
|
2858 |
},
|
2859 |
load: function() {
|
2860 |
-
this.
|
|
|
|
|
|
|
|
|
2861 |
},
|
2862 |
setMuted: function(muted) {
|
2863 |
this.media.setMuted(muted);
|
@@ -2875,40 +3881,181 @@ if (typeof jQuery != 'undefined') {
|
|
2875 |
return this.media.volume;
|
2876 |
},
|
2877 |
setSrc: function(src) {
|
2878 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2879 |
},
|
2880 |
remove: function() {
|
2881 |
-
var t = this;
|
2882 |
-
|
2883 |
-
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2887 |
}
|
2888 |
-
|
2889 |
// grab video and put it back in place
|
2890 |
if (!t.isDynamic) {
|
2891 |
-
t.$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2892 |
}
|
2893 |
-
|
2894 |
-
t.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2895 |
}
|
2896 |
};
|
2897 |
|
2898 |
-
|
2899 |
-
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2903 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2904 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2905 |
}
|
2906 |
-
|
2907 |
-
$(document).ready(function() {
|
2908 |
-
// auto enable using JSON attribute
|
2909 |
-
$('.mejs-player').mediaelementplayer();
|
2910 |
-
});
|
2911 |
-
|
2912 |
// push out to window
|
2913 |
window.MediaElementPlayer = mejs.MediaElementPlayer;
|
2914 |
|
@@ -2917,17 +4064,22 @@ if (typeof jQuery != 'undefined') {
|
|
2917 |
(function($) {
|
2918 |
|
2919 |
$.extend(mejs.MepDefaults, {
|
2920 |
-
|
|
|
2921 |
});
|
2922 |
|
|
|
2923 |
// PLAY/pause BUTTON
|
2924 |
$.extend(MediaElementPlayer.prototype, {
|
2925 |
buildplaypause: function(player, controls, layers, media) {
|
2926 |
var
|
2927 |
t = this,
|
2928 |
-
|
|
|
|
|
|
|
2929 |
$('<div class="mejs-button mejs-playpause-button mejs-play" >' +
|
2930 |
-
'<button type="button" aria-controls="' + t.id + '" title="' +
|
2931 |
'</div>')
|
2932 |
.appendTo(controls)
|
2933 |
.click(function(e) {
|
@@ -2940,26 +4092,47 @@ if (typeof jQuery != 'undefined') {
|
|
2940 |
}
|
2941 |
|
2942 |
return false;
|
2943 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2944 |
|
2945 |
media.addEventListener('play',function() {
|
2946 |
-
|
2947 |
}, false);
|
2948 |
media.addEventListener('playing',function() {
|
2949 |
-
|
2950 |
}, false);
|
2951 |
|
2952 |
|
2953 |
media.addEventListener('pause',function() {
|
2954 |
-
|
2955 |
}, false);
|
2956 |
media.addEventListener('paused',function() {
|
2957 |
-
|
2958 |
}, false);
|
2959 |
}
|
2960 |
});
|
2961 |
|
2962 |
})(mejs.$);
|
|
|
2963 |
(function($) {
|
2964 |
|
2965 |
$.extend(mejs.MepDefaults, {
|
@@ -2969,10 +4142,10 @@ if (typeof jQuery != 'undefined') {
|
|
2969 |
// STOP BUTTON
|
2970 |
$.extend(MediaElementPlayer.prototype, {
|
2971 |
buildstop: function(player, controls, layers, media) {
|
2972 |
-
var t = this
|
2973 |
-
|
2974 |
-
|
2975 |
-
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.stopText + '"></button>' +
|
2976 |
'</div>')
|
2977 |
.appendTo(controls)
|
2978 |
.click(function() {
|
@@ -2984,8 +4157,8 @@ if (typeof jQuery != 'undefined') {
|
|
2984 |
media.pause();
|
2985 |
controls.find('.mejs-time-current').width('0px');
|
2986 |
controls.find('.mejs-time-handle').css('left', '0px');
|
2987 |
-
controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0
|
2988 |
-
controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0
|
2989 |
layers.find('.mejs-poster').show();
|
2990 |
}
|
2991 |
});
|
@@ -2993,43 +4166,70 @@ if (typeof jQuery != 'undefined') {
|
|
2993 |
});
|
2994 |
|
2995 |
})(mejs.$);
|
|
|
2996 |
(function($) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2997 |
// progress/loaded bar
|
2998 |
$.extend(MediaElementPlayer.prototype, {
|
2999 |
buildprogress: function(player, controls, layers, media) {
|
3000 |
|
3001 |
-
|
3002 |
-
|
3003 |
-
|
3004 |
-
|
3005 |
-
|
3006 |
-
|
3007 |
-
|
3008 |
-
|
3009 |
-
|
3010 |
-
'</span>'+
|
3011 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3012 |
'</div>')
|
3013 |
.appendTo(controls);
|
3014 |
-
|
3015 |
|
3016 |
-
|
3017 |
-
|
3018 |
-
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
-
|
3024 |
-
|
3025 |
-
|
3026 |
-
var
|
3027 |
-
|
3028 |
-
width = total.outerWidth(true),
|
3029 |
percentage = 0,
|
3030 |
newTime = 0,
|
3031 |
-
pos = 0
|
3032 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3033 |
|
3034 |
if (media.duration) {
|
3035 |
if (x < offset.left) {
|
@@ -3037,7 +4237,7 @@ if (typeof jQuery != 'undefined') {
|
|
3037 |
} else if (x > width + offset.left) {
|
3038 |
x = width + offset.left;
|
3039 |
}
|
3040 |
-
|
3041 |
pos = x - offset.left;
|
3042 |
percentage = (pos / width);
|
3043 |
newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
|
@@ -3049,53 +4249,139 @@ if (typeof jQuery != 'undefined') {
|
|
3049 |
|
3050 |
// position floating time box
|
3051 |
if (!mejs.MediaFeatures.hasTouch) {
|
3052 |
-
|
3053 |
-
|
3054 |
-
|
3055 |
}
|
3056 |
}
|
3057 |
},
|
3058 |
-
|
3059 |
-
|
3060 |
-
|
3061 |
-
|
3062 |
-
|
3063 |
-
|
3064 |
-
|
3065 |
-
|
3066 |
-
|
3067 |
-
|
3068 |
-
|
3069 |
-
|
3070 |
-
|
3071 |
-
|
3072 |
-
|
3073 |
-
|
3074 |
-
mouseIsDown = false;
|
3075 |
-
timefloat.hide();
|
3076 |
-
$(document).unbind('.dur');
|
3077 |
-
});
|
3078 |
-
return false;
|
3079 |
-
}
|
3080 |
-
})
|
3081 |
-
.bind('mouseenter', function(e) {
|
3082 |
-
mouseIsOver = true;
|
3083 |
-
$(document).bind('mousemove.dur', function(e) {
|
3084 |
-
handleMouseMove(e);
|
3085 |
});
|
3086 |
-
|
3087 |
-
|
3088 |
-
|
3089 |
-
|
3090 |
-
|
3091 |
-
|
3092 |
-
if (!mouseIsDown) {
|
3093 |
-
$(document).unbind('.dur');
|
3094 |
-
timefloat.hide();
|
3095 |
}
|
3096 |
-
}
|
3097 |
|
3098 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3099 |
media.addEventListener('progress', function (e) {
|
3100 |
player.setProgressRail(e);
|
3101 |
player.setCurrentRail(e);
|
@@ -3105,37 +4391,36 @@ if (typeof jQuery != 'undefined') {
|
|
3105 |
media.addEventListener('timeupdate', function(e) {
|
3106 |
player.setProgressRail(e);
|
3107 |
player.setCurrentRail(e);
|
|
|
3108 |
}, false);
|
3109 |
-
|
3110 |
-
|
3111 |
-
|
3112 |
-
|
3113 |
-
|
3114 |
-
t.current = current;
|
3115 |
-
t.handle = handle;
|
3116 |
},
|
3117 |
setProgressRail: function(e) {
|
3118 |
|
3119 |
var
|
3120 |
t = this,
|
3121 |
-
target = (e
|
3122 |
-
percent = null;
|
3123 |
|
3124 |
// newest HTML5 spec has buffered array (FF4, Webkit)
|
3125 |
if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
|
3126 |
-
//
|
3127 |
-
percent = target.buffered.end(
|
3128 |
}
|
3129 |
// Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
|
3130 |
// to be anything other than 0. If the byte count is available we use this instead.
|
3131 |
// Browsers that support the else if do not seem to have the bufferedBytes value and
|
3132 |
// should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
|
3133 |
-
else if (target && target.bytesTotal
|
3134 |
percent = target.bufferedBytes / target.bytesTotal;
|
3135 |
}
|
3136 |
// Firefox 3 with an Ogg file seems to go this way
|
3137 |
-
else if (e && e.lengthComputable && e.total
|
3138 |
-
percent = e.loaded/e.total;
|
3139 |
}
|
3140 |
|
3141 |
// finally update the progress bar
|
@@ -3151,20 +4436,20 @@ if (typeof jQuery != 'undefined') {
|
|
3151 |
|
3152 |
var t = this;
|
3153 |
|
3154 |
-
if (t.media.currentTime
|
3155 |
|
3156 |
// update bar and handle
|
3157 |
if (t.total && t.handle) {
|
3158 |
var
|
3159 |
-
newWidth = t.total.width() * t.media.currentTime / t.media.duration,
|
3160 |
-
handlePos = newWidth - (t.handle.outerWidth(true) / 2);
|
3161 |
|
3162 |
t.current.width(newWidth);
|
3163 |
t.handle.css('left', handlePos);
|
3164 |
}
|
3165 |
}
|
3166 |
|
3167 |
-
}
|
3168 |
});
|
3169 |
})(mejs.$);
|
3170 |
|
@@ -3173,7 +4458,7 @@ if (typeof jQuery != 'undefined') {
|
|
3173 |
// options
|
3174 |
$.extend(mejs.MepDefaults, {
|
3175 |
duration: -1,
|
3176 |
-
timeAndDurationSeparator: '
|
3177 |
});
|
3178 |
|
3179 |
|
@@ -3182,16 +4467,20 @@ if (typeof jQuery != 'undefined') {
|
|
3182 |
buildcurrent: function(player, controls, layers, media) {
|
3183 |
var t = this;
|
3184 |
|
3185 |
-
$('<div class="mejs-time">'+
|
3186 |
-
'<span class="mejs-currenttime">' +
|
3187 |
-
|
3188 |
-
|
3189 |
-
|
|
|
3190 |
|
3191 |
t.currenttime = t.controls.find('.mejs-currenttime');
|
3192 |
|
3193 |
media.addEventListener('timeupdate',function() {
|
3194 |
-
|
|
|
|
|
|
|
3195 |
}, false);
|
3196 |
},
|
3197 |
|
@@ -3202,10 +4491,7 @@ if (typeof jQuery != 'undefined') {
|
|
3202 |
if (controls.children().last().find('.mejs-currenttime').length > 0) {
|
3203 |
$(t.options.timeAndDurationSeparator +
|
3204 |
'<span class="mejs-duration">' +
|
3205 |
-
(t.options.duration
|
3206 |
-
mejs.Utility.secondsToTimeCode(t.options.duration, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25) :
|
3207 |
-
((player.options.alwaysShowHours ? '00:' : '') + (player.options.showTimecodeFrameCount? '00:00:00':'00:00'))
|
3208 |
-
) +
|
3209 |
'</span>')
|
3210 |
.appendTo(controls.find('.mejs-time'));
|
3211 |
} else {
|
@@ -3215,10 +4501,7 @@ if (typeof jQuery != 'undefined') {
|
|
3215 |
|
3216 |
$('<div class="mejs-time mejs-duration-container">'+
|
3217 |
'<span class="mejs-duration">' +
|
3218 |
-
(t.options.duration
|
3219 |
-
mejs.Utility.secondsToTimeCode(t.options.duration, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25) :
|
3220 |
-
((player.options.alwaysShowHours ? '00:' : '') + (player.options.showTimecodeFrameCount? '00:00:00':'00:00'))
|
3221 |
-
) +
|
3222 |
'</span>' +
|
3223 |
'</div>')
|
3224 |
.appendTo(controls);
|
@@ -3227,228 +4510,289 @@ if (typeof jQuery != 'undefined') {
|
|
3227 |
t.durationD = t.controls.find('.mejs-duration');
|
3228 |
|
3229 |
media.addEventListener('timeupdate',function() {
|
3230 |
-
|
|
|
|
|
3231 |
}, false);
|
3232 |
},
|
3233 |
|
3234 |
updateCurrent: function() {
|
3235 |
var t = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
3236 |
|
3237 |
if (t.currenttime) {
|
3238 |
-
t.currenttime.html(mejs.Utility.secondsToTimeCode(
|
3239 |
}
|
3240 |
},
|
3241 |
|
3242 |
-
updateDuration: function() {
|
3243 |
var t = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3244 |
|
3245 |
//Toggle the long video class if the video is longer than an hour.
|
3246 |
-
t.container.toggleClass("mejs-long-video",
|
3247 |
|
3248 |
-
if (t.
|
3249 |
-
t.durationD.html(mejs.Utility.secondsToTimeCode(
|
3250 |
}
|
3251 |
}
|
3252 |
});
|
3253 |
|
3254 |
})(mejs.$);
|
3255 |
-
|
|
|
3256 |
|
3257 |
$.extend(mejs.MepDefaults, {
|
3258 |
-
muteText: '
|
|
|
3259 |
hideVolumeOnTouchDevices: true,
|
3260 |
-
|
3261 |
audioVolume: 'horizontal',
|
3262 |
videoVolume: 'vertical'
|
3263 |
});
|
3264 |
|
3265 |
$.extend(MediaElementPlayer.prototype, {
|
3266 |
-
buildvolume: function(player, controls, layers, media) {
|
3267 |
-
|
3268 |
// Android and iOS don't support volume controls
|
3269 |
-
if (mejs.MediaFeatures.
|
3270 |
return;
|
3271 |
-
|
3272 |
var t = this,
|
3273 |
mode = (t.isVideo) ? t.options.videoVolume : t.options.audioVolume,
|
3274 |
mute = (mode == 'horizontal') ?
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
3279 |
-
|
3280 |
-
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
|
3285 |
-
|
|
|
|
|
|
|
|
|
3286 |
.appendTo(controls) :
|
3287 |
-
|
3288 |
-
|
3289 |
-
|
3290 |
-
|
3291 |
-
|
3292 |
-
'
|
3293 |
-
'
|
3294 |
-
'<
|
3295 |
-
|
3296 |
-
|
|
|
|
|
|
|
|
|
3297 |
.appendTo(controls),
|
3298 |
-
|
3299 |
-
|
3300 |
-
|
3301 |
-
|
3302 |
|
3303 |
-
|
3304 |
|
3305 |
-
|
3306 |
-
|
3307 |
-
|
3308 |
-
|
3309 |
-
return;
|
3310 |
-
}
|
3311 |
-
|
3312 |
-
// correct to 0-1
|
3313 |
-
volume = Math.max(0,volume);
|
3314 |
-
volume = Math.min(volume,1);
|
3315 |
-
|
3316 |
-
// ajust mute button style
|
3317 |
-
if (volume == 0) {
|
3318 |
-
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
3319 |
-
} else {
|
3320 |
-
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
3321 |
-
}
|
3322 |
-
|
3323 |
-
// position slider
|
3324 |
-
if (mode == 'vertical') {
|
3325 |
-
var
|
3326 |
-
|
3327 |
-
// height of the full size volume slider background
|
3328 |
-
totalHeight = volumeTotal.height(),
|
3329 |
-
|
3330 |
-
// top/left of full size volume slider background
|
3331 |
-
totalPosition = volumeTotal.position(),
|
3332 |
-
|
3333 |
-
// the new top position based on the current volume
|
3334 |
-
// 70% volume on 100px height == top:30px
|
3335 |
-
newTop = totalHeight - (totalHeight * volume);
|
3336 |
-
|
3337 |
-
// handle
|
3338 |
-
volumeHandle.css('top', Math.round(totalPosition.top + newTop - (volumeHandle.height() / 2)));
|
3339 |
-
|
3340 |
-
// show the current visibility
|
3341 |
-
volumeCurrent.height(totalHeight - newTop );
|
3342 |
-
volumeCurrent.css('top', totalPosition.top + newTop);
|
3343 |
-
} else {
|
3344 |
-
var
|
3345 |
-
|
3346 |
-
// height of the full size volume slider background
|
3347 |
-
totalWidth = volumeTotal.width(),
|
3348 |
-
|
3349 |
-
// top/left of full size volume slider background
|
3350 |
-
totalPosition = volumeTotal.position(),
|
3351 |
-
|
3352 |
-
// the new left position based on the current volume
|
3353 |
-
newLeft = totalWidth * volume;
|
3354 |
-
|
3355 |
-
// handle
|
3356 |
-
volumeHandle.css('left', Math.round(totalPosition.left + newLeft - (volumeHandle.width() / 2)));
|
3357 |
-
|
3358 |
-
// rezize the current part of the volume bar
|
3359 |
-
volumeCurrent.width( Math.round(newLeft) );
|
3360 |
-
}
|
3361 |
-
},
|
3362 |
-
handleVolumeMove = function(e) {
|
3363 |
-
|
3364 |
-
var volume = null,
|
3365 |
-
totalOffset = volumeTotal.offset();
|
3366 |
-
|
3367 |
-
// calculate the new volume based on the moust position
|
3368 |
-
if (mode == 'vertical') {
|
3369 |
-
|
3370 |
-
var
|
3371 |
-
railHeight = volumeTotal.height(),
|
3372 |
-
totalTop = parseInt(volumeTotal.css('top').replace(/px/,''),10),
|
3373 |
-
newY = e.pageY - totalOffset.top;
|
3374 |
-
|
3375 |
-
volume = (railHeight - newY) / railHeight;
|
3376 |
-
|
3377 |
-
// the controls just hide themselves (usually when mouse moves too far up)
|
3378 |
-
if (totalOffset.top == 0 || totalOffset.left == 0)
|
3379 |
return;
|
3380 |
-
|
3381 |
-
|
3382 |
-
|
3383 |
-
|
3384 |
-
|
3385 |
-
|
3386 |
-
|
3387 |
-
|
3388 |
-
|
3389 |
-
|
3390 |
-
|
3391 |
-
|
3392 |
-
|
3393 |
-
|
3394 |
-
|
3395 |
-
|
3396 |
-
|
3397 |
-
|
3398 |
-
|
3399 |
-
|
3400 |
-
|
3401 |
-
|
3402 |
-
|
3403 |
-
|
3404 |
-
|
3405 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3406 |
|
3407 |
// SLIDER
|
3408 |
-
|
3409 |
mute
|
3410 |
-
|
3411 |
-
|
3412 |
-
|
3413 |
-
|
3414 |
-
|
3415 |
-
|
3416 |
-
|
3417 |
-
|
3418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3419 |
});
|
3420 |
-
|
|
|
|
|
3421 |
volumeSlider
|
3422 |
-
|
3423 |
-
|
3424 |
-
|
3425 |
-
|
|
|
|
|
3426 |
handleVolumeMove(e);
|
3427 |
-
|
3428 |
-
|
3429 |
-
|
3430 |
-
|
3431 |
-
.bind('mouseup.vol', function () {
|
3432 |
-
mouseIsDown = false;
|
3433 |
-
$(document).unbind('.vol');
|
3434 |
|
3435 |
-
|
3436 |
-
|
3437 |
-
|
3438 |
-
});
|
3439 |
-
mouseIsDown = true;
|
3440 |
-
|
3441 |
-
return false;
|
3442 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3443 |
|
|
|
|
|
|
|
|
|
|
|
3444 |
|
3445 |
// MUTE button
|
3446 |
-
mute.find('button').click(function() {
|
3447 |
-
media.setMuted(
|
|
|
|
|
|
|
|
|
|
|
3448 |
});
|
3449 |
|
3450 |
// listen for volume change events from other sources
|
3451 |
-
media.addEventListener('volumechange', function(e) {
|
3452 |
if (!mouseIsDown) {
|
3453 |
if (media.muted) {
|
3454 |
positionVolumeHandle(0);
|
@@ -3458,20 +4802,31 @@ if (typeof jQuery != 'undefined') {
|
|
3458 |
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
3459 |
}
|
3460 |
}
|
|
|
3461 |
}, false);
|
3462 |
|
3463 |
-
if
|
3464 |
-
|
3465 |
-
|
3466 |
-
|
3467 |
-
|
3468 |
-
|
3469 |
-
|
3470 |
-
|
3471 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3472 |
}
|
3473 |
});
|
3474 |
-
|
3475 |
})(mejs.$);
|
3476 |
|
3477 |
(function($) {
|
@@ -3479,7 +4834,7 @@ if (typeof jQuery != 'undefined') {
|
|
3479 |
$.extend(mejs.MepDefaults, {
|
3480 |
usePluginFullScreen: true,
|
3481 |
newWindowCallback: function() { return '';},
|
3482 |
-
fullscreenText:
|
3483 |
});
|
3484 |
|
3485 |
$.extend(MediaElementPlayer.prototype, {
|
@@ -3488,334 +4843,360 @@ if (typeof jQuery != 'undefined') {
|
|
3488 |
|
3489 |
isNativeFullScreen: false,
|
3490 |
|
3491 |
-
docStyleOverflow: null,
|
3492 |
-
|
3493 |
isInIframe: false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3494 |
|
3495 |
buildfullscreen: function(player, controls, layers, media) {
|
3496 |
|
3497 |
if (!player.isVideo)
|
3498 |
return;
|
3499 |
-
|
3500 |
-
player.isInIframe = (window.location != window.parent.location);
|
3501 |
-
|
3502 |
-
//
|
3503 |
-
|
3504 |
-
|
3505 |
-
|
3506 |
-
var target = null;
|
3507 |
-
|
3508 |
-
if (mejs.MediaFeatures.hasMozNativeFullScreen) {
|
3509 |
-
target = $(document);
|
3510 |
-
} else {
|
3511 |
-
target = player.container;
|
3512 |
-
}
|
3513 |
-
|
3514 |
-
target.bind(mejs.MediaFeatures.fullScreenEventName, function(e) {
|
3515 |
-
|
3516 |
-
if (mejs.MediaFeatures.isFullScreen()) {
|
3517 |
-
player.isNativeFullScreen = true;
|
3518 |
-
// reset the controls once we are fully in full screen
|
3519 |
-
player.setControlsSize();
|
3520 |
-
} else {
|
3521 |
-
player.isNativeFullScreen = false;
|
3522 |
-
// when a user presses ESC
|
3523 |
-
// make sure to put the player back into place
|
3524 |
-
player.exitFullScreen();
|
3525 |
-
}
|
3526 |
-
});
|
3527 |
-
}
|
3528 |
-
|
3529 |
var t = this,
|
3530 |
-
|
3531 |
-
|
3532 |
-
container = player.container,
|
3533 |
fullscreenBtn =
|
3534 |
$('<div class="mejs-button mejs-fullscreen-button">' +
|
3535 |
-
'<button type="button" aria-controls="' + t.id + '" title="' +
|
3536 |
'</div>')
|
3537 |
-
.appendTo(controls)
|
3538 |
-
|
3539 |
-
|
3540 |
-
|
3541 |
-
fullscreenBtn.click(function() {
|
3542 |
var isFullScreen = (mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || player.isFullScreen;
|
3543 |
-
|
3544 |
if (isFullScreen) {
|
3545 |
player.exitFullScreen();
|
3546 |
} else {
|
3547 |
player.enterFullScreen();
|
3548 |
}
|
3549 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3550 |
|
3551 |
-
|
|
|
3552 |
|
3553 |
-
|
3554 |
-
|
3555 |
-
|
3556 |
-
|
3557 |
-
documentElement = document.documentElement,
|
3558 |
-
getComputedStyle = window.getComputedStyle,
|
3559 |
-
supports;
|
3560 |
-
if(!('pointerEvents' in element.style)){
|
3561 |
-
return false;
|
3562 |
}
|
3563 |
-
|
3564 |
-
|
3565 |
-
|
3566 |
-
|
3567 |
-
|
3568 |
-
documentElement.removeChild(element);
|
3569 |
-
return !!supports;
|
3570 |
-
})();
|
3571 |
-
|
3572 |
-
//console.log('supportsPointerEvents', supportsPointerEvents);
|
3573 |
-
|
3574 |
-
if (supportsPointerEvents && !mejs.MediaFeatures.isOpera) { // opera doesn't allow this :(
|
3575 |
-
|
3576 |
-
// allows clicking through the fullscreen button and controls down directly to Flash
|
3577 |
-
|
3578 |
-
/*
|
3579 |
-
When a user puts his mouse over the fullscreen button, the controls are disabled
|
3580 |
-
So we put a div over the video and another one on iether side of the fullscreen button
|
3581 |
-
that caputre mouse movement
|
3582 |
-
and restore the controls once the mouse moves outside of the fullscreen button
|
3583 |
-
*/
|
3584 |
-
|
3585 |
-
var fullscreenIsDisabled = false,
|
3586 |
-
restoreControls = function() {
|
3587 |
-
if (fullscreenIsDisabled) {
|
3588 |
-
// hide the hovers
|
3589 |
-
videoHoverDiv.hide();
|
3590 |
-
controlsLeftHoverDiv.hide();
|
3591 |
-
controlsRightHoverDiv.hide();
|
3592 |
-
|
3593 |
-
// restore the control bar
|
3594 |
-
fullscreenBtn.css('pointer-events', '');
|
3595 |
-
t.controls.css('pointer-events', '');
|
3596 |
-
|
3597 |
-
// store for later
|
3598 |
-
fullscreenIsDisabled = false;
|
3599 |
-
}
|
3600 |
-
},
|
3601 |
-
videoHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
3602 |
-
controlsLeftHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
3603 |
-
controlsRightHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
3604 |
-
positionHoverDivs = function() {
|
3605 |
-
var style = {position: 'absolute', top: 0, left: 0}; //, backgroundColor: '#f00'};
|
3606 |
-
videoHoverDiv.css(style);
|
3607 |
-
controlsLeftHoverDiv.css(style);
|
3608 |
-
controlsRightHoverDiv.css(style);
|
3609 |
-
|
3610 |
-
// over video, but not controls
|
3611 |
-
videoHoverDiv
|
3612 |
-
.width( t.container.width() )
|
3613 |
-
.height( t.container.height() - t.controls.height() );
|
3614 |
-
|
3615 |
-
// over controls, but not the fullscreen button
|
3616 |
-
var fullScreenBtnOffset = fullscreenBtn.offset().left - t.container.offset().left;
|
3617 |
-
fullScreenBtnWidth = fullscreenBtn.outerWidth(true);
|
3618 |
-
|
3619 |
-
controlsLeftHoverDiv
|
3620 |
-
.width( fullScreenBtnOffset )
|
3621 |
-
.height( t.controls.height() )
|
3622 |
-
.css({top: t.container.height() - t.controls.height()});
|
3623 |
-
|
3624 |
-
// after the fullscreen button
|
3625 |
-
controlsRightHoverDiv
|
3626 |
-
.width( t.container.width() - fullScreenBtnOffset - fullScreenBtnWidth )
|
3627 |
-
.height( t.controls.height() )
|
3628 |
-
.css({top: t.container.height() - t.controls.height(),
|
3629 |
-
left: fullScreenBtnOffset + fullScreenBtnWidth});
|
3630 |
-
};
|
3631 |
|
3632 |
-
|
3633 |
-
positionHoverDivs();
|
3634 |
-
});
|
3635 |
|
3636 |
-
|
3637 |
-
|
3638 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3639 |
|
3640 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3641 |
|
3642 |
-
|
3643 |
-
containerPos = player.container.offset();
|
3644 |
|
3645 |
-
|
3646 |
-
|
|
|
|
|
|
|
3647 |
|
3648 |
-
|
3649 |
-
|
3650 |
-
|
|
|
|
|
|
|
|
|
3651 |
|
3652 |
-
|
3653 |
-
|
3654 |
-
|
3655 |
-
controlsLeftHoverDiv.show();
|
3656 |
-
positionHoverDivs();
|
3657 |
|
3658 |
-
|
3659 |
-
|
3660 |
|
3661 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3662 |
|
3663 |
-
|
3664 |
-
|
3665 |
-
|
3666 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3667 |
|
|
|
|
|
|
|
3668 |
|
3669 |
-
|
3670 |
-
|
3671 |
-
|
3672 |
-
$(document).mousemove(function(e) {
|
3673 |
|
3674 |
-
|
3675 |
-
|
3676 |
|
3677 |
-
|
3678 |
|
|
|
|
|
3679 |
|
3680 |
-
|
3681 |
-
|
3682 |
-
) {
|
3683 |
|
3684 |
-
|
3685 |
-
|
|
|
3686 |
|
3687 |
-
|
3688 |
-
|
3689 |
-
}
|
3690 |
-
});
|
3691 |
-
*/
|
3692 |
|
|
|
|
|
|
|
|
|
3693 |
|
3694 |
-
|
3695 |
|
3696 |
-
|
|
|
3697 |
|
3698 |
-
|
3699 |
-
.mouseover(function() {
|
3700 |
|
3701 |
-
|
3702 |
-
|
3703 |
-
|
3704 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3705 |
|
3706 |
-
var buttonPos = fullscreenBtn.offset(),
|
3707 |
-
containerPos = player.container.offset();
|
3708 |
|
3709 |
-
|
|
|
3710 |
|
3711 |
-
|
3712 |
-
.mouseout(function() {
|
3713 |
|
3714 |
-
|
3715 |
-
|
3716 |
-
delete hideTimeout;
|
3717 |
-
}
|
3718 |
|
3719 |
-
|
3720 |
-
media.hideFullscreenButton();
|
3721 |
-
}, 1500);
|
3722 |
|
3723 |
|
3724 |
-
|
3725 |
-
|
3726 |
-
|
3727 |
|
3728 |
-
|
|
|
3729 |
|
3730 |
-
|
3731 |
-
|
3732 |
-
player.exitFullScreen();
|
3733 |
}
|
3734 |
});
|
3735 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3736 |
},
|
|
|
|
|
|
|
3737 |
enterFullScreen: function() {
|
3738 |
|
3739 |
var t = this;
|
3740 |
|
3741 |
-
|
3742 |
-
|
3743 |
-
//t.media.setFullscreen(true);
|
3744 |
-
//player.isFullScreen = true;
|
3745 |
return;
|
3746 |
}
|
3747 |
|
3748 |
-
// store overflow
|
3749 |
-
docStyleOverflow = document.documentElement.style.overflow;
|
3750 |
// set it to not show scroll bars so 100% will work
|
3751 |
-
|
3752 |
|
3753 |
// store sizing
|
3754 |
-
normalHeight = t.container.height();
|
3755 |
-
normalWidth = t.container.width();
|
3756 |
-
|
3757 |
-
// attempt to do true fullscreen (Safari 5.1 and Firefox Nightly only for now)
|
3758 |
-
if (t.media.pluginType === 'native') {
|
3759 |
-
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3760 |
-
|
3761 |
-
mejs.MediaFeatures.requestFullScreen(t.container[0]);
|
3762 |
-
//return;
|
3763 |
-
|
3764 |
-
if (t.isInIframe) {
|
3765 |
-
// sometimes exiting from fullscreen doesn't work
|
3766 |
-
// notably in Chrome <iframe>. Fixed in version 17
|
3767 |
-
setTimeout(function checkFullscreen() {
|
3768 |
-
|
3769 |
-
if (t.isNativeFullScreen) {
|
3770 |
-
|
3771 |
-
// check if the video is suddenly not really fullscreen
|
3772 |
-
if ($(window).width() !== screen.width) {
|
3773 |
-
// manually exit
|
3774 |
-
t.exitFullScreen();
|
3775 |
-
} else {
|
3776 |
-
// test again
|
3777 |
-
setTimeout(checkFullscreen, 500);
|
3778 |
-
}
|
3779 |
-
}
|
3780 |
|
3781 |
|
3782 |
-
}, 500);
|
3783 |
-
}
|
3784 |
|
3785 |
-
|
3786 |
-
|
3787 |
-
return;
|
3788 |
-
}
|
3789 |
-
}
|
3790 |
|
3791 |
-
|
3792 |
-
|
3793 |
-
var url = t.options.newWindowCallback(this);
|
3794 |
|
|
|
|
|
|
|
|
|
3795 |
|
3796 |
-
|
|
|
|
|
|
|
|
|
|
|
3797 |
|
3798 |
-
|
3799 |
-
|
3800 |
-
|
3801 |
-
|
3802 |
-
|
3803 |
-
|
3804 |
-
|
3805 |
-
if (!t.isNativeFullScreen) {
|
3806 |
-
t.pause();
|
3807 |
-
window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
|
3808 |
}
|
3809 |
-
}
|
3810 |
-
|
|
|
3811 |
}
|
3812 |
-
|
3813 |
-
}
|
3814 |
-
|
3815 |
-
|
3816 |
-
|
3817 |
-
|
3818 |
-
|
3819 |
// make full size
|
3820 |
t.container
|
3821 |
.addClass('mejs-container-fullscreen')
|
@@ -3826,24 +5207,28 @@ if (typeof jQuery != 'undefined') {
|
|
3826 |
// Only needed for safari 5.1 native full screen, can cause display issues elsewhere
|
3827 |
// Actually, it seems to be needed for IE8, too
|
3828 |
//if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3829 |
-
setTimeout(function() {
|
3830 |
t.container.css({width: '100%', height: '100%'});
|
3831 |
t.setControlsSize();
|
3832 |
}, 500);
|
3833 |
//}
|
3834 |
|
3835 |
-
if (t.pluginType === 'native') {
|
3836 |
t.$media
|
3837 |
.width('100%')
|
3838 |
.height('100%');
|
3839 |
} else {
|
3840 |
-
t.container.find('
|
3841 |
.width('100%')
|
3842 |
-
.height('100%');
|
3843 |
-
|
3844 |
-
|
3845 |
-
|
3846 |
-
|
|
|
|
|
|
|
|
|
3847 |
}
|
3848 |
|
3849 |
t.layers.children('div')
|
@@ -3858,48 +5243,59 @@ if (typeof jQuery != 'undefined') {
|
|
3858 |
|
3859 |
t.setControlsSize();
|
3860 |
t.isFullScreen = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3861 |
},
|
3862 |
|
3863 |
exitFullScreen: function() {
|
3864 |
|
3865 |
var t = this;
|
3866 |
|
|
|
|
|
|
|
3867 |
// firefox can't adjust plugins
|
|
|
3868 |
if (t.media.pluginType !== 'native' && mejs.MediaFeatures.isFirefox) {
|
3869 |
t.media.setFullscreen(false);
|
3870 |
//player.isFullScreen = false;
|
3871 |
return;
|
3872 |
}
|
|
|
3873 |
|
3874 |
-
// come
|
3875 |
if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || t.isFullScreen)) {
|
3876 |
mejs.MediaFeatures.cancelFullScreen();
|
3877 |
}
|
3878 |
|
3879 |
// restore scroll bars to document
|
3880 |
-
|
3881 |
|
3882 |
t.container
|
3883 |
.removeClass('mejs-container-fullscreen')
|
3884 |
-
.width(normalWidth)
|
3885 |
-
.height(normalHeight);
|
3886 |
-
//.css({position: '', left: '', top: '', right: '', bottom: '', overflow: 'inherit', width: normalWidth + 'px', height: normalHeight + 'px', 'z-index': 1});
|
3887 |
|
3888 |
-
if (t.pluginType === 'native') {
|
3889 |
t.$media
|
3890 |
-
.width(normalWidth)
|
3891 |
-
.height(normalHeight);
|
3892 |
} else {
|
3893 |
-
t.container.find('
|
3894 |
-
.width(normalWidth)
|
3895 |
-
.height(normalHeight);
|
3896 |
|
3897 |
-
t.media.setVideoSize(normalWidth, normalHeight);
|
3898 |
}
|
3899 |
|
3900 |
t.layers.children('div')
|
3901 |
-
.width(normalWidth)
|
3902 |
-
.height(normalHeight);
|
3903 |
|
3904 |
t.fullscreenBtn
|
3905 |
.removeClass('mejs-unfullscreen')
|
@@ -3907,6 +5303,12 @@ if (typeof jQuery != 'undefined') {
|
|
3907 |
|
3908 |
t.setControlsSize();
|
3909 |
t.isFullScreen = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
3910 |
}
|
3911 |
});
|
3912 |
|
@@ -3914,75 +5316,236 @@ if (typeof jQuery != 'undefined') {
|
|
3914 |
|
3915 |
(function($) {
|
3916 |
|
3917 |
-
//
|
3918 |
-
$.extend(mejs.MepDefaults, {
|
3919 |
-
|
3920 |
-
|
3921 |
-
|
3922 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3923 |
});
|
3924 |
|
3925 |
$.extend(MediaElementPlayer.prototype, {
|
3926 |
-
|
3927 |
hasChapters: false,
|
3928 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3929 |
buildtracks: function(player, controls, layers, media) {
|
3930 |
-
if (
|
3931 |
-
return;
|
3932 |
-
|
3933 |
-
if (player.tracks.length == 0)
|
3934 |
return;
|
3935 |
|
3936 |
-
var t= this,
|
|
|
|
|
|
|
|
|
|
|
3937 |
|
3938 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3939 |
$('<div class="mejs-chapters mejs-layer"></div>')
|
3940 |
.prependTo(layers).hide();
|
3941 |
-
player.captions =
|
3942 |
-
$('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position
|
|
|
3943 |
.prependTo(layers).hide();
|
3944 |
player.captionsText = player.captions.find('.mejs-captions-text');
|
3945 |
-
player.captionsButton =
|
3946 |
$('<div class="mejs-button mejs-captions-button">'+
|
3947 |
-
'<button type="button" aria-controls="' + t.id + '" title="' +
|
3948 |
'<div class="mejs-captions-selector">'+
|
3949 |
'<ul>'+
|
3950 |
'<li>'+
|
3951 |
'<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
|
3952 |
-
'<label for="' + player.id + '_captions_none">
|
3953 |
'</li>' +
|
3954 |
'</ul>'+
|
3955 |
'</div>'+
|
3956 |
'</div>')
|
3957 |
-
.appendTo(controls)
|
3958 |
-
|
3959 |
-
// hover
|
3960 |
-
.hover(function() {
|
3961 |
-
$(this).find('.mejs-captions-selector').css('visibility','visible');
|
3962 |
-
}, function() {
|
3963 |
-
$(this).find('.mejs-captions-selector').css('visibility','hidden');
|
3964 |
-
})
|
3965 |
-
|
3966 |
-
// handle clicks to the language radio buttons
|
3967 |
-
.delegate('input[type=radio]','click',function() {
|
3968 |
-
lang = this.value;
|
3969 |
|
3970 |
-
|
3971 |
-
|
3972 |
-
|
3973 |
-
|
3974 |
-
|
3975 |
-
|
3976 |
-
|
3977 |
-
|
3978 |
-
|
3979 |
-
|
3980 |
-
|
3981 |
-
|
3982 |
-
|
3983 |
-
|
3984 |
-
|
3985 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3986 |
|
3987 |
if (!player.options.alwaysShowControls) {
|
3988 |
// move with controls
|
@@ -4006,23 +5569,31 @@ if (typeof jQuery != 'undefined') {
|
|
4006 |
player.selectedTrack = null;
|
4007 |
player.isLoadingTrack = false;
|
4008 |
|
4009 |
-
|
4010 |
-
|
4011 |
// add to list
|
4012 |
for (i=0; i<player.tracks.length; i++) {
|
4013 |
-
|
|
|
4014 |
player.addTrackButton(player.tracks[i].srclang, player.tracks[i].label);
|
4015 |
}
|
4016 |
}
|
4017 |
|
|
|
4018 |
player.loadNextTrack();
|
4019 |
|
4020 |
-
|
4021 |
-
media.addEventListener('timeupdate',function(e) {
|
4022 |
player.displayCaptions();
|
4023 |
}, false);
|
4024 |
|
4025 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4026 |
player.displayChapters();
|
4027 |
}, false);
|
4028 |
|
@@ -4030,22 +5601,48 @@ if (typeof jQuery != 'undefined') {
|
|
4030 |
function () {
|
4031 |
// chapters
|
4032 |
if (player.hasChapters) {
|
4033 |
-
player.chapters.
|
4034 |
player.chapters.fadeIn(200).height(player.chapters.find('.mejs-chapter').outerHeight());
|
4035 |
}
|
4036 |
},
|
4037 |
function () {
|
4038 |
if (player.hasChapters && !media.paused) {
|
4039 |
player.chapters.fadeOut(200, function() {
|
4040 |
-
$(this).
|
4041 |
$(this).css('display','block');
|
4042 |
});
|
4043 |
}
|
4044 |
});
|
4045 |
-
|
|
|
|
|
|
|
|
|
4046 |
// check for autoplay
|
4047 |
if (player.node.getAttribute('autoplay') !== null) {
|
4048 |
-
player.chapters.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4049 |
}
|
4050 |
},
|
4051 |
|
@@ -4059,6 +5656,8 @@ if (typeof jQuery != 'undefined') {
|
|
4059 |
} else {
|
4060 |
// add done?
|
4061 |
t.isLoadingTrack = false;
|
|
|
|
|
4062 |
}
|
4063 |
},
|
4064 |
|
@@ -4070,8 +5669,6 @@ if (typeof jQuery != 'undefined') {
|
|
4070 |
|
4071 |
track.isLoaded = true;
|
4072 |
|
4073 |
-
// create button
|
4074 |
-
//t.addTrackButton(track.srclang);
|
4075 |
t.enableTrackButton(track.srclang, track.label);
|
4076 |
|
4077 |
t.loadNextTrack();
|
@@ -4079,40 +5676,47 @@ if (typeof jQuery != 'undefined') {
|
|
4079 |
};
|
4080 |
|
4081 |
|
4082 |
-
|
4083 |
-
|
4084 |
-
|
4085 |
-
|
|
|
4086 |
|
4087 |
-
|
4088 |
-
|
4089 |
-
|
4090 |
-
|
4091 |
-
|
4092 |
-
|
4093 |
-
|
4094 |
-
after();
|
4095 |
|
4096 |
-
|
4097 |
-
|
4098 |
-
|
4099 |
-
|
4100 |
-
|
4101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4102 |
}
|
4103 |
-
}
|
4104 |
-
|
4105 |
-
t.loadNextTrack();
|
4106 |
-
}
|
4107 |
-
});
|
4108 |
},
|
4109 |
|
4110 |
enableTrackButton: function(lang, label) {
|
4111 |
var t = this;
|
4112 |
-
|
4113 |
if (label === '') {
|
4114 |
label = mejs.language.codes[lang] || lang;
|
4115 |
-
}
|
4116 |
|
4117 |
t.captionsButton
|
4118 |
.find('input[value=' + lang + ']')
|
@@ -4122,12 +5726,20 @@ if (typeof jQuery != 'undefined') {
|
|
4122 |
|
4123 |
// auto select
|
4124 |
if (t.options.startLanguage == lang) {
|
4125 |
-
$('#' + t.id + '_captions_' + lang).
|
4126 |
}
|
4127 |
|
4128 |
t.adjustLanguageBox();
|
4129 |
},
|
4130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4131 |
addTrackButton: function(lang, label) {
|
4132 |
var t = this;
|
4133 |
if (label === '') {
|
@@ -4156,6 +5768,28 @@ if (typeof jQuery != 'undefined') {
|
|
4156 |
);
|
4157 |
},
|
4158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4159 |
displayCaptions: function() {
|
4160 |
|
4161 |
if (typeof this.tracks == 'undefined')
|
@@ -4166,10 +5800,11 @@ if (typeof jQuery != 'undefined') {
|
|
4166 |
i,
|
4167 |
track = t.selectedTrack;
|
4168 |
|
4169 |
-
if (track
|
4170 |
for (i=0; i<track.entries.times.length; i++) {
|
4171 |
-
if (t.media.currentTime >= track.entries.times[i].start && t.media.currentTime <= track.entries.times[i].stop){
|
4172 |
-
|
|
|
4173 |
t.captions.show().height(0);
|
4174 |
return; // exit out if one is visible;
|
4175 |
}
|
@@ -4180,8 +5815,72 @@ if (typeof jQuery != 'undefined') {
|
|
4180 |
}
|
4181 |
},
|
4182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4183 |
displayChapters: function() {
|
4184 |
-
var
|
4185 |
t = this,
|
4186 |
i;
|
4187 |
|
@@ -4195,7 +5894,7 @@ if (typeof jQuery != 'undefined') {
|
|
4195 |
},
|
4196 |
|
4197 |
drawChapters: function(chapters) {
|
4198 |
-
var
|
4199 |
t = this,
|
4200 |
i,
|
4201 |
dur,
|
@@ -4221,10 +5920,10 @@ if (typeof jQuery != 'undefined') {
|
|
4221 |
//}
|
4222 |
|
4223 |
t.chapters.append( $(
|
4224 |
-
'<div class="mejs-chapter" rel="' + chapters.entries.times[i].start + '" style="left: ' + usedPercent.toString() + '%;width: ' + percent.toString() + '%;">' +
|
4225 |
-
'<div class="mejs-chapter-block' + ((i==chapters.entries.times.length-1) ? ' mejs-chapter-block-last' : '') + '">' +
|
4226 |
-
'<span class="ch-title">' + chapters.entries.text[i] + '</span>' +
|
4227 |
-
'<span class="ch-time">' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].start) + '–' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].stop) + '</span>' +
|
4228 |
'</div>' +
|
4229 |
'</div>'));
|
4230 |
usedPercent += percent;
|
@@ -4233,7 +5932,7 @@ if (typeof jQuery != 'undefined') {
|
|
4233 |
t.chapters.find('div.mejs-chapter').click(function() {
|
4234 |
t.media.setCurrentTime( parseFloat( $(this).attr('rel') ) );
|
4235 |
if (t.media.paused) {
|
4236 |
-
t.media.play();
|
4237 |
}
|
4238 |
});
|
4239 |
|
@@ -4260,7 +5959,7 @@ if (typeof jQuery != 'undefined') {
|
|
4260 |
nl:'Dutch',
|
4261 |
en:'English',
|
4262 |
et:'Estonian',
|
4263 |
-
|
4264 |
fi:'Finnish',
|
4265 |
fr:'French',
|
4266 |
gl:'Galician',
|
@@ -4285,7 +5984,7 @@ if (typeof jQuery != 'undefined') {
|
|
4285 |
fa:'Persian',
|
4286 |
pl:'Polish',
|
4287 |
pt:'Portuguese',
|
4288 |
-
//'pt-pt':'Portuguese (Portugal)',
|
4289 |
ro:'Romanian',
|
4290 |
ru:'Russian',
|
4291 |
sr:'Serbian',
|
@@ -4305,10 +6004,10 @@ if (typeof jQuery != 'undefined') {
|
|
4305 |
};
|
4306 |
|
4307 |
/*
|
4308 |
-
Parses
|
4309 |
================================
|
4310 |
WEBVTT
|
4311 |
-
|
4312 |
1
|
4313 |
00:00:01,1 --> 00:00:05,000
|
4314 |
A line of text
|
@@ -4316,51 +6015,50 @@ if (typeof jQuery != 'undefined') {
|
|
4316 |
2
|
4317 |
00:01:15,1 --> 00:02:05,000
|
4318 |
A second line of text
|
4319 |
-
|
4320 |
===============================
|
4321 |
|
4322 |
Adapted from: http://www.delphiki.com/html5/playr
|
4323 |
*/
|
4324 |
mejs.TrackFormatParser = {
|
4325 |
-
|
4326 |
-
|
4327 |
-
pattern_identifier: /^([a-zA-z]+-)?[0-9]+$/,
|
4328 |
-
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})?)(.*)$/,
|
4329 |
|
4330 |
parse: function(trackText) {
|
4331 |
-
var
|
4332 |
i = 0,
|
4333 |
lines = mejs.TrackFormatParser.split2(trackText, /\r?\n/),
|
4334 |
entries = {text:[], times:[]},
|
4335 |
timecode,
|
4336 |
-
text
|
|
|
4337 |
for(; i<lines.length; i++) {
|
4338 |
-
|
4339 |
-
if (this.pattern_identifier.exec(lines[i])){
|
4340 |
-
// skip to the next line where the start --> end time code should be
|
4341 |
-
i++;
|
4342 |
-
timecode = this.pattern_timecode.exec(lines[i]);
|
4343 |
|
4344 |
-
|
4345 |
-
|
4346 |
-
|
4347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4348 |
i++;
|
4349 |
-
while(lines[i] !== '' && i<lines.length){
|
4350 |
-
text = text + '\n' + lines[i];
|
4351 |
-
i++;
|
4352 |
-
}
|
4353 |
-
text = $.trim(text).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
|
4354 |
-
// Text is in a different array so I can use .join
|
4355 |
-
entries.text.push(text);
|
4356 |
-
entries.times.push(
|
4357 |
-
{
|
4358 |
-
start: (mejs.Utility.convertSMPTEtoSeconds(timecode[1]) == 0) ? 0.200 : mejs.Utility.convertSMPTEtoSeconds(timecode[1]),
|
4359 |
-
stop: mejs.Utility.convertSMPTEtoSeconds(timecode[3]),
|
4360 |
-
settings: timecode[5]
|
4361 |
-
});
|
4362 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4363 |
}
|
|
|
4364 |
}
|
4365 |
return entries;
|
4366 |
}
|
@@ -4369,14 +6067,12 @@ if (typeof jQuery != 'undefined') {
|
|
4369 |
dfxp: {
|
4370 |
parse: function(trackText) {
|
4371 |
trackText = $(trackText).filter("tt");
|
4372 |
-
var
|
4373 |
i = 0,
|
4374 |
container = trackText.children("div").eq(0),
|
4375 |
lines = container.find("p"),
|
4376 |
styleNode = trackText.find("#" + container.attr("style")),
|
4377 |
styles,
|
4378 |
-
begin,
|
4379 |
-
end,
|
4380 |
text,
|
4381 |
entries = {text:[], times:[]};
|
4382 |
|
@@ -4405,15 +6101,14 @@ if (typeof jQuery != 'undefined') {
|
|
4405 |
if (styles) {
|
4406 |
style = "";
|
4407 |
for (var _style in styles) {
|
4408 |
-
style += _style + ":" + styles[_style] + ";";
|
4409 |
}
|
4410 |
}
|
4411 |
if (style) _temp_times.style = style;
|
4412 |
-
if (_temp_times.start
|
4413 |
entries.times.push(_temp_times);
|
4414 |
text = $.trim(lines.eq(i).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
|
4415 |
entries.text.push(text);
|
4416 |
-
if (entries.times.start == 0) entries.times.start = 2;
|
4417 |
}
|
4418 |
return entries;
|
4419 |
}
|
@@ -4424,13 +6119,13 @@ if (typeof jQuery != 'undefined') {
|
|
4424 |
return text.split(regex);
|
4425 |
}
|
4426 |
};
|
4427 |
-
|
4428 |
// test for browsers with bad String.split method.
|
4429 |
if ('x\n\ny'.split(/\n/gi).length != 3) {
|
4430 |
// add super slow IE8 and below version
|
4431 |
mejs.TrackFormatParser.split2 = function(text, regex) {
|
4432 |
-
var
|
4433 |
-
parts = [],
|
4434 |
chunk = '',
|
4435 |
i;
|
4436 |
|
@@ -4443,8 +6138,179 @@ if (typeof jQuery != 'undefined') {
|
|
4443 |
}
|
4444 |
parts.push(chunk);
|
4445 |
return parts;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4446 |
}
|
4447 |
-
}
|
4448 |
|
4449 |
})(mejs.$);
|
4450 |
|
@@ -4467,9 +6333,9 @@ $.extend(mejs.MepDefaults,
|
|
4467 |
return null;
|
4468 |
|
4469 |
if (player.isFullScreen) {
|
4470 |
-
return
|
4471 |
} else {
|
4472 |
-
return
|
4473 |
}
|
4474 |
},
|
4475 |
click: function(player) {
|
@@ -4485,9 +6351,9 @@ $.extend(mejs.MepDefaults,
|
|
4485 |
{
|
4486 |
render: function(player) {
|
4487 |
if (player.media.muted) {
|
4488 |
-
return
|
4489 |
} else {
|
4490 |
-
return
|
4491 |
}
|
4492 |
},
|
4493 |
click: function(player) {
|
@@ -4506,7 +6372,7 @@ $.extend(mejs.MepDefaults,
|
|
4506 |
// demo of simple download video
|
4507 |
{
|
4508 |
render: function(player) {
|
4509 |
-
return
|
4510 |
},
|
4511 |
click: function(player) {
|
4512 |
window.location.href = player.media.currentSrc;
|
@@ -4537,11 +6403,15 @@ $.extend(mejs.MepDefaults,
|
|
4537 |
});
|
4538 |
player.contextMenu.bind('mouseleave', function() {
|
4539 |
|
4540 |
-
//
|
4541 |
player.startContextMenuTimer();
|
4542 |
|
4543 |
});
|
4544 |
},
|
|
|
|
|
|
|
|
|
4545 |
|
4546 |
isContextMenuEnabled: true,
|
4547 |
enableContextMenu: function() {
|
@@ -4553,7 +6423,7 @@ $.extend(mejs.MepDefaults,
|
|
4553 |
|
4554 |
contextMenuTimeout: null,
|
4555 |
startContextMenuTimer: function() {
|
4556 |
-
//
|
4557 |
|
4558 |
var t = this;
|
4559 |
|
@@ -4567,7 +6437,7 @@ $.extend(mejs.MepDefaults,
|
|
4567 |
killContextMenuTimer: function() {
|
4568 |
var timer = this.contextMenuTimer;
|
4569 |
|
4570 |
-
//
|
4571 |
|
4572 |
if (timer != null) {
|
4573 |
clearTimeout(timer);
|
@@ -4641,13 +6511,45 @@ $.extend(mejs.MepDefaults,
|
|
4641 |
});
|
4642 |
|
4643 |
})(mejs.$);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4644 |
/**
|
4645 |
* Postroll plugin
|
4646 |
*/
|
4647 |
(function($) {
|
4648 |
|
4649 |
$.extend(mejs.MepDefaults, {
|
4650 |
-
postrollCloseText:
|
4651 |
});
|
4652 |
|
4653 |
// Postroll
|
@@ -4655,11 +6557,12 @@ $.extend(mejs.MepDefaults,
|
|
4655 |
buildpostroll: function(player, controls, layers, media) {
|
4656 |
var
|
4657 |
t = this,
|
|
|
4658 |
postrollLink = t.container.find('link[rel="postroll"]').attr('href');
|
4659 |
|
4660 |
if (typeof postrollLink !== 'undefined') {
|
4661 |
player.postroll =
|
4662 |
-
$('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">' +
|
4663 |
|
4664 |
t.media.addEventListener('ended', function (e) {
|
4665 |
$.ajax({
|
@@ -4676,4 +6579,77 @@ $.extend(mejs.MepDefaults,
|
|
4676 |
});
|
4677 |
|
4678 |
})(mejs.$);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4679 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/*!
|
2 |
+
*
|
3 |
+
* MediaElement.js
|
4 |
+
* HTML5 <video> and <audio> shim and player
|
5 |
+
* http://mediaelementjs.com/
|
6 |
+
*
|
7 |
+
* Creates a JavaScript object that mimics HTML5 MediaElement API
|
8 |
+
* for browsers that don't understand HTML5 or can't play the provided codec
|
9 |
+
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
10 |
+
*
|
11 |
+
* Copyright 2010-2014, John Dyer (http://j.hn)
|
12 |
+
* License: MIT
|
13 |
+
*
|
14 |
+
*/
|
15 |
// Namespace
|
16 |
var mejs = mejs || {};
|
17 |
|
18 |
// version number
|
19 |
+
mejs.version = '2.23.5';
|
20 |
+
|
21 |
|
22 |
// player number (for missing, same id attr)
|
23 |
mejs.meIndex = 0;
|
28 |
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','audio/mpeg']}
|
29 |
],
|
30 |
flash: [
|
31 |
+
{version: [9,0,124], types: ['video/mp4','video/m4v','video/mov','video/flv','video/rtmp','video/x-flv','audio/flv','audio/x-flv','audio/mp3','audio/m4a', 'audio/mp4', 'audio/mpeg', 'video/dailymotion', 'video/x-dailymotion', 'application/x-mpegURL', 'audio/ogg']}
|
32 |
+
// 'video/youtube', 'video/x-youtube',
|
33 |
+
// ,{version: [12,0], types: ['video/webm']} // for future reference (hopefully!)
|
34 |
],
|
35 |
youtube: [
|
36 |
+
{version: null, types: ['video/youtube', 'video/x-youtube', 'audio/youtube', 'audio/x-youtube']}
|
37 |
],
|
38 |
vimeo: [
|
39 |
{version: null, types: ['video/vimeo', 'video/x-vimeo']}
|
59 |
var
|
60 |
i = 0,
|
61 |
j,
|
62 |
+
codePath = '',
|
63 |
+
testname = '',
|
64 |
+
slashPos,
|
65 |
+
filenamePos,
|
66 |
+
scriptUrl,
|
67 |
+
scriptPath,
|
68 |
+
scriptFilename,
|
69 |
scripts = document.getElementsByTagName('script'),
|
70 |
il = scripts.length,
|
71 |
jl = scriptNames.length;
|
72 |
+
|
73 |
+
// go through all <script> tags
|
74 |
for (; i < il; i++) {
|
75 |
+
scriptUrl = scripts[i].src;
|
76 |
+
slashPos = scriptUrl.lastIndexOf('/');
|
77 |
+
if (slashPos > -1) {
|
78 |
+
scriptFilename = scriptUrl.substring(slashPos + 1);
|
79 |
+
scriptPath = scriptUrl.substring(0, slashPos + 1);
|
80 |
+
} else {
|
81 |
+
scriptFilename = scriptUrl;
|
82 |
+
scriptPath = '';
|
83 |
+
}
|
84 |
+
|
85 |
+
// see if any <script> tags have a file name that matches the
|
86 |
for (j = 0; j < jl; j++) {
|
87 |
+
testname = scriptNames[j];
|
88 |
+
filenamePos = scriptFilename.indexOf(testname);
|
89 |
+
if (filenamePos > -1) {
|
90 |
+
codePath = scriptPath;
|
91 |
break;
|
92 |
}
|
93 |
}
|
94 |
+
|
95 |
+
// if we found a path, then break and return it
|
96 |
+
if (codePath !== '') {
|
97 |
break;
|
98 |
}
|
99 |
}
|
100 |
+
|
101 |
+
// send the best path back
|
102 |
+
return codePath;
|
103 |
},
|
104 |
+
/*
|
105 |
+
* Calculate the time format to use. We have a default format set in the
|
106 |
+
* options but it can be imcomplete. We ajust it according to the media
|
107 |
+
* duration.
|
108 |
+
*
|
109 |
+
* We support format like 'hh:mm:ss:ff'.
|
110 |
+
*/
|
111 |
+
calculateTimeFormat: function(time, options, fps) {
|
112 |
+
if (time < 0) {
|
113 |
+
time = 0;
|
114 |
+
}
|
115 |
+
|
116 |
+
if(typeof fps == 'undefined') {
|
117 |
fps = 25;
|
118 |
}
|
119 |
+
|
120 |
+
var format = options.timeFormat,
|
121 |
+
firstChar = format[0],
|
122 |
+
firstTwoPlaces = (format[1] == format[0]),
|
123 |
+
separatorIndex = firstTwoPlaces? 2: 1,
|
124 |
+
separator = ':',
|
125 |
+
hours = Math.floor(time / 3600) % 24,
|
126 |
minutes = Math.floor(time / 60) % 60,
|
127 |
seconds = Math.floor(time % 60),
|
128 |
frames = Math.floor(((time % 1)*fps).toFixed(3)),
|
129 |
+
lis = [
|
130 |
+
[frames, 'f'],
|
131 |
+
[seconds, 's'],
|
132 |
+
[minutes, 'm'],
|
133 |
+
[hours, 'h']
|
134 |
+
];
|
135 |
+
|
136 |
+
// Try to get the separator from the format
|
137 |
+
if (format.length < separatorIndex) {
|
138 |
+
separator = format[separatorIndex];
|
139 |
+
}
|
140 |
+
|
141 |
+
var required = false;
|
142 |
+
|
143 |
+
for (var i=0, len=lis.length; i < len; i++) {
|
144 |
+
if (format.indexOf(lis[i][1]) !== -1) {
|
145 |
+
required=true;
|
146 |
+
}
|
147 |
+
else if (required) {
|
148 |
+
var hasNextValue = false;
|
149 |
+
for (var j=i; j < len; j++) {
|
150 |
+
if (lis[j][0] > 0) {
|
151 |
+
hasNextValue = true;
|
152 |
+
break;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
if (! hasNextValue) {
|
157 |
+
break;
|
158 |
+
}
|
159 |
+
|
160 |
+
if (!firstTwoPlaces) {
|
161 |
+
format = firstChar + format;
|
162 |
+
}
|
163 |
+
format = lis[i][1] + separator + format;
|
164 |
+
if (firstTwoPlaces) {
|
165 |
+
format = lis[i][1] + format;
|
166 |
+
}
|
167 |
+
firstChar = lis[i][1];
|
168 |
+
}
|
169 |
+
}
|
170 |
+
options.currentTimeFormat = format;
|
171 |
+
},
|
172 |
+
/*
|
173 |
+
* Prefix the given number by zero if it is lower than 10.
|
174 |
+
*/
|
175 |
+
twoDigitsString: function(n) {
|
176 |
+
if (n < 10) {
|
177 |
+
return '0' + n;
|
178 |
+
}
|
179 |
+
return String(n);
|
180 |
+
},
|
181 |
+
secondsToTimeCode: function(time, options) {
|
182 |
+
if (time < 0) {
|
183 |
+
time = 0;
|
184 |
+
}
|
185 |
+
|
186 |
+
// Maintain backward compatibility with method signature before v2.18.
|
187 |
+
if (typeof options !== 'object') {
|
188 |
+
var format = 'm:ss';
|
189 |
+
format = arguments[1] ? 'hh:mm:ss' : format; // forceHours
|
190 |
+
format = arguments[2] ? format + ':ff' : format; // showFrameCount
|
191 |
+
|
192 |
+
options = {
|
193 |
+
currentTimeFormat: format,
|
194 |
+
framesPerSecond: arguments[3] || 25
|
195 |
+
};
|
196 |
+
}
|
197 |
+
|
198 |
+
var fps = options.framesPerSecond;
|
199 |
+
if(typeof fps === 'undefined') {
|
200 |
+
fps = 25;
|
201 |
+
}
|
202 |
+
|
203 |
+
var format = options.currentTimeFormat,
|
204 |
+
hours = Math.floor(time / 3600) % 24,
|
205 |
+
minutes = Math.floor(time / 60) % 60,
|
206 |
+
seconds = Math.floor(time % 60),
|
207 |
+
frames = Math.floor(((time % 1)*fps).toFixed(3));
|
208 |
+
lis = [
|
209 |
+
[frames, 'f'],
|
210 |
+
[seconds, 's'],
|
211 |
+
[minutes, 'm'],
|
212 |
+
[hours, 'h']
|
213 |
+
];
|
214 |
+
|
215 |
+
var res = format;
|
216 |
+
for (i=0,len=lis.length; i < len; i++) {
|
217 |
+
res = res.replace(lis[i][1]+lis[i][1], this.twoDigitsString(lis[i][0]));
|
218 |
+
res = res.replace(lis[i][1], lis[i][0]);
|
219 |
+
}
|
220 |
+
return res;
|
221 |
},
|
222 |
|
223 |
timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
|
269 |
/* borrowed from SWFObject: http://code.google.com/p/swfobject/source/browse/trunk/swfobject/src/swfobject.js#474 */
|
270 |
removeSwf: function(id) {
|
271 |
var obj = document.getElementById(id);
|
272 |
+
if (obj && /object|embed/i.test(obj.nodeName)) {
|
273 |
if (mejs.MediaFeatures.isIE) {
|
274 |
obj.style.display = "none";
|
275 |
(function(){
|
294 |
}
|
295 |
obj.parentNode.removeChild(obj);
|
296 |
}
|
297 |
+
},
|
298 |
+
determineScheme: function(url) {
|
299 |
+
if (url && url.indexOf("://") != -1) {
|
300 |
+
return url.substr(0, url.indexOf("://")+3);
|
301 |
+
}
|
302 |
+
return "//"; // let user agent figure this out
|
303 |
+
},
|
304 |
+
|
305 |
+
// taken from underscore
|
306 |
+
debounce: function(func, wait, immediate) {
|
307 |
+
var timeout;
|
308 |
+
return function() {
|
309 |
+
var context = this, args = arguments;
|
310 |
+
var later = function() {
|
311 |
+
timeout = null;
|
312 |
+
if (!immediate) func.apply(context, args);
|
313 |
+
};
|
314 |
+
var callNow = immediate && !timeout;
|
315 |
+
clearTimeout(timeout);
|
316 |
+
timeout = setTimeout(later, wait);
|
317 |
+
if (callNow) func.apply(context, args);
|
318 |
+
};
|
319 |
+
},
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Returns true if targetNode appears after sourceNode in the dom.
|
323 |
+
* @param {HTMLElement} sourceNode - the source node for comparison
|
324 |
+
* @param {HTMLElement} targetNode - the node to compare against sourceNode
|
325 |
+
*/
|
326 |
+
isNodeAfter: function(sourceNode, targetNode) {
|
327 |
+
return !!(
|
328 |
+
sourceNode &&
|
329 |
+
targetNode &&
|
330 |
+
typeof sourceNode.compareDocumentPosition === 'function' &&
|
331 |
+
sourceNode.compareDocumentPosition(targetNode) & Node.DOCUMENT_POSITION_PRECEDING
|
332 |
+
);
|
333 |
}
|
334 |
};
|
335 |
|
453 |
t.isiOS = t.isiPhone || t.isiPad;
|
454 |
t.isAndroid = (ua.match(/android/i) !== null);
|
455 |
t.isBustedAndroid = (ua.match(/android 2\.[12]/) !== null);
|
456 |
+
t.isBustedNativeHTTPS = (location.protocol === 'https:' && (ua.match(/android [12]\./) !== null || ua.match(/macintosh.* version.* safari/) !== null));
|
457 |
+
t.isIE = (nav.appName.toLowerCase().indexOf("microsoft") != -1 || nav.appName.toLowerCase().match(/trident/gi) !== null);
|
458 |
t.isChrome = (ua.match(/chrome/gi) !== null);
|
459 |
+
t.isChromium = (ua.match(/chromium/gi) !== null);
|
460 |
t.isFirefox = (ua.match(/firefox/gi) !== null);
|
461 |
t.isWebkit = (ua.match(/webkit/gi) !== null);
|
462 |
+
t.isGecko = (ua.match(/gecko/gi) !== null) && !t.isWebkit && !t.isIE;
|
463 |
t.isOpera = (ua.match(/opera/gi) !== null);
|
464 |
+
t.hasTouch = ('ontouchstart' in window); // && window.ontouchstart != null); // this breaks iOS 7
|
465 |
+
|
466 |
+
// Borrowed from `Modernizr.svgasimg`, sources:
|
467 |
+
// - https://github.com/Modernizr/Modernizr/issues/687
|
468 |
+
// - https://github.com/Modernizr/Modernizr/pull/1209/files
|
469 |
+
t.svgAsImg = !!document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1');
|
470 |
|
471 |
// create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
|
472 |
for (i=0; i<html5Elements.length; i++) {
|
473 |
v = document.createElement(html5Elements[i]);
|
474 |
}
|
475 |
+
|
476 |
t.supportsMediaTag = (typeof v.canPlayType !== 'undefined' || t.isBustedAndroid);
|
477 |
|
478 |
+
// Fix for IE9 on Windows 7N / Windows 7KN (Media Player not installer)
|
479 |
+
try{
|
480 |
+
v.canPlayType("video/mp4");
|
481 |
+
}catch(e){
|
482 |
+
t.supportsMediaTag = false;
|
483 |
+
}
|
484 |
+
|
485 |
+
t.supportsPointerEvents = (function() {
|
486 |
+
// TAKEN FROM MODERNIZR
|
487 |
+
var element = document.createElement('x'),
|
488 |
+
documentElement = document.documentElement,
|
489 |
+
getComputedStyle = window.getComputedStyle,
|
490 |
+
supports;
|
491 |
+
if(!('pointerEvents' in element.style)){
|
492 |
+
return false;
|
493 |
+
}
|
494 |
+
element.style.pointerEvents = 'auto';
|
495 |
+
element.style.pointerEvents = 'x';
|
496 |
+
documentElement.appendChild(element);
|
497 |
+
supports = getComputedStyle &&
|
498 |
+
getComputedStyle(element, '').pointerEvents === 'auto';
|
499 |
+
documentElement.removeChild(element);
|
500 |
+
return !!supports;
|
501 |
+
})();
|
502 |
+
|
503 |
+
|
504 |
+
// Older versions of Firefox can't move plugins around without it resetting,
|
505 |
+
t.hasFirefoxPluginMovingProblem = false;
|
506 |
+
|
507 |
// detect native JavaScript fullscreen (Safari/Firefox only, Chrome still fails)
|
508 |
+
|
509 |
// iOS
|
510 |
+
t.hasiOSFullScreen = (typeof v.webkitEnterFullscreen !== 'undefined');
|
511 |
+
|
512 |
+
// W3C
|
513 |
+
t.hasNativeFullscreen = (typeof v.requestFullscreen !== 'undefined');
|
514 |
+
|
515 |
+
// webkit/firefox/IE11+
|
516 |
t.hasWebkitNativeFullScreen = (typeof v.webkitRequestFullScreen !== 'undefined');
|
517 |
t.hasMozNativeFullScreen = (typeof v.mozRequestFullScreen !== 'undefined');
|
518 |
+
t.hasMsNativeFullScreen = (typeof v.msRequestFullscreen !== 'undefined');
|
519 |
+
|
520 |
+
t.hasTrueNativeFullScreen = (t.hasWebkitNativeFullScreen || t.hasMozNativeFullScreen || t.hasMsNativeFullScreen);
|
521 |
t.nativeFullScreenEnabled = t.hasTrueNativeFullScreen;
|
522 |
+
|
523 |
+
// Enabled?
|
524 |
if (t.hasMozNativeFullScreen) {
|
525 |
+
t.nativeFullScreenEnabled = document.mozFullScreenEnabled;
|
526 |
+
} else if (t.hasMsNativeFullScreen) {
|
527 |
+
t.nativeFullScreenEnabled = document.msFullscreenEnabled;
|
528 |
}
|
529 |
+
|
530 |
+
if (t.isChrome) {
|
531 |
+
t.hasiOSFullScreen = false;
|
|
|
532 |
}
|
533 |
+
|
534 |
if (t.hasTrueNativeFullScreen) {
|
535 |
+
|
536 |
+
t.fullScreenEventName = '';
|
537 |
+
if (t.hasWebkitNativeFullScreen) {
|
538 |
+
t.fullScreenEventName = 'webkitfullscreenchange';
|
539 |
+
|
540 |
+
} else if (t.hasMozNativeFullScreen) {
|
541 |
+
t.fullScreenEventName = 'mozfullscreenchange';
|
542 |
+
|
543 |
+
} else if (t.hasMsNativeFullScreen) {
|
544 |
+
t.fullScreenEventName = 'MSFullscreenChange';
|
545 |
+
}
|
546 |
+
|
547 |
t.isFullScreen = function() {
|
548 |
+
if (t.hasMozNativeFullScreen) {
|
549 |
return d.mozFullScreen;
|
550 |
+
|
551 |
+
} else if (t.hasWebkitNativeFullScreen) {
|
552 |
return d.webkitIsFullScreen;
|
553 |
+
|
554 |
+
} else if (t.hasMsNativeFullScreen) {
|
555 |
+
return d.msFullscreenElement !== null;
|
556 |
}
|
557 |
}
|
558 |
+
|
559 |
t.requestFullScreen = function(el) {
|
560 |
+
|
561 |
if (t.hasWebkitNativeFullScreen) {
|
562 |
el.webkitRequestFullScreen();
|
563 |
+
|
564 |
} else if (t.hasMozNativeFullScreen) {
|
565 |
el.mozRequestFullScreen();
|
566 |
+
|
567 |
+
} else if (t.hasMsNativeFullScreen) {
|
568 |
+
el.msRequestFullscreen();
|
569 |
+
|
570 |
}
|
571 |
}
|
572 |
+
|
573 |
+
t.cancelFullScreen = function() {
|
574 |
if (t.hasWebkitNativeFullScreen) {
|
575 |
document.webkitCancelFullScreen();
|
576 |
+
|
577 |
} else if (t.hasMozNativeFullScreen) {
|
578 |
document.mozCancelFullScreen();
|
579 |
+
|
580 |
+
} else if (t.hasMsNativeFullScreen) {
|
581 |
+
document.msExitFullscreen();
|
582 |
+
|
583 |
}
|
584 |
+
}
|
585 |
+
|
586 |
}
|
587 |
+
|
588 |
+
|
589 |
// OS X 10.5 can't do this even if it says it can :(
|
590 |
+
if (t.hasiOSFullScreen && ua.match(/mac os x 10_5/i)) {
|
591 |
t.hasNativeFullScreen = false;
|
592 |
+
t.hasiOSFullScreen = false;
|
593 |
}
|
594 |
+
|
595 |
}
|
596 |
};
|
597 |
mejs.MediaFeatures.init();
|
695 |
// HTML5 methods
|
696 |
play: function () {
|
697 |
if (this.pluginApi != null) {
|
698 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
699 |
this.pluginApi.playVideo();
|
700 |
} else {
|
701 |
this.pluginApi.playMedia();
|
705 |
},
|
706 |
load: function () {
|
707 |
if (this.pluginApi != null) {
|
708 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
709 |
} else {
|
710 |
this.pluginApi.loadMedia();
|
711 |
}
|
715 |
},
|
716 |
pause: function () {
|
717 |
if (this.pluginApi != null) {
|
718 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
719 |
+
if( this.pluginApi.getPlayerState() == 1 ) {
|
720 |
+
this.pluginApi.pauseVideo();
|
721 |
+
}
|
722 |
} else {
|
723 |
this.pluginApi.pauseMedia();
|
724 |
}
|
729 |
},
|
730 |
stop: function () {
|
731 |
if (this.pluginApi != null) {
|
732 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
733 |
this.pluginApi.stopVideo();
|
734 |
} else {
|
735 |
this.pluginApi.stopMedia();
|
753 |
for (j=0; j<pluginInfo.types.length; j++) {
|
754 |
// find plugin that can play the type
|
755 |
if (type == pluginInfo.types[j]) {
|
756 |
+
return 'probably';
|
757 |
}
|
758 |
}
|
759 |
}
|
760 |
}
|
761 |
|
762 |
+
return '';
|
763 |
},
|
764 |
|
765 |
positionFullscreenButton: function(x,y,visibleAndAbove) {
|
766 |
if (this.pluginApi != null && this.pluginApi.positionFullscreenButton) {
|
767 |
+
this.pluginApi.positionFullscreenButton(Math.floor(x),Math.floor(y),visibleAndAbove);
|
768 |
}
|
769 |
},
|
770 |
|
790 |
media = url[i];
|
791 |
if (this.canPlayType(media.type)) {
|
792 |
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
|
793 |
+
this.src = mejs.Utility.absolutizeUrl(media.src);
|
794 |
break;
|
795 |
}
|
796 |
}
|
799 |
},
|
800 |
setCurrentTime: function (time) {
|
801 |
if (this.pluginApi != null) {
|
802 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
803 |
this.pluginApi.seekTo(time);
|
804 |
} else {
|
805 |
this.pluginApi.setCurrentTime(time);
|
830 |
this.pluginApi.unMute();
|
831 |
}
|
832 |
this.muted = muted;
|
833 |
+
this.dispatchEvent({type:'volumechange'});
|
834 |
} else {
|
835 |
this.pluginApi.setMuted(muted);
|
836 |
}
|
842 |
setVideoSize: function (width, height) {
|
843 |
|
844 |
//if (this.pluginType == 'flash' || this.pluginType == 'silverlight') {
|
845 |
+
if (this.pluginElement && this.pluginElement.style) {
|
846 |
this.pluginElement.style.width = width + 'px';
|
847 |
this.pluginElement.style.height = height + 'px';
|
848 |
}
|
881 |
var callbacks = this.events[eventName];
|
882 |
if (!callbacks) return true;
|
883 |
if (!callback) { this.events[eventName] = []; return true; }
|
884 |
+
for (var i = 0; i < callbacks.length; i++) {
|
885 |
if (callbacks[i] === callback) {
|
886 |
this.events[eventName].splice(i, 1);
|
887 |
return true;
|
889 |
}
|
890 |
return false;
|
891 |
},
|
892 |
+
dispatchEvent: function (event) {
|
893 |
var i,
|
894 |
args,
|
895 |
+
callbacks = this.events[event.type];
|
896 |
|
897 |
if (callbacks) {
|
|
|
898 |
for (i = 0; i < callbacks.length; i++) {
|
899 |
+
callbacks[i].apply(this, [event]);
|
900 |
}
|
901 |
}
|
902 |
},
|
913 |
if (this.hasAttribute(name)) {
|
914 |
return this.attributes[name];
|
915 |
}
|
916 |
+
return null;
|
917 |
},
|
918 |
setAttribute: function(name, value){
|
919 |
this.attributes[name] = value;
|
924 |
}
|
925 |
};
|
926 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
927 |
/*
|
928 |
Default options
|
929 |
*/
|
939 |
plugins: ['flash','silverlight','youtube','vimeo'],
|
940 |
// shows debug errors on screen
|
941 |
enablePluginDebug: false,
|
942 |
+
// use plugin for browsers that have trouble with Basic Authentication on HTTPS sites
|
943 |
+
httpsBasicAuthSite: false,
|
944 |
// overrides the type specified, useful for dynamic instantiation
|
945 |
type: '',
|
946 |
// path to Flash and Silverlight plugins
|
949 |
flashName: 'flashmediaelement.swf',
|
950 |
// streamer for RTMP streaming
|
951 |
flashStreamer: '',
|
952 |
+
// set to 'always' for CDN version
|
953 |
+
flashScriptAccess: 'sameDomain',
|
954 |
// turns on the smoothing filter in Flash
|
955 |
enablePluginSmoothing: false,
|
956 |
+
// enabled pseudo-streaming (seek) on .mp4 files
|
957 |
+
enablePseudoStreaming: false,
|
958 |
+
// start query parameter sent to server for pseudo-streaming
|
959 |
+
pseudoStreamingStartQueryParam: 'start',
|
960 |
// name of silverlight file
|
961 |
silverlightName: 'silverlightmediaelement.xap',
|
962 |
// default if the <video width> is not specified
|
974 |
timerRate: 250,
|
975 |
// initial volume for player
|
976 |
startVolume: 0.8,
|
977 |
+
// custom error message in case media cannot be played; otherwise, Download File
|
978 |
+
// link will be displayed
|
979 |
+
customError: "",
|
980 |
success: function () { },
|
981 |
error: function () { }
|
982 |
};
|
994 |
|
995 |
create: function(el, o) {
|
996 |
var
|
997 |
+
options = {},
|
998 |
htmlMediaElement = (typeof(el) == 'string') ? document.getElementById(el) : el,
|
999 |
tagName = htmlMediaElement.tagName.toLowerCase(),
|
1000 |
isMediaTag = (tagName === 'audio' || tagName === 'video'),
|
1007 |
prop;
|
1008 |
|
1009 |
// extend options
|
1010 |
+
for (prop in mejs.MediaElementDefaults) {
|
1011 |
+
options[prop] = mejs.MediaElementDefaults[prop];
|
1012 |
+
}
|
1013 |
for (prop in o) {
|
1014 |
options[prop] = o[prop];
|
1015 |
+
}
|
1016 |
+
|
1017 |
|
1018 |
// clean up attributes
|
1019 |
src = (typeof src == 'undefined' || src === null || src == '') ? null : src;
|
1025 |
// test for HTML5 and plugin capabilities
|
1026 |
playback = this.determinePlayback(htmlMediaElement, options, mejs.MediaFeatures.supportsMediaTag, isMediaTag, src);
|
1027 |
playback.url = (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '';
|
1028 |
+
playback.scheme = mejs.Utility.determineScheme(playback.url);
|
1029 |
|
1030 |
if (playback.method == 'native') {
|
1031 |
// second fix for android
|
1059 |
l,
|
1060 |
n,
|
1061 |
type,
|
1062 |
+
result = { method: '', url: '', htmlMediaElement: htmlMediaElement, isVideo: (htmlMediaElement.tagName.toLowerCase() !== 'audio'), scheme: ''},
|
1063 |
pluginName,
|
1064 |
pluginVersions,
|
1065 |
pluginInfo,
|
1113 |
// STEP 2: Test for playback method
|
1114 |
|
1115 |
// special case for Android which sadly doesn't implement the canPlayType function (always returns '')
|
1116 |
+
if (result.isVideo && mejs.MediaFeatures.isBustedAndroid) {
|
1117 |
htmlMediaElement.canPlayType = function(type) {
|
1118 |
return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'maybe' : '';
|
1119 |
};
|
1120 |
}
|
1121 |
|
1122 |
+
// special case for Chromium to specify natively supported video codecs (i.e. WebM and Theora)
|
1123 |
+
if (result.isVideo && mejs.MediaFeatures.isChromium) {
|
1124 |
+
htmlMediaElement.canPlayType = function(type) {
|
1125 |
+
return (type.match(/video\/(webm|ogv|ogg)/gi) !== null) ? 'maybe' : '';
|
1126 |
+
};
|
1127 |
+
}
|
1128 |
|
1129 |
// test for native playback first
|
1130 |
+
if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'auto_plugin' || options.mode === 'native') && !(mejs.MediaFeatures.isBustedNativeHTTPS && options.httpsBasicAuthSite === true)) {
|
1131 |
|
1132 |
if (!isMediaTag) {
|
1133 |
|
1142 |
|
1143 |
for (i=0; i<mediaFiles.length; i++) {
|
1144 |
// normal check
|
1145 |
+
if (mediaFiles[i].type == "video/m3u8" || htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
|
1146 |
// special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
|
1147 |
+
|| htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== ''
|
1148 |
+
// special case for m4a supported by detecting mp4 support
|
1149 |
+
|| htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/m4a/,'mp4')).replace(/no/, '') !== '') {
|
1150 |
result.method = 'native';
|
1151 |
result.url = mediaFiles[i].url;
|
1152 |
break;
|
1191 |
// test for plugin playback types
|
1192 |
for (l=0; l<pluginInfo.types.length; l++) {
|
1193 |
// find plugin that can play the type
|
1194 |
+
if (type.toLowerCase() == pluginInfo.types[l].toLowerCase()) {
|
1195 |
result.method = pluginName;
|
1196 |
result.url = mediaFiles[i].url;
|
1197 |
return result;
|
1218 |
},
|
1219 |
|
1220 |
formatType: function(url, type) {
|
|
|
|
|
1221 |
// if no type is supplied, fake it with the extension
|
1222 |
if (url && !type) {
|
1223 |
return this.getTypeFromFile(url);
|
1236 |
|
1237 |
getTypeFromFile: function(url) {
|
1238 |
url = url.split('?')[0];
|
1239 |
+
var
|
1240 |
+
ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase(),
|
1241 |
+
av = /(mp4|m4v|ogg|ogv|m3u8|webm|webmv|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video/' : 'audio/';
|
1242 |
+
return this.getTypeFromExtension(ext, av);
|
1243 |
},
|
1244 |
|
1245 |
+
getTypeFromExtension: function(ext, av) {
|
1246 |
+
av = av || '';
|
1247 |
|
1248 |
switch (ext) {
|
1249 |
case 'mp4':
|
1250 |
case 'm4v':
|
1251 |
+
case 'm4a':
|
1252 |
+
case 'f4v':
|
1253 |
+
case 'f4a':
|
1254 |
+
return av + 'mp4';
|
1255 |
+
case 'flv':
|
1256 |
+
return av + 'x-flv';
|
1257 |
case 'webm':
|
1258 |
case 'webma':
|
1259 |
case 'webmv':
|
1260 |
+
return av + 'webm';
|
1261 |
case 'ogg':
|
1262 |
case 'oga':
|
1263 |
case 'ogv':
|
1264 |
+
return av + 'ogg';
|
1265 |
+
case 'm3u8':
|
1266 |
+
return 'application/x-mpegurl';
|
1267 |
+
case 'ts':
|
1268 |
+
return av + 'mp2t';
|
1269 |
default:
|
1270 |
+
return av + ext;
|
1271 |
}
|
1272 |
},
|
1273 |
|
1274 |
createErrorMessage: function(playback, options, poster) {
|
1275 |
var
|
1276 |
htmlMediaElement = playback.htmlMediaElement,
|
1277 |
+
errorContainer = document.createElement('div'),
|
1278 |
+
errorContent = options.customError;
|
1279 |
|
1280 |
errorContainer.className = 'me-cannotplay';
|
1281 |
|
1284 |
errorContainer.style.height = htmlMediaElement.height + 'px';
|
1285 |
} catch (e) {}
|
1286 |
|
1287 |
+
if (!errorContent) {
|
1288 |
+
errorContent = '<a href="' + playback.url + '">';
|
1289 |
+
|
1290 |
+
if (poster !== '') {
|
1291 |
+
errorContent += '<img src="' + poster + '" width="100%" height="100%" alt="" />';
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
errorContent += '<span>' + mejs.i18n.t('mejs.download-file') + '</span></a>';
|
1295 |
+
}
|
1296 |
+
|
1297 |
+
errorContainer.innerHTML = errorContent;
|
1298 |
|
1299 |
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
|
1300 |
htmlMediaElement.style.display = 'none';
|
1315 |
initVars;
|
1316 |
|
1317 |
// copy tagName from html media element
|
1318 |
+
pluginMediaElement.tagName = htmlMediaElement.tagName;
|
1319 |
|
1320 |
// copy attributes from html media element to plugin media element
|
1321 |
for (var i = 0; i < htmlMediaElement.attributes.length; i++) {
|
1322 |
var attribute = htmlMediaElement.attributes[i];
|
1323 |
+
if (attribute.specified) {
|
1324 |
pluginMediaElement.setAttribute(attribute.name, attribute.value);
|
1325 |
}
|
1326 |
}
|
1327 |
|
1328 |
// check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
|
1329 |
node = htmlMediaElement.parentNode;
|
1330 |
+
|
1331 |
+
while (node !== null && node.tagName != null && node.tagName.toLowerCase() !== 'body' &&
|
1332 |
+
node.parentNode != null && node.parentNode.tagName != null && node.parentNode.constructor != null && node.parentNode.constructor.name === "ShadowRoot") {
|
1333 |
+
if (node.parentNode.tagName.toLowerCase() === 'p') {
|
1334 |
node.parentNode.parentNode.insertBefore(node, node.parentNode);
|
1335 |
break;
|
1336 |
}
|
1338 |
}
|
1339 |
|
1340 |
if (playback.isVideo) {
|
1341 |
+
width = (options.pluginWidth > 0) ? options.pluginWidth : (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
|
1342 |
+
height = (options.pluginHeight > 0) ? options.pluginHeight : (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
|
1343 |
|
1344 |
// in case of '%' make sure it's encoded
|
1345 |
width = mejs.Utility.encodeUrl(width);
|
1354 |
|
1355 |
// register plugin
|
1356 |
pluginMediaElement.success = options.success;
|
1357 |
+
|
|
|
1358 |
// add container (must be added to DOM before inserting HTML for IE)
|
1359 |
container.className = 'me-plugin';
|
1360 |
container.id = pluginid + '_container';
|
1364 |
} else {
|
1365 |
document.body.insertBefore(container, document.body.childNodes[0]);
|
1366 |
}
|
1367 |
+
|
1368 |
+
if (playback.method === 'flash' || playback.method === 'silverlight') {
|
1369 |
|
1370 |
+
var canPlayVideo = htmlMediaElement.getAttribute('type') === 'audio/mp4',
|
1371 |
+
childrenSources = htmlMediaElement.getElementsByTagName('source');
|
1372 |
+
|
1373 |
+
if (childrenSources && !canPlayVideo) {
|
1374 |
+
for (var i = 0, total = childrenSources.length; i < total; i++) {
|
1375 |
+
if (childrenSources[i].getAttribute('type') === 'audio/mp4') {
|
1376 |
+
canPlayVideo = true;
|
1377 |
+
}
|
1378 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1379 |
}
|
1380 |
+
|
1381 |
+
// flash/silverlight vars
|
1382 |
+
initVars = [
|
1383 |
+
'id=' + pluginid,
|
1384 |
+
'isvideo=' + ((playback.isVideo || canPlayVideo) ? "true" : "false"),
|
1385 |
+
'autoplay=' + ((autoplay) ? "true" : "false"),
|
1386 |
+
'preload=' + preload,
|
1387 |
+
'width=' + width,
|
1388 |
+
'startvolume=' + options.startVolume,
|
1389 |
+
'timerrate=' + options.timerRate,
|
1390 |
+
'flashstreamer=' + options.flashStreamer,
|
1391 |
+
'height=' + height,
|
1392 |
+
'pseudostreamstart=' + options.pseudoStreamingStartQueryParam];
|
1393 |
+
|
1394 |
+
if (playback.url !== null) {
|
1395 |
+
if (playback.method == 'flash') {
|
1396 |
+
initVars.push('file=' + mejs.Utility.encodeUrl(playback.url));
|
1397 |
+
} else {
|
1398 |
+
initVars.push('file=' + playback.url);
|
1399 |
+
}
|
1400 |
+
}
|
1401 |
+
if (options.enablePluginDebug) {
|
1402 |
+
initVars.push('debug=true');
|
1403 |
+
}
|
1404 |
+
if (options.enablePluginSmoothing) {
|
1405 |
+
initVars.push('smoothing=true');
|
1406 |
+
}
|
1407 |
+
if (options.enablePseudoStreaming) {
|
1408 |
+
initVars.push('pseudostreaming=true');
|
1409 |
+
}
|
1410 |
+
if (controls) {
|
1411 |
+
initVars.push('controls=true'); // shows controls in the plugin if desired
|
1412 |
+
}
|
1413 |
+
if (options.pluginVars) {
|
1414 |
+
initVars = initVars.concat(options.pluginVars);
|
1415 |
+
}
|
1416 |
+
|
1417 |
+
// call from plugin
|
1418 |
+
window[pluginid + '_init'] = function() {
|
1419 |
+
switch (pluginMediaElement.pluginType) {
|
1420 |
+
case 'flash':
|
1421 |
+
pluginMediaElement.pluginElement = pluginMediaElement.pluginApi = document.getElementById(pluginid);
|
1422 |
+
break;
|
1423 |
+
case 'silverlight':
|
1424 |
+
pluginMediaElement.pluginElement = document.getElementById(pluginMediaElement.id);
|
1425 |
+
pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
|
1426 |
+
break;
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
if (pluginMediaElement.pluginApi != null && pluginMediaElement.success) {
|
1430 |
+
pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
|
1431 |
+
}
|
1432 |
+
};
|
1433 |
+
|
1434 |
+
// event call from plugin
|
1435 |
+
window[pluginid + '_event'] = function(eventName, values) {
|
1436 |
+
|
1437 |
+
var
|
1438 |
+
e,
|
1439 |
+
i,
|
1440 |
+
bufferedTime;
|
1441 |
+
|
1442 |
+
// fake event object to mimic real HTML media event.
|
1443 |
+
e = {
|
1444 |
+
type: eventName,
|
1445 |
+
target: pluginMediaElement
|
1446 |
+
};
|
1447 |
+
|
1448 |
+
// attach all values to element and event object
|
1449 |
+
for (i in values) {
|
1450 |
+
pluginMediaElement[i] = values[i];
|
1451 |
+
e[i] = values[i];
|
1452 |
+
}
|
1453 |
+
|
1454 |
+
// fake the newer W3C buffered TimeRange (loaded and total have been removed)
|
1455 |
+
bufferedTime = values.bufferedTime || 0;
|
1456 |
+
|
1457 |
+
e.target.buffered = e.buffered = {
|
1458 |
+
start: function(index) {
|
1459 |
+
return 0;
|
1460 |
+
},
|
1461 |
+
end: function (index) {
|
1462 |
+
return bufferedTime;
|
1463 |
+
},
|
1464 |
+
length: 1
|
1465 |
+
};
|
1466 |
+
|
1467 |
+
pluginMediaElement.dispatchEvent(e);
|
1468 |
+
}
|
1469 |
+
|
1470 |
+
|
1471 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1472 |
|
1473 |
switch (playback.method) {
|
1474 |
case 'silverlight':
|
1475 |
container.innerHTML =
|
1476 |
+
'<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + pluginid + '" name="' + pluginid + '" width="' + width + '" height="' + height + '" class="mejs-shim">' +
|
1477 |
'<param name="initParams" value="' + initVars.join(',') + '" />' +
|
1478 |
'<param name="windowless" value="true" />' +
|
1479 |
'<param name="background" value="black" />' +
|
1490 |
container.appendChild(specialIEContainer);
|
1491 |
specialIEContainer.outerHTML =
|
1492 |
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
|
1493 |
+
'id="' + pluginid + '" width="' + width + '" height="' + height + '" class="mejs-shim">' +
|
1494 |
+
'<param name="movie" value="' + options.pluginPath + options.flashName + '?' + (new Date().getTime()) + '" />' +
|
1495 |
'<param name="flashvars" value="' + initVars.join('&') + '" />' +
|
1496 |
'<param name="quality" value="high" />' +
|
1497 |
'<param name="bgcolor" value="#000000" />' +
|
1498 |
'<param name="wmode" value="transparent" />' +
|
1499 |
+
'<param name="allowScriptAccess" value="' + options.flashScriptAccess + '" />' +
|
1500 |
'<param name="allowFullScreen" value="true" />' +
|
1501 |
+
'<param name="scale" value="default" />' +
|
1502 |
'</object>';
|
1503 |
|
1504 |
} else {
|
1510 |
'quality="high" ' +
|
1511 |
'bgcolor="#000000" ' +
|
1512 |
'wmode="transparent" ' +
|
1513 |
+
'allowScriptAccess="' + options.flashScriptAccess + '" ' +
|
1514 |
'allowFullScreen="true" ' +
|
1515 |
'type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" ' +
|
1516 |
'src="' + options.pluginPath + options.flashName + '" ' +
|
1517 |
'flashvars="' + initVars.join('&') + '" ' +
|
1518 |
'width="' + width + '" ' +
|
1519 |
+
'height="' + height + '" ' +
|
1520 |
+
'scale="default"' +
|
1521 |
+
'class="mejs-shim"></embed>';
|
1522 |
}
|
1523 |
break;
|
1524 |
|
1525 |
case 'youtube':
|
1526 |
|
1527 |
|
1528 |
+
var videoId;
|
1529 |
+
// youtu.be url from share button
|
1530 |
+
if (playback.url.lastIndexOf("youtu.be") != -1) {
|
1531 |
+
videoId = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1532 |
+
if (videoId.indexOf('?') != -1) {
|
1533 |
+
videoId = videoId.substr(0, videoId.indexOf('?'));
|
1534 |
+
}
|
1535 |
+
}
|
1536 |
+
else {
|
1537 |
+
// https://www.youtube.com/watch?v=
|
1538 |
+
var videoIdMatch = playback.url.match( /[?&]v=([^&#]+)|&|#|$/ );
|
1539 |
+
if ( videoIdMatch ) {
|
1540 |
+
videoId = videoIdMatch[1];
|
1541 |
+
}
|
1542 |
+
}
|
1543 |
+
youtubeSettings = {
|
1544 |
container: container,
|
1545 |
containerId: container.id,
|
1546 |
pluginMediaElement: pluginMediaElement,
|
1547 |
pluginId: pluginid,
|
1548 |
videoId: videoId,
|
1549 |
height: height,
|
1550 |
+
width: width,
|
1551 |
+
scheme: playback.scheme,
|
1552 |
+
variables: options.youtubeIframeVars
|
1553 |
};
|
1554 |
|
1555 |
+
// favor iframe version of YouTube
|
1556 |
+
if (window.postMessage) {
|
|
|
1557 |
mejs.YouTubeApi.enqueueIframe(youtubeSettings);
|
1558 |
+
} else if (mejs.PluginDetector.hasPluginVersion('flash', [10,0,0]) ) {
|
1559 |
+
mejs.YouTubeApi.createFlash(youtubeSettings, options);
|
1560 |
}
|
|
|
1561 |
break;
|
1562 |
|
1563 |
// DEMO Code. Does NOT work.
|
1564 |
case 'vimeo':
|
1565 |
+
var player_id = pluginid + "_player";
|
|
|
1566 |
pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1567 |
|
1568 |
+
container.innerHTML ='<iframe src="' + playback.scheme + 'player.vimeo.com/video/' + pluginMediaElement.vimeoid + '?api=1&portrait=0&byline=0&title=0&player_id=' + player_id + '" width="' + width +'" height="' + height +'" frameborder="0" class="mejs-shim" id="' + player_id + '" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
|
1569 |
+
if (typeof($f) == 'function') { // froogaloop available
|
1570 |
+
var player = $f(container.childNodes[0]),
|
1571 |
+
playerState = -1;
|
1572 |
+
|
1573 |
+
player.addEvent('ready', function() {
|
1574 |
+
|
1575 |
+
player.playVideo = function() {
|
1576 |
+
player.api( 'play' );
|
1577 |
+
};
|
1578 |
+
player.stopVideo = function() {
|
1579 |
+
player.api( 'unload' );
|
1580 |
+
};
|
1581 |
+
player.pauseVideo = function() {
|
1582 |
+
player.api( 'pause' );
|
1583 |
+
};
|
1584 |
+
player.seekTo = function( seconds ) {
|
1585 |
+
player.api( 'seekTo', seconds );
|
1586 |
+
};
|
1587 |
+
player.setVolume = function( volume ) {
|
1588 |
+
player.api( 'setVolume', volume );
|
1589 |
+
};
|
1590 |
+
player.setMuted = function( muted ) {
|
1591 |
+
if( muted ) {
|
1592 |
+
player.lastVolume = player.api( 'getVolume' );
|
1593 |
+
player.api( 'setVolume', 0 );
|
1594 |
+
} else {
|
1595 |
+
player.api( 'setVolume', player.lastVolume );
|
1596 |
+
delete player.lastVolume;
|
1597 |
+
}
|
1598 |
+
};
|
1599 |
+
// parity with YT player
|
1600 |
+
player.getPlayerState = function() {
|
1601 |
+
return playerState;
|
1602 |
+
};
|
1603 |
+
|
1604 |
+
function createEvent(player, pluginMediaElement, eventName, e) {
|
1605 |
+
var event = {
|
1606 |
+
type: eventName,
|
1607 |
+
target: pluginMediaElement
|
1608 |
+
};
|
1609 |
+
if (eventName == 'timeupdate') {
|
1610 |
+
pluginMediaElement.currentTime = event.currentTime = e.seconds;
|
1611 |
+
pluginMediaElement.duration = event.duration = e.duration;
|
1612 |
+
}
|
1613 |
+
pluginMediaElement.dispatchEvent(event);
|
1614 |
+
}
|
1615 |
+
|
1616 |
+
player.addEvent('play', function() {
|
1617 |
+
playerState = 1;
|
1618 |
+
createEvent(player, pluginMediaElement, 'play');
|
1619 |
+
createEvent(player, pluginMediaElement, 'playing');
|
1620 |
+
});
|
1621 |
+
|
1622 |
+
player.addEvent('pause', function() {
|
1623 |
+
playerState = 2;
|
1624 |
+
createEvent(player, pluginMediaElement, 'pause');
|
1625 |
+
});
|
1626 |
+
|
1627 |
+
player.addEvent('finish', function() {
|
1628 |
+
playerState = 0;
|
1629 |
+
createEvent(player, pluginMediaElement, 'ended');
|
1630 |
+
});
|
1631 |
+
|
1632 |
+
player.addEvent('playProgress', function(e) {
|
1633 |
+
createEvent(player, pluginMediaElement, 'timeupdate', e);
|
1634 |
+
});
|
1635 |
+
|
1636 |
+
player.addEvent('seek', function(e) {
|
1637 |
+
playerState = 3;
|
1638 |
+
createEvent(player, pluginMediaElement, 'seeked', e);
|
1639 |
+
});
|
1640 |
+
|
1641 |
+
player.addEvent('loadProgress', function(e) {
|
1642 |
+
playerState = 3;
|
1643 |
+
createEvent(player, pluginMediaElement, 'progress', e);
|
1644 |
+
});
|
1645 |
+
|
1646 |
+
pluginMediaElement.pluginElement = container;
|
1647 |
+
pluginMediaElement.pluginApi = player;
|
1648 |
+
|
1649 |
+
pluginMediaElement.success(pluginMediaElement, pluginMediaElement.pluginElement);
|
1650 |
+
});
|
1651 |
+
}
|
1652 |
+
else {
|
1653 |
+
console.warn("You need to include froogaloop for vimeo to work");
|
1654 |
+
}
|
1655 |
break;
|
1656 |
}
|
1657 |
// hide original element
|
1658 |
htmlMediaElement.style.display = 'none';
|
1659 |
+
// prevent browser from autoplaying when using a plugin
|
1660 |
+
htmlMediaElement.removeAttribute('autoplay');
|
1661 |
|
1662 |
return pluginMediaElement;
|
1663 |
},
|
1718 |
mejs.YouTubeApi = {
|
1719 |
isIframeStarted: false,
|
1720 |
isIframeLoaded: false,
|
1721 |
+
loadIframeApi: function(yt) {
|
1722 |
if (!this.isIframeStarted) {
|
1723 |
var tag = document.createElement('script');
|
1724 |
+
tag.src = yt.scheme + "www.youtube.com/player_api";
|
1725 |
var firstScriptTag = document.getElementsByTagName('script')[0];
|
1726 |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
1727 |
this.isIframeStarted = true;
|
1733 |
if (this.isLoaded) {
|
1734 |
this.createIframe(yt);
|
1735 |
} else {
|
1736 |
+
this.loadIframeApi(yt);
|
1737 |
this.iframeQueue.push(yt);
|
1738 |
}
|
1739 |
},
|
1740 |
createIframe: function(settings) {
|
1741 |
+
|
1742 |
var
|
1743 |
+
pluginMediaElement = settings.pluginMediaElement,
|
1744 |
+
defaultVars = {controls:0, wmode:'transparent'},
|
1745 |
player = new YT.Player(settings.containerId, {
|
1746 |
height: settings.height,
|
1747 |
width: settings.width,
|
1748 |
videoId: settings.videoId,
|
1749 |
+
playerVars: mejs.$.extend({}, defaultVars, settings.variables),
|
1750 |
events: {
|
1751 |
+
'onReady': function(e) {
|
1752 |
+
|
1753 |
+
// wrapper to match
|
1754 |
+
player.setVideoSize = function(width, height) {
|
1755 |
+
player.setSize(width, height);
|
1756 |
+
};
|
1757 |
|
1758 |
// hook up iframe object to MEjs
|
1759 |
settings.pluginMediaElement.pluginApi = player;
|
1760 |
+
settings.pluginMediaElement.pluginElement = document.getElementById(settings.containerId);
|
1761 |
|
1762 |
// init mejs
|
1763 |
+
pluginMediaElement.success(pluginMediaElement, pluginMediaElement.pluginElement);
|
1764 |
+
|
1765 |
+
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'canplay');
|
1766 |
|
1767 |
// create timer
|
1768 |
setInterval(function() {
|
1769 |
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
|
1770 |
+
}, 250);
|
1771 |
+
|
1772 |
+
if (typeof pluginMediaElement.attributes.autoplay !== 'undefined') {
|
1773 |
+
player.playVideo();
|
1774 |
+
}
|
1775 |
},
|
1776 |
'onStateChange': function(e) {
|
1777 |
|
1783 |
},
|
1784 |
|
1785 |
createEvent: function (player, pluginMediaElement, eventName) {
|
1786 |
+
var event = {
|
1787 |
type: eventName,
|
1788 |
target: pluginMediaElement
|
1789 |
};
|
1791 |
if (player && player.getDuration) {
|
1792 |
|
1793 |
// time
|
1794 |
+
pluginMediaElement.currentTime = event.currentTime = player.getCurrentTime();
|
1795 |
+
pluginMediaElement.duration = event.duration = player.getDuration();
|
1796 |
|
1797 |
// state
|
1798 |
+
event.paused = pluginMediaElement.paused;
|
1799 |
+
event.ended = pluginMediaElement.ended;
|
1800 |
|
1801 |
// sound
|
1802 |
+
event.muted = player.isMuted();
|
1803 |
+
event.volume = player.getVolume() / 100;
|
1804 |
|
1805 |
// progress
|
1806 |
+
event.bytesTotal = player.getVideoBytesTotal();
|
1807 |
+
event.bufferedBytes = player.getVideoBytesLoaded();
|
1808 |
|
1809 |
// fake the W3C buffered TimeRange
|
1810 |
+
var bufferedTime = event.bufferedBytes / event.bytesTotal * event.duration;
|
1811 |
|
1812 |
+
event.target.buffered = event.buffered = {
|
1813 |
start: function(index) {
|
1814 |
return 0;
|
1815 |
},
|
1818 |
},
|
1819 |
length: 1
|
1820 |
};
|
1821 |
+
|
1822 |
}
|
1823 |
|
1824 |
// send event up the chain
|
1825 |
+
pluginMediaElement.dispatchEvent(event);
|
1826 |
},
|
1827 |
|
1828 |
iFrameReady: function() {
|
1844 |
|
1845 |
/*
|
1846 |
settings.container.innerHTML =
|
1847 |
+
'<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="' + settings.scheme + 'www.youtube.com/apiplayer?enablejsapi=1&playerapiid=' + settings.pluginId + '&version=3&autoplay=0&controls=0&modestbranding=1&loop=0" ' +
|
1848 |
+
'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; " class="mejs-shim">' +
|
1849 |
+
'<param name="allowScriptAccess" value="sameDomain">' +
|
1850 |
'<param name="wmode" value="transparent">' +
|
1851 |
'</object>';
|
1852 |
*/
|
1853 |
|
1854 |
var specialIEContainer,
|
1855 |
+
youtubeUrl = settings.scheme + 'www.youtube.com/apiplayer?enablejsapi=1&playerapiid=' + settings.pluginId + '&version=3&autoplay=0&controls=0&modestbranding=1&loop=0';
|
1856 |
|
1857 |
if (mejs.MediaFeatures.isIE) {
|
1858 |
|
1859 |
specialIEContainer = document.createElement('div');
|
1860 |
settings.container.appendChild(specialIEContainer);
|
1861 |
+
specialIEContainer.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' + settings.scheme + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
|
1862 |
+
'id="' + settings.pluginId + '" width="' + settings.width + '" height="' + settings.height + '" class="mejs-shim">' +
|
1863 |
'<param name="movie" value="' + youtubeUrl + '" />' +
|
1864 |
'<param name="wmode" value="transparent" />' +
|
1865 |
+
'<param name="allowScriptAccess" value="' + options.flashScriptAccess + '" />' +
|
1866 |
'<param name="allowFullScreen" value="true" />' +
|
1867 |
'</object>';
|
1868 |
} else {
|
1869 |
settings.container.innerHTML =
|
1870 |
'<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="' + youtubeUrl + '" ' +
|
1871 |
+
'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; " class="mejs-shim">' +
|
1872 |
+
'<param name="allowScriptAccess" value="' + options.flashScriptAccess + '">' +
|
1873 |
'<param name="wmode" value="transparent">' +
|
1874 |
'</object>';
|
1875 |
}
|
1885 |
// hook up and return to MediaELementPlayer.success
|
1886 |
pluginMediaElement.pluginApi =
|
1887 |
pluginMediaElement.pluginElement = player;
|
1888 |
+
|
1889 |
+
settings.success(pluginMediaElement, pluginMediaElement.pluginElement);
|
1890 |
|
1891 |
// load the youtube video
|
1892 |
player.cueVideoById(settings.videoId);
|
1895 |
|
1896 |
window[callbackName] = function(e) {
|
1897 |
mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
|
1898 |
+
};
|
1899 |
|
1900 |
player.addEventListener('onStateChange', callbackName);
|
1901 |
|
1902 |
setInterval(function() {
|
1903 |
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
|
1904 |
}, 250);
|
1905 |
+
|
1906 |
+
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'canplay');
|
1907 |
},
|
1908 |
|
1909 |
handleStateChange: function(youTubeState, player, pluginMediaElement) {
|
1942 |
}
|
1943 |
}
|
1944 |
// IFRAME
|
1945 |
+
window.onYouTubePlayerAPIReady = function() {
|
1946 |
mejs.YouTubeApi.iFrameReady();
|
1947 |
+
};
|
1948 |
// FLASH
|
1949 |
+
window.onYouTubePlayerReady = function(id) {
|
1950 |
mejs.YouTubeApi.flashReady(id);
|
1951 |
+
};
|
1952 |
|
1953 |
window.mejs = mejs;
|
1954 |
window.MediaElement = mejs.MediaElement;
|
1955 |
|
1956 |
+
/**
|
1957 |
+
* Localize strings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1958 |
*
|
1959 |
+
* Include translations from JS files and method to pluralize properly strings.
|
|
|
|
|
|
|
1960 |
*
|
1961 |
*/
|
1962 |
+
(function (doc, win, mejs, undefined) {
|
1963 |
+
|
1964 |
+
var i18n = {
|
1965 |
+
/**
|
1966 |
+
* @type {String}
|
1967 |
+
*/
|
1968 |
+
'default': 'en',
|
1969 |
+
|
1970 |
+
/**
|
1971 |
+
* @type {String[]}
|
1972 |
+
*/
|
1973 |
+
locale: {
|
1974 |
+
language: (mejs.i18n && mejs.i18n.locale.language) || '',
|
1975 |
+
strings: (mejs.i18n && mejs.i18n.locale.strings) || {}
|
1976 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1977 |
|
1978 |
+
/**
|
1979 |
+
* Filters for available languages.
|
1980 |
+
*
|
1981 |
+
* This plural forms are grouped in family groups based on
|
1982 |
+
* https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plural_Rules
|
1983 |
+
* with some additions and corrections according to the Localization Guide list
|
1984 |
+
* (http://localization-guide.readthedocs.io/en/latest/l10n/pluralforms.html)
|
1985 |
+
*
|
1986 |
+
* Arguments are dynamic following the structure:
|
1987 |
+
* - argument1 : Number to determine form
|
1988 |
+
* - argument2...argumentN: Possible matches
|
1989 |
+
*
|
1990 |
+
* @type {Function[]}
|
1991 |
+
*/
|
1992 |
+
pluralForms: [
|
1993 |
+
// 0: Chinese, Japanese, Korean, Persian, Turkish, Thai, Lao, Aymará,
|
1994 |
+
// Tibetan, Chiga, Dzongkha, Indonesian, Lojban, Georgian, Kazakh, Khmer, Kyrgyz, Malay,
|
1995 |
+
// Burmese, Yakut, Sundanese, Tatar, Uyghur, Vietnamese, Wolof
|
1996 |
+
function () {
|
1997 |
+
return arguments[1];
|
1998 |
+
},
|
1999 |
+
// 1: Danish, Dutch, English, Faroese, Frisian, German, Norwegian, Swedish, Estonian, Finnish,
|
2000 |
+
// Hungarian, Basque, Greek, Hebrew, Italian, Portuguese, Spanish, Catalan, Afrikaans,
|
2001 |
+
// Angika, Assamese, Asturian, Azerbaijani, Bulgarian, Bengali, Bodo, Aragonese, Dogri,
|
2002 |
+
// Esperanto, Argentinean Spanish, Fulah, Friulian, Galician, Gujarati, Hausa,
|
2003 |
+
// Hindi, Chhattisgarhi, Armenian, Interlingua, Greenlandic, Kannada, Kurdish, Letzeburgesch,
|
2004 |
+
// Maithili, Malayalam, Mongolian, Manipuri, Marathi, Nahuatl, Neapolitan, Norwegian Bokmal,
|
2005 |
+
// Nepali, Norwegian Nynorsk, Norwegian (old code), Northern Sotho, Oriya, Punjabi, Papiamento,
|
2006 |
+
// Piemontese, Pashto, Romansh, Kinyarwanda, Santali, Scots, Sindhi, Northern Sami, Sinhala,
|
2007 |
+
// Somali, Songhay, Albanian, Swahili, Tamil, Telugu, Turkmen, Urdu, Yoruba
|
2008 |
+
function () {
|
2009 |
+
var args = arguments;
|
2010 |
+
if (args[0] === 1) {
|
2011 |
+
return args[1];
|
2012 |
+
} else {
|
2013 |
+
return args[2];
|
2014 |
+
}
|
2015 |
+
},
|
2016 |
+
// 2: French, Brazilian Portuguese, Acholi, Akan, Amharic, Mapudungun, Breton, Filipino,
|
2017 |
+
// Gun, Lingala, Mauritian Creole, Malagasy, Maori, Occitan, Tajik, Tigrinya, Uzbek, Walloon
|
2018 |
+
function () {
|
2019 |
+
var args = arguments;
|
2020 |
+
if ([0, 1].indexOf(args[0]) > -1) {
|
2021 |
+
return args[1];
|
2022 |
+
} else {
|
2023 |
+
return args[2];
|
2024 |
+
}
|
2025 |
+
},
|
2026 |
+
// 3: Latvian
|
2027 |
+
function () {
|
2028 |
+
var args = arguments;
|
2029 |
+
if (args[0] % 10 === 1 && args[0] % 100 !== 11) {
|
2030 |
+
return args[1];
|
2031 |
+
} else if (args[0] !== 0) {
|
2032 |
+
return args[2];
|
2033 |
+
} else {
|
2034 |
+
return args[3];
|
2035 |
+
}
|
2036 |
+
},
|
2037 |
+
// 4: Scottish Gaelic
|
2038 |
+
function () {
|
2039 |
+
var args = arguments;
|
2040 |
+
if (args[0] === 1 || args[0] === 11) {
|
2041 |
+
return args[1];
|
2042 |
+
} else if (args[0] === 2 || args[0] === 12) {
|
2043 |
+
return args[2];
|
2044 |
+
} else if (args[0] > 2 && args[0] < 20) {
|
2045 |
+
return args[3];
|
2046 |
+
} else {
|
2047 |
+
return args[4];
|
2048 |
+
}
|
2049 |
+
},
|
2050 |
+
// 5: Romanian
|
2051 |
+
function () {
|
2052 |
+
if (args[0] === 1) {
|
2053 |
+
return args[1];
|
2054 |
+
} else if (args[0] === 0 || (args[0] % 100 > 0 && args[0] % 100 < 20)) {
|
2055 |
+
return args[2];
|
2056 |
+
} else {
|
2057 |
+
return args[3];
|
2058 |
+
}
|
2059 |
+
},
|
2060 |
+
// 6: Lithuanian
|
2061 |
+
function () {
|
2062 |
+
var args = arguments;
|
2063 |
+
if (args[0] % 10 === 1 && args[0] % 100 !== 11) {
|
2064 |
+
return args[1];
|
2065 |
+
} else if (args[0] % 10 >= 2 && (args[0] % 100 < 10 || args[0] % 100 >= 20)) {
|
2066 |
+
return args[2];
|
2067 |
+
} else {
|
2068 |
+
return [3];
|
2069 |
+
}
|
2070 |
+
},
|
2071 |
+
// 7: Belarusian, Bosnian, Croatian, Serbian, Russian, Ukrainian
|
2072 |
+
function () {
|
2073 |
+
var args = arguments;
|
2074 |
+
if (args[0] % 10 === 1 && args[0] % 100 !== 11) {
|
2075 |
+
return args[1];
|
2076 |
+
} else if (args[0] % 10 >= 2 && args[0] % 10 <= 4 && (args[0] % 100 < 10 || args[0] % 100 >= 20)) {
|
2077 |
+
return args[2];
|
2078 |
+
} else {
|
2079 |
+
return args[3];
|
2080 |
+
}
|
2081 |
+
},
|
2082 |
+
// 8: Slovak, Czech
|
2083 |
+
function () {
|
2084 |
+
var args = arguments;
|
2085 |
+
if (args[0] === 1) {
|
2086 |
+
return args[1];
|
2087 |
+
} else if (args[0] >= 2 && args[0] <= 4) {
|
2088 |
+
return args[2];
|
2089 |
+
} else {
|
2090 |
+
return args[3];
|
2091 |
+
}
|
2092 |
+
},
|
2093 |
+
// 9: Polish
|
2094 |
+
function () {
|
2095 |
+
var args = arguments;
|
2096 |
+
if (args[0] === 1) {
|
2097 |
+
return args[1];
|
2098 |
+
} else if (args[0] % 10 >= 2 && args[0] % 10 <= 4 && (args[0] % 100 < 10 || args[0] % 100 >= 20)) {
|
2099 |
+
return args[2];
|
2100 |
+
} else {
|
2101 |
+
return args[3];
|
2102 |
+
}
|
2103 |
+
},
|
2104 |
+
// 10: Slovenian
|
2105 |
+
function () {
|
2106 |
+
var args = arguments;
|
2107 |
+
if (args[0] % 100 === 1) {
|
2108 |
+
return args[2];
|
2109 |
+
} else if (args[0] % 100 === 2) {
|
2110 |
+
return args[3];
|
2111 |
+
} else if (args[0] % 100 === 3 || args[0] % 100 === 4) {
|
2112 |
+
return args[4];
|
2113 |
+
} else {
|
2114 |
+
return args[1];
|
2115 |
+
}
|
2116 |
+
},
|
2117 |
+
// 11: Irish Gaelic
|
2118 |
+
function () {
|
2119 |
+
var args = arguments;
|
2120 |
+
if (args[0] === 1) {
|
2121 |
+
return args[1];
|
2122 |
+
} else if (args[0] === 2) {
|
2123 |
+
return args[2];
|
2124 |
+
} else if (args[0] > 2 && args[0] < 7) {
|
2125 |
+
return args[3];
|
2126 |
+
} else if (args[0] > 6 && args[0] < 11) {
|
2127 |
+
return args[4];
|
2128 |
+
} else {
|
2129 |
+
return args[5];
|
2130 |
+
}
|
2131 |
+
},
|
2132 |
+
// 12: Arabic
|
2133 |
+
function () {
|
2134 |
+
var args = arguments;
|
2135 |
+
if (args[0] === 0) {
|
2136 |
+
return args[1];
|
2137 |
+
} else if (args[0] === 1) {
|
2138 |
+
return args[2];
|
2139 |
+
} else if (args[0] === 2) {
|
2140 |
+
return args[3];
|
2141 |
+
} else if (args[0] % 100 >= 3 && args[0] % 100 <= 10) {
|
2142 |
+
return args[4];
|
2143 |
+
} else if (args[0] % 100 >= 11) {
|
2144 |
+
return args[5];
|
2145 |
+
} else {
|
2146 |
+
return args[6];
|
2147 |
+
}
|
2148 |
+
},
|
2149 |
+
// 13: Maltese
|
2150 |
+
function () {
|
2151 |
+
var args = arguments;
|
2152 |
+
if (args[0] === 1) {
|
2153 |
+
return args[1];
|
2154 |
+
} else if (args[0] === 0 || (args[0] % 100 > 1 && args[0] % 100 < 11)) {
|
2155 |
+
return args[2];
|
2156 |
+
} else if (args[0] % 100 > 10 && args[0] % 100 < 20) {
|
2157 |
+
return args[3];
|
2158 |
+
} else {
|
2159 |
+
return args[4];
|
2160 |
+
}
|
2161 |
+
|
2162 |
+
},
|
2163 |
+
// 14: Macedonian
|
2164 |
+
function () {
|
2165 |
+
var args = arguments;
|
2166 |
+
if (args[0] % 10 === 1) {
|
2167 |
+
return args[1];
|
2168 |
+
} else if (args[0] % 10 === 2) {
|
2169 |
+
return args[2];
|
2170 |
+
} else {
|
2171 |
+
return args[3];
|
2172 |
+
}
|
2173 |
+
},
|
2174 |
+
// 15: Icelandic
|
2175 |
+
function () {
|
2176 |
+
var args = arguments;
|
2177 |
+
if (args[0] !== 11 && args[0] % 10 === 1) {
|
2178 |
+
return args[1];
|
2179 |
+
} else {
|
2180 |
+
return args[2];
|
2181 |
+
}
|
2182 |
+
},
|
2183 |
+
// New additions
|
2184 |
+
|
2185 |
+
// 16: Kashubian
|
2186 |
+
// Note: in https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plural_Rules
|
2187 |
+
// Breton is listed as #16 but in the Localization Guide it belongs to the group 2
|
2188 |
+
function () {
|
2189 |
+
var args = arguments;
|
2190 |
+
if (args[0] === 1) {
|
2191 |
+
return args[1];
|
2192 |
+
} else if (args[0] % 10 >= 2 && args[0] % 10 <= 4 && (args[0] % 100 < 10 || args[0] % 100 >= 20)) {
|
2193 |
+
return args[2];
|
2194 |
+
} else {
|
2195 |
+
return args[3];
|
2196 |
+
}
|
2197 |
+
},
|
2198 |
+
// 17: Welsh
|
2199 |
+
function () {
|
2200 |
+
var args = arguments;
|
2201 |
+
if (args[0] === 1) {
|
2202 |
+
return args[1];
|
2203 |
+
} else if (args[0] === 2) {
|
2204 |
+
return args[2];
|
2205 |
+
} else if (args[0] !== 8 && args[0] !== 11) {
|
2206 |
+
return args[3];
|
2207 |
+
} else {
|
2208 |
+
return args[4];
|
2209 |
+
}
|
2210 |
+
},
|
2211 |
+
// 18: Javanese
|
2212 |
+
function () {
|
2213 |
+
var args = arguments;
|
2214 |
+
if (args[0] === 0) {
|
2215 |
+
return args[1];
|
2216 |
+
} else {
|
2217 |
+
return args[2];
|
2218 |
+
}
|
2219 |
+
},
|
2220 |
+
// 19: Cornish
|
2221 |
+
function () {
|
2222 |
+
var args = arguments;
|
2223 |
+
if (args[0] === 1) {
|
2224 |
+
return args[1];
|
2225 |
+
} else if (args[0] === 2) {
|
2226 |
+
return args[2];
|
2227 |
+
} else if (args[0] === 3) {
|
2228 |
+
return args[3];
|
2229 |
+
} else {
|
2230 |
+
return args[4];
|
2231 |
+
}
|
2232 |
+
},
|
2233 |
+
// 20: Mandinka
|
2234 |
+
function () {
|
2235 |
+
var args = arguments;
|
2236 |
+
if (args[0] === 0) {
|
2237 |
+
return args[1];
|
2238 |
+
} else if (args[0] === 1) {
|
2239 |
+
return args[2];
|
2240 |
+
} else {
|
2241 |
+
return args[3];
|
2242 |
+
}
|
2243 |
+
}
|
2244 |
+
],
|
2245 |
+
/**
|
2246 |
+
* Get specified language
|
2247 |
+
*
|
2248 |
+
*/
|
2249 |
+
getLanguage: function () {
|
2250 |
+
var language = i18n.locale.language || i18n['default'];
|
2251 |
+
return /^(x\-)?[a-z]{2,}(\-\w{2,})?(\-\w{2,})?$/.exec(language) ? language : i18n['default'];
|
2252 |
+
},
|
2253 |
|
2254 |
+
/**
|
2255 |
+
* Translate a string to a specified language, including optionally a number to pluralize translation
|
2256 |
+
*
|
2257 |
+
* @param {String} message
|
2258 |
+
* @param {Number} pluralParam
|
2259 |
+
* @return {String}
|
2260 |
+
*/
|
2261 |
+
t: function (message, pluralParam) {
|
2262 |
|
2263 |
+
if (typeof message === 'string' && message.length) {
|
|
|
|
|
|
|
|
|
|
|
|
|
2264 |
|
2265 |
+
var
|
2266 |
+
language = i18n.getLanguage(),
|
2267 |
+
str,
|
2268 |
+
pluralForm,
|
2269 |
+
/**
|
2270 |
+
* Modify string using algorithm to detect plural forms.
|
2271 |
+
*
|
2272 |
+
* @private
|
2273 |
+
* @see http://stackoverflow.com/questions/1353408/messageformat-in-javascript-parameters-in-localized-ui-strings
|
2274 |
+
* @param {String|String[]} input - String or array of strings to pick the plural form
|
2275 |
+
* @param {Number} number - Number to determine the proper plural form
|
2276 |
+
* @param {Number} form - Number of language family to apply plural form
|
2277 |
+
* @return {String}
|
2278 |
+
*/
|
2279 |
+
plural = function (input, number, form) {
|
2280 |
+
|
2281 |
+
if (typeof input !== 'object' || typeof number !== 'number' || typeof form !== 'number') {
|
2282 |
+
return input;
|
2283 |
+
}
|
2284 |
+
|
2285 |
+
if (typeof input === 'string') {
|
2286 |
+
return input;
|
2287 |
+
}
|
2288 |
|
2289 |
+
// Perform plural form or return original text
|
2290 |
+
return i18n.pluralForms[form].apply(null, [number].concat(input));
|
2291 |
+
},
|
2292 |
+
/**
|
2293 |
+
*
|
2294 |
+
* @param {String} input
|
2295 |
+
* @return {String}
|
2296 |
+
*/
|
2297 |
+
escapeHTML = function (input) {
|
2298 |
+
var map = {
|
2299 |
+
'&': '&',
|
2300 |
+
'<': '<',
|
2301 |
+
'>': '>',
|
2302 |
+
'"': '"'
|
2303 |
+
};
|
2304 |
+
|
2305 |
+
return input.replace(/[&<>"]/g, function(c) {
|
2306 |
+
return map[c];
|
2307 |
+
});
|
2308 |
+
}
|
2309 |
+
;
|
2310 |
+
|
2311 |
+
// Fetch the localized version of the string
|
2312 |
+
if (i18n.locale.strings && i18n.locale.strings[language]) {
|
2313 |
+
str = i18n.locale.strings[language][message];
|
2314 |
+
if (typeof pluralParam === 'number') {
|
2315 |
+
pluralForm = i18n.locale.strings[language]['mejs.plural-form'];
|
2316 |
+
str = plural.apply(null, [str, pluralParam, pluralForm]);
|
2317 |
+
}
|
2318 |
+
}
|
2319 |
|
2320 |
+
// Fallback to default language if requested uid is not translated
|
2321 |
+
if (!str && i18n.locale.strings && i18n.locale.strings[i18n['default']]) {
|
2322 |
+
str = i18n.locale.strings[i18n['default']][message];
|
2323 |
+
if (typeof pluralParam === 'number') {
|
2324 |
+
pluralForm = i18n.locale.strings[i18n['default']]['mejs.plural-form'];
|
2325 |
+
str = plural.apply(null, [str, pluralParam, pluralForm]);
|
2326 |
|
2327 |
+
}
|
2328 |
+
}
|
2329 |
+
|
2330 |
+
// As a last resort, use the requested uid, to mimic original behavior of i18n utils (in which uid was the english text)
|
2331 |
+
str = str || message;
|
2332 |
+
|
2333 |
+
// Replace token
|
2334 |
+
if (typeof pluralParam === 'number') {
|
2335 |
+
str = str.replace('%1', pluralParam);
|
2336 |
+
}
|
2337 |
+
|
2338 |
+
return escapeHTML(str);
|
2339 |
+
|
2340 |
+
}
|
2341 |
+
|
2342 |
+
return message;
|
2343 |
+
}
|
2344 |
+
|
2345 |
+
};
|
2346 |
+
|
2347 |
+
// i18n fixes for compatibility with WordPress
|
2348 |
+
if (typeof mejsL10n !== 'undefined') {
|
2349 |
+
i18n.locale.language = mejsL10n.language;
|
2350 |
+
}
|
2351 |
+
|
2352 |
+
// Register variable
|
2353 |
+
mejs.i18n = i18n;
|
2354 |
+
|
2355 |
+
|
2356 |
+
}(document, window, mejs));
|
2357 |
|
2358 |
+
// i18n fixes for compatibility with WordPress
|
2359 |
+
;(function (mejs, undefined) {
|
2360 |
+
|
2361 |
+
"use strict";
|
2362 |
+
|
2363 |
+
if (typeof mejsL10n !== 'undefined') {
|
2364 |
+
mejs[mejsL10n.language] = mejsL10n.strings;
|
2365 |
+
}
|
2366 |
+
|
2367 |
+
}(mejs.i18n.locale.strings));
|
2368 |
/*!
|
2369 |
* This is a i18n.locale language object.
|
2370 |
*
|
2371 |
+
* English; This can serve as a template for other languages to translate
|
2372 |
*
|
2373 |
* @author
|
2374 |
+
* TBD
|
2375 |
+
* Sascha Greuel (Twitter: @SoftCreatR)
|
2376 |
*
|
2377 |
* @see
|
2378 |
* me-i18n.js
|
2380 |
* @params
|
2381 |
* - exports - CommonJS, window ..
|
2382 |
*/
|
2383 |
+
(function (exports) {
|
|
|
2384 |
"use strict";
|
2385 |
|
2386 |
+
if (exports.en === undefined) {
|
2387 |
+
exports.en = {
|
2388 |
+
"mejs.plural-form": 1,
|
2389 |
+
|
2390 |
+
// me-shim
|
2391 |
+
"mejs.download-file": "Download File",
|
2392 |
+
|
2393 |
+
// mep-feature-contextmenu
|
2394 |
+
"mejs.fullscreen-off": "Turn off Fullscreen",
|
2395 |
+
"mejs.fullscreen-on": "Go Fullscreen",
|
2396 |
+
"mejs.download-video": "Download Video",
|
2397 |
+
|
2398 |
+
// mep-feature-fullscreen
|
2399 |
+
"mejs.fullscreen": "Fullscreen",
|
2400 |
+
|
2401 |
+
// mep-feature-jumpforward
|
2402 |
+
"mejs.time-jump-forward": ["Jump forward 1 second", "Jump forward %1 seconds"],
|
2403 |
+
|
2404 |
+
// mep-feature-playpause
|
2405 |
+
"mejs.play": "Play",
|
2406 |
+
"mejs.pause": "Pause",
|
2407 |
+
|
2408 |
+
// mep-feature-postroll
|
2409 |
+
"mejs.close": "Close",
|
2410 |
+
|
2411 |
+
// mep-feature-progress
|
2412 |
+
"mejs.time-slider": "Time Slider",
|
2413 |
+
"mejs.time-help-text": "Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.",
|
2414 |
+
|
2415 |
+
// mep-feature-skipback
|
2416 |
+
"mejs.time-skip-back": ["Skip back 1 second", "Skip back %1 seconds"],
|
2417 |
+
|
2418 |
+
// mep-feature-tracks
|
2419 |
+
"mejs.captions-subtitles": "Captions/Subtitles",
|
2420 |
+
"mejs.none": "None",
|
2421 |
+
|
2422 |
+
// mep-feature-volume
|
2423 |
+
"mejs.mute-toggle": "Mute Toggle",
|
2424 |
+
"mejs.volume-help-text": "Use Up/Down Arrow keys to increase or decrease volume.",
|
2425 |
+
"mejs.unmute": "Unmute",
|
2426 |
+
"mejs.mute": "Mute",
|
2427 |
+
"mejs.volume-slider": "Volume Slider",
|
2428 |
|
2429 |
+
// mep-player
|
2430 |
+
"mejs.video-player": "Video Player",
|
2431 |
+
"mejs.audio-player": "Audio Player",
|
2432 |
+
|
2433 |
+
// mep-feature-ads
|
2434 |
+
"mejs.ad-skip": "Skip ad",
|
2435 |
+
"mejs.ad-skip-info": ["Skip in 1 second", "Skip in %1 seconds"],
|
2436 |
+
|
2437 |
+
// mep-feature-sourcechooser
|
2438 |
+
"mejs.source-chooser": "Source Chooser"
|
2439 |
+
};
|
2440 |
+
}
|
2441 |
}(mejs.i18n.locale.strings));
|
2442 |
|
2443 |
/*!
|
2444 |
+
*
|
2445 |
* MediaElementPlayer
|
2446 |
* http://mediaelementjs.com/
|
2447 |
*
|
2448 |
* Creates a controller bar for HTML5 <video> add <audio> tags
|
2449 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
2450 |
*
|
2451 |
+
* Copyright 2010-2013, John Dyer (http://j.hn/)
|
2452 |
* License: MIT
|
2453 |
*
|
2454 |
*/
|
2455 |
if (typeof jQuery != 'undefined') {
|
2456 |
mejs.$ = jQuery;
|
2457 |
+
} else if (typeof Zepto != 'undefined') {
|
2458 |
+
mejs.$ = Zepto;
|
2459 |
+
|
2460 |
+
// define `outerWidth` method which has not been realized in Zepto
|
2461 |
+
Zepto.fn.outerWidth = function(includeMargin) {
|
2462 |
+
var width = $(this).width();
|
2463 |
+
if (includeMargin) {
|
2464 |
+
width += parseInt($(this).css('margin-right'), 10);
|
2465 |
+
width += parseInt($(this).css('margin-left'), 10);
|
2466 |
+
}
|
2467 |
+
return width
|
2468 |
+
}
|
2469 |
+
|
2470 |
} else if (typeof ender != 'undefined') {
|
2471 |
mejs.$ = ender;
|
2472 |
}
|
2476 |
mejs.MepDefaults = {
|
2477 |
// url to poster (to fix iOS 3.x)
|
2478 |
poster: '',
|
2479 |
+
// When the video is ended, we can show the poster.
|
2480 |
+
showPosterWhenEnded: false,
|
2481 |
// default if the <video width> is not specified
|
2482 |
defaultVideoWidth: 480,
|
2483 |
// default if the <video height> is not specified
|
2490 |
defaultAudioWidth: 400,
|
2491 |
// default if the user doesn't specify
|
2492 |
defaultAudioHeight: 30,
|
2493 |
+
// default amount to move back when back key is pressed
|
|
|
2494 |
defaultSeekBackwardInterval: function(media) {
|
2495 |
return (media.duration * 0.05);
|
2496 |
+
},
|
2497 |
+
// default amount to move forward when forward key is pressed
|
2498 |
defaultSeekForwardInterval: function(media) {
|
2499 |
return (media.duration * 0.05);
|
2500 |
+
},
|
2501 |
+
// set dimensions via JS instead of CSS
|
2502 |
+
setDimensions: true,
|
2503 |
// width of audio player
|
2504 |
audioWidth: -1,
|
2505 |
// height of audio player
|
2506 |
+
audioHeight: -1,
|
2507 |
// initial volume when the player starts (overrided by user cookie)
|
2508 |
startVolume: 0.8,
|
2509 |
// useful for <audio> player loops
|
2510 |
loop: false,
|
2511 |
// rewind to beginning when media ends
|
2512 |
+
autoRewind: true,
|
2513 |
// resize to media dimensions
|
2514 |
enableAutosize: true,
|
2515 |
+
/*
|
2516 |
+
* Time format to use. Default: 'mm:ss'
|
2517 |
+
* Supported units:
|
2518 |
+
* h: hour
|
2519 |
+
* m: minute
|
2520 |
+
* s: second
|
2521 |
+
* f: frame count
|
2522 |
+
* When using 'hh', 'mm', 'ss' or 'ff' we always display 2 digits.
|
2523 |
+
* If you use 'h', 'm', 's' or 'f' we display 1 digit if possible.
|
2524 |
+
*
|
2525 |
+
* Example to display 75 seconds:
|
2526 |
+
* Format 'mm:ss': 01:15
|
2527 |
+
* Format 'm:ss': 1:15
|
2528 |
+
* Format 'm:s': 1:15
|
2529 |
+
*/
|
2530 |
+
timeFormat: '',
|
2531 |
// forces the hour marker (##:00:00)
|
2532 |
alwaysShowHours: false,
|
|
|
2533 |
// show framecount in timecode (##:00:00:00)
|
2534 |
showTimecodeFrameCount: false,
|
2535 |
// used when showTimecodeFrameCount is set to true
|
2536 |
framesPerSecond: 25,
|
|
|
2537 |
// automatically calculate the width of the progress bar based on the sizes of other elements
|
2538 |
autosizeProgress : true,
|
2539 |
// Hide controls when playing and mouse is not over the video
|
2540 |
alwaysShowControls: false,
|
2541 |
+
// Display the video control
|
2542 |
+
hideVideoControlsOnLoad: false,
|
2543 |
+
// Enable click video element to toggle play/pause
|
2544 |
+
clickToPlayPause: true,
|
2545 |
+
// Time in ms to hide controls
|
2546 |
+
controlsTimeoutDefault: 1500,
|
2547 |
+
// Time in ms to trigger the timer when mouse moves
|
2548 |
+
controlsTimeoutMouseEnter: 2500,
|
2549 |
+
// Time in ms to trigger the timer when mouse leaves
|
2550 |
+
controlsTimeoutMouseLeave: 1000,
|
2551 |
// force iPad's native controls
|
2552 |
iPadUseNativeControls: false,
|
2553 |
// force iPhone's native controls
|
2554 |
+
iPhoneUseNativeControls: false,
|
2555 |
// force Android's native controls
|
2556 |
+
AndroidUseNativeControls: false,
|
2557 |
// features to show
|
2558 |
features: ['playpause','current','progress','duration','tracks','volume','fullscreen'],
|
2559 |
// only for dynamic
|
2560 |
isVideo: true,
|
2561 |
+
// stretching modes (auto, fill, responsive, none)
|
2562 |
+
stretching: 'auto',
|
2563 |
// turns keyboard support on and off for this instance
|
2564 |
enableKeyboard: true,
|
2565 |
+
// when this player starts, it will pause other players
|
|
|
2566 |
pauseOtherPlayers: true,
|
|
|
2567 |
// array of keyboard actions such as play pause
|
2568 |
keyActions: [
|
2569 |
{
|
2570 |
keys: [
|
2571 |
32, // SPACE
|
2572 |
179 // GOOGLE play/pause button
|
2573 |
+
],
|
2574 |
+
action: function(player, media, key, event) {
|
2575 |
+
|
2576 |
+
if (!mejs.MediaFeatures.isFirefox) {
|
2577 |
if (media.paused || media.ended) {
|
2578 |
+
media.play();
|
2579 |
} else {
|
2580 |
+
media.pause();
|
2581 |
+
}
|
2582 |
+
}
|
2583 |
}
|
2584 |
},
|
2585 |
{
|
2586 |
keys: [38], // UP
|
2587 |
+
action: function(player, media, key, event) {
|
2588 |
+
player.container.find('.mejs-volume-slider').css('display','block');
|
2589 |
+
if (player.isVideo) {
|
2590 |
+
player.showControls();
|
2591 |
+
player.startControlsTimer();
|
2592 |
+
}
|
2593 |
+
|
2594 |
var newVolume = Math.min(media.volume + 0.1, 1);
|
2595 |
media.setVolume(newVolume);
|
2596 |
}
|
2597 |
},
|
2598 |
{
|
2599 |
keys: [40], // DOWN
|
2600 |
+
action: function(player, media, key, event) {
|
2601 |
+
player.container.find('.mejs-volume-slider').css('display','block');
|
2602 |
+
if (player.isVideo) {
|
2603 |
+
player.showControls();
|
2604 |
+
player.startControlsTimer();
|
2605 |
+
}
|
2606 |
+
|
2607 |
var newVolume = Math.max(media.volume - 0.1, 0);
|
2608 |
media.setVolume(newVolume);
|
2609 |
}
|
2613 |
37, // LEFT
|
2614 |
227 // Google TV rewind
|
2615 |
],
|
2616 |
+
action: function(player, media, key, event) {
|
2617 |
if (!isNaN(media.duration) && media.duration > 0) {
|
2618 |
if (player.isVideo) {
|
2619 |
player.showControls();
|
2620 |
player.startControlsTimer();
|
2621 |
}
|
2622 |
+
|
2623 |
// 5%
|
2624 |
var newTime = Math.max(media.currentTime - player.options.defaultSeekBackwardInterval(media), 0);
|
2625 |
media.setCurrentTime(newTime);
|
2630 |
keys: [
|
2631 |
39, // RIGHT
|
2632 |
228 // Google TV forward
|
2633 |
+
],
|
2634 |
+
action: function(player, media, key, event) {
|
2635 |
if (!isNaN(media.duration) && media.duration > 0) {
|
2636 |
if (player.isVideo) {
|
2637 |
player.showControls();
|
2638 |
player.startControlsTimer();
|
2639 |
}
|
2640 |
+
|
2641 |
// 5%
|
2642 |
+
var newTime = Math.min(media.currentTime + player.options.defaultSeekForwardInterval(media), media.duration);
|
2643 |
media.setCurrentTime(newTime);
|
2644 |
}
|
2645 |
}
|
2646 |
},
|
2647 |
{
|
2648 |
+
keys: [70], // F
|
2649 |
+
action: function(player, media, key, event) {
|
2650 |
if (typeof player.enterFullScreen != 'undefined') {
|
2651 |
if (player.isFullScreen) {
|
2652 |
player.exitFullScreen();
|
2655 |
}
|
2656 |
}
|
2657 |
}
|
2658 |
+
},
|
2659 |
+
{
|
2660 |
+
keys: [77], // M
|
2661 |
+
action: function(player, media, key, event) {
|
2662 |
+
player.container.find('.mejs-volume-slider').css('display','block');
|
2663 |
+
if (player.isVideo) {
|
2664 |
+
player.showControls();
|
2665 |
+
player.startControlsTimer();
|
2666 |
+
}
|
2667 |
+
if (player.media.muted) {
|
2668 |
+
player.setMuted(false);
|
2669 |
+
} else {
|
2670 |
+
player.setMuted(true);
|
2671 |
+
}
|
2672 |
+
}
|
2673 |
+
}
|
2674 |
+
]
|
2675 |
};
|
2676 |
|
2677 |
mejs.mepIndex = 0;
|
2678 |
+
|
2679 |
+
mejs.players = {};
|
2680 |
|
2681 |
// wraps a MediaElement object in player controls
|
2682 |
mejs.MediaElementPlayer = function(node, o) {
|
2683 |
// enforce object, even without "new" (via John Resig)
|
2684 |
if ( !(this instanceof mejs.MediaElementPlayer) ) {
|
2685 |
return new mejs.MediaElementPlayer(node, o);
|
2686 |
+
}
|
2687 |
|
2688 |
var t = this;
|
2689 |
+
|
2690 |
// these will be reset after the MediaElement.success fires
|
2691 |
t.$media = t.$node = $(node);
|
2692 |
+
t.node = t.media = t.$media[0];
|
2693 |
+
|
2694 |
+
if(!t.node) {
|
2695 |
+
return;
|
2696 |
+
}
|
2697 |
+
|
2698 |
// check for existing player
|
2699 |
if (typeof t.node.player != 'undefined') {
|
2700 |
return t.node.player;
|
|
|
|
|
|
|
2701 |
}
|
2702 |
+
|
2703 |
+
|
2704 |
// try to get options from data-mejsoptions
|
2705 |
if (typeof o == 'undefined') {
|
2706 |
+
o = t.$node.data('mejsoptions');
|
2707 |
}
|
2708 |
+
|
2709 |
// extend default options
|
2710 |
t.options = $.extend({},mejs.MepDefaults,o);
|
2711 |
+
|
2712 |
+
if (!t.options.timeFormat) {
|
2713 |
+
// Generate the time format according to options
|
2714 |
+
t.options.timeFormat = 'mm:ss';
|
2715 |
+
if (t.options.alwaysShowHours) {
|
2716 |
+
t.options.timeFormat = 'hh:mm:ss';
|
2717 |
+
}
|
2718 |
+
if (t.options.showTimecodeFrameCount) {
|
2719 |
+
t.options.timeFormat += ':ff';
|
2720 |
+
}
|
2721 |
+
}
|
2722 |
+
|
2723 |
+
mejs.Utility.calculateTimeFormat(0, t.options, t.options.framesPerSecond || 25);
|
2724 |
+
|
2725 |
+
// unique ID
|
2726 |
+
t.id = 'mep_' + mejs.mepIndex++;
|
2727 |
+
|
2728 |
// add to player array (for focus events)
|
2729 |
+
mejs.players[t.id] = t;
|
2730 |
+
|
2731 |
// start up
|
2732 |
t.init();
|
2733 |
|
2736 |
|
2737 |
// actual player
|
2738 |
mejs.MediaElementPlayer.prototype = {
|
2739 |
+
|
2740 |
hasFocus: false,
|
2741 |
+
|
2742 |
controlsAreVisible: true,
|
2743 |
+
|
2744 |
init: function() {
|
2745 |
|
2746 |
var
|
2752 |
error: function(e) { t.handleError(e);}
|
2753 |
}),
|
2754 |
tagName = t.media.tagName.toLowerCase();
|
2755 |
+
|
2756 |
t.isDynamic = (tagName !== 'audio' && tagName !== 'video');
|
2757 |
+
|
2758 |
+
if (t.isDynamic) {
|
2759 |
+
// get video from src or href?
|
2760 |
+
t.isVideo = t.options.isVideo;
|
2761 |
} else {
|
2762 |
t.isVideo = (tagName !== 'audio' && t.options.isVideo);
|
2763 |
}
|
2764 |
+
|
2765 |
+
// use native controls in iPad, iPhone, and Android
|
2766 |
if ((mf.isiPad && t.options.iPadUseNativeControls) || (mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
2767 |
+
|
2768 |
// add controls and stop
|
2769 |
t.$media.attr('controls', 'controls');
|
2770 |
|
2771 |
// attempt to fix iOS 3 bug
|
2772 |
//t.$media.removeAttr('poster');
|
2773 |
+
// no Issue found on iOS3 -ttroxell
|
2774 |
|
2775 |
// override Apple's autoplay override for iPads
|
2776 |
if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
|
2777 |
+
t.play();
|
|
|
2778 |
}
|
2779 |
+
|
2780 |
+
} else if (mf.isAndroid && t.options.AndroidUseNativeControls) {
|
2781 |
+
|
2782 |
// leave default player
|
2783 |
|
2784 |
+
} else if (t.isVideo || (!t.isVideo && t.options.features.length)) {
|
2785 |
|
2786 |
// DESKTOP: use MediaElementPlayer controls
|
|
|
|
|
|
|
|
|
|
|
|
|
2787 |
|
2788 |
+
// remove native controls
|
2789 |
+
t.$media.removeAttr('controls');
|
2790 |
+
var videoPlayerTitle = t.isVideo ?
|
2791 |
+
mejs.i18n.t('mejs.video-player') : mejs.i18n.t('mejs.audio-player');
|
2792 |
+
// insert description for screen readers
|
2793 |
+
$('<span class="mejs-offscreen">' + videoPlayerTitle + '</span>').insertBefore(t.$media);
|
2794 |
// build container
|
2795 |
t.container =
|
2796 |
+
$('<div id="' + t.id + '" class="mejs-container ' + (mejs.MediaFeatures.svgAsImg ? 'svg' : 'no-svg') +
|
2797 |
+
'" tabindex="0" role="application" aria-label="' + videoPlayerTitle + '">'+
|
2798 |
'<div class="mejs-inner">'+
|
2799 |
'<div class="mejs-mediaelement"></div>'+
|
2800 |
'<div class="mejs-layers"></div>'+
|
2803 |
'</div>' +
|
2804 |
'</div>')
|
2805 |
.addClass(t.$media[0].className)
|
2806 |
+
.insertBefore(t.$media)
|
2807 |
+
.focus(function ( e ) {
|
2808 |
+
if( !t.controlsAreVisible && !t.hasFocus && t.controlsEnabled) {
|
2809 |
+
t.showControls(true);
|
2810 |
+
// In versions older than IE11, the focus causes the playbar to be displayed
|
2811 |
+
// if user clicks on the Play/Pause button in the control bar once it attempts
|
2812 |
+
// to hide it
|
2813 |
+
if (!t.hasMsNativeFullScreen) {
|
2814 |
+
// If e.relatedTarget appears before container, send focus to play button,
|
2815 |
+
// else send focus to last control button.
|
2816 |
+
var btnSelector = '.mejs-playpause-button > button';
|
2817 |
+
|
2818 |
+
if (mejs.Utility.isNodeAfter(e.relatedTarget, t.container[0])) {
|
2819 |
+
btnSelector = '.mejs-controls .mejs-button:last-child > button';
|
2820 |
+
}
|
2821 |
+
|
2822 |
+
var button = t.container.find(btnSelector);
|
2823 |
+
button.focus();
|
2824 |
+
}
|
2825 |
+
}
|
2826 |
+
});
|
2827 |
+
|
2828 |
+
// When no elements in controls, hide bar completely
|
2829 |
+
if (!t.options.features.length) {
|
2830 |
+
t.container.css('background', 'transparent').find('.mejs-controls').hide();
|
2831 |
+
}
|
2832 |
+
|
2833 |
+
if (t.isVideo && t.options.stretching === 'fill' && !t.container.parent('mejs-fill-container').length) {
|
2834 |
+
// outer container
|
2835 |
+
t.outerContainer = t.$media.parent();
|
2836 |
+
t.container.wrap('<div class="mejs-fill-container"/>');
|
2837 |
+
}
|
2838 |
+
|
2839 |
// add classes for user and content
|
2840 |
t.container.addClass(
|
2841 |
(mf.isAndroid ? 'mejs-android ' : '') +
|
2843 |
(mf.isiPad ? 'mejs-ipad ' : '') +
|
2844 |
(mf.isiPhone ? 'mejs-iphone ' : '') +
|
2845 |
(t.isVideo ? 'mejs-video ' : 'mejs-audio ')
|
2846 |
+
);
|
2847 |
+
|
2848 |
|
2849 |
// move the <video/video> tag into the right spot
|
2850 |
+
t.container.find('.mejs-mediaelement').append(t.$media);
|
2851 |
+
|
2852 |
+
// needs to be assigned here, after iOS remap
|
2853 |
+
t.node.player = t;
|
2854 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2855 |
// find parts
|
2856 |
t.controls = t.container.find('.mejs-controls');
|
2857 |
t.layers = t.container.find('.mejs-layers');
|
2858 |
|
2859 |
// determine the size
|
2860 |
+
|
2861 |
/* size priority:
|
2862 |
+
(1) videoWidth (forced),
|
2863 |
(2) style="width;height;"
|
2864 |
(3) width attribute,
|
2865 |
(4) defaultVideoWidth (for unspecified cases)
|
2866 |
*/
|
2867 |
+
|
2868 |
var tagType = (t.isVideo ? 'video' : 'audio'),
|
2869 |
capsTagName = tagType.substring(0,1).toUpperCase() + tagType.substring(1);
|
2870 |
+
|
2871 |
+
|
2872 |
+
|
2873 |
if (t.options[tagType + 'Width'] > 0 || t.options[tagType + 'Width'].toString().indexOf('%') > -1) {
|
2874 |
t.width = t.options[tagType + 'Width'];
|
2875 |
} else if (t.media.style.width !== '' && t.media.style.width !== null) {
|
2876 |
+
t.width = t.media.style.width;
|
2877 |
} else if (t.media.getAttribute('width') !== null) {
|
2878 |
t.width = t.$media.attr('width');
|
2879 |
} else {
|
2880 |
t.width = t.options['default' + capsTagName + 'Width'];
|
2881 |
}
|
2882 |
+
|
2883 |
if (t.options[tagType + 'Height'] > 0 || t.options[tagType + 'Height'].toString().indexOf('%') > -1) {
|
2884 |
t.height = t.options[tagType + 'Height'];
|
2885 |
} else if (t.media.style.height !== '' && t.media.style.height !== null) {
|
2886 |
t.height = t.media.style.height;
|
2887 |
} else if (t.$media[0].getAttribute('height') !== null) {
|
2888 |
+
t.height = t.$media.attr('height');
|
2889 |
} else {
|
2890 |
t.height = t.options['default' + capsTagName + 'Height'];
|
2891 |
}
|
2892 |
|
2893 |
// set the size, while we wait for the plugins to load below
|
2894 |
t.setPlayerSize(t.width, t.height);
|
2895 |
+
|
2896 |
// create MediaElementShim
|
2897 |
+
meOptions.pluginWidth = t.width;
|
2898 |
+
meOptions.pluginHeight = t.height;
|
2899 |
+
}
|
2900 |
+
// Hide media completely for audio that doesn't have any features
|
2901 |
+
else if (!t.isVideo && !t.options.features.length) {
|
2902 |
+
t.$media.hide();
|
2903 |
}
|
|
|
|
|
2904 |
|
2905 |
// create MediaElement shim
|
2906 |
mejs.MediaElement(t.$media[0], meOptions);
|
2907 |
|
2908 |
+
if (typeof(t.container) !== 'undefined' && t.options.features.length && t.controlsAreVisible) {
|
2909 |
+
// controls are shown when loaded
|
2910 |
+
t.container.trigger('controlsshown');
|
2911 |
+
}
|
2912 |
},
|
2913 |
+
|
2914 |
showControls: function(doAnimation) {
|
2915 |
var t = this;
|
2916 |
+
|
2917 |
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
2918 |
+
|
2919 |
if (t.controlsAreVisible)
|
2920 |
return;
|
2921 |
+
|
2922 |
if (doAnimation) {
|
2923 |
t.controls
|
2924 |
+
.removeClass('mejs-offscreen')
|
2925 |
.stop(true, true).fadeIn(200, function() {
|
2926 |
+
t.controlsAreVisible = true;
|
2927 |
+
t.container.trigger('controlsshown');
|
2928 |
});
|
2929 |
+
|
2930 |
// any additional controls people might add and want to hide
|
2931 |
t.container.find('.mejs-control')
|
2932 |
+
.removeClass('mejs-offscreen')
|
2933 |
+
.stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
|
2934 |
+
|
2935 |
} else {
|
2936 |
t.controls
|
2937 |
+
.removeClass('mejs-offscreen')
|
2938 |
.css('display','block');
|
2939 |
+
|
2940 |
// any additional controls people might add and want to hide
|
2941 |
t.container.find('.mejs-control')
|
2942 |
+
.removeClass('mejs-offscreen')
|
2943 |
.css('display','block');
|
2944 |
+
|
2945 |
t.controlsAreVisible = true;
|
2946 |
t.container.trigger('controlsshown');
|
2947 |
}
|
2948 |
+
|
2949 |
t.setControlsSize();
|
2950 |
+
|
2951 |
},
|
2952 |
|
2953 |
hideControls: function(doAnimation) {
|
2954 |
var t = this;
|
2955 |
+
|
2956 |
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
2957 |
+
|
2958 |
+
if (!t.controlsAreVisible || t.options.alwaysShowControls || t.keyboardAction || t.media.paused || t.media.ended)
|
2959 |
return;
|
2960 |
+
|
2961 |
if (doAnimation) {
|
2962 |
// fade out main controls
|
2963 |
t.controls.stop(true, true).fadeOut(200, function() {
|
2964 |
$(this)
|
2965 |
+
.addClass('mejs-offscreen')
|
2966 |
.css('display','block');
|
2967 |
+
|
2968 |
t.controlsAreVisible = false;
|
2969 |
t.container.trigger('controlshidden');
|
2970 |
+
});
|
2971 |
+
|
2972 |
// any additional controls people might add and want to hide
|
2973 |
t.container.find('.mejs-control').stop(true, true).fadeOut(200, function() {
|
2974 |
$(this)
|
2975 |
+
.addClass('mejs-offscreen')
|
2976 |
.css('display','block');
|
2977 |
+
});
|
2978 |
} else {
|
2979 |
+
|
2980 |
// hide main controls
|
2981 |
t.controls
|
2982 |
+
.addClass('mejs-offscreen')
|
2983 |
+
.css('display','block');
|
2984 |
+
|
2985 |
// hide others
|
2986 |
t.container.find('.mejs-control')
|
2987 |
+
.addClass('mejs-offscreen')
|
2988 |
.css('display','block');
|
2989 |
+
|
2990 |
t.controlsAreVisible = false;
|
2991 |
t.container.trigger('controlshidden');
|
2992 |
}
|
2993 |
+
},
|
2994 |
|
2995 |
controlsTimer: null,
|
2996 |
|
2997 |
startControlsTimer: function(timeout) {
|
2998 |
|
2999 |
var t = this;
|
3000 |
+
|
3001 |
+
timeout = typeof timeout != 'undefined' ? timeout : t.options.controlsTimeoutDefault;
|
3002 |
|
3003 |
t.killControlsTimer('start');
|
3004 |
|
3005 |
t.controlsTimer = setTimeout(function() {
|
3006 |
+
//
|
3007 |
t.hideControls();
|
3008 |
t.killControlsTimer('hide');
|
3009 |
}, timeout);
|
3018 |
delete t.controlsTimer;
|
3019 |
t.controlsTimer = null;
|
3020 |
}
|
3021 |
+
},
|
3022 |
+
|
3023 |
controlsEnabled: true,
|
3024 |
+
|
3025 |
disableControls: function() {
|
3026 |
var t= this;
|
3027 |
+
|
3028 |
t.killControlsTimer();
|
3029 |
t.hideControls(false);
|
3030 |
this.controlsEnabled = false;
|
3031 |
},
|
3032 |
+
|
3033 |
enableControls: function() {
|
3034 |
var t= this;
|
3035 |
+
|
3036 |
t.showControls(false);
|
3037 |
+
|
3038 |
t.controlsEnabled = true;
|
3039 |
+
},
|
|
|
3040 |
|
3041 |
// Sets up all controls and events
|
3042 |
+
meReady: function(media, domNode) {
|
3043 |
+
|
3044 |
+
var
|
3045 |
+
t = this,
|
3046 |
mf = mejs.MediaFeatures,
|
3047 |
autoplayAttr = domNode.getAttribute('autoplay'),
|
3048 |
autoplay = !(typeof autoplayAttr == 'undefined' || autoplayAttr === null || autoplayAttr === 'false'),
|
3050 |
feature;
|
3051 |
|
3052 |
// make sure it can't create itself again if a plugin reloads
|
3053 |
+
if (t.created) {
|
3054 |
return;
|
3055 |
+
} else {
|
3056 |
+
t.created = true;
|
3057 |
+
}
|
3058 |
|
3059 |
t.media = media;
|
3060 |
t.domNode = domNode;
|
3061 |
+
|
3062 |
+
if (!(mf.isAndroid && t.options.AndroidUseNativeControls) && !(mf.isiPad && t.options.iPadUseNativeControls) && !(mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
3063 |
+
|
3064 |
+
// In the event that no features are specified for audio,
|
3065 |
+
// create only MediaElement instance rather than
|
3066 |
+
// doing all the work to create a full player
|
3067 |
+
if (!t.isVideo && !t.options.features.length) {
|
3068 |
+
|
3069 |
+
// force autoplay for HTML5
|
3070 |
+
if (autoplay && media.pluginType == 'native') {
|
3071 |
+
t.play();
|
3072 |
+
}
|
3073 |
+
|
3074 |
+
|
3075 |
+
if (t.options.success) {
|
3076 |
+
|
3077 |
+
if (typeof t.options.success == 'string') {
|
3078 |
+
window[t.options.success](t.media, t.domNode, t);
|
3079 |
+
} else {
|
3080 |
+
t.options.success(t.media, t.domNode, t);
|
3081 |
+
}
|
3082 |
+
}
|
3083 |
+
|
3084 |
+
return;
|
3085 |
+
}
|
3086 |
+
|
3087 |
// two built in features
|
3088 |
t.buildposter(t, t.controls, t.layers, t.media);
|
3089 |
t.buildkeyboard(t, t.controls, t.layers, t.media);
|
3101 |
} catch (e) {
|
3102 |
// TODO: report control error
|
3103 |
//throw e;
|
3104 |
+
|
3105 |
+
|
3106 |
}
|
3107 |
}
|
3108 |
}
|
3109 |
|
3110 |
t.container.trigger('controlsready');
|
3111 |
+
|
3112 |
// reset all layers and controls
|
3113 |
t.setPlayerSize(t.width, t.height);
|
3114 |
t.setControlsSize();
|
3115 |
+
|
3116 |
|
3117 |
// controls fade
|
3118 |
if (t.isVideo) {
|
3119 |
+
|
3120 |
+
if (mejs.MediaFeatures.hasTouch && !t.options.alwaysShowControls) {
|
3121 |
+
|
3122 |
// for touch devices (iOS, Android)
|
3123 |
// show/hide without animation on touch
|
3124 |
+
|
3125 |
t.$media.bind('touchstart', function() {
|
3126 |
+
|
|
|
3127 |
// toggle controls
|
3128 |
if (t.controlsAreVisible) {
|
3129 |
t.hideControls(false);
|
3132 |
t.showControls(false);
|
3133 |
}
|
3134 |
}
|
3135 |
+
});
|
3136 |
+
|
3137 |
} else {
|
3138 |
+
|
3139 |
+
// create callback here since it needs access to current
|
3140 |
+
// MediaElement object
|
3141 |
+
t.clickToPlayPauseCallback = function() {
|
3142 |
+
//
|
3143 |
+
|
3144 |
+
if (t.options.clickToPlayPause) {
|
3145 |
+
if (t.media.paused) {
|
3146 |
+
t.play();
|
3147 |
+
} else {
|
3148 |
+
t.pause();
|
3149 |
+
}
|
3150 |
+
|
3151 |
+
var button = t.$media.closest('.mejs-container').find('.mejs-overlay-button'),
|
3152 |
+
pressed = button.attr('aria-pressed');
|
3153 |
+
button.attr('aria-pressed', !pressed);
|
3154 |
+
}
|
3155 |
+
};
|
3156 |
+
|
3157 |
+
// click to play/pause
|
3158 |
+
t.media.addEventListener('click', t.clickToPlayPauseCallback, false);
|
3159 |
+
|
3160 |
// show/hide controls
|
3161 |
t.container
|
3162 |
+
.bind('mouseenter', function () {
|
3163 |
if (t.controlsEnabled) {
|
3164 |
+
if (!t.options.alwaysShowControls ) {
|
3165 |
t.killControlsTimer('enter');
|
3166 |
t.showControls();
|
3167 |
+
t.startControlsTimer(t.options.controlsTimeoutMouseEnter);
|
3168 |
}
|
3169 |
}
|
3170 |
})
|
3173 |
if (!t.controlsAreVisible) {
|
3174 |
t.showControls();
|
3175 |
}
|
|
|
3176 |
if (!t.options.alwaysShowControls) {
|
3177 |
+
t.startControlsTimer(t.options.controlsTimeoutMouseEnter);
|
3178 |
}
|
3179 |
}
|
3180 |
})
|
3181 |
.bind('mouseleave', function () {
|
3182 |
if (t.controlsEnabled) {
|
3183 |
if (!t.media.paused && !t.options.alwaysShowControls) {
|
3184 |
+
t.startControlsTimer(t.options.controlsTimeoutMouseLeave);
|
3185 |
}
|
3186 |
}
|
3187 |
});
|
3188 |
}
|
3189 |
+
|
3190 |
+
if(t.options.hideVideoControlsOnLoad) {
|
3191 |
+
t.hideControls(false);
|
3192 |
+
}
|
3193 |
+
|
3194 |
// check for autoplay
|
3195 |
if (autoplay && !t.options.alwaysShowControls) {
|
3196 |
t.hideControls();
|
3209 |
}, false);
|
3210 |
}
|
3211 |
}
|
3212 |
+
|
3213 |
// EVENTS
|
3214 |
|
3215 |
+
// FOCUS: when a video starts playing, it takes focus from other players (possibly pausing them)
|
3216 |
+
t.media.addEventListener('play', function() {
|
3217 |
+
var playerIndex;
|
3218 |
+
|
3219 |
+
// go through all other players
|
3220 |
+
for (playerIndex in mejs.players) {
|
3221 |
+
var p = mejs.players[playerIndex];
|
3222 |
+
if (p.id != t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended) {
|
3223 |
+
p.pause();
|
|
|
3224 |
}
|
3225 |
+
p.hasFocus = false;
|
3226 |
+
}
|
3227 |
+
|
3228 |
+
t.hasFocus = true;
|
3229 |
},false);
|
3230 |
+
|
3231 |
|
3232 |
// ended for all
|
3233 |
t.media.addEventListener('ended', function (e) {
|
3234 |
if(t.options.autoRewind) {
|
3235 |
try{
|
3236 |
t.media.setCurrentTime(0);
|
3237 |
+
// Fixing an Android stock browser bug, where "seeked" isn't fired correctly after ending the video and jumping to the beginning
|
3238 |
+
window.setTimeout(function(){
|
3239 |
+
$(t.container).find('.mejs-overlay-loading').parent().hide();
|
3240 |
+
}, 20);
|
3241 |
} catch (exp) {
|
3242 |
+
|
3243 |
}
|
3244 |
}
|
3245 |
+
if (t.media.pluginType === 'youtube') {
|
3246 |
+
t.media.stop();
|
3247 |
+
} else {
|
3248 |
+
t.media.pause();
|
3249 |
+
}
|
3250 |
+
|
3251 |
+
if (t.setProgressRail) {
|
3252 |
t.setProgressRail();
|
3253 |
+
}
|
3254 |
+
if (t.setCurrentRail) {
|
3255 |
+
t.setCurrentRail();
|
3256 |
+
}
|
3257 |
|
3258 |
if (t.options.loop) {
|
3259 |
+
t.play();
|
3260 |
} else if (!t.options.alwaysShowControls && t.controlsEnabled) {
|
3261 |
t.showControls();
|
3262 |
}
|
3263 |
}, false);
|
3264 |
+
|
3265 |
// resize on the first play
|
3266 |
+
t.media.addEventListener('loadedmetadata', function() {
|
3267 |
+
|
3268 |
+
mejs.Utility.calculateTimeFormat(t.duration, t.options, t.options.framesPerSecond || 25);
|
3269 |
+
|
3270 |
if (t.updateDuration) {
|
3271 |
t.updateDuration();
|
3272 |
}
|
3273 |
if (t.updateCurrent) {
|
3274 |
t.updateCurrent();
|
3275 |
}
|
3276 |
+
|
3277 |
if (!t.isFullScreen) {
|
3278 |
t.setPlayerSize(t.width, t.height);
|
3279 |
t.setControlsSize();
|
3280 |
}
|
3281 |
}, false);
|
3282 |
|
3283 |
+
// Only change the time format when necessary
|
3284 |
+
var duration = null;
|
3285 |
+
t.media.addEventListener('timeupdate',function() {
|
3286 |
+
if (duration !== this.duration) {
|
3287 |
+
duration = this.duration;
|
3288 |
+
mejs.Utility.calculateTimeFormat(duration, t.options, t.options.framesPerSecond || 25);
|
3289 |
+
|
3290 |
+
// make sure to fill in and resize the controls (e.g., 00:00 => 01:13:15
|
3291 |
+
if (t.updateDuration) {
|
3292 |
+
t.updateDuration();
|
3293 |
+
}
|
3294 |
+
if (t.updateCurrent) {
|
3295 |
+
t.updateCurrent();
|
3296 |
+
}
|
3297 |
+
t.setControlsSize();
|
3298 |
+
|
3299 |
+
}
|
3300 |
+
}, false);
|
3301 |
+
|
3302 |
+
t.container.focusout(function (e) {
|
3303 |
+
if( e.relatedTarget ) { //FF is working on supporting focusout https://bugzilla.mozilla.org/show_bug.cgi?id=687787
|
3304 |
+
var $target = $(e.relatedTarget);
|
3305 |
+
if (t.keyboardAction && $target.parents('.mejs-container').length === 0) {
|
3306 |
+
t.keyboardAction = false;
|
3307 |
+
if (t.isVideo && !t.options.alwaysShowControls) {
|
3308 |
+
t.hideControls(true);
|
3309 |
+
}
|
3310 |
+
|
3311 |
+
}
|
3312 |
+
}
|
3313 |
+
});
|
3314 |
|
3315 |
// webkit has trouble doing this without a delay
|
3316 |
setTimeout(function () {
|
3317 |
t.setPlayerSize(t.width, t.height);
|
3318 |
t.setControlsSize();
|
3319 |
}, 50);
|
3320 |
+
|
3321 |
// adjust controls whenever window sizes (used to be in fullscreen only)
|
3322 |
+
t.globalBind('resize', function() {
|
3323 |
+
|
3324 |
+
// don't resize for fullscreen mode
|
3325 |
if ( !(t.isFullScreen || (mejs.MediaFeatures.hasTrueNativeFullScreen && document.webkitIsFullScreen)) ) {
|
3326 |
t.setPlayerSize(t.width, t.height);
|
3327 |
}
|
3328 |
+
|
3329 |
// always adjust controls
|
3330 |
t.setControlsSize();
|
3331 |
+
});
|
3332 |
|
3333 |
+
// This is a work-around for a bug in the YouTube iFrame player, which means
|
3334 |
+
// we can't use the play() API for the initial playback on iOS or Android;
|
3335 |
+
// user has to start playback directly by tapping on the iFrame.
|
3336 |
+
if (t.media.pluginType == 'youtube' && ( mf.isiOS || mf.isAndroid ) ) {
|
3337 |
+
t.container.find('.mejs-overlay-play').hide();
|
3338 |
+
t.container.find('.mejs-poster').hide();
|
3339 |
}
|
3340 |
}
|
3341 |
+
|
3342 |
// force autoplay for HTML5
|
3343 |
if (autoplay && media.pluginType == 'native') {
|
3344 |
+
t.play();
|
|
|
3345 |
}
|
3346 |
|
3347 |
|
3348 |
if (t.options.success) {
|
3349 |
+
|
3350 |
if (typeof t.options.success == 'string') {
|
3351 |
+
window[t.options.success](t.media, t.domNode, t);
|
3352 |
} else {
|
3353 |
+
t.options.success(t.media, t.domNode, t);
|
3354 |
}
|
3355 |
}
|
3356 |
},
|
3357 |
|
3358 |
handleError: function(e) {
|
3359 |
var t = this;
|
3360 |
+
|
3361 |
+
if (t.controls) {
|
3362 |
+
t.controls.hide();
|
3363 |
+
}
|
3364 |
+
|
3365 |
// Tell user that the file cannot be played
|
3366 |
if (t.options.error) {
|
3367 |
t.options.error(e);
|
3371 |
setPlayerSize: function(width,height) {
|
3372 |
var t = this;
|
3373 |
|
3374 |
+
if( !t.options.setDimensions ) {
|
3375 |
+
return false;
|
3376 |
+
}
|
3377 |
+
|
3378 |
+
if (typeof width != 'undefined') {
|
3379 |
t.width = width;
|
3380 |
+
}
|
|
|
|
|
3381 |
|
3382 |
+
if (typeof height != 'undefined') {
|
3383 |
+
t.height = height;
|
3384 |
+
}
|
3385 |
+
|
3386 |
+
// check stretching modes
|
3387 |
+
switch (t.options.stretching) {
|
3388 |
+
case 'fill':
|
3389 |
+
// The 'fill' effect only makes sense on video; for audio we will set the dimensions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3390 |
if (t.isVideo) {
|
3391 |
+
this.setFillMode();
|
3392 |
+
} else {
|
3393 |
+
this.setDimensions(t.width, t.height);
|
3394 |
}
|
3395 |
+
break;
|
3396 |
+
case 'responsive':
|
3397 |
+
this.setResponsiveMode();
|
3398 |
+
break;
|
3399 |
+
case 'none':
|
3400 |
+
this.setDimensions(t.width, t.height);
|
3401 |
+
break;
|
3402 |
+
// This is the 'auto' mode
|
3403 |
+
default:
|
3404 |
+
if (this.hasFluidMode() === true) {
|
3405 |
+
this.setResponsiveMode();
|
3406 |
+
} else {
|
3407 |
+
this.setDimensions(t.width, t.height);
|
3408 |
+
}
|
3409 |
+
break;
|
3410 |
+
}
|
3411 |
+
},
|
3412 |
+
|
3413 |
+
hasFluidMode: function() {
|
3414 |
+
var t = this;
|
3415 |
+
|
3416 |
+
// detect 100% mode - use currentStyle for IE since css() doesn't return percentages
|
3417 |
+
return (t.height.toString().indexOf('%') > 0 || (t.$node.css('max-width') !== 'none' && t.$node.css('max-width') !== 't.width') || (t.$node[0].currentStyle && t.$node[0].currentStyle.maxWidth === '100%'));
|
3418 |
+
},
|
3419 |
+
|
3420 |
+
setResponsiveMode: function() {
|
3421 |
+
var t = this;
|
3422 |
+
|
3423 |
+
// do we have the native dimensions yet?
|
3424 |
+
var nativeWidth = (function() {
|
3425 |
+
if (t.isVideo) {
|
3426 |
+
if (t.media.videoWidth && t.media.videoWidth > 0) {
|
3427 |
+
return t.media.videoWidth;
|
3428 |
+
} else if (t.media.getAttribute('width') !== null) {
|
3429 |
+
return t.media.getAttribute('width');
|
3430 |
+
} else {
|
3431 |
+
return t.options.defaultVideoWidth;
|
3432 |
+
}
|
3433 |
+
} else {
|
3434 |
+
return t.options.defaultAudioWidth;
|
3435 |
+
}
|
3436 |
+
})();
|
3437 |
+
|
3438 |
+
var nativeHeight = (function() {
|
3439 |
+
if (t.isVideo) {
|
3440 |
+
if (t.media.videoHeight && t.media.videoHeight > 0) {
|
3441 |
+
return t.media.videoHeight;
|
3442 |
+
} else if (t.media.getAttribute('height') !== null) {
|
3443 |
+
return t.media.getAttribute('height');
|
3444 |
+
} else {
|
3445 |
+
return t.options.defaultVideoHeight;
|
3446 |
+
}
|
3447 |
+
} else {
|
3448 |
+
return t.options.defaultAudioHeight;
|
3449 |
}
|
3450 |
+
})();
|
3451 |
+
|
3452 |
+
var parentWidth = t.container.parent().closest(':visible').width(),
|
3453 |
+
parentHeight = t.container.parent().closest(':visible').height(),
|
3454 |
+
newHeight = t.isVideo || !t.options.autosizeProgress ? parseInt(parentWidth * nativeHeight/nativeWidth, 10) : nativeHeight;
|
3455 |
|
3456 |
+
// When we use percent, the newHeight can't be calculated so we get the container height
|
3457 |
+
if (isNaN(newHeight) || ( parentHeight !== 0 && newHeight > parentHeight && parentHeight > nativeHeight)) {
|
3458 |
+
newHeight = parentHeight;
|
3459 |
+
}
|
3460 |
+
|
3461 |
+
if (t.container.parent().length > 0 && t.container.parent()[0].tagName.toLowerCase() === 'body') { // && t.container.siblings().count == 0) {
|
3462 |
+
parentWidth = $(window).width();
|
3463 |
+
newHeight = $(window).height();
|
3464 |
+
}
|
3465 |
+
|
3466 |
+
if ( newHeight && parentWidth ) {
|
3467 |
|
3468 |
+
// set outer container size
|
|
|
3469 |
t.container
|
3470 |
+
.width(parentWidth)
|
3471 |
+
.height(newHeight);
|
3472 |
+
|
3473 |
+
// set native <video> or <audio> and shims
|
3474 |
+
t.$media.add(t.container.find('.mejs-shim'))
|
3475 |
+
.width('100%')
|
3476 |
+
.height('100%');
|
3477 |
+
|
3478 |
+
// if shim is ready, send the size to the embeded plugin
|
3479 |
+
if (t.isVideo) {
|
3480 |
+
if (t.media.setVideoSize) {
|
3481 |
+
t.media.setVideoSize(parentWidth, newHeight);
|
3482 |
+
}
|
3483 |
+
}
|
3484 |
+
|
3485 |
+
// set the layers
|
3486 |
t.layers.children('.mejs-layer')
|
3487 |
+
.width('100%')
|
3488 |
+
.height('100%');
|
|
|
3489 |
}
|
3490 |
},
|
3491 |
+
|
3492 |
+
setFillMode: function() {
|
3493 |
var t = this,
|
3494 |
+
parent = t.outerContainer;
|
3495 |
+
|
3496 |
+
if (!parent.width()) {
|
3497 |
+
parent.height(t.$media.width());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3498 |
}
|
3499 |
+
|
3500 |
+
if (!parent.height()) {
|
3501 |
+
parent.height(t.$media.height());
|
3502 |
+
}
|
3503 |
+
|
3504 |
+
var parentWidth = parent.width(),
|
3505 |
+
parentHeight = parent.height();
|
3506 |
|
3507 |
+
t.setDimensions('100%', '100%');
|
3508 |
+
|
3509 |
+
// This prevents an issue when displaying poster
|
3510 |
+
t.container.find('.mejs-poster img').css('display', 'block');
|
3511 |
+
|
3512 |
+
targetElement = t.container.find('object, embed, iframe, video');
|
3513 |
+
|
3514 |
+
// calculate new width and height
|
3515 |
+
var initHeight = t.height,
|
3516 |
+
initWidth = t.width,
|
3517 |
+
// scale to the target width
|
3518 |
+
scaleX1 = parentWidth,
|
3519 |
+
scaleY1 = (initHeight * parentWidth) / initWidth,
|
3520 |
+
// scale to the target height
|
3521 |
+
scaleX2 = (initWidth * parentHeight) / initHeight,
|
3522 |
+
scaleY2 = parentHeight,
|
3523 |
+
// now figure out which one we should use
|
3524 |
+
bScaleOnWidth = !(scaleX2 > parentWidth),
|
3525 |
+
finalWidth = bScaleOnWidth ? Math.floor(scaleX1) : Math.floor(scaleX2),
|
3526 |
+
finalHeight = bScaleOnWidth ? Math.floor(scaleY1) : Math.floor(scaleY2);
|
3527 |
+
|
3528 |
+
if (bScaleOnWidth) {
|
3529 |
+
targetElement.height(finalHeight).width(parentWidth);
|
3530 |
+
if (t.media.setVideoSize) {
|
3531 |
+
t.media.setVideoSize(parentWidth, finalHeight);
|
3532 |
+
}
|
3533 |
+
} else {
|
3534 |
+
targetElement.height(parentHeight).width(finalWidth);
|
3535 |
+
if (t.media.setVideoSize) {
|
3536 |
+
t.media.setVideoSize(finalWidth, parentHeight);
|
3537 |
+
}
|
3538 |
+
}
|
3539 |
+
|
3540 |
+
targetElement.css({
|
3541 |
+
'margin-left': Math.floor((parentWidth - finalWidth) / 2),
|
3542 |
+
'margin-top': 0
|
3543 |
+
});
|
3544 |
+
},
|
3545 |
+
|
3546 |
+
setDimensions: function(width, height) {
|
3547 |
+
var t = this;
|
3548 |
+
|
3549 |
+
t.container
|
3550 |
+
.width(width)
|
3551 |
+
.height(height);
|
3552 |
+
|
3553 |
+
t.layers.children('.mejs-layer')
|
3554 |
+
.width(width)
|
3555 |
+
.height(height);
|
3556 |
+
},
|
3557 |
+
|
3558 |
+
setControlsSize: function() {
|
3559 |
+
var t = this,
|
3560 |
+
usedWidth = 0,
|
3561 |
+
railWidth = 0,
|
3562 |
+
rail = t.controls.find('.mejs-time-rail'),
|
3563 |
+
total = t.controls.find('.mejs-time-total'),
|
3564 |
+
others = rail.siblings(),
|
3565 |
+
lastControl = others.last(),
|
3566 |
+
lastControlPosition = null,
|
3567 |
+
avoidAutosizeProgress = t.options && !t.options.autosizeProgress;
|
3568 |
+
|
3569 |
+
// skip calculation if hidden
|
3570 |
+
if (!t.container.is(':visible') || !rail.length || !rail.is(':visible')) {
|
3571 |
+
return;
|
3572 |
+
}
|
3573 |
+
|
3574 |
+
// allow the size to come from custom CSS
|
3575 |
+
if (avoidAutosizeProgress) {
|
3576 |
+
// Also, frontends devs can be more flexible
|
3577 |
+
// due the opportunity of absolute positioning.
|
3578 |
+
railWidth = parseInt(rail.css('width'), 10);
|
3579 |
+
}
|
3580 |
+
|
3581 |
+
// attempt to autosize
|
3582 |
+
if (railWidth === 0 || !railWidth) {
|
3583 |
+
|
3584 |
+
// find the size of all the other controls besides the rail
|
3585 |
+
others.each(function() {
|
3586 |
+
var $this = $(this);
|
3587 |
+
if ($this.css('position') != 'absolute' && $this.is(':visible')) {
|
3588 |
usedWidth += $(this).outerWidth(true);
|
3589 |
}
|
3590 |
});
|
3591 |
+
|
3592 |
// fit the rail into the remaining space
|
3593 |
railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.width());
|
3594 |
}
|
3595 |
|
3596 |
+
// resize the rail,
|
3597 |
+
// but then check if the last control (say, the fullscreen button) got pushed down
|
3598 |
+
// this often happens when zoomed
|
3599 |
+
do {
|
3600 |
+
// outer area
|
3601 |
+
// we only want to set an inline style with the width of the rail
|
3602 |
+
// if we're trying to autosize.
|
3603 |
+
if (!avoidAutosizeProgress) {
|
3604 |
+
rail.width(railWidth);
|
3605 |
+
}
|
3606 |
+
|
3607 |
+
// dark space
|
3608 |
+
total.width(railWidth - (total.outerWidth(true) - total.width()));
|
3609 |
+
|
3610 |
+
if (lastControl.css('position') != 'absolute') {
|
3611 |
+
lastControlPosition = lastControl.length ? lastControl.position() : null;
|
3612 |
+
railWidth--;
|
3613 |
+
}
|
3614 |
+
} while (lastControlPosition !== null && lastControlPosition.top.toFixed(2) > 0 && railWidth > 0);
|
3615 |
+
|
3616 |
+
t.container.trigger('controlsresize');
|
3617 |
},
|
3618 |
|
3619 |
|
3620 |
buildposter: function(player, controls, layers, media) {
|
3621 |
var t = this,
|
3622 |
+
poster =
|
3623 |
$('<div class="mejs-poster mejs-layer">' +
|
3624 |
'</div>')
|
3625 |
.appendTo(layers),
|
3628 |
// prioriy goes to option (this is useful if you need to support iOS 3.x (iOS completely fails with poster)
|
3629 |
if (player.options.poster !== '') {
|
3630 |
posterUrl = player.options.poster;
|
3631 |
+
}
|
3632 |
+
|
3633 |
// second, try the real poster
|
3634 |
+
if ( posterUrl ) {
|
3635 |
t.setPoster(posterUrl);
|
3636 |
} else {
|
3637 |
poster.hide();
|
3640 |
media.addEventListener('play',function() {
|
3641 |
poster.hide();
|
3642 |
}, false);
|
3643 |
+
|
3644 |
+
if(player.options.showPosterWhenEnded && player.options.autoRewind){
|
3645 |
+
media.addEventListener('ended',function() {
|
3646 |
+
poster.show();
|
3647 |
+
}, false);
|
3648 |
+
}
|
3649 |
},
|
3650 |
+
|
3651 |
setPoster: function(url) {
|
3652 |
var t = this,
|
3653 |
posterDiv = t.container.find('.mejs-poster'),
|
3654 |
posterImg = posterDiv.find('img');
|
3655 |
+
|
3656 |
+
if (posterImg.length === 0) {
|
3657 |
+
posterImg = $('<img width="100%" height="100%" alt="" />').appendTo(posterDiv);
|
3658 |
+
}
|
3659 |
+
|
3660 |
posterImg.attr('src', url);
|
3661 |
+
posterDiv.css({'background-image' : 'url(' + url + ')'});
|
3662 |
},
|
3663 |
|
3664 |
buildoverlays: function(player, controls, layers, media) {
|
3665 |
+
var t = this;
|
3666 |
if (!player.isVideo)
|
3667 |
return;
|
3668 |
|
3669 |
+
var
|
3670 |
+
loading =
|
3671 |
$('<div class="mejs-overlay mejs-layer">'+
|
3672 |
'<div class="mejs-overlay-loading"><span></span></div>'+
|
3673 |
'</div>')
|
3674 |
.hide() // start out hidden
|
3675 |
.appendTo(layers),
|
3676 |
+
error =
|
3677 |
$('<div class="mejs-overlay mejs-layer">'+
|
3678 |
'<div class="mejs-overlay-error"></div>'+
|
3679 |
'</div>')
|
3680 |
.hide() // start out hidden
|
3681 |
.appendTo(layers),
|
3682 |
// this needs to come last so it's on top
|
3683 |
+
bigPlay =
|
3684 |
$('<div class="mejs-overlay mejs-layer mejs-overlay-play">'+
|
3685 |
+
'<div class="mejs-overlay-button" role="button" aria-label="' + mejs.i18n.t('mejs.play') + '" aria-pressed="false"></div>'+
|
3686 |
'</div>')
|
3687 |
.appendTo(layers)
|
3688 |
+
.bind('click', function() { // Removed 'touchstart' due issues on Samsung Android devices where a tap on bigPlay started and immediately stopped the video
|
3689 |
+
if (t.options.clickToPlayPause) {
|
3690 |
+
if (media.paused) {
|
3691 |
+
media.play();
|
3692 |
+
}
|
3693 |
+
|
3694 |
+
var button = $(this).find('.mejs-overlay-button'),
|
3695 |
+
pressed = button.attr('aria-pressed');
|
3696 |
+
button.attr('aria-pressed', !!pressed);
|
3697 |
+
}
|
3698 |
});
|
3699 |
+
|
3700 |
/*
|
3701 |
if (mejs.MediaFeatures.isiOS || mejs.MediaFeatures.isAndroid) {
|
3702 |
bigPlay.remove();
|
3703 |
loading.remove();
|
3704 |
}
|
3705 |
*/
|
3706 |
+
|
3707 |
|
3708 |
// show/hide big play button
|
3709 |
media.addEventListener('play',function() {
|
3711 |
loading.hide();
|
3712 |
controls.find('.mejs-time-buffering').hide();
|
3713 |
error.hide();
|
3714 |
+
}, false);
|
3715 |
+
|
3716 |
media.addEventListener('playing', function() {
|
3717 |
bigPlay.hide();
|
3718 |
loading.hide();
|
3719 |
controls.find('.mejs-time-buffering').hide();
|
3720 |
+
error.hide();
|
3721 |
}, false);
|
3722 |
|
3723 |
media.addEventListener('seeking', function() {
|
3729 |
loading.hide();
|
3730 |
controls.find('.mejs-time-buffering').hide();
|
3731 |
}, false);
|
3732 |
+
|
3733 |
media.addEventListener('pause',function() {
|
3734 |
if (!mejs.MediaFeatures.isiPhone) {
|
3735 |
bigPlay.show();
|
3736 |
}
|
3737 |
}, false);
|
3738 |
+
|
3739 |
media.addEventListener('waiting', function() {
|
3740 |
+
loading.show();
|
3741 |
controls.find('.mejs-time-buffering').show();
|
3742 |
+
}, false);
|
3743 |
+
|
3744 |
+
|
3745 |
+
// show/hide loading
|
3746 |
media.addEventListener('loadeddata',function() {
|
3747 |
// for some reason Chrome is firing this event
|
3748 |
//if (mejs.MediaFeatures.isChrome && media.getAttribute && media.getAttribute('preload') === 'none')
|
3749 |
// return;
|
3750 |
+
|
3751 |
loading.show();
|
3752 |
controls.find('.mejs-time-buffering').show();
|
3753 |
+
// Firing the 'canplay' event after a timeout which isn't getting fired on some Android 4.1 devices (https://github.com/johndyer/mediaelement/issues/1305)
|
3754 |
+
if (mejs.MediaFeatures.isAndroid) {
|
3755 |
+
media.canplayTimeout = window.setTimeout(
|
3756 |
+
function() {
|
3757 |
+
if (document.createEvent) {
|
3758 |
+
var evt = document.createEvent('HTMLEvents');
|
3759 |
+
evt.initEvent('canplay', true, true);
|
3760 |
+
return media.dispatchEvent(evt);
|
3761 |
+
}
|
3762 |
+
}, 300
|
3763 |
+
);
|
3764 |
+
}
|
3765 |
+
}, false);
|
3766 |
media.addEventListener('canplay',function() {
|
3767 |
loading.hide();
|
3768 |
controls.find('.mejs-time-buffering').hide();
|
3769 |
+
clearTimeout(media.canplayTimeout); // Clear timeout inside 'loadeddata' to prevent 'canplay' to fire twice
|
3770 |
+
}, false);
|
3771 |
|
3772 |
// error handling
|
3773 |
+
media.addEventListener('error',function(e) {
|
3774 |
+
t.handleError(e);
|
3775 |
loading.hide();
|
3776 |
+
bigPlay.hide();
|
3777 |
error.show();
|
3778 |
+
error.find('.mejs-overlay-error').html("Error loading this resource");
|
3779 |
+
}, false);
|
3780 |
+
|
3781 |
+
media.addEventListener('keydown', function(e) {
|
3782 |
+
t.onkeydown(player, media, e);
|
3783 |
+
}, false);
|
3784 |
},
|
3785 |
+
|
3786 |
buildkeyboard: function(player, controls, layers, media) {
|
3787 |
|
3788 |
var t = this;
|
3789 |
+
|
3790 |
+
t.container.keydown(function () {
|
3791 |
+
t.keyboardAction = true;
|
3792 |
+
});
|
3793 |
+
|
3794 |
// listen for key presses
|
3795 |
+
t.globalBind('keydown', function(event) {
|
3796 |
+
player.hasFocus = $(event.target).closest('.mejs-container').length !== 0
|
3797 |
+
&& $(event.target).closest('.mejs-container').attr('id') === player.$media.closest('.mejs-container').attr('id');
|
3798 |
+
return t.onkeydown(player, media, event);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3799 |
});
|
3800 |
+
|
3801 |
+
|
3802 |
// check if someone clicked outside a player region, then kill its focus
|
3803 |
+
t.globalBind('click', function(event) {
|
3804 |
+
player.hasFocus = $(event.target).closest('.mejs-container').length !== 0;
|
|
|
|
|
3805 |
});
|
3806 |
+
|
3807 |
+
},
|
3808 |
+
onkeydown: function(player, media, e) {
|
3809 |
+
if (player.hasFocus && player.options.enableKeyboard) {
|
3810 |
+
// find a matching key
|
3811 |
+
for (var i = 0, il = player.options.keyActions.length; i < il; i++) {
|
3812 |
+
var keyAction = player.options.keyActions[i];
|
3813 |
+
|
3814 |
+
for (var j = 0, jl = keyAction.keys.length; j < jl; j++) {
|
3815 |
+
if (e.keyCode == keyAction.keys[j]) {
|
3816 |
+
if (typeof(e.preventDefault) == "function") e.preventDefault();
|
3817 |
+
keyAction.action(player, media, e.keyCode, e);
|
3818 |
+
return false;
|
3819 |
+
}
|
3820 |
+
}
|
3821 |
+
}
|
3822 |
+
}
|
3823 |
+
|
3824 |
+
return true;
|
3825 |
},
|
3826 |
|
3827 |
findTracks: function() {
|
3831 |
// store for use by plugins
|
3832 |
t.tracks = [];
|
3833 |
tracktags.each(function(index, track) {
|
3834 |
+
|
3835 |
track = $(track);
|
3836 |
+
|
3837 |
t.tracks.push({
|
3838 |
+
srclang: (track.attr('srclang')) ? track.attr('srclang').toLowerCase() : '',
|
3839 |
src: track.attr('src'),
|
3840 |
kind: track.attr('kind'),
|
3841 |
label: track.attr('label') || '',
|
3850 |
this.setControlsSize();
|
3851 |
},
|
3852 |
play: function() {
|
3853 |
+
this.load();
|
3854 |
this.media.play();
|
3855 |
},
|
3856 |
pause: function() {
|
3857 |
+
try {
|
3858 |
+
this.media.pause();
|
3859 |
+
} catch (e) {}
|
3860 |
},
|
3861 |
load: function() {
|
3862 |
+
if (!this.isLoaded) {
|
3863 |
+
this.media.load();
|
3864 |
+
}
|
3865 |
+
|
3866 |
+
this.isLoaded = true;
|
3867 |
},
|
3868 |
setMuted: function(muted) {
|
3869 |
this.media.setMuted(muted);
|
3881 |
return this.media.volume;
|
3882 |
},
|
3883 |
setSrc: function(src) {
|
3884 |
+
var
|
3885 |
+
t = this;
|
3886 |
+
|
3887 |
+
// If using YouTube, its API is different to load a specific source
|
3888 |
+
if (t.media.pluginType === 'youtube') {
|
3889 |
+
var videoId;
|
3890 |
+
|
3891 |
+
if (typeof src !== 'string') {
|
3892 |
+
var i, media;
|
3893 |
+
|
3894 |
+
for (i=0; i<src.length; i++) {
|
3895 |
+
media = src[i];
|
3896 |
+
if (this.canPlayType(media.type)) {
|
3897 |
+
src = media.src;
|
3898 |
+
break;
|
3899 |
+
}
|
3900 |
+
}
|
3901 |
+
}
|
3902 |
+
|
3903 |
+
// youtu.be url from share button
|
3904 |
+
if (src.lastIndexOf('youtu.be') !== -1) {
|
3905 |
+
videoId = src.substr(src.lastIndexOf('/') + 1);
|
3906 |
+
|
3907 |
+
if (videoId.indexOf('?') !== -1) {
|
3908 |
+
videoId = videoId.substr(0, videoId.indexOf('?'));
|
3909 |
+
}
|
3910 |
+
|
3911 |
+
} else {
|
3912 |
+
// https://www.youtube.com/watch?v=
|
3913 |
+
var videoIdMatch = src.match(/[?&]v=([^&#]+)|&|#|$/);
|
3914 |
+
|
3915 |
+
if (videoIdMatch) {
|
3916 |
+
videoId = videoIdMatch[1];
|
3917 |
+
}
|
3918 |
+
}
|
3919 |
+
|
3920 |
+
if (t.media.getAttribute('autoplay') !== null) {
|
3921 |
+
t.media.pluginApi.loadVideoById(videoId);
|
3922 |
+
} else {
|
3923 |
+
t.media.pluginApi.cueVideoById(videoId);
|
3924 |
+
}
|
3925 |
+
|
3926 |
+
}
|
3927 |
+
else {
|
3928 |
+
t.media.setSrc(src);
|
3929 |
+
}
|
3930 |
},
|
3931 |
remove: function() {
|
3932 |
+
var t = this, featureIndex, feature;
|
3933 |
+
|
3934 |
+
t.container.prev('.mejs-offscreen').remove();
|
3935 |
+
|
3936 |
+
// invoke features cleanup
|
3937 |
+
for (featureIndex in t.options.features) {
|
3938 |
+
feature = t.options.features[featureIndex];
|
3939 |
+
if (t['clean' + feature]) {
|
3940 |
+
try {
|
3941 |
+
t['clean' + feature](t);
|
3942 |
+
} catch (e) {
|
3943 |
+
// TODO: report control error
|
3944 |
+
//throw e;
|
3945 |
+
//
|
3946 |
+
//
|
3947 |
+
}
|
3948 |
+
}
|
3949 |
}
|
3950 |
+
|
3951 |
// grab video and put it back in place
|
3952 |
if (!t.isDynamic) {
|
3953 |
+
t.$media.prop('controls', true);
|
3954 |
+
// detach events from the video
|
3955 |
+
// TODO: detach event listeners better than this;
|
3956 |
+
// also detach ONLY the events attached by this plugin!
|
3957 |
+
t.$node.clone().insertBefore(t.container).show();
|
3958 |
+
t.$node.remove();
|
3959 |
+
} else {
|
3960 |
+
t.$node.insertBefore(t.container);
|
3961 |
}
|
3962 |
+
|
3963 |
+
if (t.media.pluginType !== 'native') {
|
3964 |
+
t.media.remove();
|
3965 |
+
}
|
3966 |
+
|
3967 |
+
// Remove the player from the mejs.players object so that pauseOtherPlayers doesn't blow up when trying to pause a non existance flash api.
|
3968 |
+
delete mejs.players[t.id];
|
3969 |
+
|
3970 |
+
if (typeof t.container == 'object') {
|
3971 |
+
t.container.remove();
|
3972 |
+
}
|
3973 |
+
t.globalUnbind();
|
3974 |
+
delete t.node.player;
|
3975 |
+
},
|
3976 |
+
rebuildtracks: function(){
|
3977 |
+
var t = this;
|
3978 |
+
t.findTracks();
|
3979 |
+
t.buildtracks(t, t.controls, t.layers, t.media);
|
3980 |
+
},
|
3981 |
+
resetSize: function(){
|
3982 |
+
var t = this;
|
3983 |
+
// webkit has trouble doing this without a delay
|
3984 |
+
setTimeout(function () {
|
3985 |
+
//
|
3986 |
+
t.setPlayerSize(t.width, t.height);
|
3987 |
+
t.setControlsSize();
|
3988 |
+
}, 50);
|
3989 |
}
|
3990 |
};
|
3991 |
|
3992 |
+
(function(){
|
3993 |
+
var rwindow = /^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;
|
3994 |
+
|
3995 |
+
function splitEvents(events, id) {
|
3996 |
+
// add player ID as an event namespace so it's easier to unbind them all later
|
3997 |
+
var ret = {d: [], w: []};
|
3998 |
+
$.each((events || '').split(' '), function(k, v){
|
3999 |
+
var eventname = v + '.' + id;
|
4000 |
+
if (eventname.indexOf('.') === 0) {
|
4001 |
+
ret.d.push(eventname);
|
4002 |
+
ret.w.push(eventname);
|
4003 |
+
}
|
4004 |
+
else {
|
4005 |
+
ret[rwindow.test(v) ? 'w' : 'd'].push(eventname);
|
4006 |
+
}
|
4007 |
});
|
4008 |
+
ret.d = ret.d.join(' ');
|
4009 |
+
ret.w = ret.w.join(' ');
|
4010 |
+
return ret;
|
4011 |
+
}
|
4012 |
+
|
4013 |
+
mejs.MediaElementPlayer.prototype.globalBind = function(events, data, callback) {
|
4014 |
+
var t = this;
|
4015 |
+
var doc = t.node ? t.node.ownerDocument : document;
|
4016 |
+
|
4017 |
+
events = splitEvents(events, t.id);
|
4018 |
+
if (events.d) $(doc).bind(events.d, data, callback);
|
4019 |
+
if (events.w) $(window).bind(events.w, data, callback);
|
4020 |
+
};
|
4021 |
+
|
4022 |
+
mejs.MediaElementPlayer.prototype.globalUnbind = function(events, callback) {
|
4023 |
+
var t = this;
|
4024 |
+
var doc = t.node ? t.node.ownerDocument : document;
|
4025 |
+
|
4026 |
+
events = splitEvents(events, t.id);
|
4027 |
+
if (events.d) $(doc).unbind(events.d, callback);
|
4028 |
+
if (events.w) $(window).unbind(events.w, callback);
|
4029 |
+
};
|
4030 |
+
})();
|
4031 |
+
|
4032 |
+
// turn into jQuery plugin
|
4033 |
+
if (typeof $ != 'undefined') {
|
4034 |
+
$.fn.mediaelementplayer = function (options) {
|
4035 |
+
if (options === false) {
|
4036 |
+
this.each(function () {
|
4037 |
+
var player = $(this).data('mediaelementplayer');
|
4038 |
+
if (player) {
|
4039 |
+
player.remove();
|
4040 |
+
}
|
4041 |
+
$(this).removeData('mediaelementplayer');
|
4042 |
+
});
|
4043 |
+
}
|
4044 |
+
else {
|
4045 |
+
this.each(function () {
|
4046 |
+
$(this).data('mediaelementplayer', new mejs.MediaElementPlayer(this, options));
|
4047 |
+
});
|
4048 |
+
}
|
4049 |
+
return this;
|
4050 |
};
|
4051 |
+
|
4052 |
+
|
4053 |
+
$(document).ready(function() {
|
4054 |
+
// auto enable using JSON attribute
|
4055 |
+
$('.mejs-player').mediaelementplayer();
|
4056 |
+
});
|
4057 |
}
|
4058 |
+
|
|
|
|
|
|
|
|
|
|
|
4059 |
// push out to window
|
4060 |
window.MediaElementPlayer = mejs.MediaElementPlayer;
|
4061 |
|
4064 |
(function($) {
|
4065 |
|
4066 |
$.extend(mejs.MepDefaults, {
|
4067 |
+
playText: '',
|
4068 |
+
pauseText: ''
|
4069 |
});
|
4070 |
|
4071 |
+
|
4072 |
// PLAY/pause BUTTON
|
4073 |
$.extend(MediaElementPlayer.prototype, {
|
4074 |
buildplaypause: function(player, controls, layers, media) {
|
4075 |
var
|
4076 |
t = this,
|
4077 |
+
op = t.options,
|
4078 |
+
playTitle = op.playText ? op.playText : mejs.i18n.t('mejs.play'),
|
4079 |
+
pauseTitle = op.pauseText ? op.pauseText : mejs.i18n.t('mejs.pause'),
|
4080 |
+
play =
|
4081 |
$('<div class="mejs-button mejs-playpause-button mejs-play" >' +
|
4082 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + playTitle + '" aria-label="' + pauseTitle + '"></button>' +
|
4083 |
'</div>')
|
4084 |
.appendTo(controls)
|
4085 |
.click(function(e) {
|
4092 |
}
|
4093 |
|
4094 |
return false;
|
4095 |
+
}),
|
4096 |
+
play_btn = play.find('button');
|
4097 |
+
|
4098 |
+
|
4099 |
+
function togglePlayPause(which) {
|
4100 |
+
if ('play' === which) {
|
4101 |
+
play.removeClass('mejs-play').addClass('mejs-pause');
|
4102 |
+
play_btn.attr({
|
4103 |
+
'title': pauseTitle,
|
4104 |
+
'aria-label': pauseTitle
|
4105 |
+
});
|
4106 |
+
} else {
|
4107 |
+
play.removeClass('mejs-pause').addClass('mejs-play');
|
4108 |
+
play_btn.attr({
|
4109 |
+
'title': playTitle,
|
4110 |
+
'aria-label': playTitle
|
4111 |
+
});
|
4112 |
+
}
|
4113 |
+
};
|
4114 |
+
togglePlayPause('pse');
|
4115 |
+
|
4116 |
|
4117 |
media.addEventListener('play',function() {
|
4118 |
+
togglePlayPause('play');
|
4119 |
}, false);
|
4120 |
media.addEventListener('playing',function() {
|
4121 |
+
togglePlayPause('play');
|
4122 |
}, false);
|
4123 |
|
4124 |
|
4125 |
media.addEventListener('pause',function() {
|
4126 |
+
togglePlayPause('pse');
|
4127 |
}, false);
|
4128 |
media.addEventListener('paused',function() {
|
4129 |
+
togglePlayPause('pse');
|
4130 |
}, false);
|
4131 |
}
|
4132 |
});
|
4133 |
|
4134 |
})(mejs.$);
|
4135 |
+
|
4136 |
(function($) {
|
4137 |
|
4138 |
$.extend(mejs.MepDefaults, {
|
4142 |
// STOP BUTTON
|
4143 |
$.extend(MediaElementPlayer.prototype, {
|
4144 |
buildstop: function(player, controls, layers, media) {
|
4145 |
+
var t = this;
|
4146 |
+
|
4147 |
+
$('<div class="mejs-button mejs-stop-button mejs-stop">' +
|
4148 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.stopText + '" aria-label="' + t.options.stopText + '"></button>' +
|
4149 |
'</div>')
|
4150 |
.appendTo(controls)
|
4151 |
.click(function() {
|
4157 |
media.pause();
|
4158 |
controls.find('.mejs-time-current').width('0px');
|
4159 |
controls.find('.mejs-time-handle').css('left', '0px');
|
4160 |
+
controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0, player.options));
|
4161 |
+
controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0, player.options));
|
4162 |
layers.find('.mejs-poster').show();
|
4163 |
}
|
4164 |
});
|
4166 |
});
|
4167 |
|
4168 |
})(mejs.$);
|
4169 |
+
|
4170 |
(function($) {
|
4171 |
+
|
4172 |
+
$.extend(mejs.MepDefaults, {
|
4173 |
+
// Enable tooltip that shows time in progress bar
|
4174 |
+
enableProgressTooltip: true,
|
4175 |
+
progressHelpText: ''
|
4176 |
+
});
|
4177 |
+
|
4178 |
// progress/loaded bar
|
4179 |
$.extend(MediaElementPlayer.prototype, {
|
4180 |
buildprogress: function(player, controls, layers, media) {
|
4181 |
|
4182 |
+
var
|
4183 |
+
t = this,
|
4184 |
+
mouseIsDown = false,
|
4185 |
+
mouseIsOver = false,
|
4186 |
+
lastKeyPressTime = 0,
|
4187 |
+
startedPaused = false,
|
4188 |
+
autoRewindInitial = player.options.autoRewind,
|
4189 |
+
progressTitle = t.options.progressHelpText ? t.options.progressHelpText : mejs.i18n.t('mejs.time-help-text'),
|
4190 |
+
tooltip = player.options.enableProgressTooltip ? '<span class="mejs-time-float">' +
|
4191 |
+
'<span class="mejs-time-float-current">00:00</span>' +
|
4192 |
+
'<span class="mejs-time-float-corner"></span>' +
|
4193 |
+
'</span>' : "";
|
4194 |
+
|
4195 |
+
$('<div class="mejs-time-rail">' +
|
4196 |
+
'<span class="mejs-time-total mejs-time-slider">' +
|
4197 |
+
//'<span class="mejs-offscreen">' + progressTitle + '</span>' +
|
4198 |
+
'<span class="mejs-time-buffering"></span>' +
|
4199 |
+
'<span class="mejs-time-loaded"></span>' +
|
4200 |
+
'<span class="mejs-time-current"></span>' +
|
4201 |
+
'<span class="mejs-time-handle"></span>' +
|
4202 |
+
tooltip +
|
4203 |
+
'</span>' +
|
4204 |
'</div>')
|
4205 |
.appendTo(controls);
|
4206 |
+
controls.find('.mejs-time-buffering').hide();
|
4207 |
|
4208 |
+
t.total = controls.find('.mejs-time-total');
|
4209 |
+
t.loaded = controls.find('.mejs-time-loaded');
|
4210 |
+
t.current = controls.find('.mejs-time-current');
|
4211 |
+
t.handle = controls.find('.mejs-time-handle');
|
4212 |
+
t.timefloat = controls.find('.mejs-time-float');
|
4213 |
+
t.timefloatcurrent = controls.find('.mejs-time-float-current');
|
4214 |
+
t.slider = controls.find('.mejs-time-slider');
|
4215 |
+
|
4216 |
+
var handleMouseMove = function (e) {
|
4217 |
+
|
4218 |
+
var offset = t.total.offset(),
|
4219 |
+
width = t.total.width(),
|
|
|
4220 |
percentage = 0,
|
4221 |
newTime = 0,
|
4222 |
+
pos = 0,
|
4223 |
+
x;
|
4224 |
+
|
4225 |
+
// mouse or touch position relative to the object
|
4226 |
+
if (e.originalEvent && e.originalEvent.changedTouches) {
|
4227 |
+
x = e.originalEvent.changedTouches[0].pageX;
|
4228 |
+
} else if (e.changedTouches) { // for Zepto
|
4229 |
+
x = e.changedTouches[0].pageX;
|
4230 |
+
} else {
|
4231 |
+
x = e.pageX;
|
4232 |
+
}
|
4233 |
|
4234 |
if (media.duration) {
|
4235 |
if (x < offset.left) {
|
4237 |
} else if (x > width + offset.left) {
|
4238 |
x = width + offset.left;
|
4239 |
}
|
4240 |
+
|
4241 |
pos = x - offset.left;
|
4242 |
percentage = (pos / width);
|
4243 |
newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
|
4249 |
|
4250 |
// position floating time box
|
4251 |
if (!mejs.MediaFeatures.hasTouch) {
|
4252 |
+
t.timefloat.css('left', pos);
|
4253 |
+
t.timefloatcurrent.html( mejs.Utility.secondsToTimeCode(newTime, player.options) );
|
4254 |
+
t.timefloat.show();
|
4255 |
}
|
4256 |
}
|
4257 |
},
|
4258 |
+
// Accessibility for slider
|
4259 |
+
updateSlider = function (e) {
|
4260 |
+
|
4261 |
+
var seconds = media.currentTime,
|
4262 |
+
timeSliderText = mejs.i18n.t('mejs.time-slider'),
|
4263 |
+
time = mejs.Utility.secondsToTimeCode(seconds, player.options),
|
4264 |
+
duration = media.duration;
|
4265 |
+
|
4266 |
+
t.slider.attr({
|
4267 |
+
'aria-label': timeSliderText,
|
4268 |
+
'aria-valuemin': 0,
|
4269 |
+
'aria-valuemax': duration,
|
4270 |
+
'aria-valuenow': seconds,
|
4271 |
+
'aria-valuetext': time,
|
4272 |
+
'role': 'slider',
|
4273 |
+
'tabindex': 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4274 |
});
|
4275 |
+
|
4276 |
+
},
|
4277 |
+
restartPlayer = function () {
|
4278 |
+
var now = new Date();
|
4279 |
+
if (now - lastKeyPressTime >= 1000) {
|
4280 |
+
media.play();
|
|
|
|
|
|
|
4281 |
}
|
4282 |
+
};
|
4283 |
|
4284 |
+
t.slider.bind('focus', function (e) {
|
4285 |
+
player.options.autoRewind = false;
|
4286 |
+
});
|
4287 |
+
|
4288 |
+
t.slider.bind('blur', function (e) {
|
4289 |
+
player.options.autoRewind = autoRewindInitial;
|
4290 |
+
});
|
4291 |
+
|
4292 |
+
t.slider.bind('keydown', function (e) {
|
4293 |
+
|
4294 |
+
if ((new Date() - lastKeyPressTime) >= 1000) {
|
4295 |
+
startedPaused = media.paused;
|
4296 |
+
}
|
4297 |
+
|
4298 |
+
var keyCode = e.keyCode,
|
4299 |
+
duration = media.duration,
|
4300 |
+
seekTime = media.currentTime,
|
4301 |
+
seekForward = player.options.defaultSeekForwardInterval(media),
|
4302 |
+
seekBackward = player.options.defaultSeekBackwardInterval(media);
|
4303 |
+
|
4304 |
+
switch (keyCode) {
|
4305 |
+
case 37: // left
|
4306 |
+
case 40: // Down
|
4307 |
+
seekTime -= seekBackward;
|
4308 |
+
break;
|
4309 |
+
case 39: // Right
|
4310 |
+
case 38: // Up
|
4311 |
+
seekTime += seekForward;
|
4312 |
+
break;
|
4313 |
+
case 36: // Home
|
4314 |
+
seekTime = 0;
|
4315 |
+
break;
|
4316 |
+
case 35: // end
|
4317 |
+
seekTime = duration;
|
4318 |
+
break;
|
4319 |
+
case 32: // space
|
4320 |
+
case 13: // enter
|
4321 |
+
media.paused ? media.play() : media.pause();
|
4322 |
+
return;
|
4323 |
+
default:
|
4324 |
+
return;
|
4325 |
+
}
|
4326 |
+
|
4327 |
+
seekTime = seekTime < 0 ? 0 : (seekTime >= duration ? duration : Math.floor(seekTime));
|
4328 |
+
lastKeyPressTime = new Date();
|
4329 |
+
if (!startedPaused) {
|
4330 |
+
media.pause();
|
4331 |
+
}
|
4332 |
+
|
4333 |
+
if (seekTime < media.duration && !startedPaused) {
|
4334 |
+
setTimeout(restartPlayer, 1100);
|
4335 |
+
}
|
4336 |
+
|
4337 |
+
media.setCurrentTime(seekTime);
|
4338 |
+
|
4339 |
+
e.preventDefault();
|
4340 |
+
e.stopPropagation();
|
4341 |
+
return false;
|
4342 |
+
});
|
4343 |
+
|
4344 |
+
|
4345 |
+
// handle clicks
|
4346 |
+
//controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
|
4347 |
+
t.total
|
4348 |
+
.bind('mousedown touchstart', function (e) {
|
4349 |
+
// only handle left clicks or touch
|
4350 |
+
if (e.which === 1 || e.which === 0) {
|
4351 |
+
mouseIsDown = true;
|
4352 |
+
handleMouseMove(e);
|
4353 |
+
t.globalBind('mousemove.dur touchmove.dur', function(e) {
|
4354 |
+
handleMouseMove(e);
|
4355 |
+
});
|
4356 |
+
t.globalBind('mouseup.dur touchend.dur', function (e) {
|
4357 |
+
mouseIsDown = false;
|
4358 |
+
if (typeof t.timefloat !== 'undefined') {
|
4359 |
+
t.timefloat.hide();
|
4360 |
+
}
|
4361 |
+
t.globalUnbind('.dur');
|
4362 |
+
});
|
4363 |
+
}
|
4364 |
+
})
|
4365 |
+
.bind('mouseenter', function(e) {
|
4366 |
+
mouseIsOver = true;
|
4367 |
+
t.globalBind('mousemove.dur', function(e) {
|
4368 |
+
handleMouseMove(e);
|
4369 |
+
});
|
4370 |
+
if (typeof t.timefloat !== 'undefined' && !mejs.MediaFeatures.hasTouch) {
|
4371 |
+
t.timefloat.show();
|
4372 |
+
}
|
4373 |
+
})
|
4374 |
+
.bind('mouseleave',function(e) {
|
4375 |
+
mouseIsOver = false;
|
4376 |
+
if (!mouseIsDown) {
|
4377 |
+
t.globalUnbind('.dur');
|
4378 |
+
if (typeof t.timefloat !== 'undefined') {
|
4379 |
+
t.timefloat.hide();
|
4380 |
+
}
|
4381 |
+
}
|
4382 |
+
});
|
4383 |
+
|
4384 |
+
// loading
|
4385 |
media.addEventListener('progress', function (e) {
|
4386 |
player.setProgressRail(e);
|
4387 |
player.setCurrentRail(e);
|
4391 |
media.addEventListener('timeupdate', function(e) {
|
4392 |
player.setProgressRail(e);
|
4393 |
player.setCurrentRail(e);
|
4394 |
+
updateSlider(e);
|
4395 |
}, false);
|
4396 |
+
|
4397 |
+
t.container.on('controlsresize', function(e) {
|
4398 |
+
player.setProgressRail(e);
|
4399 |
+
player.setCurrentRail(e);
|
4400 |
+
});
|
|
|
|
|
4401 |
},
|
4402 |
setProgressRail: function(e) {
|
4403 |
|
4404 |
var
|
4405 |
t = this,
|
4406 |
+
target = (e !== undefined) ? e.target : t.media,
|
4407 |
+
percent = null;
|
4408 |
|
4409 |
// newest HTML5 spec has buffered array (FF4, Webkit)
|
4410 |
if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
|
4411 |
+
// account for a real array with multiple values - always read the end of the last buffer
|
4412 |
+
percent = target.buffered.end(target.buffered.length - 1) / target.duration;
|
4413 |
}
|
4414 |
// Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
|
4415 |
// to be anything other than 0. If the byte count is available we use this instead.
|
4416 |
// Browsers that support the else if do not seem to have the bufferedBytes value and
|
4417 |
// should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
|
4418 |
+
else if (target && target.bytesTotal !== undefined && target.bytesTotal > 0 && target.bufferedBytes !== undefined) {
|
4419 |
percent = target.bufferedBytes / target.bytesTotal;
|
4420 |
}
|
4421 |
// Firefox 3 with an Ogg file seems to go this way
|
4422 |
+
else if (e && e.lengthComputable && e.total !== 0) {
|
4423 |
+
percent = e.loaded / e.total;
|
4424 |
}
|
4425 |
|
4426 |
// finally update the progress bar
|
4436 |
|
4437 |
var t = this;
|
4438 |
|
4439 |
+
if (t.media.currentTime !== undefined && t.media.duration) {
|
4440 |
|
4441 |
// update bar and handle
|
4442 |
if (t.total && t.handle) {
|
4443 |
var
|
4444 |
+
newWidth = Math.round(t.total.width() * t.media.currentTime / t.media.duration),
|
4445 |
+
handlePos = newWidth - Math.round(t.handle.outerWidth(true) / 2);
|
4446 |
|
4447 |
t.current.width(newWidth);
|
4448 |
t.handle.css('left', handlePos);
|
4449 |
}
|
4450 |
}
|
4451 |
|
4452 |
+
}
|
4453 |
});
|
4454 |
})(mejs.$);
|
4455 |
|
4458 |
// options
|
4459 |
$.extend(mejs.MepDefaults, {
|
4460 |
duration: -1,
|
4461 |
+
timeAndDurationSeparator: '<span> | </span>'
|
4462 |
});
|
4463 |
|
4464 |
|
4467 |
buildcurrent: function(player, controls, layers, media) {
|
4468 |
var t = this;
|
4469 |
|
4470 |
+
$('<div class="mejs-time" role="timer" aria-live="off">' +
|
4471 |
+
'<span class="mejs-currenttime">' +
|
4472 |
+
mejs.Utility.secondsToTimeCode(0, player.options) +
|
4473 |
+
'</span>'+
|
4474 |
+
'</div>')
|
4475 |
+
.appendTo(controls);
|
4476 |
|
4477 |
t.currenttime = t.controls.find('.mejs-currenttime');
|
4478 |
|
4479 |
media.addEventListener('timeupdate',function() {
|
4480 |
+
if (t.controlsAreVisible) {
|
4481 |
+
player.updateCurrent();
|
4482 |
+
}
|
4483 |
+
|
4484 |
}, false);
|
4485 |
},
|
4486 |
|
4491 |
if (controls.children().last().find('.mejs-currenttime').length > 0) {
|
4492 |
$(t.options.timeAndDurationSeparator +
|
4493 |
'<span class="mejs-duration">' +
|
4494 |
+
mejs.Utility.secondsToTimeCode(t.options.duration, t.options) +
|
|
|
|
|
|
|
4495 |
'</span>')
|
4496 |
.appendTo(controls.find('.mejs-time'));
|
4497 |
} else {
|
4501 |
|
4502 |
$('<div class="mejs-time mejs-duration-container">'+
|
4503 |
'<span class="mejs-duration">' +
|
4504 |
+
mejs.Utility.secondsToTimeCode(t.options.duration, t.options) +
|
|
|
|
|
|
|
4505 |
'</span>' +
|
4506 |
'</div>')
|
4507 |
.appendTo(controls);
|
4510 |
t.durationD = t.controls.find('.mejs-duration');
|
4511 |
|
4512 |
media.addEventListener('timeupdate',function() {
|
4513 |
+
if (t.controlsAreVisible) {
|
4514 |
+
player.updateDuration();
|
4515 |
+
}
|
4516 |
}, false);
|
4517 |
},
|
4518 |
|
4519 |
updateCurrent: function() {
|
4520 |
var t = this;
|
4521 |
+
|
4522 |
+
var currentTime = t.media.currentTime;
|
4523 |
+
|
4524 |
+
if (isNaN(currentTime)) {
|
4525 |
+
currentTime = 0;
|
4526 |
+
}
|
4527 |
|
4528 |
if (t.currenttime) {
|
4529 |
+
t.currenttime.html(mejs.Utility.secondsToTimeCode(currentTime, t.options));
|
4530 |
}
|
4531 |
},
|
4532 |
|
4533 |
+
updateDuration: function() {
|
4534 |
var t = this;
|
4535 |
+
|
4536 |
+
var duration = t.media.duration;
|
4537 |
+
if (t.options.duration > 0) {
|
4538 |
+
duration = t.options.duration;
|
4539 |
+
}
|
4540 |
+
|
4541 |
+
if (isNaN(duration)) {
|
4542 |
+
duration = 0;
|
4543 |
+
}
|
4544 |
|
4545 |
//Toggle the long video class if the video is longer than an hour.
|
4546 |
+
t.container.toggleClass("mejs-long-video", duration > 3600);
|
4547 |
|
4548 |
+
if (t.durationD && duration > 0) {
|
4549 |
+
t.durationD.html(mejs.Utility.secondsToTimeCode(duration, t.options));
|
4550 |
}
|
4551 |
}
|
4552 |
});
|
4553 |
|
4554 |
})(mejs.$);
|
4555 |
+
|
4556 |
+
(function ($) {
|
4557 |
|
4558 |
$.extend(mejs.MepDefaults, {
|
4559 |
+
muteText: mejs.i18n.t('mejs.mute-toggle'),
|
4560 |
+
allyVolumeControlText: mejs.i18n.t('mejs.volume-help-text'),
|
4561 |
hideVolumeOnTouchDevices: true,
|
4562 |
+
|
4563 |
audioVolume: 'horizontal',
|
4564 |
videoVolume: 'vertical'
|
4565 |
});
|
4566 |
|
4567 |
$.extend(MediaElementPlayer.prototype, {
|
4568 |
+
buildvolume: function (player, controls, layers, media) {
|
4569 |
+
|
4570 |
// Android and iOS don't support volume controls
|
4571 |
+
if ((mejs.MediaFeatures.isAndroid || mejs.MediaFeatures.isiOS) && this.options.hideVolumeOnTouchDevices)
|
4572 |
return;
|
4573 |
+
|
4574 |
var t = this,
|
4575 |
mode = (t.isVideo) ? t.options.videoVolume : t.options.audioVolume,
|
4576 |
mute = (mode == 'horizontal') ?
|
4577 |
+
|
4578 |
+
// horizontal version
|
4579 |
+
$('<div class="mejs-button mejs-volume-button mejs-mute">' +
|
4580 |
+
'<button type="button" aria-controls="' + t.id +
|
4581 |
+
'" title="' + t.options.muteText +
|
4582 |
+
'" aria-label="' + t.options.muteText +
|
4583 |
+
'"></button>' +
|
4584 |
+
'</div>' +
|
4585 |
+
'<a href="javascript:void(0);" class="mejs-horizontal-volume-slider">' + // outer background
|
4586 |
+
'<span class="mejs-offscreen">' + t.options.allyVolumeControlText + '</span>' +
|
4587 |
+
'<div class="mejs-horizontal-volume-total"></div>' + // line background
|
4588 |
+
'<div class="mejs-horizontal-volume-current"></div>' + // current volume
|
4589 |
+
'<div class="mejs-horizontal-volume-handle"></div>' + // handle
|
4590 |
+
'</a>'
|
4591 |
+
)
|
4592 |
.appendTo(controls) :
|
4593 |
+
|
4594 |
+
// vertical version
|
4595 |
+
$('<div class="mejs-button mejs-volume-button mejs-mute">' +
|
4596 |
+
'<button type="button" aria-controls="' + t.id +
|
4597 |
+
'" title="' + t.options.muteText +
|
4598 |
+
'" aria-label="' + t.options.muteText +
|
4599 |
+
'"></button>' +
|
4600 |
+
'<a href="javascript:void(0);" class="mejs-volume-slider">' + // outer background
|
4601 |
+
'<span class="mejs-offscreen">' + t.options.allyVolumeControlText + '</span>' +
|
4602 |
+
'<div class="mejs-volume-total"></div>' + // line background
|
4603 |
+
'<div class="mejs-volume-current"></div>' + // current volume
|
4604 |
+
'<div class="mejs-volume-handle"></div>' + // handle
|
4605 |
+
'</a>' +
|
4606 |
+
'</div>')
|
4607 |
.appendTo(controls),
|
4608 |
+
volumeSlider = t.container.find('.mejs-volume-slider, .mejs-horizontal-volume-slider'),
|
4609 |
+
volumeTotal = t.container.find('.mejs-volume-total, .mejs-horizontal-volume-total'),
|
4610 |
+
volumeCurrent = t.container.find('.mejs-volume-current, .mejs-horizontal-volume-current'),
|
4611 |
+
volumeHandle = t.container.find('.mejs-volume-handle, .mejs-horizontal-volume-handle'),
|
4612 |
|
4613 |
+
positionVolumeHandle = function (volume, secondTry) {
|
4614 |
|
4615 |
+
if (!volumeSlider.is(':visible') && typeof secondTry == 'undefined') {
|
4616 |
+
volumeSlider.show();
|
4617 |
+
positionVolumeHandle(volume, true);
|
4618 |
+
volumeSlider.hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4619 |
return;
|
4620 |
+
}
|
4621 |
+
|
4622 |
+
// correct to 0-1
|
4623 |
+
volume = Math.max(0, volume);
|
4624 |
+
volume = Math.min(volume, 1);
|
4625 |
+
|
4626 |
+
// adjust mute button style
|
4627 |
+
if (volume === 0) {
|
4628 |
+
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
4629 |
+
mute.children('button').attr('title', mejs.i18n.t('mejs.unmute')).attr('aria-label', mejs.i18n.t('mejs.unmute'));
|
4630 |
+
} else {
|
4631 |
+
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
4632 |
+
mute.children('button').attr('title', mejs.i18n.t('mejs.mute')).attr('aria-label', mejs.i18n.t('mejs.mute'));
|
4633 |
+
}
|
4634 |
+
|
4635 |
+
// top/left of full size volume slider background
|
4636 |
+
var totalPosition = volumeTotal.position();
|
4637 |
+
// position slider
|
4638 |
+
if (mode == 'vertical') {
|
4639 |
+
var
|
4640 |
+
// height of the full size volume slider background
|
4641 |
+
totalHeight = volumeTotal.height(),
|
4642 |
+
|
4643 |
+
// the new top position based on the current volume
|
4644 |
+
// 70% volume on 100px height == top:30px
|
4645 |
+
newTop = totalHeight - (totalHeight * volume);
|
4646 |
+
|
4647 |
+
// handle
|
4648 |
+
volumeHandle.css('top', Math.round(totalPosition.top + newTop - (volumeHandle.height() / 2)));
|
4649 |
+
|
4650 |
+
// show the current visibility
|
4651 |
+
volumeCurrent.height(totalHeight - newTop);
|
4652 |
+
volumeCurrent.css('top', totalPosition.top + newTop);
|
4653 |
+
} else {
|
4654 |
+
var
|
4655 |
+
// height of the full size volume slider background
|
4656 |
+
totalWidth = volumeTotal.width(),
|
4657 |
+
|
4658 |
+
// the new left position based on the current volume
|
4659 |
+
newLeft = totalWidth * volume;
|
4660 |
+
|
4661 |
+
// handle
|
4662 |
+
volumeHandle.css('left', Math.round(totalPosition.left + newLeft - (volumeHandle.width() / 2)));
|
4663 |
+
|
4664 |
+
// rezize the current part of the volume bar
|
4665 |
+
volumeCurrent.width(Math.round(newLeft));
|
4666 |
+
}
|
4667 |
+
},
|
4668 |
+
handleVolumeMove = function (e) {
|
4669 |
+
|
4670 |
+
var volume = null,
|
4671 |
+
totalOffset = volumeTotal.offset();
|
4672 |
+
|
4673 |
+
// calculate the new volume based on the moust position
|
4674 |
+
if (mode === 'vertical') {
|
4675 |
+
|
4676 |
+
var
|
4677 |
+
railHeight = volumeTotal.height(),
|
4678 |
+
newY = e.pageY - totalOffset.top;
|
4679 |
+
|
4680 |
+
volume = (railHeight - newY) / railHeight;
|
4681 |
+
|
4682 |
+
// the controls just hide themselves (usually when mouse moves too far up)
|
4683 |
+
if (totalOffset.top === 0 || totalOffset.left === 0) {
|
4684 |
+
return;
|
4685 |
+
}
|
4686 |
+
|
4687 |
+
} else {
|
4688 |
+
var
|
4689 |
+
railWidth = volumeTotal.width(),
|
4690 |
+
newX = e.pageX - totalOffset.left;
|
4691 |
+
|
4692 |
+
volume = newX / railWidth;
|
4693 |
+
}
|
4694 |
+
|
4695 |
+
// ensure the volume isn't outside 0-1
|
4696 |
+
volume = Math.max(0, volume);
|
4697 |
+
volume = Math.min(volume, 1);
|
4698 |
+
|
4699 |
+
// position the slider and handle
|
4700 |
+
positionVolumeHandle(volume);
|
4701 |
+
|
4702 |
+
// set the media object (this will trigger the volumechanged event)
|
4703 |
+
if (volume === 0) {
|
4704 |
+
media.setMuted(true);
|
4705 |
+
} else {
|
4706 |
+
media.setMuted(false);
|
4707 |
+
}
|
4708 |
+
media.setVolume(volume);
|
4709 |
+
},
|
4710 |
+
mouseIsDown = false,
|
4711 |
+
mouseIsOver = false;
|
4712 |
|
4713 |
// SLIDER
|
4714 |
+
|
4715 |
mute
|
4716 |
+
.hover(function () {
|
4717 |
+
volumeSlider.show();
|
4718 |
+
mouseIsOver = true;
|
4719 |
+
}, function () {
|
4720 |
+
mouseIsOver = false;
|
4721 |
+
|
4722 |
+
if (!mouseIsDown && mode == 'vertical') {
|
4723 |
+
volumeSlider.hide();
|
4724 |
+
}
|
4725 |
+
});
|
4726 |
+
|
4727 |
+
var updateVolumeSlider = function (e) {
|
4728 |
+
|
4729 |
+
var volume = Math.floor(media.volume * 100);
|
4730 |
+
|
4731 |
+
volumeSlider.attr({
|
4732 |
+
'aria-label': mejs.i18n.t('mejs.volume-slider'),
|
4733 |
+
'aria-valuemin': 0,
|
4734 |
+
'aria-valuemax': 100,
|
4735 |
+
'aria-valuenow': volume,
|
4736 |
+
'aria-valuetext': volume + '%',
|
4737 |
+
'role': 'slider',
|
4738 |
+
'tabindex': 0
|
4739 |
});
|
4740 |
+
|
4741 |
+
};
|
4742 |
+
|
4743 |
volumeSlider
|
4744 |
+
.bind('mouseover', function () {
|
4745 |
+
mouseIsOver = true;
|
4746 |
+
})
|
4747 |
+
.bind('mousedown', function (e) {
|
4748 |
+
handleVolumeMove(e);
|
4749 |
+
t.globalBind('mousemove.vol', function (e) {
|
4750 |
handleVolumeMove(e);
|
4751 |
+
});
|
4752 |
+
t.globalBind('mouseup.vol', function () {
|
4753 |
+
mouseIsDown = false;
|
4754 |
+
t.globalUnbind('.vol');
|
|
|
|
|
|
|
4755 |
|
4756 |
+
if (!mouseIsOver && mode == 'vertical') {
|
4757 |
+
volumeSlider.hide();
|
4758 |
+
}
|
|
|
|
|
|
|
|
|
4759 |
});
|
4760 |
+
mouseIsDown = true;
|
4761 |
+
|
4762 |
+
return false;
|
4763 |
+
})
|
4764 |
+
.bind('keydown', function (e) {
|
4765 |
+
var keyCode = e.keyCode;
|
4766 |
+
var volume = media.volume;
|
4767 |
+
switch (keyCode) {
|
4768 |
+
case 38: // Up
|
4769 |
+
volume = Math.min(volume + 0.1, 1);
|
4770 |
+
break;
|
4771 |
+
case 40: // Down
|
4772 |
+
volume = Math.max(0, volume - 0.1);
|
4773 |
+
break;
|
4774 |
+
default:
|
4775 |
+
return true;
|
4776 |
+
}
|
4777 |
|
4778 |
+
mouseIsDown = false;
|
4779 |
+
positionVolumeHandle(volume);
|
4780 |
+
media.setVolume(volume);
|
4781 |
+
return false;
|
4782 |
+
});
|
4783 |
|
4784 |
// MUTE button
|
4785 |
+
mute.find('button').click(function () {
|
4786 |
+
media.setMuted(!media.muted);
|
4787 |
+
});
|
4788 |
+
|
4789 |
+
//Keyboard input
|
4790 |
+
mute.find('button').bind('focus', function () {
|
4791 |
+
volumeSlider.show();
|
4792 |
});
|
4793 |
|
4794 |
// listen for volume change events from other sources
|
4795 |
+
media.addEventListener('volumechange', function (e) {
|
4796 |
if (!mouseIsDown) {
|
4797 |
if (media.muted) {
|
4798 |
positionVolumeHandle(0);
|
4802 |
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
4803 |
}
|
4804 |
}
|
4805 |
+
updateVolumeSlider(e);
|
4806 |
}, false);
|
4807 |
|
4808 |
+
// mutes the media and sets the volume icon muted if the initial volume is set to 0
|
4809 |
+
if (player.options.startVolume === 0) {
|
4810 |
+
media.setMuted(true);
|
4811 |
+
}
|
4812 |
+
|
4813 |
+
// shim gets the startvolume as a parameter, but we have to set it on the native <video> and <audio> elements
|
4814 |
+
if (media.pluginType === 'native') {
|
4815 |
+
media.setVolume(player.options.startVolume);
|
4816 |
}
|
4817 |
+
|
4818 |
+
t.container.on('controlsresize', function () {
|
4819 |
+
if (media.muted) {
|
4820 |
+
positionVolumeHandle(0);
|
4821 |
+
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
4822 |
+
} else {
|
4823 |
+
positionVolumeHandle(media.volume);
|
4824 |
+
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
4825 |
+
}
|
4826 |
+
});
|
4827 |
}
|
4828 |
});
|
4829 |
+
|
4830 |
})(mejs.$);
|
4831 |
|
4832 |
(function($) {
|
4834 |
$.extend(mejs.MepDefaults, {
|
4835 |
usePluginFullScreen: true,
|
4836 |
newWindowCallback: function() { return '';},
|
4837 |
+
fullscreenText: ''
|
4838 |
});
|
4839 |
|
4840 |
$.extend(MediaElementPlayer.prototype, {
|
4843 |
|
4844 |
isNativeFullScreen: false,
|
4845 |
|
|
|
|
|
4846 |
isInIframe: false,
|
4847 |
+
|
4848 |
+
// Possible modes
|
4849 |
+
// (1) 'native-native' HTML5 video + browser fullscreen (IE10+, etc.)
|
4850 |
+
// (2) 'plugin-native' plugin video + browser fullscreen (fails in some versions of Firefox)
|
4851 |
+
// (3) 'fullwindow' Full window (retains all UI)
|
4852 |
+
// usePluginFullScreen = true
|
4853 |
+
// (4) 'plugin-click' Flash 1 - click through with pointer events
|
4854 |
+
// (5) 'plugin-hover' Flash 2 - hover popup in flash (IE6-8)
|
4855 |
+
fullscreenMode: '',
|
4856 |
|
4857 |
buildfullscreen: function(player, controls, layers, media) {
|
4858 |
|
4859 |
if (!player.isVideo)
|
4860 |
return;
|
4861 |
+
|
4862 |
+
player.isInIframe = (window.location != window.parent.location);
|
4863 |
+
|
4864 |
+
// detect on start
|
4865 |
+
media.addEventListener('loadstart', function() { player.detectFullscreenMode(); });
|
4866 |
+
|
4867 |
+
// build button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4868 |
var t = this,
|
4869 |
+
hideTimeout = null,
|
4870 |
+
fullscreenTitle = t.options.fullscreenText ? t.options.fullscreenText : mejs.i18n.t('mejs.fullscreen'),
|
|
|
4871 |
fullscreenBtn =
|
4872 |
$('<div class="mejs-button mejs-fullscreen-button">' +
|
4873 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + fullscreenTitle + '" aria-label="' + fullscreenTitle + '"></button>' +
|
4874 |
'</div>')
|
4875 |
+
.appendTo(controls)
|
4876 |
+
.on('click', function() {
|
4877 |
+
|
4878 |
+
// toggle fullscreen
|
|
|
4879 |
var isFullScreen = (mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || player.isFullScreen;
|
4880 |
+
|
4881 |
if (isFullScreen) {
|
4882 |
player.exitFullScreen();
|
4883 |
} else {
|
4884 |
player.enterFullScreen();
|
4885 |
}
|
4886 |
+
})
|
4887 |
+
.on('mouseover', function() {
|
4888 |
+
|
4889 |
+
// very old browsers with a plugin
|
4890 |
+
if (t.fullscreenMode == 'plugin-hover') {
|
4891 |
+
if (hideTimeout !== null) {
|
4892 |
+
clearTimeout(hideTimeout);
|
4893 |
+
delete hideTimeout;
|
4894 |
+
}
|
4895 |
+
|
4896 |
+
var buttonPos = fullscreenBtn.offset(),
|
4897 |
+
containerPos = player.container.offset();
|
4898 |
+
|
4899 |
+
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, true);
|
4900 |
+
}
|
4901 |
|
4902 |
+
})
|
4903 |
+
.on('mouseout', function() {
|
4904 |
|
4905 |
+
if (t.fullscreenMode == 'plugin-hover') {
|
4906 |
+
if (hideTimeout !== null) {
|
4907 |
+
clearTimeout(hideTimeout);
|
4908 |
+
delete hideTimeout;
|
|
|
|
|
|
|
|
|
|
|
4909 |
}
|
4910 |
+
|
4911 |
+
hideTimeout = setTimeout(function() {
|
4912 |
+
media.hideFullscreenButton();
|
4913 |
+
}, 1500);
|
4914 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4915 |
|
4916 |
+
});
|
|
|
|
|
4917 |
|
4918 |
+
|
4919 |
+
|
4920 |
+
player.fullscreenBtn = fullscreenBtn;
|
4921 |
+
|
4922 |
+
t.globalBind('keydown',function (e) {
|
4923 |
+
if (e.keyCode == 27 && ((mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || t.isFullScreen)) {
|
4924 |
+
player.exitFullScreen();
|
4925 |
+
}
|
4926 |
+
});
|
4927 |
+
|
4928 |
+
t.normalHeight = 0;
|
4929 |
+
t.normalWidth = 0;
|
4930 |
+
|
4931 |
+
// setup native fullscreen event
|
4932 |
+
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
4933 |
+
|
4934 |
+
// chrome doesn't alays fire this in an iframe
|
4935 |
+
var fullscreenChanged = function(e) {
|
4936 |
+
if (player.isFullScreen) {
|
4937 |
+
if (mejs.MediaFeatures.isFullScreen()) {
|
4938 |
+
player.isNativeFullScreen = true;
|
4939 |
+
// reset the controls once we are fully in full screen
|
4940 |
+
player.setControlsSize();
|
4941 |
+
} else {
|
4942 |
+
player.isNativeFullScreen = false;
|
4943 |
+
// when a user presses ESC
|
4944 |
+
// make sure to put the player back into place
|
4945 |
+
player.exitFullScreen();
|
4946 |
+
}
|
4947 |
+
}
|
4948 |
+
};
|
4949 |
+
|
4950 |
+
player.globalBind(mejs.MediaFeatures.fullScreenEventName, fullscreenChanged);
|
4951 |
+
}
|
4952 |
|
4953 |
+
},
|
4954 |
+
|
4955 |
+
detectFullscreenMode: function() {
|
4956 |
+
|
4957 |
+
var t = this,
|
4958 |
+
mode = '',
|
4959 |
+
features = mejs.MediaFeatures;
|
4960 |
+
|
4961 |
+
if (features.hasTrueNativeFullScreen && t.media.pluginType === 'native') {
|
4962 |
+
mode = 'native-native';
|
4963 |
+
} else if (features.hasTrueNativeFullScreen && t.media.pluginType !== 'native' && !features.hasFirefoxPluginMovingProblem) {
|
4964 |
+
mode = 'plugin-native';
|
4965 |
+
} else if (t.usePluginFullScreen) {
|
4966 |
+
if (mejs.MediaFeatures.supportsPointerEvents) {
|
4967 |
+
mode = 'plugin-click';
|
4968 |
+
// this needs some special setup
|
4969 |
+
t.createPluginClickThrough();
|
4970 |
+
} else {
|
4971 |
+
mode = 'plugin-hover';
|
4972 |
+
}
|
4973 |
+
|
4974 |
+
} else {
|
4975 |
+
mode = 'fullwindow';
|
4976 |
+
}
|
4977 |
+
|
4978 |
+
|
4979 |
+
t.fullscreenMode = mode;
|
4980 |
+
return mode;
|
4981 |
+
},
|
4982 |
+
|
4983 |
+
isPluginClickThroughCreated: false,
|
4984 |
+
|
4985 |
+
createPluginClickThrough: function() {
|
4986 |
+
|
4987 |
+
var t = this;
|
4988 |
+
|
4989 |
+
// don't build twice
|
4990 |
+
if (t.isPluginClickThroughCreated) {
|
4991 |
+
return;
|
4992 |
+
}
|
4993 |
|
4994 |
+
// allows clicking through the fullscreen button and controls down directly to Flash
|
|
|
4995 |
|
4996 |
+
/*
|
4997 |
+
When a user puts his mouse over the fullscreen button, we disable the controls so that mouse events can go down to flash (pointer-events)
|
4998 |
+
We then put a divs over the video and on either side of the fullscreen button
|
4999 |
+
to capture mouse movement and restore the controls once the mouse moves outside of the fullscreen button
|
5000 |
+
*/
|
5001 |
|
5002 |
+
var fullscreenIsDisabled = false,
|
5003 |
+
restoreControls = function() {
|
5004 |
+
if (fullscreenIsDisabled) {
|
5005 |
+
// hide the hovers
|
5006 |
+
for (var i in hoverDivs) {
|
5007 |
+
hoverDivs[i].hide();
|
5008 |
+
}
|
5009 |
|
5010 |
+
// restore the control bar
|
5011 |
+
t.fullscreenBtn.css('pointer-events', '');
|
5012 |
+
t.controls.css('pointer-events', '');
|
|
|
|
|
5013 |
|
5014 |
+
// prevent clicks from pausing video
|
5015 |
+
t.media.removeEventListener('click', t.clickToPlayPauseCallback);
|
5016 |
|
5017 |
+
// store for later
|
5018 |
+
fullscreenIsDisabled = false;
|
5019 |
+
}
|
5020 |
+
},
|
5021 |
+
hoverDivs = {},
|
5022 |
+
hoverDivNames = ['top', 'left', 'right', 'bottom'],
|
5023 |
+
i, len,
|
5024 |
+
positionHoverDivs = function() {
|
5025 |
+
var fullScreenBtnOffsetLeft = fullscreenBtn.offset().left - t.container.offset().left,
|
5026 |
+
fullScreenBtnOffsetTop = fullscreenBtn.offset().top - t.container.offset().top,
|
5027 |
+
fullScreenBtnWidth = fullscreenBtn.outerWidth(true),
|
5028 |
+
fullScreenBtnHeight = fullscreenBtn.outerHeight(true),
|
5029 |
+
containerWidth = t.container.width(),
|
5030 |
+
containerHeight = t.container.height();
|
5031 |
+
|
5032 |
+
for (i in hoverDivs) {
|
5033 |
+
hoverDivs[i].css({position: 'absolute', top: 0, left: 0}); //, backgroundColor: '#f00'});
|
5034 |
+
}
|
5035 |
|
5036 |
+
// over video, but not controls
|
5037 |
+
hoverDivs['top']
|
5038 |
+
.width( containerWidth )
|
5039 |
+
.height( fullScreenBtnOffsetTop );
|
5040 |
+
|
5041 |
+
// over controls, but not the fullscreen button
|
5042 |
+
hoverDivs['left']
|
5043 |
+
.width( fullScreenBtnOffsetLeft )
|
5044 |
+
.height( fullScreenBtnHeight )
|
5045 |
+
.css({top: fullScreenBtnOffsetTop});
|
5046 |
+
|
5047 |
+
// after the fullscreen button
|
5048 |
+
hoverDivs['right']
|
5049 |
+
.width( containerWidth - fullScreenBtnOffsetLeft - fullScreenBtnWidth )
|
5050 |
+
.height( fullScreenBtnHeight )
|
5051 |
+
.css({top: fullScreenBtnOffsetTop,
|
5052 |
+
left: fullScreenBtnOffsetLeft + fullScreenBtnWidth});
|
5053 |
+
|
5054 |
+
// under the fullscreen button
|
5055 |
+
hoverDivs['bottom']
|
5056 |
+
.width( containerWidth )
|
5057 |
+
.height( containerHeight - fullScreenBtnHeight - fullScreenBtnOffsetTop )
|
5058 |
+
.css({top: fullScreenBtnOffsetTop + fullScreenBtnHeight});
|
5059 |
+
};
|
5060 |
|
5061 |
+
t.globalBind('resize', function() {
|
5062 |
+
positionHoverDivs();
|
5063 |
+
});
|
5064 |
|
5065 |
+
for (i = 0, len = hoverDivNames.length; i < len; i++) {
|
5066 |
+
hoverDivs[hoverDivNames[i]] = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls).hide();
|
5067 |
+
}
|
|
|
5068 |
|
5069 |
+
// on hover, kill the fullscreen button's HTML handling, allowing clicks down to Flash
|
5070 |
+
fullscreenBtn.on('mouseover',function() {
|
5071 |
|
5072 |
+
if (!t.isFullScreen) {
|
5073 |
|
5074 |
+
var buttonPos = fullscreenBtn.offset(),
|
5075 |
+
containerPos = player.container.offset();
|
5076 |
|
5077 |
+
// move the button in Flash into place
|
5078 |
+
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, false);
|
|
|
5079 |
|
5080 |
+
// allows click through
|
5081 |
+
t.fullscreenBtn.css('pointer-events', 'none');
|
5082 |
+
t.controls.css('pointer-events', 'none');
|
5083 |
|
5084 |
+
// restore click-to-play
|
5085 |
+
t.media.addEventListener('click', t.clickToPlayPauseCallback);
|
|
|
|
|
|
|
5086 |
|
5087 |
+
// show the divs that will restore things
|
5088 |
+
for (i in hoverDivs) {
|
5089 |
+
hoverDivs[i].show();
|
5090 |
+
}
|
5091 |
|
5092 |
+
positionHoverDivs();
|
5093 |
|
5094 |
+
fullscreenIsDisabled = true;
|
5095 |
+
}
|
5096 |
|
5097 |
+
});
|
|
|
5098 |
|
5099 |
+
// restore controls anytime the user enters or leaves fullscreen
|
5100 |
+
media.addEventListener('fullscreenchange', function(e) {
|
5101 |
+
t.isFullScreen = !t.isFullScreen;
|
5102 |
+
// don't allow plugin click to pause video - messes with
|
5103 |
+
// plugin's controls
|
5104 |
+
if (t.isFullScreen) {
|
5105 |
+
t.media.removeEventListener('click', t.clickToPlayPauseCallback);
|
5106 |
+
} else {
|
5107 |
+
t.media.addEventListener('click', t.clickToPlayPauseCallback);
|
5108 |
+
}
|
5109 |
+
restoreControls();
|
5110 |
+
});
|
5111 |
|
|
|
|
|
5112 |
|
5113 |
+
// the mouseout event doesn't work on the fullscren button, because we already killed the pointer-events
|
5114 |
+
// so we use the document.mousemove event to restore controls when the mouse moves outside the fullscreen button
|
5115 |
|
5116 |
+
t.globalBind('mousemove', function(e) {
|
|
|
5117 |
|
5118 |
+
// if the mouse is anywhere but the fullsceen button, then restore it all
|
5119 |
+
if (fullscreenIsDisabled) {
|
|
|
|
|
5120 |
|
5121 |
+
var fullscreenBtnPos = fullscreenBtn.offset();
|
|
|
|
|
5122 |
|
5123 |
|
5124 |
+
if (e.pageY < fullscreenBtnPos.top || e.pageY > fullscreenBtnPos.top + fullscreenBtn.outerHeight(true) ||
|
5125 |
+
e.pageX < fullscreenBtnPos.left || e.pageX > fullscreenBtnPos.left + fullscreenBtn.outerWidth(true)
|
5126 |
+
) {
|
5127 |
|
5128 |
+
fullscreenBtn.css('pointer-events', '');
|
5129 |
+
t.controls.css('pointer-events', '');
|
5130 |
|
5131 |
+
fullscreenIsDisabled = false;
|
5132 |
+
}
|
|
|
5133 |
}
|
5134 |
});
|
5135 |
|
5136 |
+
|
5137 |
+
t.isPluginClickThroughCreated = true;
|
5138 |
+
},
|
5139 |
+
|
5140 |
+
cleanfullscreen: function(player) {
|
5141 |
+
player.exitFullScreen();
|
5142 |
},
|
5143 |
+
|
5144 |
+
containerSizeTimeout: null,
|
5145 |
+
|
5146 |
enterFullScreen: function() {
|
5147 |
|
5148 |
var t = this;
|
5149 |
|
5150 |
+
if (mejs.MediaFeatures.isiOS && mejs.MediaFeatures.hasiOSFullScreen && typeof t.media.webkitEnterFullscreen === 'function') {
|
5151 |
+
t.media.webkitEnterFullscreen();
|
|
|
|
|
5152 |
return;
|
5153 |
}
|
5154 |
|
|
|
|
|
5155 |
// set it to not show scroll bars so 100% will work
|
5156 |
+
$(document.documentElement).addClass('mejs-fullscreen');
|
5157 |
|
5158 |
// store sizing
|
5159 |
+
t.normalHeight = t.container.height();
|
5160 |
+
t.normalWidth = t.container.width();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5161 |
|
5162 |
|
|
|
|
|
5163 |
|
5164 |
+
// attempt to do true fullscreen
|
5165 |
+
if (t.fullscreenMode === 'native-native' || t.fullscreenMode === 'plugin-native') {
|
|
|
|
|
|
|
5166 |
|
5167 |
+
mejs.MediaFeatures.requestFullScreen(t.container[0]);
|
5168 |
+
//return;
|
|
|
5169 |
|
5170 |
+
if (t.isInIframe) {
|
5171 |
+
// sometimes exiting from fullscreen doesn't work
|
5172 |
+
// notably in Chrome <iframe>. Fixed in version 17
|
5173 |
+
setTimeout(function checkFullscreen() {
|
5174 |
|
5175 |
+
if (t.isNativeFullScreen) {
|
5176 |
+
var percentErrorMargin = 0.002, // 0.2%
|
5177 |
+
windowWidth = $(window).width(),
|
5178 |
+
screenWidth = screen.width,
|
5179 |
+
absDiff = Math.abs(screenWidth - windowWidth),
|
5180 |
+
marginError = screenWidth * percentErrorMargin;
|
5181 |
|
5182 |
+
// check if the video is suddenly not really fullscreen
|
5183 |
+
if (absDiff > marginError) {
|
5184 |
+
// manually exit
|
5185 |
+
t.exitFullScreen();
|
5186 |
+
} else {
|
5187 |
+
// test again
|
5188 |
+
setTimeout(checkFullscreen, 500);
|
|
|
|
|
|
|
5189 |
}
|
5190 |
+
}
|
5191 |
+
|
5192 |
+
}, 1000);
|
5193 |
}
|
5194 |
+
|
5195 |
+
} else if (t.fullscreeMode == 'fullwindow') {
|
5196 |
+
// move into position
|
5197 |
+
|
5198 |
+
}
|
5199 |
+
|
|
|
5200 |
// make full size
|
5201 |
t.container
|
5202 |
.addClass('mejs-container-fullscreen')
|
5207 |
// Only needed for safari 5.1 native full screen, can cause display issues elsewhere
|
5208 |
// Actually, it seems to be needed for IE8, too
|
5209 |
//if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
5210 |
+
t.containerSizeTimeout = setTimeout(function() {
|
5211 |
t.container.css({width: '100%', height: '100%'});
|
5212 |
t.setControlsSize();
|
5213 |
}, 500);
|
5214 |
//}
|
5215 |
|
5216 |
+
if (t.media.pluginType === 'native') {
|
5217 |
t.$media
|
5218 |
.width('100%')
|
5219 |
.height('100%');
|
5220 |
} else {
|
5221 |
+
t.container.find('.mejs-shim')
|
5222 |
.width('100%')
|
5223 |
+
.height('100%');
|
5224 |
+
|
5225 |
+
setTimeout(function() {
|
5226 |
+
var win = $(window),
|
5227 |
+
winW = win.width(),
|
5228 |
+
winH = win.height();
|
5229 |
+
|
5230 |
+
t.media.setVideoSize(winW,winH);
|
5231 |
+
}, 500);
|
5232 |
}
|
5233 |
|
5234 |
t.layers.children('div')
|
5243 |
|
5244 |
t.setControlsSize();
|
5245 |
t.isFullScreen = true;
|
5246 |
+
|
5247 |
+
var zoomFactor = Math.min(screen.width / t.width, screen.height / t.height);
|
5248 |
+
t.container.find('.mejs-captions-text').css('font-size', zoomFactor * 100 + '%');
|
5249 |
+
t.container.find('.mejs-captions-text').css('line-height', 'normal');
|
5250 |
+
t.container.find('.mejs-captions-position').css('bottom', '45px');
|
5251 |
+
|
5252 |
+
t.container.trigger('enteredfullscreen');
|
5253 |
},
|
5254 |
|
5255 |
exitFullScreen: function() {
|
5256 |
|
5257 |
var t = this;
|
5258 |
|
5259 |
+
// Prevent container from attempting to stretch a second time
|
5260 |
+
clearTimeout(t.containerSizeTimeout);
|
5261 |
+
|
5262 |
// firefox can't adjust plugins
|
5263 |
+
/*
|
5264 |
if (t.media.pluginType !== 'native' && mejs.MediaFeatures.isFirefox) {
|
5265 |
t.media.setFullscreen(false);
|
5266 |
//player.isFullScreen = false;
|
5267 |
return;
|
5268 |
}
|
5269 |
+
*/
|
5270 |
|
5271 |
+
// come out of native fullscreen
|
5272 |
if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || t.isFullScreen)) {
|
5273 |
mejs.MediaFeatures.cancelFullScreen();
|
5274 |
}
|
5275 |
|
5276 |
// restore scroll bars to document
|
5277 |
+
$(document.documentElement).removeClass('mejs-fullscreen');
|
5278 |
|
5279 |
t.container
|
5280 |
.removeClass('mejs-container-fullscreen')
|
5281 |
+
.width(t.normalWidth)
|
5282 |
+
.height(t.normalHeight);
|
|
|
5283 |
|
5284 |
+
if (t.media.pluginType === 'native') {
|
5285 |
t.$media
|
5286 |
+
.width(t.normalWidth)
|
5287 |
+
.height(t.normalHeight);
|
5288 |
} else {
|
5289 |
+
t.container.find('.mejs-shim')
|
5290 |
+
.width(t.normalWidth)
|
5291 |
+
.height(t.normalHeight);
|
5292 |
|
5293 |
+
t.media.setVideoSize(t.normalWidth, t.normalHeight);
|
5294 |
}
|
5295 |
|
5296 |
t.layers.children('div')
|
5297 |
+
.width(t.normalWidth)
|
5298 |
+
.height(t.normalHeight);
|
5299 |
|
5300 |
t.fullscreenBtn
|
5301 |
.removeClass('mejs-unfullscreen')
|
5303 |
|
5304 |
t.setControlsSize();
|
5305 |
t.isFullScreen = false;
|
5306 |
+
|
5307 |
+
t.container.find('.mejs-captions-text').css('font-size','');
|
5308 |
+
t.container.find('.mejs-captions-text').css('line-height', '');
|
5309 |
+
t.container.find('.mejs-captions-position').css('bottom', '');
|
5310 |
+
|
5311 |
+
t.container.trigger('exitedfullscreen');
|
5312 |
}
|
5313 |
});
|
5314 |
|
5316 |
|
5317 |
(function($) {
|
5318 |
|
5319 |
+
// Speed
|
5320 |
+
$.extend(mejs.MepDefaults, {
|
5321 |
+
|
5322 |
+
// We also support to pass object like this:
|
5323 |
+
// [{name: 'Slow', value: '0.75'}, {name: 'Normal', value: '1.00'}, ...]
|
5324 |
+
speeds: ['2.00', '1.50', '1.25', '1.00', '0.75'],
|
5325 |
+
|
5326 |
+
defaultSpeed: '1.00',
|
5327 |
+
|
5328 |
+
speedChar: 'x'
|
5329 |
+
|
5330 |
+
});
|
5331 |
+
|
5332 |
+
$.extend(MediaElementPlayer.prototype, {
|
5333 |
+
|
5334 |
+
buildspeed: function(player, controls, layers, media) {
|
5335 |
+
var t = this;
|
5336 |
+
|
5337 |
+
if (t.media.pluginType == 'native') {
|
5338 |
+
var
|
5339 |
+
speedButton = null,
|
5340 |
+
speedSelector = null,
|
5341 |
+
playbackSpeed = null,
|
5342 |
+
inputId = null;
|
5343 |
+
|
5344 |
+
var speeds = [];
|
5345 |
+
var defaultInArray = false;
|
5346 |
+
for (var i=0, len=t.options.speeds.length; i < len; i++) {
|
5347 |
+
var s = t.options.speeds[i];
|
5348 |
+
if (typeof(s) === 'string'){
|
5349 |
+
speeds.push({
|
5350 |
+
name: s + t.options.speedChar,
|
5351 |
+
value: s
|
5352 |
+
});
|
5353 |
+
if(s === t.options.defaultSpeed) {
|
5354 |
+
defaultInArray = true;
|
5355 |
+
}
|
5356 |
+
}
|
5357 |
+
else {
|
5358 |
+
speeds.push(s);
|
5359 |
+
if(s.value === t.options.defaultSpeed) {
|
5360 |
+
defaultInArray = true;
|
5361 |
+
}
|
5362 |
+
}
|
5363 |
+
}
|
5364 |
+
|
5365 |
+
if (!defaultInArray) {
|
5366 |
+
speeds.push({
|
5367 |
+
name: t.options.defaultSpeed + t.options.speedChar,
|
5368 |
+
value: t.options.defaultSpeed
|
5369 |
+
});
|
5370 |
+
}
|
5371 |
+
|
5372 |
+
speeds.sort(function(a, b) {
|
5373 |
+
return parseFloat(b.value) - parseFloat(a.value);
|
5374 |
+
});
|
5375 |
+
|
5376 |
+
var getSpeedNameFromValue = function(value) {
|
5377 |
+
for(i=0,len=speeds.length; i <len; i++) {
|
5378 |
+
if (speeds[i].value === value) {
|
5379 |
+
return speeds[i].name;
|
5380 |
+
}
|
5381 |
+
}
|
5382 |
+
};
|
5383 |
+
|
5384 |
+
var html = '<div class="mejs-button mejs-speed-button">' +
|
5385 |
+
'<button type="button">' + getSpeedNameFromValue(t.options.defaultSpeed) + '</button>' +
|
5386 |
+
'<div class="mejs-speed-selector">' +
|
5387 |
+
'<ul>';
|
5388 |
+
|
5389 |
+
for (i = 0, il = speeds.length; i<il; i++) {
|
5390 |
+
inputId = t.id + '-speed-' + speeds[i].value;
|
5391 |
+
html += '<li>' +
|
5392 |
+
'<input type="radio" name="speed" ' +
|
5393 |
+
'value="' + speeds[i].value + '" ' +
|
5394 |
+
'id="' + inputId + '" ' +
|
5395 |
+
(speeds[i].value === t.options.defaultSpeed ? ' checked' : '') +
|
5396 |
+
' />' +
|
5397 |
+
'<label for="' + inputId + '" ' +
|
5398 |
+
(speeds[i].value === t.options.defaultSpeed ? ' class="mejs-speed-selected"' : '') +
|
5399 |
+
'>' + speeds[i].name + '</label>' +
|
5400 |
+
'</li>';
|
5401 |
+
}
|
5402 |
+
html += '</ul></div></div>';
|
5403 |
+
|
5404 |
+
speedButton = $(html).appendTo(controls);
|
5405 |
+
speedSelector = speedButton.find('.mejs-speed-selector');
|
5406 |
+
|
5407 |
+
playbackSpeed = t.options.defaultSpeed;
|
5408 |
+
|
5409 |
+
media.addEventListener('loadedmetadata', function(e) {
|
5410 |
+
if (playbackSpeed) {
|
5411 |
+
media.playbackRate = parseFloat(playbackSpeed);
|
5412 |
+
}
|
5413 |
+
}, true);
|
5414 |
+
|
5415 |
+
speedSelector
|
5416 |
+
.on('click', 'input[type="radio"]', function() {
|
5417 |
+
var newSpeed = $(this).attr('value');
|
5418 |
+
playbackSpeed = newSpeed;
|
5419 |
+
media.playbackRate = parseFloat(newSpeed);
|
5420 |
+
speedButton.find('button').html(getSpeedNameFromValue(newSpeed));
|
5421 |
+
speedButton.find('.mejs-speed-selected').removeClass('mejs-speed-selected');
|
5422 |
+
speedButton.find('input[type="radio"]:checked').next().addClass('mejs-speed-selected');
|
5423 |
+
});
|
5424 |
+
speedButton
|
5425 |
+
.one( 'mouseenter focusin', function() {
|
5426 |
+
speedSelector
|
5427 |
+
.height(
|
5428 |
+
speedButton.find('.mejs-speed-selector ul').outerHeight(true) +
|
5429 |
+
speedButton.find('.mejs-speed-translations').outerHeight(true))
|
5430 |
+
.css('top', (-1 * speedSelector.height()) + 'px');
|
5431 |
+
});
|
5432 |
+
}
|
5433 |
+
}
|
5434 |
+
});
|
5435 |
+
|
5436 |
+
})(mejs.$);
|
5437 |
+
|
5438 |
+
(function($) {
|
5439 |
+
|
5440 |
+
// add extra default options
|
5441 |
+
$.extend(mejs.MepDefaults, {
|
5442 |
+
// this will automatically turn on a <track>
|
5443 |
+
startLanguage: '',
|
5444 |
+
|
5445 |
+
tracksText: '',
|
5446 |
+
|
5447 |
+
// By default, no WAI-ARIA live region - don't make a
|
5448 |
+
// screen reader speak captions over an audio track.
|
5449 |
+
tracksAriaLive: false,
|
5450 |
+
|
5451 |
+
// option to remove the [cc] button when no <track kind="subtitles"> are present
|
5452 |
+
hideCaptionsButtonWhenEmpty: true,
|
5453 |
+
|
5454 |
+
// If true and we only have one track, change captions to popup
|
5455 |
+
toggleCaptionsButtonWhenOnlyOne: false,
|
5456 |
+
|
5457 |
+
// #id or .class
|
5458 |
+
slidesSelector: ''
|
5459 |
});
|
5460 |
|
5461 |
$.extend(MediaElementPlayer.prototype, {
|
5462 |
+
|
5463 |
hasChapters: false,
|
5464 |
|
5465 |
+
cleartracks: function(player, controls, layers, media){
|
5466 |
+
if(player) {
|
5467 |
+
if(player.captions) player.captions.remove();
|
5468 |
+
if(player.chapters) player.chapters.remove();
|
5469 |
+
if(player.captionsText) player.captionsText.remove();
|
5470 |
+
if(player.captionsButton) player.captionsButton.remove();
|
5471 |
+
}
|
5472 |
+
},
|
5473 |
buildtracks: function(player, controls, layers, media) {
|
5474 |
+
if (player.tracks.length === 0)
|
|
|
|
|
|
|
5475 |
return;
|
5476 |
|
5477 |
+
var t = this,
|
5478 |
+
attr = t.options.tracksAriaLive ?
|
5479 |
+
'role="log" aria-live="assertive" aria-atomic="false"' : '',
|
5480 |
+
tracksTitle = t.options.tracksText ? t.options.tracksText : mejs.i18n.t('mejs.captions-subtitles'),
|
5481 |
+
i,
|
5482 |
+
kind;
|
5483 |
|
5484 |
+
if (t.domNode.textTracks) { // if browser will do native captions, prefer mejs captions, loop through tracks and hide
|
5485 |
+
for (i = t.domNode.textTracks.length - 1; i >= 0; i--) {
|
5486 |
+
t.domNode.textTracks[i].mode = "hidden";
|
5487 |
+
}
|
5488 |
+
}
|
5489 |
+
t.cleartracks(player, controls, layers, media);
|
5490 |
+
player.chapters =
|
5491 |
$('<div class="mejs-chapters mejs-layer"></div>')
|
5492 |
.prependTo(layers).hide();
|
5493 |
+
player.captions =
|
5494 |
+
$('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover" ' +
|
5495 |
+
attr + '><span class="mejs-captions-text"></span></div></div>')
|
5496 |
.prependTo(layers).hide();
|
5497 |
player.captionsText = player.captions.find('.mejs-captions-text');
|
5498 |
+
player.captionsButton =
|
5499 |
$('<div class="mejs-button mejs-captions-button">'+
|
5500 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + tracksTitle + '" aria-label="' + tracksTitle + '"></button>'+
|
5501 |
'<div class="mejs-captions-selector">'+
|
5502 |
'<ul>'+
|
5503 |
'<li>'+
|
5504 |
'<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
|
5505 |
+
'<label for="' + player.id + '_captions_none">' + mejs.i18n.t('mejs.none') +'</label>'+
|
5506 |
'</li>' +
|
5507 |
'</ul>'+
|
5508 |
'</div>'+
|
5509 |
'</div>')
|
5510 |
+
.appendTo(controls);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5511 |
|
5512 |
+
|
5513 |
+
var subtitleCount = 0;
|
5514 |
+
for (i=0; i<player.tracks.length; i++) {
|
5515 |
+
kind = player.tracks[i].kind;
|
5516 |
+
if (kind === 'subtitles' || kind === 'captions') {
|
5517 |
+
subtitleCount++;
|
5518 |
+
}
|
5519 |
+
}
|
5520 |
+
|
5521 |
+
// if only one language then just make the button a toggle
|
5522 |
+
if (t.options.toggleCaptionsButtonWhenOnlyOne && subtitleCount == 1){
|
5523 |
+
// click
|
5524 |
+
player.captionsButton.on('click',function() {
|
5525 |
+
if (player.selectedTrack === null) {
|
5526 |
+
lang = player.tracks[0].srclang;
|
5527 |
+
} else {
|
5528 |
+
lang = 'none';
|
5529 |
+
}
|
5530 |
+
player.setTrack(lang);
|
5531 |
+
});
|
5532 |
+
} else {
|
5533 |
+
// hover or keyboard focus
|
5534 |
+
player.captionsButton.on( 'mouseenter focusin', function() {
|
5535 |
+
$(this).find('.mejs-captions-selector').removeClass('mejs-offscreen');
|
5536 |
+
})
|
5537 |
+
|
5538 |
+
// handle clicks to the language radio buttons
|
5539 |
+
.on('click','input[type=radio]',function() {
|
5540 |
+
lang = this.value;
|
5541 |
+
player.setTrack(lang);
|
5542 |
+
});
|
5543 |
+
|
5544 |
+
player.captionsButton.on( 'mouseleave focusout', function() {
|
5545 |
+
$(this).find(".mejs-captions-selector").addClass("mejs-offscreen");
|
5546 |
+
});
|
5547 |
+
|
5548 |
+
}
|
5549 |
|
5550 |
if (!player.options.alwaysShowControls) {
|
5551 |
// move with controls
|
5569 |
player.selectedTrack = null;
|
5570 |
player.isLoadingTrack = false;
|
5571 |
|
|
|
|
|
5572 |
// add to list
|
5573 |
for (i=0; i<player.tracks.length; i++) {
|
5574 |
+
kind = player.tracks[i].kind;
|
5575 |
+
if (kind === 'subtitles' || kind === 'captions') {
|
5576 |
player.addTrackButton(player.tracks[i].srclang, player.tracks[i].label);
|
5577 |
}
|
5578 |
}
|
5579 |
|
5580 |
+
// start loading tracks
|
5581 |
player.loadNextTrack();
|
5582 |
|
5583 |
+
media.addEventListener('timeupdate',function() {
|
|
|
5584 |
player.displayCaptions();
|
5585 |
}, false);
|
5586 |
|
5587 |
+
if (player.options.slidesSelector !== '') {
|
5588 |
+
player.slidesContainer = $(player.options.slidesSelector);
|
5589 |
+
|
5590 |
+
media.addEventListener('timeupdate',function() {
|
5591 |
+
player.displaySlides();
|
5592 |
+
}, false);
|
5593 |
+
|
5594 |
+
}
|
5595 |
+
|
5596 |
+
media.addEventListener('loadedmetadata', function() {
|
5597 |
player.displayChapters();
|
5598 |
}, false);
|
5599 |
|
5601 |
function () {
|
5602 |
// chapters
|
5603 |
if (player.hasChapters) {
|
5604 |
+
player.chapters.removeClass('mejs-offscreen');
|
5605 |
player.chapters.fadeIn(200).height(player.chapters.find('.mejs-chapter').outerHeight());
|
5606 |
}
|
5607 |
},
|
5608 |
function () {
|
5609 |
if (player.hasChapters && !media.paused) {
|
5610 |
player.chapters.fadeOut(200, function() {
|
5611 |
+
$(this).addClass('mejs-offscreen');
|
5612 |
$(this).css('display','block');
|
5613 |
});
|
5614 |
}
|
5615 |
});
|
5616 |
+
|
5617 |
+
t.container.on('controlsresize', function() {
|
5618 |
+
t.adjustLanguageBox();
|
5619 |
+
});
|
5620 |
+
|
5621 |
// check for autoplay
|
5622 |
if (player.node.getAttribute('autoplay') !== null) {
|
5623 |
+
player.chapters.addClass('mejs-offscreen');
|
5624 |
+
}
|
5625 |
+
},
|
5626 |
+
|
5627 |
+
setTrack: function(lang){
|
5628 |
+
|
5629 |
+
var t = this,
|
5630 |
+
i;
|
5631 |
+
|
5632 |
+
if (lang == 'none') {
|
5633 |
+
t.selectedTrack = null;
|
5634 |
+
t.captionsButton.removeClass('mejs-captions-enabled');
|
5635 |
+
} else {
|
5636 |
+
for (i=0; i<t.tracks.length; i++) {
|
5637 |
+
if (t.tracks[i].srclang == lang) {
|
5638 |
+
if (t.selectedTrack === null)
|
5639 |
+
t.captionsButton.addClass('mejs-captions-enabled');
|
5640 |
+
t.selectedTrack = t.tracks[i];
|
5641 |
+
t.captions.attr('lang', t.selectedTrack.srclang);
|
5642 |
+
t.displayCaptions();
|
5643 |
+
break;
|
5644 |
+
}
|
5645 |
+
}
|
5646 |
}
|
5647 |
},
|
5648 |
|
5656 |
} else {
|
5657 |
// add done?
|
5658 |
t.isLoadingTrack = false;
|
5659 |
+
|
5660 |
+
t.checkForTracks();
|
5661 |
}
|
5662 |
},
|
5663 |
|
5669 |
|
5670 |
track.isLoaded = true;
|
5671 |
|
|
|
|
|
5672 |
t.enableTrackButton(track.srclang, track.label);
|
5673 |
|
5674 |
t.loadNextTrack();
|
5676 |
};
|
5677 |
|
5678 |
|
5679 |
+
if (track.src !== undefined || track.src !== "") {
|
5680 |
+
$.ajax({
|
5681 |
+
url: track.src,
|
5682 |
+
dataType: "text",
|
5683 |
+
success: function(d) {
|
5684 |
|
5685 |
+
// parse the loaded file
|
5686 |
+
if (typeof d == "string" && (/<tt\s+xml/ig).exec(d)) {
|
5687 |
+
track.entries = mejs.TrackFormatParser.dfxp.parse(d);
|
5688 |
+
} else {
|
5689 |
+
track.entries = mejs.TrackFormatParser.webvtt.parse(d);
|
5690 |
+
}
|
|
|
|
|
5691 |
|
5692 |
+
after();
|
5693 |
+
|
5694 |
+
if (track.kind == 'chapters') {
|
5695 |
+
t.media.addEventListener('play', function() {
|
5696 |
+
if (t.media.duration > 0) {
|
5697 |
+
t.displayChapters(track);
|
5698 |
+
}
|
5699 |
+
}, false);
|
5700 |
+
}
|
5701 |
+
|
5702 |
+
if (track.kind == 'slides') {
|
5703 |
+
t.setupSlides(track);
|
5704 |
+
}
|
5705 |
+
},
|
5706 |
+
error: function() {
|
5707 |
+
t.removeTrackButton(track.srclang);
|
5708 |
+
t.loadNextTrack();
|
5709 |
}
|
5710 |
+
});
|
5711 |
+
}
|
|
|
|
|
|
|
5712 |
},
|
5713 |
|
5714 |
enableTrackButton: function(lang, label) {
|
5715 |
var t = this;
|
5716 |
+
|
5717 |
if (label === '') {
|
5718 |
label = mejs.language.codes[lang] || lang;
|
5719 |
+
}
|
5720 |
|
5721 |
t.captionsButton
|
5722 |
.find('input[value=' + lang + ']')
|
5726 |
|
5727 |
// auto select
|
5728 |
if (t.options.startLanguage == lang) {
|
5729 |
+
$('#' + t.id + '_captions_' + lang).prop('checked', true).trigger('click');
|
5730 |
}
|
5731 |
|
5732 |
t.adjustLanguageBox();
|
5733 |
},
|
5734 |
|
5735 |
+
removeTrackButton: function(lang) {
|
5736 |
+
var t = this;
|
5737 |
+
|
5738 |
+
t.captionsButton.find('input[value=' + lang + ']').closest('li').remove();
|
5739 |
+
|
5740 |
+
t.adjustLanguageBox();
|
5741 |
+
},
|
5742 |
+
|
5743 |
addTrackButton: function(lang, label) {
|
5744 |
var t = this;
|
5745 |
if (label === '') {
|
5768 |
);
|
5769 |
},
|
5770 |
|
5771 |
+
checkForTracks: function() {
|
5772 |
+
var
|
5773 |
+
t = this,
|
5774 |
+
hasSubtitles = false;
|
5775 |
+
|
5776 |
+
// check if any subtitles
|
5777 |
+
if (t.options.hideCaptionsButtonWhenEmpty) {
|
5778 |
+
for (var i=0; i<t.tracks.length; i++) {
|
5779 |
+
var kind = t.tracks[i].kind;
|
5780 |
+
if ((kind === 'subtitles' || kind === 'captions') && t.tracks[i].isLoaded) {
|
5781 |
+
hasSubtitles = true;
|
5782 |
+
break;
|
5783 |
+
}
|
5784 |
+
}
|
5785 |
+
|
5786 |
+
if (!hasSubtitles) {
|
5787 |
+
t.captionsButton.hide();
|
5788 |
+
t.setControlsSize();
|
5789 |
+
}
|
5790 |
+
}
|
5791 |
+
},
|
5792 |
+
|
5793 |
displayCaptions: function() {
|
5794 |
|
5795 |
if (typeof this.tracks == 'undefined')
|
5800 |
i,
|
5801 |
track = t.selectedTrack;
|
5802 |
|
5803 |
+
if (track !== null && track.isLoaded) {
|
5804 |
for (i=0; i<track.entries.times.length; i++) {
|
5805 |
+
if (t.media.currentTime >= track.entries.times[i].start && t.media.currentTime <= track.entries.times[i].stop) {
|
5806 |
+
// Set the line before the timecode as a class so the cue can be targeted if needed
|
5807 |
+
t.captionsText.html(track.entries.text[i]).attr('class', 'mejs-captions-text ' + (track.entries.times[i].identifier || ''));
|
5808 |
t.captions.show().height(0);
|
5809 |
return; // exit out if one is visible;
|
5810 |
}
|
5815 |
}
|
5816 |
},
|
5817 |
|
5818 |
+
setupSlides: function(track) {
|
5819 |
+
var t = this;
|
5820 |
+
|
5821 |
+
t.slides = track;
|
5822 |
+
t.slides.entries.imgs = [t.slides.entries.text.length];
|
5823 |
+
t.showSlide(0);
|
5824 |
+
|
5825 |
+
},
|
5826 |
+
|
5827 |
+
showSlide: function(index) {
|
5828 |
+
if (typeof this.tracks == 'undefined' || typeof this.slidesContainer == 'undefined') {
|
5829 |
+
return;
|
5830 |
+
}
|
5831 |
+
|
5832 |
+
var t = this,
|
5833 |
+
url = t.slides.entries.text[index],
|
5834 |
+
img = t.slides.entries.imgs[index];
|
5835 |
+
|
5836 |
+
if (typeof img == 'undefined' || typeof img.fadeIn == 'undefined') {
|
5837 |
+
|
5838 |
+
t.slides.entries.imgs[index] = img = $('<img src="' + url + '">')
|
5839 |
+
.on('load', function() {
|
5840 |
+
img.appendTo(t.slidesContainer)
|
5841 |
+
.hide()
|
5842 |
+
.fadeIn()
|
5843 |
+
.siblings(':visible')
|
5844 |
+
.fadeOut();
|
5845 |
+
|
5846 |
+
});
|
5847 |
+
|
5848 |
+
} else {
|
5849 |
+
|
5850 |
+
if (!img.is(':visible') && !img.is(':animated')) {
|
5851 |
+
|
5852 |
+
//
|
5853 |
+
|
5854 |
+
img.fadeIn()
|
5855 |
+
.siblings(':visible')
|
5856 |
+
.fadeOut();
|
5857 |
+
}
|
5858 |
+
}
|
5859 |
+
|
5860 |
+
},
|
5861 |
+
|
5862 |
+
displaySlides: function() {
|
5863 |
+
|
5864 |
+
if (typeof this.slides == 'undefined')
|
5865 |
+
return;
|
5866 |
+
|
5867 |
+
var
|
5868 |
+
t = this,
|
5869 |
+
slides = t.slides,
|
5870 |
+
i;
|
5871 |
+
|
5872 |
+
for (i=0; i<slides.entries.times.length; i++) {
|
5873 |
+
if (t.media.currentTime >= slides.entries.times[i].start && t.media.currentTime <= slides.entries.times[i].stop){
|
5874 |
+
|
5875 |
+
t.showSlide(i);
|
5876 |
+
|
5877 |
+
return; // exit out if one is visible;
|
5878 |
+
}
|
5879 |
+
}
|
5880 |
+
},
|
5881 |
+
|
5882 |
displayChapters: function() {
|
5883 |
+
var
|
5884 |
t = this,
|
5885 |
i;
|
5886 |
|
5894 |
},
|
5895 |
|
5896 |
drawChapters: function(chapters) {
|
5897 |
+
var
|
5898 |
t = this,
|
5899 |
i,
|
5900 |
dur,
|
5920 |
//}
|
5921 |
|
5922 |
t.chapters.append( $(
|
5923 |
+
'<div class="mejs-chapter" rel="' + chapters.entries.times[i].start + '" style="left: ' + usedPercent.toString() + '%;width: ' + percent.toString() + '%;">' +
|
5924 |
+
'<div class="mejs-chapter-block' + ((i==chapters.entries.times.length-1) ? ' mejs-chapter-block-last' : '') + '">' +
|
5925 |
+
'<span class="ch-title">' + chapters.entries.text[i] + '</span>' +
|
5926 |
+
'<span class="ch-time">' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].start, t.options) + '–' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].stop, t.options) + '</span>' +
|
5927 |
'</div>' +
|
5928 |
'</div>'));
|
5929 |
usedPercent += percent;
|
5932 |
t.chapters.find('div.mejs-chapter').click(function() {
|
5933 |
t.media.setCurrentTime( parseFloat( $(this).attr('rel') ) );
|
5934 |
if (t.media.paused) {
|
5935 |
+
t.media.play();
|
5936 |
}
|
5937 |
});
|
5938 |
|
5959 |
nl:'Dutch',
|
5960 |
en:'English',
|
5961 |
et:'Estonian',
|
5962 |
+
fl:'Filipino',
|
5963 |
fi:'Finnish',
|
5964 |
fr:'French',
|
5965 |
gl:'Galician',
|
5984 |
fa:'Persian',
|
5985 |
pl:'Polish',
|
5986 |
pt:'Portuguese',
|
5987 |
+
// 'pt-pt':'Portuguese (Portugal)',
|
5988 |
ro:'Romanian',
|
5989 |
ru:'Russian',
|
5990 |
sr:'Serbian',
|
6004 |
};
|
6005 |
|
6006 |
/*
|
6007 |
+
Parses WebVTT format which should be formatted as
|
6008 |
================================
|
6009 |
WEBVTT
|
6010 |
+
|
6011 |
1
|
6012 |
00:00:01,1 --> 00:00:05,000
|
6013 |
A line of text
|
6015 |
2
|
6016 |
00:01:15,1 --> 00:02:05,000
|
6017 |
A second line of text
|
6018 |
+
|
6019 |
===============================
|
6020 |
|
6021 |
Adapted from: http://www.delphiki.com/html5/playr
|
6022 |
*/
|
6023 |
mejs.TrackFormatParser = {
|
6024 |
+
webvtt: {
|
6025 |
+
pattern_timecode: /^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,
|
|
|
|
|
6026 |
|
6027 |
parse: function(trackText) {
|
6028 |
+
var
|
6029 |
i = 0,
|
6030 |
lines = mejs.TrackFormatParser.split2(trackText, /\r?\n/),
|
6031 |
entries = {text:[], times:[]},
|
6032 |
timecode,
|
6033 |
+
text,
|
6034 |
+
identifier;
|
6035 |
for(; i<lines.length; i++) {
|
6036 |
+
timecode = this.pattern_timecode.exec(lines[i]);
|
|
|
|
|
|
|
|
|
6037 |
|
6038 |
+
if (timecode && i<lines.length) {
|
6039 |
+
if ((i - 1) >= 0 && lines[i - 1] !== '') {
|
6040 |
+
identifier = lines[i - 1];
|
6041 |
+
}
|
6042 |
+
i++;
|
6043 |
+
// grab all the (possibly multi-line) text that follows
|
6044 |
+
text = lines[i];
|
6045 |
+
i++;
|
6046 |
+
while(lines[i] !== '' && i<lines.length){
|
6047 |
+
text = text + '\n' + lines[i];
|
6048 |
i++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6049 |
}
|
6050 |
+
text = $.trim(text).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
|
6051 |
+
// Text is in a different array so I can use .join
|
6052 |
+
entries.text.push(text);
|
6053 |
+
entries.times.push(
|
6054 |
+
{
|
6055 |
+
identifier: identifier,
|
6056 |
+
start: (mejs.Utility.convertSMPTEtoSeconds(timecode[1]) === 0) ? 0.200 : mejs.Utility.convertSMPTEtoSeconds(timecode[1]),
|
6057 |
+
stop: mejs.Utility.convertSMPTEtoSeconds(timecode[3]),
|
6058 |
+
settings: timecode[5]
|
6059 |
+
});
|
6060 |
}
|
6061 |
+
identifier = '';
|
6062 |
}
|
6063 |
return entries;
|
6064 |
}
|
6067 |
dfxp: {
|
6068 |
parse: function(trackText) {
|
6069 |
trackText = $(trackText).filter("tt");
|
6070 |
+
var
|
6071 |
i = 0,
|
6072 |
container = trackText.children("div").eq(0),
|
6073 |
lines = container.find("p"),
|
6074 |
styleNode = trackText.find("#" + container.attr("style")),
|
6075 |
styles,
|
|
|
|
|
6076 |
text,
|
6077 |
entries = {text:[], times:[]};
|
6078 |
|
6101 |
if (styles) {
|
6102 |
style = "";
|
6103 |
for (var _style in styles) {
|
6104 |
+
style += _style + ":" + styles[_style] + ";";
|
6105 |
}
|
6106 |
}
|
6107 |
if (style) _temp_times.style = style;
|
6108 |
+
if (_temp_times.start === 0) _temp_times.start = 0.200;
|
6109 |
entries.times.push(_temp_times);
|
6110 |
text = $.trim(lines.eq(i).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
|
6111 |
entries.text.push(text);
|
|
|
6112 |
}
|
6113 |
return entries;
|
6114 |
}
|
6119 |
return text.split(regex);
|
6120 |
}
|
6121 |
};
|
6122 |
+
|
6123 |
// test for browsers with bad String.split method.
|
6124 |
if ('x\n\ny'.split(/\n/gi).length != 3) {
|
6125 |
// add super slow IE8 and below version
|
6126 |
mejs.TrackFormatParser.split2 = function(text, regex) {
|
6127 |
+
var
|
6128 |
+
parts = [],
|
6129 |
chunk = '',
|
6130 |
i;
|
6131 |
|
6138 |
}
|
6139 |
parts.push(chunk);
|
6140 |
return parts;
|
6141 |
+
};
|
6142 |
+
}
|
6143 |
+
|
6144 |
+
})(mejs.$);
|
6145 |
+
|
6146 |
+
// Source Chooser Plugin
|
6147 |
+
(function($) {
|
6148 |
+
|
6149 |
+
$.extend(mejs.MepDefaults, {
|
6150 |
+
sourcechooserText: ''
|
6151 |
+
});
|
6152 |
+
|
6153 |
+
$.extend(MediaElementPlayer.prototype, {
|
6154 |
+
buildsourcechooser: function(player, controls, layers, media) {
|
6155 |
+
|
6156 |
+
var
|
6157 |
+
t = this,
|
6158 |
+
sourceTitle = t.options.sourcechooserText ? t.options.sourcechooserText : mejs.i18n.t('mejs.source-chooser'),
|
6159 |
+
hoverTimeout
|
6160 |
+
;
|
6161 |
+
|
6162 |
+
player.sourcechooserButton =
|
6163 |
+
$('<div class="mejs-button mejs-sourcechooser-button">'+
|
6164 |
+
'<button type="button" role="button" aria-haspopup="true" aria-owns="' + t.id + '" title="' + sourceTitle + '" aria-label="' + sourceTitle + '"></button>'+
|
6165 |
+
'<div class="mejs-sourcechooser-selector mejs-offscreen" role="menu" aria-expanded="false" aria-hidden="true">'+
|
6166 |
+
'<ul>'+
|
6167 |
+
'</ul>'+
|
6168 |
+
'</div>'+
|
6169 |
+
'</div>')
|
6170 |
+
.appendTo(controls)
|
6171 |
+
|
6172 |
+
// hover
|
6173 |
+
.hover(function() {
|
6174 |
+
clearTimeout(hoverTimeout);
|
6175 |
+
player.showSourcechooserSelector();
|
6176 |
+
}, function() {
|
6177 |
+
var self = $(this);
|
6178 |
+
hoverTimeout = setTimeout(function () {
|
6179 |
+
player.hideSourcechooserSelector();
|
6180 |
+
}, 500);
|
6181 |
+
})
|
6182 |
+
|
6183 |
+
// keyboard menu activation
|
6184 |
+
.on('keydown', function (e) {
|
6185 |
+
var keyCode = e.keyCode;
|
6186 |
+
|
6187 |
+
switch (keyCode) {
|
6188 |
+
case 32: // space
|
6189 |
+
if (!mejs.MediaFeatures.isFirefox) { // space sends the click event in Firefox
|
6190 |
+
player.showSourcechooserSelector();
|
6191 |
+
}
|
6192 |
+
$(this).find('.mejs-sourcechooser-selector')
|
6193 |
+
.find('input[type=radio]:checked').first().focus();
|
6194 |
+
break;
|
6195 |
+
case 13: // enter
|
6196 |
+
player.showSourcechooserSelector();
|
6197 |
+
$(this).find('.mejs-sourcechooser-selector')
|
6198 |
+
.find('input[type=radio]:checked').first().focus();
|
6199 |
+
break;
|
6200 |
+
case 27: // esc
|
6201 |
+
player.hideSourcechooserSelector();
|
6202 |
+
$(this).find('button').focus();
|
6203 |
+
break;
|
6204 |
+
default:
|
6205 |
+
return true;
|
6206 |
+
}
|
6207 |
+
})
|
6208 |
+
|
6209 |
+
// close menu when tabbing away
|
6210 |
+
.on('focusout', mejs.Utility.debounce(function (e) { // Safari triggers focusout multiple times
|
6211 |
+
// Firefox does NOT support e.relatedTarget to see which element
|
6212 |
+
// just lost focus, so wait to find the next focused element
|
6213 |
+
setTimeout(function () {
|
6214 |
+
var parent = $(document.activeElement).closest('.mejs-sourcechooser-selector');
|
6215 |
+
if (!parent.length) {
|
6216 |
+
// focus is outside the control; close menu
|
6217 |
+
player.hideSourcechooserSelector();
|
6218 |
+
}
|
6219 |
+
}, 0);
|
6220 |
+
}, 100))
|
6221 |
+
|
6222 |
+
// handle clicks to the source radio buttons
|
6223 |
+
.delegate('input[type=radio]', 'click', function() {
|
6224 |
+
// set aria states
|
6225 |
+
$(this).attr('aria-selected', true).attr('checked', 'checked');
|
6226 |
+
$(this).closest('.mejs-sourcechooser-selector').find('input[type=radio]').not(this).attr('aria-selected', 'false').removeAttr('checked');
|
6227 |
+
|
6228 |
+
var src = this.value;
|
6229 |
+
|
6230 |
+
if (media.currentSrc != src) {
|
6231 |
+
var currentTime = media.currentTime;
|
6232 |
+
var paused = media.paused;
|
6233 |
+
media.pause();
|
6234 |
+
media.setSrc(src);
|
6235 |
+
|
6236 |
+
media.addEventListener('loadedmetadata', function(e) {
|
6237 |
+
media.currentTime = currentTime;
|
6238 |
+
}, true);
|
6239 |
+
|
6240 |
+
var canPlayAfterSourceSwitchHandler = function(e) {
|
6241 |
+
if (!paused) {
|
6242 |
+
media.play();
|
6243 |
+
}
|
6244 |
+
media.removeEventListener("canplay", canPlayAfterSourceSwitchHandler, true);
|
6245 |
+
};
|
6246 |
+
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler, true);
|
6247 |
+
media.load();
|
6248 |
+
}
|
6249 |
+
})
|
6250 |
+
|
6251 |
+
// Handle click so that screen readers can toggle the menu
|
6252 |
+
.delegate('button', 'click', function (e) {
|
6253 |
+
if ($(this).siblings('.mejs-sourcechooser-selector').hasClass('mejs-offscreen')) {
|
6254 |
+
player.showSourcechooserSelector();
|
6255 |
+
$(this).siblings('.mejs-sourcechooser-selector').find('input[type=radio]:checked').first().focus();
|
6256 |
+
} else {
|
6257 |
+
player.hideSourcechooserSelector();
|
6258 |
+
}
|
6259 |
+
});
|
6260 |
+
|
6261 |
+
// add to list
|
6262 |
+
for (var i in this.node.children) {
|
6263 |
+
var src = this.node.children[i];
|
6264 |
+
if (src.nodeName === 'SOURCE' && (media.canPlayType(src.type) == 'probably' || media.canPlayType(src.type) == 'maybe')) {
|
6265 |
+
player.addSourceButton(src.src, src.title, src.type, media.src == src.src);
|
6266 |
+
}
|
6267 |
+
}
|
6268 |
+
},
|
6269 |
+
|
6270 |
+
addSourceButton: function(src, label, type, isCurrent) {
|
6271 |
+
var t = this;
|
6272 |
+
if (label === '' || label == undefined) {
|
6273 |
+
label = src;
|
6274 |
+
}
|
6275 |
+
type = type.split('/')[1];
|
6276 |
+
|
6277 |
+
t.sourcechooserButton.find('ul').append(
|
6278 |
+
$('<li>'+
|
6279 |
+
'<input type="radio" name="' + t.id + '_sourcechooser" id="' + t.id + '_sourcechooser_' + label + type + '" role="menuitemradio" value="' + src + '" ' + (isCurrent ? 'checked="checked"' : '') + 'aria-selected="' + isCurrent + '"' + ' />'+
|
6280 |
+
'<label for="' + t.id + '_sourcechooser_' + label + type + '" aria-hidden="true">' + label + ' (' + type + ')</label>'+
|
6281 |
+
'</li>')
|
6282 |
+
);
|
6283 |
+
|
6284 |
+
t.adjustSourcechooserBox();
|
6285 |
+
|
6286 |
+
},
|
6287 |
+
|
6288 |
+
adjustSourcechooserBox: function() {
|
6289 |
+
var t = this;
|
6290 |
+
// adjust the size of the outer box
|
6291 |
+
t.sourcechooserButton.find('.mejs-sourcechooser-selector').height(
|
6292 |
+
t.sourcechooserButton.find('.mejs-sourcechooser-selector ul').outerHeight(true)
|
6293 |
+
);
|
6294 |
+
},
|
6295 |
+
|
6296 |
+
hideSourcechooserSelector: function () {
|
6297 |
+
this.sourcechooserButton.find('.mejs-sourcechooser-selector')
|
6298 |
+
.addClass('mejs-offscreen')
|
6299 |
+
.attr('aria-expanded', 'false')
|
6300 |
+
.attr('aria-hidden', 'true')
|
6301 |
+
.find('input[type=radio]') // make radios not fucusable
|
6302 |
+
.attr('tabindex', '-1');
|
6303 |
+
},
|
6304 |
+
|
6305 |
+
showSourcechooserSelector: function () {
|
6306 |
+
this.sourcechooserButton.find('.mejs-sourcechooser-selector')
|
6307 |
+
.removeClass('mejs-offscreen')
|
6308 |
+
.attr('aria-expanded', 'true')
|
6309 |
+
.attr('aria-hidden', 'false')
|
6310 |
+
.find('input[type=radio]')
|
6311 |
+
.attr('tabindex', '0');
|
6312 |
}
|
6313 |
+
});
|
6314 |
|
6315 |
})(mejs.$);
|
6316 |
|
6333 |
return null;
|
6334 |
|
6335 |
if (player.isFullScreen) {
|
6336 |
+
return mejs.i18n.t('mejs.fullscreen-off');
|
6337 |
} else {
|
6338 |
+
return mejs.i18n.t('mejs.fullscreen-on');
|
6339 |
}
|
6340 |
},
|
6341 |
click: function(player) {
|
6351 |
{
|
6352 |
render: function(player) {
|
6353 |
if (player.media.muted) {
|
6354 |
+
return mejs.i18n.t('mejs.unmute');
|
6355 |
} else {
|
6356 |
+
return mejs.i18n.t('mejs.mute');
|
6357 |
}
|
6358 |
},
|
6359 |
click: function(player) {
|
6372 |
// demo of simple download video
|
6373 |
{
|
6374 |
render: function(player) {
|
6375 |
+
return mejs.i18n.t('mejs.download-video');
|
6376 |
},
|
6377 |
click: function(player) {
|
6378 |
window.location.href = player.media.currentSrc;
|
6403 |
});
|
6404 |
player.contextMenu.bind('mouseleave', function() {
|
6405 |
|
6406 |
+
//
|
6407 |
player.startContextMenuTimer();
|
6408 |
|
6409 |
});
|
6410 |
},
|
6411 |
+
|
6412 |
+
cleancontextmenu: function(player) {
|
6413 |
+
player.contextMenu.remove();
|
6414 |
+
},
|
6415 |
|
6416 |
isContextMenuEnabled: true,
|
6417 |
enableContextMenu: function() {
|
6423 |
|
6424 |
contextMenuTimeout: null,
|
6425 |
startContextMenuTimer: function() {
|
6426 |
+
//
|
6427 |
|
6428 |
var t = this;
|
6429 |
|
6437 |
killContextMenuTimer: function() {
|
6438 |
var timer = this.contextMenuTimer;
|
6439 |
|
6440 |
+
//
|
6441 |
|
6442 |
if (timer != null) {
|
6443 |
clearTimeout(timer);
|
6511 |
});
|
6512 |
|
6513 |
})(mejs.$);
|
6514 |
+
(function($) {
|
6515 |
+
// skip back button
|
6516 |
+
|
6517 |
+
$.extend(mejs.MepDefaults, {
|
6518 |
+
skipBackInterval: 30,
|
6519 |
+
// %1 will be replaced with skipBackInterval in this string
|
6520 |
+
skipBackText: ''
|
6521 |
+
});
|
6522 |
+
|
6523 |
+
$.extend(MediaElementPlayer.prototype, {
|
6524 |
+
buildskipback: function(player, controls, layers, media) {
|
6525 |
+
var
|
6526 |
+
t = this,
|
6527 |
+
defaultTitle = mejs.i18n.t('mejs.time-skip-back', t.options.skipBackInterval),
|
6528 |
+
skipTitle = t.options.skipBackText ? t.options.skipBackText : defaultTitle,
|
6529 |
+
// create the loop button
|
6530 |
+
loop =
|
6531 |
+
$('<div class="mejs-button mejs-skip-back-button">' +
|
6532 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + skipTitle + '" aria-label="' + skipTitle + '">' + t.options.skipBackInterval + '</button>' +
|
6533 |
+
'</div>')
|
6534 |
+
// append it to the toolbar
|
6535 |
+
.appendTo(controls)
|
6536 |
+
// add a click toggle event
|
6537 |
+
.click(function() {
|
6538 |
+
media.setCurrentTime(Math.max(media.currentTime - t.options.skipBackInterval, 0));
|
6539 |
+
$(this).find('button').blur();
|
6540 |
+
});
|
6541 |
+
}
|
6542 |
+
});
|
6543 |
+
|
6544 |
+
})(mejs.$);
|
6545 |
+
|
6546 |
/**
|
6547 |
* Postroll plugin
|
6548 |
*/
|
6549 |
(function($) {
|
6550 |
|
6551 |
$.extend(mejs.MepDefaults, {
|
6552 |
+
postrollCloseText: ''
|
6553 |
});
|
6554 |
|
6555 |
// Postroll
|
6557 |
buildpostroll: function(player, controls, layers, media) {
|
6558 |
var
|
6559 |
t = this,
|
6560 |
+
postrollTitle = t.options.postrollCloseText ? t.options.postrollCloseText : mejs.i18n.t('mejs.close'),
|
6561 |
postrollLink = t.container.find('link[rel="postroll"]').attr('href');
|
6562 |
|
6563 |
if (typeof postrollLink !== 'undefined') {
|
6564 |
player.postroll =
|
6565 |
+
$('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">' + postrollTitle + '</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(layers).hide();
|
6566 |
|
6567 |
t.media.addEventListener('ended', function (e) {
|
6568 |
$.ajax({
|
6579 |
});
|
6580 |
|
6581 |
})(mejs.$);
|
6582 |
+
/*
|
6583 |
+
MediaElement-Markers is a MediaElement.js plugin that lets you add Visual Cues in the progress time rail.
|
6584 |
+
This plugin also lets you register a custom callback function that will be called everytime the play position reaches a marker.
|
6585 |
+
Marker position and a reference to the MediaElement Player object is passed to the registered callback function for any post processing. Marker color is configurable.
|
6586 |
+
|
6587 |
+
*/
|
6588 |
+
|
6589 |
+
(function ($) {
|
6590 |
+
// markers
|
6591 |
+
|
6592 |
+
$.extend(mejs.MepDefaults, {
|
6593 |
+
markerColor: '#E9BC3D', //default marker color
|
6594 |
+
markers: [],
|
6595 |
+
markerCallback: function () {
|
6596 |
+
|
6597 |
+
}
|
6598 |
+
});
|
6599 |
+
|
6600 |
+
$.extend(MediaElementPlayer.prototype, {
|
6601 |
+
buildmarkers: function (player, controls, layers, media) {
|
6602 |
+
var t = this,
|
6603 |
+
i = 0,
|
6604 |
+
currentPos = -1,
|
6605 |
+
currentMarker = -1,
|
6606 |
+
lastPlayPos = -1, //Track backward seek
|
6607 |
+
lastMarkerCallBack = -1; //Prevents successive firing of callbacks
|
6608 |
+
|
6609 |
+
for (i = 0; i < player.options.markers.length; ++i) {
|
6610 |
+
controls.find('.mejs-time-total').append('<span class="mejs-time-marker"></span>');
|
6611 |
+
}
|
6612 |
+
|
6613 |
+
media.addEventListener('durationchange', function (e) {
|
6614 |
+
player.setmarkers(controls);
|
6615 |
+
});
|
6616 |
+
media.addEventListener('timeupdate', function (e) {
|
6617 |
+
currentPos = Math.floor(media.currentTime);
|
6618 |
+
if (lastPlayPos > currentPos) {
|
6619 |
+
if (lastMarkerCallBack > currentPos) {
|
6620 |
+
lastMarkerCallBack = -1;
|
6621 |
+
}
|
6622 |
+
} else {
|
6623 |
+
lastPlayPos = currentPos;
|
6624 |
+
}
|
6625 |
+
|
6626 |
+
for (i = 0; i < player.options.markers.length; ++i) {
|
6627 |
+
currentMarker = Math.floor(player.options.markers[i]);
|
6628 |
+
if (currentPos === currentMarker && currentMarker !== lastMarkerCallBack) {
|
6629 |
+
player.options.markerCallback(media, media.currentTime); //Fires the callback function
|
6630 |
+
lastMarkerCallBack = currentMarker;
|
6631 |
+
}
|
6632 |
+
}
|
6633 |
+
|
6634 |
+
}, false);
|
6635 |
|
6636 |
+
},
|
6637 |
+
setmarkers: function (controls) {
|
6638 |
+
var t = this,
|
6639 |
+
i = 0,
|
6640 |
+
left;
|
6641 |
+
|
6642 |
+
for (i = 0; i < t.options.markers.length; ++i) {
|
6643 |
+
if (Math.floor(t.options.markers[i]) <= t.media.duration && Math.floor(t.options.markers[i]) >= 0) {
|
6644 |
+
left = 100 * Math.floor(t.options.markers[i]) / t.media.duration;
|
6645 |
+
$(controls.find('.mejs-time-marker')[i]).css({
|
6646 |
+
"width": "1px",
|
6647 |
+
"left": left+"%",
|
6648 |
+
"background": t.options.markerColor
|
6649 |
+
});
|
6650 |
+
}
|
6651 |
+
}
|
6652 |
+
|
6653 |
+
}
|
6654 |
+
});
|
6655 |
+
})(mejs.$);
|
mediaelement/mediaelement-and-player.min.js
CHANGED
@@ -1,160 +1,43 @@
|
|
1 |
/*!
|
2 |
-
*
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
|
14 |
-
|
15 |
-
mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().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="",g,f=document.getElementsByTagName("script"),h=f.length,l=a.length;b<h;b++){g=f[b].src;for(c=0;c<l;c++){e=a[c];if(g.indexOf(e)>
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
this.src=mejs.Utility.absolutizeUrl(a);break}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.setVolume(a*100):this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){if(this.pluginType=="youtube"){a?this.pluginApi.mute():this.pluginApi.unMute();this.muted=a;this.dispatchEvent("volumechange")}else this.pluginApi.setMuted(a);
|
33 |
-
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&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.setFullscreen(true)},exitFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&
|
34 |
-
this.setFullscreen(false)},addEventListener:function(a,b){this.events[a]=this.events[a]||[];this.events[a].push(b)},removeEventListener:function(a,b){if(!a){this.events={};return true}var c=this.events[a];if(!c)return true;if(!b){this.events[a]=[];return true}for(i=0;i<c.length;i++)if(c[i]===b){this.events[a].splice(i,1);return true}return false},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)}},hasAttribute:function(a){return a in
|
35 |
-
this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){if(this.hasAttribute(a))return this.attributes[a];return""},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id)}};
|
36 |
-
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];if(b){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,
|
37 |
-
c)}},fireEvent:function(a,b,c){var d,e;a=this.pluginMediaElements[a];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)}};
|
38 |
-
mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:false,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",enablePluginSmoothing:false,silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:0.8,
|
39 |
-
success:function(){},error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
|
40 |
-
mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),g=e==="audio"||e==="video",f=g?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var h=d.getAttribute("autoplay"),l=d.getAttribute("preload"),j=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];f=typeof f=="undefined"||f===null||f==""?null:f;e=typeof e=="undefined"||e===null?"":e;l=typeof l=="undefined"||l===null||l==="false"?
|
41 |
-
"none":l;h=!(typeof h=="undefined"||h===null||h==="false");j=!(typeof j=="undefined"||j===null||j==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,g,f);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},false)}return this.updateNative(k,c,h,l)}else if(k.method!=="")return this.createPlugin(k,c,e,h,l,j);else{this.createErrorMessage(k,c,e);return this}},
|
42 |
-
determinePlayback:function(a,b,c,d,e){var g=[],f,h,l,j={method:"",url:"",htmlMediaElement:a,isVideo:a.tagName.toLowerCase()!="audio"},k;if(typeof b.type!="undefined"&&b.type!=="")if(typeof b.type=="string")g.push({type:b.type,url:e});else for(f=0;f<b.type.length;f++)g.push({type:b.type[f],url:e});else if(e!==null){l=this.formatType(e,a.getAttribute("type"));g.push({type:l,url:e})}else for(f=0;f<a.childNodes.length;f++){h=a.childNodes[f];if(h.nodeType==1&&h.tagName.toLowerCase()=="source"){e=h.getAttribute("src");
|
43 |
-
l=this.formatType(e,h.getAttribute("type"));h=h.getAttribute("media");if(!h||!window.matchMedia||window.matchMedia&&window.matchMedia(h).matches)g.push({type:l,url:e})}}if(!d&&g.length>0&&g[0].url!==null&&this.getTypeFromFile(g[0].url).indexOf("audio")>-1)j.isVideo=false;if(mejs.MediaFeatures.isBustedAndroid)a.canPlayType=function(m){return m.match(/video\/(mp4|m4v)/gi)!==null?"maybe":""};if(c&&(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="native")){if(!d){f=document.createElement(j.isVideo?
|
44 |
-
"video":"audio");a.parentNode.insertBefore(f,a);a.style.display="none";j.htmlMediaElement=a=f}for(f=0;f<g.length;f++)if(a.canPlayType(g[f].type).replace(/no/,"")!==""||a.canPlayType(g[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){j.method="native";j.url=g[f].url;break}if(j.method==="native"){if(j.url!==null)a.src=j.url;if(b.mode!=="auto_plugin")return j}}if(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="shim")for(f=0;f<g.length;f++){l=g[f].type;for(a=0;a<b.plugins.length;a++){e=b.plugins[a];
|
45 |
-
h=mejs.plugins[e];for(c=0;c<h.length;c++){k=h[c];if(k.version==null||mejs.PluginDetector.hasPluginVersion(e,k.version))for(d=0;d<k.types.length;d++)if(l==k.types[d]){j.method=e;j.url=g[f].url;return j}}}}if(b.mode==="auto_plugin"&&j.method==="native")return j;if(j.method===""&&g.length>0)j.url=g[0].url;return j},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},getTypeFromFile:function(a){a=a.split("?")[0];a=a.substring(a.lastIndexOf(".")+
|
46 |
-
1);return(/(mp4|m4v|ogg|ogv|webm|webmv|flv|wmv|mpeg|mov)/gi.test(a)?"video":"audio")+"/"+this.getTypeFromExtension(a)},getTypeFromExtension:function(a){switch(a){case "mp4":case "m4v":return"mp4";case "webm":case "webma":case "webmv":return"webm";case "ogg":case "oga":case "ogv":return"ogg";default:return a}},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className="me-cannotplay";try{e.style.width=d.width+"px";e.style.height=d.height+"px"}catch(g){}e.innerHTML=
|
47 |
-
c!==""?'<a href="'+a.url+'"><img src="'+c+'" width="100%" height="100%" /></a>':'<a href="'+a.url+'"><span>'+mejs.i18n.t("Download File")+"</span></a>";d.parentNode.insertBefore(e,d);d.style.display="none";b.error(d)},createPlugin:function(a,b,c,d,e,g){c=a.htmlMediaElement;var f=1,h=1,l="me_"+a.method+"_"+mejs.meIndex++,j=new mejs.PluginMediaElement(l,a.method,a.url),k=document.createElement("div"),m;j.tagName=c.tagName;for(m=0;m<c.attributes.length;m++){var n=c.attributes[m];n.specified==true&&j.setAttribute(n.name,
|
48 |
-
n.value)}for(m=c.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);break}m=m.parentNode}if(a.isVideo){f=b.videoWidth>0?b.videoWidth:c.getAttribute("width")!==null?c.getAttribute("width"):b.defaultVideoWidth;h=b.videoHeight>0?b.videoHeight:c.getAttribute("height")!==null?c.getAttribute("height"):b.defaultVideoHeight;f=mejs.Utility.encodeUrl(f);h=mejs.Utility.encodeUrl(h)}else if(b.enablePluginDebug){f=
|
49 |
-
320;h=240}j.success=b.success;mejs.MediaPluginBridge.registerPluginElement(l,j,c);k.className="me-plugin";k.id=l+"_container";a.isVideo?c.parentNode.insertBefore(k,c):document.body.insertBefore(k,document.body.childNodes[0]);d=["id="+l,"isvideo="+(a.isVideo?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+f,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"flashstreamer="+b.flashStreamer,"height="+h];if(a.url!==null)a.method=="flash"?d.push("file="+mejs.Utility.encodeUrl(a.url)):
|
50 |
-
d.push("file="+a.url);b.enablePluginDebug&&d.push("debug=true");b.enablePluginSmoothing&&d.push("smoothing=true");g&&d.push("controls=true");if(b.pluginVars)d=d.concat(b.pluginVars);switch(a.method){case "silverlight":k.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+l+'" name="'+l+'" width="'+f+'" height="'+h+'"><param name="initParams" value="'+d.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="'+
|
51 |
-
b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){a=document.createElement("div");k.appendChild(a);a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+l+'" width="'+f+'" height="'+h+'"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+d.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 k.innerHTML=
|
52 |
-
'<embed id="'+l+'" name="'+l+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+d.join("&")+'" width="'+f+'" height="'+h+'"></embed>';break;case "youtube":b=a.url.substr(a.url.lastIndexOf("=")+1);youtubeSettings={container:k,containerId:k.id,pluginMediaElement:j,pluginId:l,videoId:b,
|
53 |
-
height:h,width:f};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":j.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1);k.innerHTML='<iframe src="http://player.vimeo.com/video/'+j.vimeoid+'?portrait=0&byline=0&title=0" width="'+f+'" height="'+h+'" frameborder="0"></iframe>'}c.style.display="none";return j},updateNative:function(a,b){var c=a.htmlMediaElement,d;for(d in mejs.HtmlMediaElement)c[d]=
|
54 |
-
mejs.HtmlMediaElement[d];b.success(c,c);return c}};
|
55 |
-
mejs.YouTubeApi={isIframeStarted:false,isIframeLoaded:false,loadIframeApi:function(){if(!this.isIframeStarted){var a=document.createElement("script");a.src="http://www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);this.isIframeStarted=true}},iframeQueue:[],enqueueIframe:function(a){if(this.isLoaded)this.createIframe(a);else{this.loadIframeApi();this.iframeQueue.push(a)}},createIframe:function(a){var b=a.pluginMediaElement,c=new YT.Player(a.containerId,
|
56 |
-
{height:a.height,width:a.width,videoId:a.videoId,playerVars:{controls:0},events:{onReady:function(){a.pluginMediaElement.pluginApi=c;mejs.MediaPluginBridge.initPlugin(a.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(c,b,"timeupdate")},250)},onStateChange:function(d){mejs.YouTubeApi.handleStateChange(d.data,c,b)}}})},createEvent:function(a,b,c){c={type:c,target:b};if(a&&a.getDuration){b.currentTime=c.currentTime=a.getCurrentTime();b.duration=c.duration=a.getDuration();c.paused=b.paused;
|
57 |
-
c.ended=b.ended;c.muted=a.isMuted();c.volume=a.getVolume()/100;c.bytesTotal=a.getVideoBytesTotal();c.bufferedBytes=a.getVideoBytesLoaded();var d=c.bufferedBytes/c.bytesTotal*c.duration;c.target.buffered=c.buffered={start:function(){return 0},end:function(){return d},length:1}}b.dispatchEvent(c.type,c)},iFrameReady:function(){for(this.isIframeLoaded=this.isLoaded=true;this.iframeQueue.length>0;)this.createIframe(this.iframeQueue.pop())},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=
|
58 |
-
a;var b,c="http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+a.pluginId+"&version=3&autoplay=0&controls=0&modestbranding=1&loop=0";if(mejs.MediaFeatures.isIE){b=document.createElement("div");a.container.appendChild(b);b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'"><param name="movie" value="'+c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else a.container.innerHTML=
|
59 |
-
'<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; "><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c;mejs.MediaPluginBridge.initPlugin(a);c.cueVideoById(b.videoId);a=b.containerId+"_callback";window[a]=function(e){mejs.YouTubeApi.handleStateChange(e,
|
60 |
-
c,d)};c.addEventListener("onStateChange",a);setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250)},handleStateChange:function(a,b,c){switch(a){case -1:c.paused=true;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=false;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=false;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"play");mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=true;c.ended=false;mejs.YouTubeApi.createEvent(b,
|
61 |
-
c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress")}}};function onYouTubePlayerAPIReady(){mejs.YouTubeApi.iFrameReady()}function onYouTubePlayerReady(a){mejs.YouTubeApi.flashReady(a)}window.mejs=mejs;window.MediaElement=mejs.MediaElement;
|
62 |
-
(function(a,b,c){var d={locale:{strings:{}},methods:{}};d.locale.getLanguage=function(){return{language:navigator.language}};d.locale.INIT_LANGUAGE=d.locale.getLanguage();d.methods.checkPlain=function(e){var g,f,h={"&":"&",'"':""","<":"<",">":">"};e=String(e);for(g in h)if(h.hasOwnProperty(g)){f=RegExp(g,"g");e=e.replace(f,h[g])}return e};d.methods.formatString=function(e,g){for(var f in g){switch(f.charAt(0)){case "@":g[f]=d.methods.checkPlain(g[f]);break;case "!":break;default:g[f]=
|
63 |
-
'<em class="placeholder">'+d.methods.checkPlain(g[f])+"</em>"}e=e.replace(f,g[f])}return e};d.methods.t=function(e,g,f){if(d.locale.strings&&d.locale.strings[f.context]&&d.locale.strings[f.context][e])e=d.locale.strings[f.context][e];if(g)e=d.methods.formatString(e,g);return e};d.t=function(e,g,f){if(typeof e==="string"&&e.length>0){var h=d.locale.getLanguage();f=f||{context:h.language};return d.methods.t(e,g,f)}else throw{name:"InvalidArgumentException",message:"First argument is either not a string or empty."};
|
64 |
-
};c.i18n=d})(jQuery,document,mejs);(function(a){a.de={Fullscreen:"Vollbild","Go Fullscreen":"Vollbild an","Turn off Fullscreen":"Vollbild aus",Close:"Schlie\u00dfen"}})(mejs.i18n.locale.strings);
|
65 |
-
|
66 |
-
/*!
|
67 |
* MediaElementPlayer
|
68 |
* http://mediaelementjs.com/
|
69 |
*
|
70 |
* Creates a controller bar for HTML5 <video> add <audio> tags
|
71 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
72 |
*
|
73 |
-
* Copyright 2010-
|
74 |
* License: MIT
|
75 |
*
|
76 |
-
*/
|
77 |
-
(function(f){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return a.duration*0.05},defaultSeekForwardInterval:function(a){return a.duration*0.05},audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,autoRewind:true,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,clickToPlayPause:true,
|
78 |
-
iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:true,enableKeyboard:true,pauseOtherPlayers:true,keyActions:[{keys:[32,179],action:function(a,b){b.paused||b.ended?b.play():b.pause()}},{keys:[38],action:function(a,b){b.setVolume(Math.min(b.volume+0.1,1))}},{keys:[40],action:function(a,b){b.setVolume(Math.max(b.volume-0.1,0))}},{keys:[37,227],action:function(a,b){if(!isNaN(b.duration)&&
|
79 |
-
b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.max(b.currentTime-a.options.defaultSeekBackwardInterval(b),0);b.setCurrentTime(c)}}},{keys:[39,228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.min(b.currentTime+a.options.defaultSeekForwardInterval(b),b.duration);b.setCurrentTime(c)}}},{keys:[70],action:function(a){if(typeof a.enterFullScreen!="undefined")a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}}]};
|
80 |
-
mejs.mepIndex=0;mejs.players=[];mejs.MediaElementPlayer=function(a,b){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,b);this.$media=this.$node=f(a);this.node=this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;if(typeof b=="undefined")b=this.$node.data("mejsoptions");this.options=f.extend({},mejs.MepDefaults,b);mejs.players.push(this);this.init();return this};mejs.MediaElementPlayer.prototype={hasFocus:false,
|
81 |
-
controlsAreVisible:true,init:function(){var a=this,b=mejs.MediaFeatures,c=f.extend(true,{},a.options,{success:function(e,g){a.meReady(e,g)},error:function(e){a.handleError(e)}}),d=a.media.tagName.toLowerCase();a.isDynamic=d!=="audio"&&d!=="video";a.isVideo=a.isDynamic?a.options.isVideo:d!=="audio"&&a.options.isVideo;if(b.isiPad&&a.options.iPadUseNativeControls||b.isiPhone&&a.options.iPhoneUseNativeControls){a.$media.attr("controls","controls");if(b.isiPad&&a.media.getAttribute("autoplay")!==null){a.media.load();
|
82 |
-
a.media.play()}}else if(!(b.isAndroid&&a.AndroidUseNativeControls)){a.$media.removeAttr("controls");a.id="mep_"+mejs.mepIndex++;a.container=f('<div id="'+a.id+'" class="mejs-container '+(mejs.MediaFeatures.svg?"svg":"no-svg")+'"><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.addClass((b.isAndroid?"mejs-android ":
|
83 |
-
"")+(b.isiOS?"mejs-ios ":"")+(b.isiPad?"mejs-ipad ":"")+(b.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio "));if(b.isiOS){b=a.$media.clone();a.container.find(".mejs-mediaelement").append(b);a.$media.remove();a.$node=a.$media=b;a.node=a.media=b[0]}else a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");b=a.isVideo?"video":"audio";d=b.substring(0,1).toUpperCase()+b.substring(1);a.width=a.options[b+
|
84 |
-
"Width"]>0||a.options[b+"Width"].toString().indexOf("%")>-1?a.options[b+"Width"]:a.media.style.width!==""&&a.media.style.width!==null?a.media.style.width:a.media.getAttribute("width")!==null?a.$media.attr("width"):a.options["default"+d+"Width"];a.height=a.options[b+"Height"]>0||a.options[b+"Height"].toString().indexOf("%")>-1?a.options[b+"Height"]:a.media.style.height!==""&&a.media.style.height!==null?a.media.style.height:a.$media[0].getAttribute("height")!==null?a.$media.attr("height"):a.options["default"+
|
85 |
-
d+"Height"];a.setPlayerSize(a.width,a.height);c.pluginWidth=a.height;c.pluginHeight=a.width}mejs.MediaElement(a.$media[0],c);a.container.trigger("controlsshown")},showControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!b.controlsAreVisible){if(a){b.controls.css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true;b.container.trigger("controlsshown")});b.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=
|
86 |
-
true})}else{b.controls.css("visibility","visible").css("display","block");b.container.find(".mejs-control").css("visibility","visible").css("display","block");b.controlsAreVisible=true;b.container.trigger("controlsshown")}b.setControlsSize()}},hideControls:function(a){var b=this;a=typeof a=="undefined"||a;if(b.controlsAreVisible)if(a){b.controls.stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")});
|
87 |
-
b.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block")})}else{b.controls.css("visibility","hidden").css("display","block");b.container.find(".mejs-control").css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")}},controlsTimer:null,startControlsTimer:function(a){var b=this;a=typeof a!="undefined"?a:1500;b.killControlsTimer("start");b.controlsTimer=setTimeout(function(){b.hideControls();
|
88 |
-
b.killControlsTimer("hide")},a)},killControlsTimer:function(){if(this.controlsTimer!==null){clearTimeout(this.controlsTimer);delete this.controlsTimer;this.controlsTimer=null}},controlsEnabled:true,disableControls:function(){this.killControlsTimer();this.hideControls(false);this.controlsEnabled=false},enableControls:function(){this.showControls(false);this.controlsEnabled=true},meReady:function(a,b){var c=this,d=mejs.MediaFeatures,e=b.getAttribute("autoplay");e=!(typeof e=="undefined"||e===null||
|
89 |
-
e==="false");var g;if(!c.created){c.created=true;c.media=a;c.domNode=b;if(!(d.isAndroid&&c.options.AndroidUseNativeControls)&&!(d.isiPad&&c.options.iPadUseNativeControls)&&!(d.isiPhone&&c.options.iPhoneUseNativeControls)){c.buildposter(c,c.controls,c.layers,c.media);c.buildkeyboard(c,c.controls,c.layers,c.media);c.buildoverlays(c,c.controls,c.layers,c.media);c.findTracks();for(g in c.options.features){d=c.options.features[g];if(c["build"+d])try{c["build"+d](c,c.controls,c.layers,c.media)}catch(k){}}c.container.trigger("controlsready");
|
90 |
-
c.setPlayerSize(c.width,c.height);c.setControlsSize();if(c.isVideo){if(mejs.MediaFeatures.hasTouch)c.$media.bind("touchstart",function(){if(c.controlsAreVisible)c.hideControls(false);else c.controlsEnabled&&c.showControls(false)});else{c.media.addEventListener("click",function(){if(c.options.clickToPlayPause)c.media.paused?c.media.play():c.media.pause()});c.container.bind("mouseenter mouseover",function(){if(c.controlsEnabled)if(!c.options.alwaysShowControls){c.killControlsTimer("enter");c.showControls();
|
91 |
-
c.startControlsTimer(2500)}}).bind("mousemove",function(){if(c.controlsEnabled){c.controlsAreVisible||c.showControls();c.options.alwaysShowControls||c.startControlsTimer(2500)}}).bind("mouseleave",function(){c.controlsEnabled&&!c.media.paused&&!c.options.alwaysShowControls&&c.startControlsTimer(1E3)})}e&&!c.options.alwaysShowControls&&c.hideControls();c.options.enableAutosize&&c.media.addEventListener("loadedmetadata",function(h){if(c.options.videoHeight<=0&&c.domNode.getAttribute("height")===null&&
|
92 |
-
!isNaN(h.target.videoHeight)){c.setPlayerSize(h.target.videoWidth,h.target.videoHeight);c.setControlsSize();c.media.setVideoSize(h.target.videoWidth,h.target.videoHeight)}},false)}a.addEventListener("play",function(){for(var h=0,o=mejs.players.length;h<o;h++){var n=mejs.players[h];n.id!=c.id&&c.options.pauseOtherPlayers&&!n.paused&&!n.ended&&n.pause();n.hasFocus=false}c.hasFocus=true},false);c.media.addEventListener("ended",function(){if(c.options.autoRewind)try{c.media.setCurrentTime(0)}catch(h){}c.media.pause();
|
93 |
-
c.setProgressRail&&c.setProgressRail();c.setCurrentRail&&c.setCurrentRail();if(c.options.loop)c.media.play();else!c.options.alwaysShowControls&&c.controlsEnabled&&c.showControls()},false);c.media.addEventListener("loadedmetadata",function(){c.updateDuration&&c.updateDuration();c.updateCurrent&&c.updateCurrent();if(!c.isFullScreen){c.setPlayerSize(c.width,c.height);c.setControlsSize()}},false);setTimeout(function(){c.setPlayerSize(c.width,c.height);c.setControlsSize()},50);f(window).resize(function(){c.isFullScreen||
|
94 |
-
mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||c.setPlayerSize(c.width,c.height);c.setControlsSize()});c.media.pluginType=="youtube"&&c.container.find(".mejs-overlay-play").hide()}if(e&&a.pluginType=="native"){a.load();a.play()}if(c.options.success)typeof c.options.success=="string"?window[c.options.success](c.media,c.domNode,c):c.options.success(c.media,c.domNode,c)}},handleError:function(a){this.controls.hide();this.options.error&&this.options.error(a)},setPlayerSize:function(a,
|
95 |
-
b){if(typeof a!="undefined")this.width=a;if(typeof b!="undefined")this.height=b;if(this.height.toString().indexOf("%")>0||this.$node.css("max-width")==="100%"||this.$node[0].currentStyle&&this.$node[0].currentStyle.maxWidth==="100%"){var c=this.isVideo?this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.options.defaultVideoWidth:this.options.defaultAudioWidth,d=this.isVideo?this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.options.defaultVideoHeight:
|
96 |
-
this.options.defaultAudioHeight,e=this.container.parent().closest(":visible").width();c=this.isVideo||!this.options.autosizeProgress?parseInt(e*d/c,10):d;if(this.container.parent()[0].tagName.toLowerCase()==="body"){e=f(window).width();c=f(window).height()}if(c!=0&&e!=0){this.container.width(e).height(c);this.$media.width("100%").height("100%");this.container.find("object, embed, iframe").width("100%").height("100%");this.isVideo&&this.media.setVideoSize&&this.media.setVideoSize(e,c);this.layers.children(".mejs-layer").width("100%").height("100%")}}else{this.container.width(this.width).height(this.height);
|
97 |
-
this.layers.children(".mejs-layer").width(this.width).height(this.height)}},setControlsSize:function(){var a=0,b=0,c=this.controls.find(".mejs-time-rail"),d=this.controls.find(".mejs-time-total");this.controls.find(".mejs-time-current");this.controls.find(".mejs-time-loaded");var e=c.siblings();if(this.options&&!this.options.autosizeProgress)b=parseInt(c.css("width"));if(b===0||!b){e.each(function(){if(f(this).css("position")!="absolute")a+=f(this).outerWidth(true)});b=this.controls.width()-a-(c.outerWidth(true)-
|
98 |
-
c.width())}c.width(b);d.width(b-(d.outerWidth(true)-d.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},buildposter:function(a,b,c,d){var e=f('<div class="mejs-poster mejs-layer"></div>').appendTo(c);b=a.$media.attr("poster");if(a.options.poster!=="")b=a.options.poster;b!==""&&b!=null?this.setPoster(b):e.hide();d.addEventListener("play",function(){e.hide()},false)},setPoster:function(a){var b=this.container.find(".mejs-poster"),c=b.find("img");if(c.length==
|
99 |
-
0)c=f('<img width="100%" height="100%" />').appendTo(b);c.attr("src",a)},buildoverlays:function(a,b,c,d){var e=this;if(a.isVideo){var g=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(c),k=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(c),h=f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(c).click(function(){if(e.options.clickToPlayPause)d.paused?
|
100 |
-
d.play():d.pause()});d.addEventListener("play",function(){h.hide();g.hide();b.find(".mejs-time-buffering").hide();k.hide()},false);d.addEventListener("playing",function(){h.hide();g.hide();b.find(".mejs-time-buffering").hide();k.hide()},false);d.addEventListener("seeking",function(){g.show();b.find(".mejs-time-buffering").show()},false);d.addEventListener("seeked",function(){g.hide();b.find(".mejs-time-buffering").hide()},false);d.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||h.show()},
|
101 |
-
false);d.addEventListener("waiting",function(){g.show();b.find(".mejs-time-buffering").show()},false);d.addEventListener("loadeddata",function(){g.show();b.find(".mejs-time-buffering").show()},false);d.addEventListener("canplay",function(){g.hide();b.find(".mejs-time-buffering").hide()},false);d.addEventListener("error",function(){g.hide();b.find(".mejs-time-buffering").hide();k.show();k.find("mejs-overlay-error").html("Error loading this resource")},false)}},buildkeyboard:function(a,b,c,d){f(document).keydown(function(e){if(a.hasFocus&&
|
102 |
-
a.options.enableKeyboard)for(var g=0,k=a.options.keyActions.length;g<k;g++)for(var h=a.options.keyActions[g],o=0,n=h.keys.length;o<n;o++)if(e.keyCode==h.keys[o]){e.preventDefault();h.action(a,d,e.keyCode);return false}return true});f(document).click(function(e){if(f(e.target).closest(".mejs-container").length==0)a.hasFocus=false})},findTracks:function(){var a=this,b=a.$media.find("track");a.tracks=[];b.each(function(c,d){d=f(d);a.tracks.push({srclang:d.attr("srclang").toLowerCase(),src:d.attr("src"),
|
103 |
-
kind:d.attr("kind"),label:d.attr("label")||"",entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize(this.width,this.height);this.setControlsSize()},play:function(){this.media.play()},pause:function(){this.media.pause()},load:function(){this.media.load()},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},
|
104 |
-
getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){if(this.media.pluginType==="flash")this.media.remove();else this.media.pluginType==="native"&&this.$media.prop("controls",true);this.isDynamic||this.$node.insertBefore(this.container);this.container.remove()}};if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){return this.each(function(){new mejs.MediaElementPlayer(this,a)})};f(document).ready(function(){f(".mejs-player").mediaelementplayer()});
|
105 |
-
window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
|
106 |
-
(function(f){f.extend(mejs.MepDefaults,{playpauseText:"Play/Pause"});f.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,b,c,d){var e=f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+this.id+'" title="'+this.options.playpauseText+'"></button></div>').appendTo(b).click(function(g){g.preventDefault();d.paused?d.play():d.pause();return false});d.addEventListener("play",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);
|
107 |
-
d.addEventListener("playing",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);d.addEventListener("pause",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false);d.addEventListener("paused",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);
|
108 |
-
(function(f){f.extend(mejs.MepDefaults,{stopText:"Stop"});f.extend(MediaElementPlayer.prototype,{buildstop:function(a,b,c,d){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="'+this.options.stopText+'"></button></div>').appendTo(b).click(function(){d.paused||d.pause();if(d.currentTime>0){d.setCurrentTime(0);d.pause();b.find(".mejs-time-current").width("0px");b.find(".mejs-time-handle").css("left","0px");b.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));
|
109 |
-
b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-poster").show()}})}})})(mejs.$);
|
110 |
-
(function(f){f.extend(MediaElementPlayer.prototype,{buildprogress:function(a,b,c,d){f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-buffering"></span><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(b);b.find(".mejs-time-buffering").hide();var e=
|
111 |
-
b.find(".mejs-time-total");c=b.find(".mejs-time-loaded");var g=b.find(".mejs-time-current"),k=b.find(".mejs-time-handle"),h=b.find(".mejs-time-float"),o=b.find(".mejs-time-float-current"),n=function(m){m=m.pageX;var q=e.offset(),i=e.outerWidth(true),j=0,l=j=0;if(d.duration){if(m<q.left)m=q.left;else if(m>i+q.left)m=i+q.left;l=m-q.left;j=l/i;j=j<=0.02?0:j*d.duration;p&&j!==d.currentTime&&d.setCurrentTime(j);if(!mejs.MediaFeatures.hasTouch){h.css("left",l);o.html(mejs.Utility.secondsToTimeCode(j));
|
112 |
-
h.show()}}},p=false;e.bind("mousedown",function(m){if(m.which===1){p=true;n(m);f(document).bind("mousemove.dur",function(q){n(q)}).bind("mouseup.dur",function(){p=false;h.hide();f(document).unbind(".dur")});return false}}).bind("mouseenter",function(){f(document).bind("mousemove.dur",function(m){n(m)});mejs.MediaFeatures.hasTouch||h.show()}).bind("mouseleave",function(){if(!p){f(document).unbind(".dur");h.hide()}});d.addEventListener("progress",function(m){a.setProgressRail(m);a.setCurrentRail(m)},
|
113 |
-
false);d.addEventListener("timeupdate",function(m){a.setProgressRail(m);a.setCurrentRail(m)},false);this.loaded=c;this.total=e;this.current=g;this.handle=k},setProgressRail:function(a){var b=a!=undefined?a.target:this.media,c=null;if(b&&b.buffered&&b.buffered.length>0&&b.buffered.end&&b.duration)c=b.buffered.end(0)/b.duration;else if(b&&b.bytesTotal!=undefined&&b.bytesTotal>0&&b.bufferedBytes!=undefined)c=b.bufferedBytes/b.bytesTotal;else if(a&&a.lengthComputable&&a.total!=0)c=a.loaded/a.total;if(c!==
|
114 |
-
null){c=Math.min(1,Math.max(0,c));this.loaded&&this.total&&this.loaded.width(this.total.width()*c)}},setCurrentRail:function(){if(this.media.currentTime!=undefined&&this.media.duration)if(this.total&&this.handle){var a=this.total.width()*this.media.currentTime/this.media.duration,b=a-this.handle.outerWidth(true)/2;this.current.width(a);this.handle.css("left",b)}}})})(mejs.$);
|
115 |
-
(function(f){f.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:" <span> | </span> "});f.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,b,c,d){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(b);this.currenttime=this.controls.find(".mejs-currenttime");d.addEventListener("timeupdate",function(){a.updateCurrent()},false)},buildduration:function(a,
|
116 |
-
b,c,d){if(b.children().last().find(".mejs-currenttime").length>0)f(this.options.timeAndDurationSeparator+'<span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span>").appendTo(b.find(".mejs-time"));else{b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");
|
117 |
-
f('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span></div>").appendTo(b)}this.durationD=this.controls.find(".mejs-duration");d.addEventListener("timeupdate",function(){a.updateDuration()},
|
118 |
-
false)},updateCurrent:function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))},updateDuration:function(){this.container.toggleClass("mejs-long-video",this.media.duration>3600);if(this.media.duration&&this.durationD)this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,
|
119 |
-
this.options.framesPerSecond||25))}})})(mejs.$);
|
120 |
-
(function(f){f.extend(mejs.MepDefaults,{muteText:"Mute Toggle",hideVolumeOnTouchDevices:true,audioVolume:"horizontal",videoVolume:"vertical"});f.extend(MediaElementPlayer.prototype,{buildvolume:function(a,b,c,d){if(!(mejs.MediaFeatures.hasTouch&&this.options.hideVolumeOnTouchDevices)){var e=this.isVideo?this.options.videoVolume:this.options.audioVolume,g=e=="horizontal"?f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+this.id+'" title="'+this.options.muteText+
|
121 |
-
'"></button></div><div class="mejs-horizontal-volume-slider"><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></div>').appendTo(b):f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+this.id+'" title="'+this.options.muteText+'"></button><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(b),
|
122 |
-
k=this.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),h=this.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),o=this.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),n=this.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),p=function(j,l){if(!k.is(":visible")&&typeof l=="undefined"){k.show();p(j,true);k.hide()}else{j=Math.max(0,j);j=Math.min(j,1);j==0?g.removeClass("mejs-mute").addClass("mejs-unmute"):g.removeClass("mejs-unmute").addClass("mejs-mute");
|
123 |
-
if(e=="vertical"){var r=h.height(),s=h.position(),t=r-r*j;n.css("top",Math.round(s.top+t-n.height()/2));o.height(r-t);o.css("top",s.top+t)}else{r=h.width();s=h.position();r=r*j;n.css("left",Math.round(s.left+r-n.width()/2));o.width(Math.round(r))}}},m=function(j){var l=null,r=h.offset();if(e=="vertical"){l=h.height();parseInt(h.css("top").replace(/px/,""),10);l=(l-(j.pageY-r.top))/l;if(r.top==0||r.left==0)return}else{l=h.width();l=(j.pageX-r.left)/l}l=Math.max(0,l);l=Math.min(l,1);p(l);l==0?d.setMuted(true):
|
124 |
-
d.setMuted(false);d.setVolume(l)},q=false,i=false;g.hover(function(){k.show();i=true},function(){i=false;!q&&e=="vertical"&&k.hide()});k.bind("mouseover",function(){i=true}).bind("mousedown",function(j){m(j);f(document).bind("mousemove.vol",function(l){m(l)}).bind("mouseup.vol",function(){q=false;f(document).unbind(".vol");!i&&e=="vertical"&&k.hide()});q=true;return false});g.find("button").click(function(){d.setMuted(!d.muted)});d.addEventListener("volumechange",function(){if(!q)if(d.muted){p(0);
|
125 |
-
g.removeClass("mejs-mute").addClass("mejs-unmute")}else{p(d.volume);g.removeClass("mejs-unmute").addClass("mejs-mute")}},false);if(this.container.is(":visible")){p(a.options.startVolume);d.pluginType==="native"&&d.setVolume(a.options.startVolume)}}}})})(mejs.$);
|
126 |
-
(function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:true,newWindowCallback:function(){return""},fullscreenText:mejs.i18n.t("Fullscreen")});f.extend(MediaElementPlayer.prototype,{isFullScreen:false,isNativeFullScreen:false,docStyleOverflow:null,isInIframe:false,buildfullscreen:function(a,b,c,d){if(a.isVideo){a.isInIframe=window.location!=window.parent.location;if(mejs.MediaFeatures.hasTrueNativeFullScreen){c=null;c=mejs.MediaFeatures.hasMozNativeFullScreen?f(document):a.container;c.bind(mejs.MediaFeatures.fullScreenEventName,
|
127 |
-
function(){if(mejs.MediaFeatures.isFullScreen()){a.isNativeFullScreen=true;a.setControlsSize()}else{a.isNativeFullScreen=false;a.exitFullScreen()}})}var e=this,g=f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+e.id+'" title="'+e.options.fullscreenText+'"></button></div>').appendTo(b);if(e.media.pluginType==="native"||!e.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||
|
128 |
-
a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});else{var k=null;if(function(){var i=document.createElement("x"),j=document.documentElement,l=window.getComputedStyle;if(!("pointerEvents"in i.style))return false;i.style.pointerEvents="auto";i.style.pointerEvents="x";j.appendChild(i);l=l&&l(i,"").pointerEvents==="auto";j.removeChild(i);return!!l}()&&!mejs.MediaFeatures.isOpera){var h=false,o=function(){if(h){n.hide();p.hide();m.hide();g.css("pointer-events","");e.controls.css("pointer-events",
|
129 |
-
"");h=false}},n=f('<div class="mejs-fullscreen-hover" />').appendTo(e.container).mouseover(o),p=f('<div class="mejs-fullscreen-hover" />').appendTo(e.container).mouseover(o),m=f('<div class="mejs-fullscreen-hover" />').appendTo(e.container).mouseover(o),q=function(){var i={position:"absolute",top:0,left:0};n.css(i);p.css(i);m.css(i);n.width(e.container.width()).height(e.container.height()-e.controls.height());i=g.offset().left-e.container.offset().left;fullScreenBtnWidth=g.outerWidth(true);p.width(i).height(e.controls.height()).css({top:e.container.height()-
|
130 |
-
e.controls.height()});m.width(e.container.width()-i-fullScreenBtnWidth).height(e.controls.height()).css({top:e.container.height()-e.controls.height(),left:i+fullScreenBtnWidth})};f(document).resize(function(){q()});g.mouseover(function(){if(!e.isFullScreen){var i=g.offset(),j=a.container.offset();d.positionFullscreenButton(i.left-j.left,i.top-j.top,false);g.css("pointer-events","none");e.controls.css("pointer-events","none");n.show();m.show();p.show();q();h=true}});d.addEventListener("fullscreenchange",
|
131 |
-
function(){o()})}else g.mouseover(function(){if(k!==null){clearTimeout(k);delete k}var i=g.offset(),j=a.container.offset();d.positionFullscreenButton(i.left-j.left,i.top-j.top,true)}).mouseout(function(){if(k!==null){clearTimeout(k);delete k}k=setTimeout(function(){d.hideFullscreenButton()},1500)})}a.fullscreenBtn=g;f(document).bind("keydown",function(i){if((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||e.isFullScreen)&&i.keyCode==27)a.exitFullScreen()})}},enterFullScreen:function(){var a=
|
132 |
-
this;if(!(a.media.pluginType!=="native"&&(mejs.MediaFeatures.isFirefox||a.options.usePluginFullScreen))){docStyleOverflow=document.documentElement.style.overflow;document.documentElement.style.overflow="hidden";normalHeight=a.container.height();normalWidth=a.container.width();if(a.media.pluginType==="native")if(mejs.MediaFeatures.hasTrueNativeFullScreen){mejs.MediaFeatures.requestFullScreen(a.container[0]);a.isInIframe&&setTimeout(function c(){if(a.isNativeFullScreen)f(window).width()!==screen.width?
|
133 |
-
a.exitFullScreen():setTimeout(c,500)},500)}else if(mejs.MediaFeatures.hasSemiNativeFullScreen){a.media.webkitEnterFullscreen();return}if(a.isInIframe){var b=a.options.newWindowCallback(this);if(b!=="")if(mejs.MediaFeatures.hasTrueNativeFullScreen)setTimeout(function(){if(!a.isNativeFullScreen){a.pause();window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}},250);else{a.pause();window.open(b,a.id,"top=0,left=0,width="+
|
134 |
-
screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");return}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);if(a.pluginType==="native")a.$media.width("100%").height("100%");else{a.container.find("object, embed, iframe").width("100%").height("100%");a.media.setVideoSize(f(window).width(),f(window).height())}a.layers.children("div").width("100%").height("100%");
|
135 |
-
a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=true}},exitFullScreen:function(){if(this.media.pluginType!=="native"&&mejs.MediaFeatures.isFirefox)this.media.setFullscreen(false);else{if(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen))mejs.MediaFeatures.cancelFullScreen();document.documentElement.style.overflow=docStyleOverflow;this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight);
|
136 |
-
if(this.pluginType==="native")this.$media.width(normalWidth).height(normalHeight);else{this.container.find("object embed").width(normalWidth).height(normalHeight);this.media.setVideoSize(normalWidth,normalHeight)}this.layers.children("div").width(normalWidth).height(normalHeight);this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");this.setControlsSize();this.isFullScreen=false}}})})(mejs.$);
|
137 |
-
(function(f){f.extend(mejs.MepDefaults,{startLanguage:"",tracksText:"Captions/Subtitles"});f.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(a,b,c,d){if(a.isVideo)if(a.tracks.length!=0){var e;a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(c).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(c).hide();a.captionsText=a.captions.find(".mejs-captions-text");
|
138 |
-
a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+this.id+'" title="'+this.options.tracksText+'"></button><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(b).hover(function(){f(this).find(".mejs-captions-selector").css("visibility","visible")},function(){f(this).find(".mejs-captions-selector").css("visibility",
|
139 |
-
"hidden")}).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];a.captions.attr("lang",a.selectedTrack.srclang);a.displayCaptions();break}});a.options.alwaysShowControls?a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):a.container.bind("controlsshown",function(){a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("controlshidden",
|
140 |
-
function(){d.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;for(e=0;e<a.tracks.length;e++)a.tracks[e].kind=="subtitles"&&a.addTrackButton(a.tracks[e].srclang,a.tracks[e].label);a.loadNextTrack();d.addEventListener("timeupdate",function(){a.displayCaptions()},false);d.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){if(a.hasChapters){a.chapters.css("visibility",
|
141 |
-
"visible");a.chapters.fadeIn(200).height(a.chapters.find(".mejs-chapter").outerHeight())}},function(){a.hasChapters&&!d.paused&&a.chapters.fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});a.node.getAttribute("autoplay")!==null&&a.chapters.css("visibility","hidden")}},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 b=
|
142 |
-
this,c=b.tracks[a];f.ajax({url:c.src,dataType:"text",success:function(d){c.entries=typeof d=="string"&&/<tt\s+xml/ig.exec(d)?mejs.TrackFormatParser.dfxp.parse(d):mejs.TrackFormatParser.webvvt.parse(d);c.isLoaded=true;b.enableTrackButton(c.srclang,c.label);b.loadNextTrack();c.kind=="chapters"&&b.media.addEventListener("play",function(){b.media.duration>0&&b.displayChapters(c)},false)},error:function(){b.loadNextTrack()}})},enableTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("input[value="+
|
143 |
-
a+"]").prop("disabled",false).siblings("label").html(b);this.options.startLanguage==a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,b){if(b==="")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+" (loading)</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+
|
144 |
-
a+"]").remove()},adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},displayCaptions:function(){if(typeof this.tracks!="undefined"){var a,b=this.selectedTrack;if(b!=null&&b.isLoaded)for(a=0;a<b.entries.times.length;a++)if(this.media.currentTime>=b.entries.times[a].start&&this.media.currentTime<=b.entries.times[a].stop){this.captionsText.html(b.entries.text[a]);
|
145 |
-
this.captions.show().height(0);return}this.captions.hide()}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind=="chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);this.hasChapters=true;break}},drawChapters:function(a){var b=this,c,d,e=d=0;b.chapters.empty();for(c=0;c<a.entries.times.length;c++){d=a.entries.times[c].stop-a.entries.times[c].start;d=Math.floor(d/b.media.duration*100);if(d+e>100||c==a.entries.times.length-1&&d+e<100)d=100-e;b.chapters.append(f('<div class="mejs-chapter" rel="'+
|
146 |
-
a.entries.times[c].start+'" style="left: '+e.toString()+"%;width: "+d.toString()+'%;"><div class="mejs-chapter-block'+(c==a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[c].start)+"–"+mejs.Utility.secondsToTimeCode(a.entries.times[c].stop)+"</span></div></div>"));e+=d}b.chapters.find("div.mejs-chapter").click(function(){b.media.setCurrentTime(parseFloat(f(this).attr("rel")));
|
147 |
-
b.media.paused&&b.media.play()});b.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",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",
|
148 |
-
ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",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.TrackFormatParser={webvvt:{pattern_identifier:/^([a-zA-z]+-)?[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})?)(.*)$/,
|
149 |
-
parse:function(a){var b=0;a=mejs.TrackFormatParser.split2(a,/\r?\n/);for(var c={text:[],times:[]},d,e;b<a.length;b++)if(this.pattern_identifier.exec(a[b])){b++;if((d=this.pattern_timecode.exec(a[b]))&&b<a.length){b++;e=a[b];for(b++;a[b]!==""&&b<a.length;){e=e+"\n"+a[b];b++}e=f.trim(e).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,"<a href='$1' target='_blank'>$1</a>");c.text.push(e);c.times.push({start:mejs.Utility.convertSMPTEtoSeconds(d[1])==0?0.2:mejs.Utility.convertSMPTEtoSeconds(d[1]),
|
150 |
-
stop:mejs.Utility.convertSMPTEtoSeconds(d[3]),settings:d[5]})}}return c}},dfxp:{parse:function(a){a=f(a).filter("tt");var b=0;b=a.children("div").eq(0);var c=b.find("p");b=a.find("#"+b.attr("style"));var d,e;a={text:[],times:[]};if(b.length){e=b.removeAttr("id").get(0).attributes;if(e.length){d={};for(b=0;b<e.length;b++)d[e[b].name.split(":")[1]]=e[b].value}}for(b=0;b<c.length;b++){var g;e={start:null,stop:null,style:null};if(c.eq(b).attr("begin"))e.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("begin"));
|
151 |
-
if(!e.start&&c.eq(b-1).attr("end"))e.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b-1).attr("end"));if(c.eq(b).attr("end"))e.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("end"));if(!e.stop&&c.eq(b+1).attr("begin"))e.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b+1).attr("begin"));if(d){g="";for(var k in d)g+=k+":"+d[k]+";"}if(g)e.style=g;if(e.start==0)e.start=0.2;a.times.push(e);e=f.trim(c.eq(b).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
|
152 |
-
"<a href='$1' target='_blank'>$1</a>");a.text.push(e);if(a.times.start==0)a.times.start=2}return a}},split2:function(a,b){return a.split(b)}};if("x\n\ny".split(/\n/gi).length!=3)mejs.TrackFormatParser.split2=function(a,b){var c=[],d="",e;for(e=0;e<a.length;e++){d+=a.substring(e,e+1);if(b.test(d)){c.push(d.replace(b,""));d=""}}c.push(d);return c}})(mejs.$);
|
153 |
-
(function(f){f.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){if(typeof a.enterFullScreen=="undefined")return null;return a.isFullScreen?"Turn off Fullscreen":"Go Fullscreen"},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?"Unmute":"Mute"},click:function(a){a.media.muted?a.setMuted(false):a.setMuted(true)}},{isSeparator:true},{render:function(){return"Download Video"},click:function(a){window.location.href=a.media.currentSrc}}]});
|
154 |
-
f.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a){a.contextMenu=f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide();a.container.bind("contextmenu",function(b){if(a.isContextMenuEnabled){b.preventDefault();a.renderContextMenu(b.clientX-1,b.clientY-1);return false}});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=
|
155 |
-
true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;if(a!=null){clearTimeout(a);delete a}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(a,b){for(var c=this,d="",e=c.options.contextMenuItems,g=0,k=e.length;g<
|
156 |
-
k;g++)if(e[g].isSeparator)d+='<div class="mejs-contextmenu-separator"></div>';else{var h=e[g].render(c);if(h!=null)d+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+Math.random()*1E6+'">'+h+"</div>"}c.contextMenu.empty().append(f(d)).css({top:b,left:a}).show();c.contextMenu.find(".mejs-contextmenu-item").each(function(){var o=f(this),n=parseInt(o.data("itemindex"),10),p=c.options.contextMenuItems[n];typeof p.show!="undefined"&&p.show(o,c);o.click(function(){typeof p.click!=
|
157 |
-
"undefined"&&p.click(c);c.contextMenu.hide()})});setTimeout(function(){c.killControlsTimer("rev3")},100)}})})(mejs.$);
|
158 |
-
(function(f){f.extend(mejs.MepDefaults,{postrollCloseText:mejs.i18n.t("Close")});f.extend(MediaElementPlayer.prototype,{buildpostroll:function(a,b,c){var d=this.container.find('link[rel="postroll"]').attr("href");if(typeof d!=="undefined"){a.postroll=f('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">'+this.options.postrollCloseText+'</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(c).hide();this.media.addEventListener("ended",
|
159 |
-
function(){f.ajax({dataType:"html",url:d,success:function(e){c.find(".mejs-postroll-layer-content").html(e)}});a.postroll.show()},false)}}})})(mejs.$);
|
160 |
-
|
1 |
/*!
|
2 |
+
*
|
3 |
+
* MediaElement.js
|
4 |
+
* HTML5 <video> and <audio> shim and player
|
5 |
+
* http://mediaelementjs.com/
|
6 |
+
*
|
7 |
+
* Creates a JavaScript object that mimics HTML5 MediaElement API
|
8 |
+
* for browsers that don't understand HTML5 or can't play the provided codec
|
9 |
+
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
10 |
+
*
|
11 |
+
* Copyright 2010-2014, John Dyer (http://j.hn)
|
12 |
+
* License: MIT
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
var mejs=mejs||{};mejs.version="2.23.5",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","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/rtmp","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mp4","audio/mpeg","video/dailymotion","video/x-dailymotion","application/x-mpegURL","audio/ogg"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo","video/x-vimeo"]}]},mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&").split("<").join("<").split('"').join(""")},absolutizeUrl:function(a){var b=document.createElement("div");return b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>',b.firstChild.href},getScriptPath:function(a){for(var b,c,d,e,f,g,h=0,i="",j="",k=document.getElementsByTagName("script"),l=k.length,m=a.length;l>h;h++){for(e=k[h].src,c=e.lastIndexOf("/"),c>-1?(g=e.substring(c+1),f=e.substring(0,c+1)):(g=e,f=""),b=0;m>b;b++)if(j=a[b],d=g.indexOf(j),d>-1){i=f;break}if(""!==i)break}return i},calculateTimeFormat:function(a,b,c){0>a&&(a=0),"undefined"==typeof c&&(c=25);var d=b.timeFormat,e=d[0],f=d[1]==d[0],g=f?2:1,h=":",i=Math.floor(a/3600)%24,j=Math.floor(a/60)%60,k=Math.floor(a%60),l=Math.floor((a%1*c).toFixed(3)),m=[[l,"f"],[k,"s"],[j,"m"],[i,"h"]];d.length<g&&(h=d[g]);for(var n=!1,o=0,p=m.length;p>o;o++)if(-1!==d.indexOf(m[o][1]))n=!0;else if(n){for(var q=!1,r=o;p>r;r++)if(m[r][0]>0){q=!0;break}if(!q)break;f||(d=e+d),d=m[o][1]+h+d,f&&(d=m[o][1]+d),e=m[o][1]}b.currentTimeFormat=d},twoDigitsString:function(a){return 10>a?"0"+a:String(a)},secondsToTimeCode:function(a,b){if(0>a&&(a=0),"object"!=typeof b){var c="m:ss";c=arguments[1]?"hh:mm:ss":c,c=arguments[2]?c+":ff":c,b={currentTimeFormat:c,framesPerSecond:arguments[3]||25}}var d=b.framesPerSecond;"undefined"==typeof d&&(d=25);var c=b.currentTimeFormat,e=Math.floor(a/3600)%24,f=Math.floor(a/60)%60,g=Math.floor(a%60),h=Math.floor((a%1*d).toFixed(3));lis=[[h,"f"],[g,"s"],[f,"m"],[e,"h"]];var j=c;for(i=0,len=lis.length;i<len;i++)j=j.replace(lis[i][1]+lis[i][1],this.twoDigitsString(lis[i][0])),j=j.replace(lis[i][1],lis[i][0]);return j},timeCodeToSeconds:function(a,b,c,d){"undefined"==typeof c?c=!1:"undefined"==typeof d&&(d=25);var e=a.split(":"),f=parseInt(e[0],10),g=parseInt(e[1],10),h=parseInt(e[2],10),i=0,j=0;return c&&(i=parseInt(e[3])/d),j=3600*f+60*g+h+i},convertSMPTEtoSeconds:function(a){if("string"!=typeof a)return!1;a=a.replace(",",".");var b=0,c=-1!=a.indexOf(".")?a.split(".")[1].length:0,d=1;a=a.split(":").reverse();for(var e=0;e<a.length;e++)d=1,e>0&&(d=Math.pow(60,e)),b+=Number(a[e])*d;return Number(b.toFixed(c))},removeSwf:function(a){var b=document.getElementById(a);b&&/object|embed/i.test(b.nodeName)&&(mejs.MediaFeatures.isIE?(b.style.display="none",function(){4==b.readyState?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))},removeObjectInIE:function(a){var b=document.getElementById(a);if(b){for(var c in b)"function"==typeof b[c]&&(b[c]=null);b.parentNode.removeChild(b)}},determineScheme:function(a){return a&&-1!=a.indexOf("://")?a.substr(0,a.indexOf("://")+3):"//"},debounce:function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}},isNodeAfter:function(a,b){return!!(a&&b&&"function"==typeof a.compareDocumentPosition&&a.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_PRECEDING)}},mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];return b[1]=b[1]||0,b[2]=b[2]||0,c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?!0:!1},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,f,g,h=[0,0,0];if("undefined"!=typeof this.nav.plugins&&"object"==typeof this.nav.plugins[a]){if(e=this.nav.plugins[a].description,e&&("undefined"==typeof this.nav.mimeTypes||!this.nav.mimeTypes[b]||this.nav.mimeTypes[b].enabledPlugin))for(h=e.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split("."),f=0;f<h.length;f++)h[f]=parseInt(h[f].match(/\d+/),10)}else if("undefined"!=typeof window.ActiveXObject)try{g=new ActiveXObject(c),g&&(h=d(g))}catch(i){}return h}},mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[],c=a.GetVariable("$version");return c&&(c=c.split(" ")[1].split(","),b=[parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10)]),b}),mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(a,b,c,d){for(;a.isVersionSupported(b[0]+"."+b[1]+"."+b[2]+"."+b[3]);)b[c]+=d;b[c]-=d};return 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),b}),mejs.MediaFeatures={init:function(){var a,b,c=this,d=document,e=mejs.PluginDetector.nav,f=mejs.PluginDetector.ua.toLowerCase(),g=["source","track","audio","video"];c.isiPad=null!==f.match(/ipad/i),c.isiPhone=null!==f.match(/iphone/i),c.isiOS=c.isiPhone||c.isiPad,c.isAndroid=null!==f.match(/android/i),c.isBustedAndroid=null!==f.match(/android 2\.[12]/),c.isBustedNativeHTTPS="https:"===location.protocol&&(null!==f.match(/android [12]\./)||null!==f.match(/macintosh.* version.* safari/)),c.isIE=-1!=e.appName.toLowerCase().indexOf("microsoft")||null!==e.appName.toLowerCase().match(/trident/gi),c.isChrome=null!==f.match(/chrome/gi),c.isChromium=null!==f.match(/chromium/gi),c.isFirefox=null!==f.match(/firefox/gi),c.isWebkit=null!==f.match(/webkit/gi),c.isGecko=null!==f.match(/gecko/gi)&&!c.isWebkit&&!c.isIE,c.isOpera=null!==f.match(/opera/gi),c.hasTouch="ontouchstart"in window,c.svgAsImg=!!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1");for(a=0;a<g.length;a++)b=document.createElement(g[a]);c.supportsMediaTag="undefined"!=typeof b.canPlayType||c.isBustedAndroid;try{b.canPlayType("video/mp4")}catch(h){c.supportsMediaTag=!1}c.supportsPointerEvents=function(){var a,b=document.createElement("x"),c=document.documentElement,d=window.getComputedStyle;return"pointerEvents"in b.style?(b.style.pointerEvents="auto",b.style.pointerEvents="x",c.appendChild(b),a=d&&"auto"===d(b,"").pointerEvents,c.removeChild(b),!!a):!1}(),c.hasFirefoxPluginMovingProblem=!1,c.hasiOSFullScreen="undefined"!=typeof b.webkitEnterFullscreen,c.hasNativeFullscreen="undefined"!=typeof b.requestFullscreen,c.hasWebkitNativeFullScreen="undefined"!=typeof b.webkitRequestFullScreen,c.hasMozNativeFullScreen="undefined"!=typeof b.mozRequestFullScreen,c.hasMsNativeFullScreen="undefined"!=typeof b.msRequestFullscreen,c.hasTrueNativeFullScreen=c.hasWebkitNativeFullScreen||c.hasMozNativeFullScreen||c.hasMsNativeFullScreen,c.nativeFullScreenEnabled=c.hasTrueNativeFullScreen,c.hasMozNativeFullScreen?c.nativeFullScreenEnabled=document.mozFullScreenEnabled:c.hasMsNativeFullScreen&&(c.nativeFullScreenEnabled=document.msFullscreenEnabled),c.isChrome&&(c.hasiOSFullScreen=!1),c.hasTrueNativeFullScreen&&(c.fullScreenEventName="",c.hasWebkitNativeFullScreen?c.fullScreenEventName="webkitfullscreenchange":c.hasMozNativeFullScreen?c.fullScreenEventName="mozfullscreenchange":c.hasMsNativeFullScreen&&(c.fullScreenEventName="MSFullscreenChange"),c.isFullScreen=function(){return c.hasMozNativeFullScreen?d.mozFullScreen:c.hasWebkitNativeFullScreen?d.webkitIsFullScreen:c.hasMsNativeFullScreen?null!==d.msFullscreenElement:void 0},c.requestFullScreen=function(a){c.hasWebkitNativeFullScreen?a.webkitRequestFullScreen():c.hasMozNativeFullScreen?a.mozRequestFullScreen():c.hasMsNativeFullScreen&&a.msRequestFullscreen()},c.cancelFullScreen=function(){c.hasWebkitNativeFullScreen?document.webkitCancelFullScreen():c.hasMozNativeFullScreen?document.mozCancelFullScreen():c.hasMsNativeFullScreen&&document.msExitFullscreen()}),c.hasiOSFullScreen&&f.match(/mac os x 10_5/i)&&(c.hasNativeFullScreen=!1,c.hasiOSFullScreen=!1)}},mejs.MediaFeatures.init(),mejs.HtmlMediaElement={pluginType:"native",isFullScreen:!1,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){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if("string"==typeof a)this.src=a;else{var c,d;for(c=0;c<a.length;c++)if(d=a[c],this.canPlayType(d.type)){this.src=d.src;break}}},setVideoSize:function(a,b){this.width=a,this.height=b}},mejs.PluginMediaElement=function(a,b,c){this.id=a,this.pluginType=b,this.src=c,this.events={},this.attributes={}},mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:!1,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:!0,ended:!1,seeking:!1,duration:0,error:null,tagName:"",muted:!1,volume:1,currentTime:0,play:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.playVideo():this.pluginApi.playMedia(),this.paused=!1)},load:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType||this.pluginApi.loadMedia(),this.paused=!1)},pause:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?1==this.pluginApi.getPlayerState()&&this.pluginApi.pauseVideo():this.pluginApi.pauseMedia(),this.paused=!0)},stop:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.stopVideo():this.pluginApi.stopMedia(),this.paused=!0)},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++)if(d=e[b],mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return"probably";return""},positionFullscreenButton:function(a,b,c){null!=this.pluginApi&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(Math.floor(a),Math.floor(b),c)},hideFullscreenButton:function(){null!=this.pluginApi&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},setSrc:function(a){if("string"==typeof a)this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a)),this.src=mejs.Utility.absolutizeUrl(a);else{var b,c;for(b=0;b<a.length;b++)if(c=a[b],this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src)),this.src=mejs.Utility.absolutizeUrl(c.src);break}}},setCurrentTime:function(a){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a),this.currentTime=a)},setVolume:function(a){null!=this.pluginApi&&("youtube"==this.pluginType?this.pluginApi.setVolume(100*a):this.pluginApi.setVolume(a),this.volume=a)},setMuted:function(a){null!=this.pluginApi&&("youtube"==this.pluginType?(a?this.pluginApi.mute():this.pluginApi.unMute(),this.muted=a,this.dispatchEvent({type:"volumechange"})):this.pluginApi.setMuted(a),this.muted=a)},setVideoSize:function(a,b){this.pluginElement&&this.pluginElement.style&&(this.pluginElement.style.width=a+"px",this.pluginElement.style.height=b+"px"),null!=this.pluginApi&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.setFullscreen(!0)},exitFullScreen:function(){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.setFullscreen(!1)},addEventListener:function(a,b,c){this.events[a]=this.events[a]||[],this.events[a].push(b)},removeEventListener:function(a,b){if(!a)return this.events={},!0;var c=this.events[a];if(!c)return!0;if(!b)return this.events[a]=[],!0;for(var d=0;d<c.length;d++)if(c[d]===b)return this.events[a].splice(d,1),!0;return!1},dispatchEvent:function(a){var b,c=this.events[a.type];if(c)for(b=0;b<c.length;b++)c[b].apply(this,[a])},hasAttribute:function(a){return a in this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){return this.hasAttribute(a)?this.attributes[a]:null},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id)}},mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:!1,httpsBasicAuthSite:!1,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",flashScriptAccess:"sameDomain",enablePluginSmoothing:!1,enablePseudoStreaming:!1,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:.8,customError:"",success:function(){},error:function(){}},mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)},mejs.HtmlMediaElementShim={create:function(a,b){var c,d,e={},f="string"==typeof a?document.getElementById(a):a,g=f.tagName.toLowerCase(),h="audio"===g||"video"===g,i=h?f.getAttribute("src"):f.getAttribute("href"),j=f.getAttribute("poster"),k=f.getAttribute("autoplay"),l=f.getAttribute("preload"),m=f.getAttribute("controls");for(d in mejs.MediaElementDefaults)e[d]=mejs.MediaElementDefaults[d];for(d in b)e[d]=b[d];return i="undefined"==typeof i||null===i||""==i?null:i,j="undefined"==typeof j||null===j?"":j,l="undefined"==typeof l||null===l||"false"===l?"none":l,k=!("undefined"==typeof k||null===k||"false"===k),m=!("undefined"==typeof m||null===m||"false"===m),c=this.determinePlayback(f,e,mejs.MediaFeatures.supportsMediaTag,h,i),c.url=null!==c.url?mejs.Utility.absolutizeUrl(c.url):"",c.scheme=mejs.Utility.determineScheme(c.url),"native"==c.method?(mejs.MediaFeatures.isBustedAndroid&&(f.src=c.url,f.addEventListener("click",function(){f.play()},!1)),this.updateNative(c,e,k,l)):""!==c.method?this.createPlugin(c,e,j,k,l,m):(this.createErrorMessage(c,e,j),this)},determinePlayback:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=[],r={method:"",url:"",htmlMediaElement:a,isVideo:"audio"!==a.tagName.toLowerCase(),scheme:""};if("undefined"!=typeof b.type&&""!==b.type)if("string"==typeof b.type)q.push({type:b.type,url:e});else for(f=0;f<b.type.length;f++)q.push({type:b.type[f],url:e});else if(null!==e)k=this.formatType(e,a.getAttribute("type")),q.push({type:k,url:e});else for(f=0;f<a.childNodes.length;f++)j=a.childNodes[f],1==j.nodeType&&"source"==j.tagName.toLowerCase()&&(e=j.getAttribute("src"),k=this.formatType(e,j.getAttribute("type")),p=j.getAttribute("media"),(!p||!window.matchMedia||window.matchMedia&&window.matchMedia(p).matches)&&q.push({type:k,url:e}));if(!d&&q.length>0&&null!==q[0].url&&this.getTypeFromFile(q[0].url).indexOf("audio")>-1&&(r.isVideo=!1),r.isVideo&&mejs.MediaFeatures.isBustedAndroid&&(a.canPlayType=function(a){return null!==a.match(/video\/(mp4|m4v)/gi)?"maybe":""}),r.isVideo&&mejs.MediaFeatures.isChromium&&(a.canPlayType=function(a){return null!==a.match(/video\/(webm|ogv|ogg)/gi)?"maybe":""}),c&&("auto"===b.mode||"auto_plugin"===b.mode||"native"===b.mode)&&(!mejs.MediaFeatures.isBustedNativeHTTPS||b.httpsBasicAuthSite!==!0)){for(d||(o=document.createElement(r.isVideo?"video":"audio"),a.parentNode.insertBefore(o,a),a.style.display="none",r.htmlMediaElement=a=o),f=0;f<q.length;f++)if("video/m3u8"==q[f].type||""!==a.canPlayType(q[f].type).replace(/no/,"")||""!==a.canPlayType(q[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")||""!==a.canPlayType(q[f].type.replace(/m4a/,"mp4")).replace(/no/,"")){r.method="native",r.url=q[f].url;break}if("native"===r.method&&(null!==r.url&&(a.src=r.url),"auto_plugin"!==b.mode))return r}if("auto"===b.mode||"auto_plugin"===b.mode||"shim"===b.mode)for(f=0;f<q.length;f++)for(k=q[f].type,g=0;g<b.plugins.length;g++)for(l=b.plugins[g],m=mejs.plugins[l],h=0;h<m.length;h++)if(n=m[h],null==n.version||mejs.PluginDetector.hasPluginVersion(l,n.version))for(i=0;i<n.types.length;i++)if(k.toLowerCase()==n.types[i].toLowerCase())return r.method=l,r.url=q[f].url,r;return"auto_plugin"===b.mode&&"native"===r.method?r:(""===r.method&&q.length>0&&(r.url=q[0].url),r)},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},getTypeFromFile:function(a){a=a.split("?")[0];var b=a.substring(a.lastIndexOf(".")+1).toLowerCase(),c=/(mp4|m4v|ogg|ogv|m3u8|webm|webmv|flv|wmv|mpeg|mov)/gi.test(b)?"video/":"audio/";return this.getTypeFromExtension(b,c)},getTypeFromExtension:function(a,b){switch(b=b||"",a){case"mp4":case"m4v":case"m4a":case"f4v":case"f4a":return b+"mp4";case"flv":return b+"x-flv";case"webm":case"webma":case"webmv":return b+"webm";case"ogg":case"oga":case"ogv":return b+"ogg";case"m3u8":return"application/x-mpegurl";case"ts":return b+"mp2t";default:return b+a}},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div"),f=b.customError;e.className="me-cannotplay";try{e.style.width=d.width+"px",e.style.height=d.height+"px"}catch(g){}f||(f='<a href="'+a.url+'">',""!==c&&(f+='<img src="'+c+'" width="100%" height="100%" alt="" />'),f+="<span>"+mejs.i18n.t("mejs.download-file")+"</span></a>"),e.innerHTML=f,d.parentNode.insertBefore(e,d),d.style.display="none",b.error(d)},createPlugin:function(a,b,c,d,e,f){var g,h,i,j=a.htmlMediaElement,k=1,l=1,m="me_"+a.method+"_"+mejs.meIndex++,n=new mejs.PluginMediaElement(m,a.method,a.url),o=document.createElement("div");n.tagName=j.tagName;for(var p=0;p<j.attributes.length;p++){var q=j.attributes[p];q.specified&&n.setAttribute(q.name,q.value)}for(h=j.parentNode;null!==h&&null!=h.tagName&&"body"!==h.tagName.toLowerCase()&&null!=h.parentNode&&null!=h.parentNode.tagName&&null!=h.parentNode.constructor&&"ShadowRoot"===h.parentNode.constructor.name;){if("p"===h.parentNode.tagName.toLowerCase()){h.parentNode.parentNode.insertBefore(h,h.parentNode);break}h=h.parentNode}if(a.isVideo?(k=b.pluginWidth>0?b.pluginWidth:b.videoWidth>0?b.videoWidth:null!==j.getAttribute("width")?j.getAttribute("width"):b.defaultVideoWidth,l=b.pluginHeight>0?b.pluginHeight:b.videoHeight>0?b.videoHeight:null!==j.getAttribute("height")?j.getAttribute("height"):b.defaultVideoHeight,k=mejs.Utility.encodeUrl(k),l=mejs.Utility.encodeUrl(l)):b.enablePluginDebug&&(k=320,l=240),n.success=b.success,o.className="me-plugin",o.id=m+"_container",a.isVideo?j.parentNode.insertBefore(o,j):document.body.insertBefore(o,document.body.childNodes[0]),"flash"===a.method||"silverlight"===a.method){var r="audio/mp4"===j.getAttribute("type"),s=j.getElementsByTagName("source");if(s&&!r)for(var p=0,t=s.length;t>p;p++)"audio/mp4"===s[p].getAttribute("type")&&(r=!0);i=["id="+m,"isvideo="+(a.isVideo||r?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+k,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"flashstreamer="+b.flashStreamer,"height="+l,"pseudostreamstart="+b.pseudoStreamingStartQueryParam],null!==a.url&&("flash"==a.method?i.push("file="+mejs.Utility.encodeUrl(a.url)):i.push("file="+a.url)),b.enablePluginDebug&&i.push("debug=true"),b.enablePluginSmoothing&&i.push("smoothing=true"),b.enablePseudoStreaming&&i.push("pseudostreaming=true"),f&&i.push("controls=true"),b.pluginVars&&(i=i.concat(b.pluginVars)),window[m+"_init"]=function(){switch(n.pluginType){case"flash":n.pluginElement=n.pluginApi=document.getElementById(m);break;case"silverlight":n.pluginElement=document.getElementById(n.id),n.pluginApi=n.pluginElement.Content.MediaElementJS}null!=n.pluginApi&&n.success&&n.success(n,j)},window[m+"_event"]=function(a,b){var c,d,e;c={type:a,target:n};for(d in b)n[d]=b[d],c[d]=b[d];e=b.bufferedTime||0,c.target.buffered=c.buffered={start:function(a){return 0},end:function(a){return e},length:1},n.dispatchEvent(c)}}switch(a.method){case"silverlight":o.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+m+'" name="'+m+'" width="'+k+'" height="'+l+'" class="mejs-shim"><param name="initParams" value="'+i.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="'+b.pluginPath+b.silverlightName+'" /></object>';break;case"flash":mejs.MediaFeatures.isIE?(g=document.createElement("div"),o.appendChild(g),g.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+m+'" width="'+k+'" height="'+l+'" class="mejs-shim"><param name="movie" value="'+b.pluginPath+b.flashName+"?"+(new Date).getTime()+'" /><param name="flashvars" value="'+i.join("&")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="'+b.flashScriptAccess+'" /><param name="allowFullScreen" value="true" /><param name="scale" value="default" /></object>'):o.innerHTML='<embed id="'+m+'" name="'+m+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="'+b.flashScriptAccess+'" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+i.join("&")+'" width="'+k+'" height="'+l+'" scale="default"class="mejs-shim"></embed>';break;case"youtube":var u;if(-1!=a.url.lastIndexOf("youtu.be"))u=a.url.substr(a.url.lastIndexOf("/")+1),-1!=u.indexOf("?")&&(u=u.substr(0,u.indexOf("?")));else{var v=a.url.match(/[?&]v=([^&#]+)|&|#|$/);v&&(u=v[1])}youtubeSettings={container:o,containerId:o.id,pluginMediaElement:n,pluginId:m,videoId:u,height:l,width:k,scheme:a.scheme,variables:b.youtubeIframeVars},window.postMessage?mejs.YouTubeApi.enqueueIframe(youtubeSettings):mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])&&mejs.YouTubeApi.createFlash(youtubeSettings,b);break;case"vimeo":var w=m+"_player";if(n.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1),o.innerHTML='<iframe src="'+a.scheme+"player.vimeo.com/video/"+n.vimeoid+"?api=1&portrait=0&byline=0&title=0&player_id="+w+'" width="'+k+'" height="'+l+'" frameborder="0" class="mejs-shim" id="'+w+'" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',"function"==typeof $f){var x=$f(o.childNodes[0]),y=-1;x.addEvent("ready",function(){function a(a,b,c,d){var e={type:c,target:b};"timeupdate"==c&&(b.currentTime=e.currentTime=d.seconds,b.duration=e.duration=d.duration),b.dispatchEvent(e)}x.playVideo=function(){x.api("play")},x.stopVideo=function(){x.api("unload")},x.pauseVideo=function(){x.api("pause")},x.seekTo=function(a){x.api("seekTo",a)},x.setVolume=function(a){x.api("setVolume",a)},x.setMuted=function(a){a?(x.lastVolume=x.api("getVolume"),x.api("setVolume",0)):(x.api("setVolume",x.lastVolume),delete x.lastVolume)},x.getPlayerState=function(){return y},x.addEvent("play",function(){y=1,a(x,n,"play"),a(x,n,"playing")}),x.addEvent("pause",function(){y=2,a(x,n,"pause")}),x.addEvent("finish",function(){y=0,a(x,n,"ended")}),x.addEvent("playProgress",function(b){a(x,n,"timeupdate",b)}),x.addEvent("seek",function(b){y=3,a(x,n,"seeked",b)}),x.addEvent("loadProgress",function(b){y=3,a(x,n,"progress",b)}),n.pluginElement=o,n.pluginApi=x,n.success(n,n.pluginElement)})}else console.warn("You need to include froogaloop for vimeo to work")}return j.style.display="none",j.removeAttribute("autoplay"),n},updateNative:function(a,b,c,d){var e,f=a.htmlMediaElement;for(e in mejs.HtmlMediaElement)f[e]=mejs.HtmlMediaElement[e];return b.success(f,f),f}},mejs.YouTubeApi={isIframeStarted:!1,isIframeLoaded:!1,loadIframeApi:function(a){if(!this.isIframeStarted){var b=document.createElement("script");b.src=a.scheme+"www.youtube.com/player_api";var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c),this.isIframeStarted=!0}},iframeQueue:[],enqueueIframe:function(a){this.isLoaded?this.createIframe(a):(this.loadIframeApi(a),this.iframeQueue.push(a))},createIframe:function(a){var b=a.pluginMediaElement,c={controls:0,wmode:"transparent"},d=new YT.Player(a.containerId,{height:a.height,width:a.width,videoId:a.videoId,playerVars:mejs.$.extend({},c,a.variables),events:{onReady:function(c){d.setVideoSize=function(a,b){d.setSize(a,b)},a.pluginMediaElement.pluginApi=d,a.pluginMediaElement.pluginElement=document.getElementById(a.containerId),b.success(b,b.pluginElement),mejs.YouTubeApi.createEvent(d,b,"canplay"),setInterval(function(){mejs.YouTubeApi.createEvent(d,b,"timeupdate")},250),"undefined"!=typeof b.attributes.autoplay&&d.playVideo()},onStateChange:function(a){mejs.YouTubeApi.handleStateChange(a.data,d,b)}}})},createEvent:function(a,b,c){var d={type:c,target:b};if(a&&a.getDuration){b.currentTime=d.currentTime=a.getCurrentTime(),b.duration=d.duration=a.getDuration(),d.paused=b.paused,d.ended=b.ended,d.muted=a.isMuted(),d.volume=a.getVolume()/100,d.bytesTotal=a.getVideoBytesTotal(),d.bufferedBytes=a.getVideoBytesLoaded();var e=d.bufferedBytes/d.bytesTotal*d.duration;d.target.buffered=d.buffered={start:function(a){return 0},end:function(a){return e},length:1}}b.dispatchEvent(d)},iFrameReady:function(){for(this.isLoaded=!0,this.isIframeLoaded=!0;this.iframeQueue.length>0;){var a=this.iframeQueue.pop();this.createIframe(a)}},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=a;var b,c=a.scheme+"www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+a.pluginId+"&version=3&autoplay=0&controls=0&modestbranding=1&loop=0";mejs.MediaFeatures.isIE?(b=document.createElement("div"),a.container.appendChild(b),b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+a.scheme+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'" class="mejs-shim"><param name="movie" value="'+c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="'+options.flashScriptAccess+'" /><param name="allowFullScreen" value="true" /></object>'):a.container.innerHTML='<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; " class="mejs-shim"><param name="allowScriptAccess" value="'+options.flashScriptAccess+'"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c,b.success(d,d.pluginElement),c.cueVideoById(b.videoId);var e=b.containerId+"_callback";window[e]=function(a){mejs.YouTubeApi.handleStateChange(a,c,d)},c.addEventListener("onStateChange",e),setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250),mejs.YouTubeApi.createEvent(c,d,"canplay")},handleStateChange:function(a,b,c){switch(a){case-1:c.paused=!0,c.ended=!0,mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=!1,c.ended=!0,mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=!1,c.ended=!1,mejs.YouTubeApi.createEvent(b,c,"play"),mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=!0,c.ended=!1,mejs.YouTubeApi.createEvent(b,c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress");break;case 5:}}},window.onYouTubePlayerAPIReady=function(){mejs.YouTubeApi.iFrameReady()},window.onYouTubePlayerReady=function(a){mejs.YouTubeApi.flashReady(a)},window.mejs=mejs,window.MediaElement=mejs.MediaElement,function(a,b,c,d){var e={"default":"en",locale:{language:c.i18n&&c.i18n.locale.language||"",strings:c.i18n&&c.i18n.locale.strings||{}},pluralForms:[function(){return arguments[1]},function(){var a=arguments;return 1===a[0]?a[1]:a[2]},function(){var a=arguments;return[0,1].indexOf(a[0])>-1?a[1]:a[2]},function(){var a=arguments;return a[0]%10===1&&a[0]%100!==11?a[1]:0!==a[0]?a[2]:a[3]},function(){var a=arguments;return 1===a[0]||11===a[0]?a[1]:2===a[0]||12===a[0]?a[2]:a[0]>2&&a[0]<20?a[3]:a[4]},function(){return 1===args[0]?args[1]:0===args[0]||args[0]%100>0&&args[0]%100<20?args[2]:args[3]},function(){var a=arguments;return a[0]%10===1&&a[0]%100!==11?a[1]:a[0]%10>=2&&(a[0]%100<10||a[0]%100>=20)?a[2]:[3]},function(){var a=arguments;return a[0]%10===1&&a[0]%100!==11?a[1]:a[0]%10>=2&&a[0]%10<=4&&(a[0]%100<10||a[0]%100>=20)?a[2]:a[3]},function(){var a=arguments;return 1===a[0]?a[1]:a[0]>=2&&a[0]<=4?a[2]:a[3]},function(){var a=arguments;return 1===a[0]?a[1]:a[0]%10>=2&&a[0]%10<=4&&(a[0]%100<10||a[0]%100>=20)?a[2]:a[3]},function(){var a=arguments;return a[0]%100===1?a[2]:a[0]%100===2?a[3]:a[0]%100===3||a[0]%100===4?a[4]:a[1]},function(){var a=arguments;return 1===a[0]?a[1]:2===a[0]?a[2]:a[0]>2&&a[0]<7?a[3]:a[0]>6&&a[0]<11?a[4]:a[5]},function(){var a=arguments;return 0===a[0]?a[1]:1===a[0]?a[2]:2===a[0]?a[3]:a[0]%100>=3&&a[0]%100<=10?a[4]:a[0]%100>=11?a[5]:a[6]},function(){var a=arguments;return 1===a[0]?a[1]:0===a[0]||a[0]%100>1&&a[0]%100<11?a[2]:a[0]%100>10&&a[0]%100<20?a[3]:a[4]},function(){var a=arguments;return a[0]%10===1?a[1]:a[0]%10===2?a[2]:a[3]},function(){var a=arguments;return 11!==a[0]&&a[0]%10===1?a[1]:a[2]},function(){var a=arguments;return 1===a[0]?a[1]:a[0]%10>=2&&a[0]%10<=4&&(a[0]%100<10||a[0]%100>=20)?a[2]:a[3]},function(){var a=arguments;return 1===a[0]?a[1]:2===a[0]?a[2]:8!==a[0]&&11!==a[0]?a[3]:a[4]},function(){var a=arguments;return 0===a[0]?a[1]:a[2]},function(){var a=arguments;return 1===a[0]?a[1]:2===a[0]?a[2]:3===a[0]?a[3]:a[4]},function(){var a=arguments;return 0===a[0]?a[1]:1===a[0]?a[2]:a[3]}],getLanguage:function(){var a=e.locale.language||e["default"];return/^(x\-)?[a-z]{2,}(\-\w{2,})?(\-\w{2,})?$/.exec(a)?a:e["default"]},t:function(a,b){if("string"==typeof a&&a.length){var c,d,f=e.getLanguage(),g=function(a,b,c){return"object"!=typeof a||"number"!=typeof b||"number"!=typeof c?a:"string"==typeof a?a:e.pluralForms[c].apply(null,[b].concat(a))},h=function(a){var b={"&":"&","<":"<",">":">",'"':"""};return a.replace(/[&<>"]/g,function(a){return b[a]})};return e.locale.strings&&e.locale.strings[f]&&(c=e.locale.strings[f][a],"number"==typeof b&&(d=e.locale.strings[f]["mejs.plural-form"],c=g.apply(null,[c,b,d]))),!c&&e.locale.strings&&e.locale.strings[e["default"]]&&(c=e.locale.strings[e["default"]][a],"number"==typeof b&&(d=e.locale.strings[e["default"]]["mejs.plural-form"],c=g.apply(null,[c,b,d]))),c=c||a,"number"==typeof b&&(c=c.replace("%1",b)),h(c)}return a}};"undefined"!=typeof mejsL10n&&(e.locale.language=mejsL10n.language),c.i18n=e}(document,window,mejs),function(a,b){"use strict";"undefined"!=typeof mejsL10n&&(a[mejsL10n.language]=mejsL10n.strings)}(mejs.i18n.locale.strings),/*!
|
16 |
+
* This is a i18n.locale language object.
|
17 |
+
*
|
18 |
+
* English; This can serve as a template for other languages to translate
|
19 |
+
*
|
20 |
+
* @author
|
21 |
+
* TBD
|
22 |
+
* Sascha Greuel (Twitter: @SoftCreatR)
|
23 |
+
*
|
24 |
+
* @see
|
25 |
+
* me-i18n.js
|
26 |
+
*
|
27 |
+
* @params
|
28 |
+
* - exports - CommonJS, window ..
|
29 |
+
*/
|
30 |
+
function(a){"use strict";void 0===a.en&&(a.en={"mejs.plural-form":1,"mejs.download-file":"Download File","mejs.fullscreen-off":"Turn off Fullscreen","mejs.fullscreen-on":"Go Fullscreen","mejs.download-video":"Download Video","mejs.fullscreen":"Fullscreen","mejs.time-jump-forward":["Jump forward 1 second","Jump forward %1 seconds"],"mejs.play":"Play","mejs.pause":"Pause","mejs.close":"Close","mejs.time-slider":"Time Slider","mejs.time-help-text":"Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.","mejs.time-skip-back":["Skip back 1 second","Skip back %1 seconds"],"mejs.captions-subtitles":"Captions/Subtitles","mejs.none":"None","mejs.mute-toggle":"Mute Toggle","mejs.volume-help-text":"Use Up/Down Arrow keys to increase or decrease volume.","mejs.unmute":"Unmute","mejs.mute":"Mute","mejs.volume-slider":"Volume Slider","mejs.video-player":"Video Player","mejs.audio-player":"Audio Player","mejs.ad-skip":"Skip ad","mejs.ad-skip-info":["Skip in 1 second","Skip in %1 seconds"],"mejs.source-chooser":"Source Chooser"})}(mejs.i18n.locale.strings),/*!
|
31 |
+
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
* MediaElementPlayer
|
33 |
* http://mediaelementjs.com/
|
34 |
*
|
35 |
* Creates a controller bar for HTML5 <video> add <audio> tags
|
36 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
37 |
*
|
38 |
+
* Copyright 2010-2013, John Dyer (http://j.hn/)
|
39 |
* License: MIT
|
40 |
*
|
41 |
+
*/
|
42 |
+
"undefined"!=typeof jQuery?mejs.$=jQuery:"undefined"!=typeof Zepto?(mejs.$=Zepto,Zepto.fn.outerWidth=function(a){var b=$(this).width();return a&&(b+=parseInt($(this).css("margin-right"),10),b+=parseInt($(this).css("margin-left"),10)),b}):"undefined"!=typeof ender&&(mejs.$=ender),function(a){mejs.MepDefaults={poster:"",showPosterWhenEnded:!1,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return.05*a.duration},defaultSeekForwardInterval:function(a){return.05*a.duration},setDimensions:!0,audioWidth:-1,audioHeight:-1,startVolume:.8,loop:!1,autoRewind:!0,enableAutosize:!0,timeFormat:"",alwaysShowHours:!1,showTimecodeFrameCount:!1,framesPerSecond:25,autosizeProgress:!0,alwaysShowControls:!1,hideVideoControlsOnLoad:!1,clickToPlayPause:!0,controlsTimeoutDefault:1500,controlsTimeoutMouseEnter:2500,controlsTimeoutMouseLeave:1e3,iPadUseNativeControls:!1,iPhoneUseNativeControls:!1,AndroidUseNativeControls:!1,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:!0,stretching:"auto",enableKeyboard:!0,pauseOtherPlayers:!0,keyActions:[{keys:[32,179],action:function(a,b,c,d){mejs.MediaFeatures.isFirefox||(b.paused||b.ended?b.play():b.pause())}},{keys:[38],action:function(a,b,c,d){a.container.find(".mejs-volume-slider").css("display","block"),a.isVideo&&(a.showControls(),a.startControlsTimer());var e=Math.min(b.volume+.1,1);b.setVolume(e)}},{keys:[40],action:function(a,b,c,d){a.container.find(".mejs-volume-slider").css("display","block"),a.isVideo&&(a.showControls(),a.startControlsTimer());var e=Math.max(b.volume-.1,0);b.setVolume(e)}},{keys:[37,227],action:function(a,b,c,d){if(!isNaN(b.duration)&&b.duration>0){a.isVideo&&(a.showControls(),a.startControlsTimer());var e=Math.max(b.currentTime-a.options.defaultSeekBackwardInterval(b),0);b.setCurrentTime(e)}}},{keys:[39,228],action:function(a,b,c,d){if(!isNaN(b.duration)&&b.duration>0){a.isVideo&&(a.showControls(),a.startControlsTimer());var e=Math.min(b.currentTime+a.options.defaultSeekForwardInterval(b),b.duration);b.setCurrentTime(e)}}},{keys:[70],action:function(a,b,c,d){"undefined"!=typeof a.enterFullScreen&&(a.isFullScreen?a.exitFullScreen():a.enterFullScreen())}},{keys:[77],action:function(a,b,c,d){a.container.find(".mejs-volume-slider").css("display","block"),a.isVideo&&(a.showControls(),a.startControlsTimer()),a.media.muted?a.setMuted(!1):a.setMuted(!0)}}]},mejs.mepIndex=0,mejs.players={},mejs.MediaElementPlayer=function(b,c){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(b,c);var d=this;return d.$media=d.$node=a(b),d.node=d.media=d.$media[0],d.node?"undefined"!=typeof d.node.player?d.node.player:("undefined"==typeof c&&(c=d.$node.data("mejsoptions")),d.options=a.extend({},mejs.MepDefaults,c),d.options.timeFormat||(d.options.timeFormat="mm:ss",d.options.alwaysShowHours&&(d.options.timeFormat="hh:mm:ss"),d.options.showTimecodeFrameCount&&(d.options.timeFormat+=":ff")),mejs.Utility.calculateTimeFormat(0,d.options,d.options.framesPerSecond||25),d.id="mep_"+mejs.mepIndex++,mejs.players[d.id]=d,d.init(),d):void 0},mejs.MediaElementPlayer.prototype={hasFocus:!1,controlsAreVisible:!0,init:function(){var b=this,c=mejs.MediaFeatures,d=a.extend(!0,{},b.options,{success:function(a,c){b.meReady(a,c)},error:function(a){b.handleError(a)}}),e=b.media.tagName.toLowerCase();if(b.isDynamic="audio"!==e&&"video"!==e,b.isDynamic?b.isVideo=b.options.isVideo:b.isVideo="audio"!==e&&b.options.isVideo,c.isiPad&&b.options.iPadUseNativeControls||c.isiPhone&&b.options.iPhoneUseNativeControls)b.$media.attr("controls","controls"),c.isiPad&&null!==b.media.getAttribute("autoplay")&&b.play();else if(c.isAndroid&&b.options.AndroidUseNativeControls);else if(b.isVideo||!b.isVideo&&b.options.features.length){b.$media.removeAttr("controls");var f=b.isVideo?mejs.i18n.t("mejs.video-player"):mejs.i18n.t("mejs.audio-player");a('<span class="mejs-offscreen">'+f+"</span>").insertBefore(b.$media),b.container=a('<div id="'+b.id+'" class="mejs-container '+(mejs.MediaFeatures.svgAsImg?"svg":"no-svg")+'" tabindex="0" role="application" aria-label="'+f+'"><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(b.$media[0].className).insertBefore(b.$media).focus(function(a){if(!b.controlsAreVisible&&!b.hasFocus&&b.controlsEnabled&&(b.showControls(!0),!b.hasMsNativeFullScreen)){var c=".mejs-playpause-button > button";mejs.Utility.isNodeAfter(a.relatedTarget,b.container[0])&&(c=".mejs-controls .mejs-button:last-child > button");var d=b.container.find(c);d.focus()}}),b.options.features.length||b.container.css("background","transparent").find(".mejs-controls").hide(),b.isVideo&&"fill"===b.options.stretching&&!b.container.parent("mejs-fill-container").length&&(b.outerContainer=b.$media.parent(),b.container.wrap('<div class="mejs-fill-container"/>')),b.container.addClass((c.isAndroid?"mejs-android ":"")+(c.isiOS?"mejs-ios ":"")+(c.isiPad?"mejs-ipad ":"")+(c.isiPhone?"mejs-iphone ":"")+(b.isVideo?"mejs-video ":"mejs-audio ")),b.container.find(".mejs-mediaelement").append(b.$media),b.node.player=b,b.controls=b.container.find(".mejs-controls"),b.layers=b.container.find(".mejs-layers");var g=b.isVideo?"video":"audio",h=g.substring(0,1).toUpperCase()+g.substring(1);b.options[g+"Width"]>0||b.options[g+"Width"].toString().indexOf("%")>-1?b.width=b.options[g+"Width"]:""!==b.media.style.width&&null!==b.media.style.width?b.width=b.media.style.width:null!==b.media.getAttribute("width")?b.width=b.$media.attr("width"):b.width=b.options["default"+h+"Width"],b.options[g+"Height"]>0||b.options[g+"Height"].toString().indexOf("%")>-1?b.height=b.options[g+"Height"]:""!==b.media.style.height&&null!==b.media.style.height?b.height=b.media.style.height:null!==b.$media[0].getAttribute("height")?b.height=b.$media.attr("height"):b.height=b.options["default"+h+"Height"],b.setPlayerSize(b.width,b.height),d.pluginWidth=b.width,d.pluginHeight=b.height}else b.isVideo||b.options.features.length||b.$media.hide();mejs.MediaElement(b.$media[0],d),"undefined"!=typeof b.container&&b.options.features.length&&b.controlsAreVisible&&b.container.trigger("controlsshown")},showControls:function(a){var b=this;a="undefined"==typeof a||a,b.controlsAreVisible||(a?(b.controls.removeClass("mejs-offscreen").stop(!0,!0).fadeIn(200,function(){b.controlsAreVisible=!0,b.container.trigger("controlsshown")}),b.container.find(".mejs-control").removeClass("mejs-offscreen").stop(!0,!0).fadeIn(200,function(){b.controlsAreVisible=!0})):(b.controls.removeClass("mejs-offscreen").css("display","block"),b.container.find(".mejs-control").removeClass("mejs-offscreen").css("display","block"),b.controlsAreVisible=!0,b.container.trigger("controlsshown")),b.setControlsSize())},hideControls:function(b){var c=this;b="undefined"==typeof b||b,!c.controlsAreVisible||c.options.alwaysShowControls||c.keyboardAction||c.media.paused||c.media.ended||(b?(c.controls.stop(!0,!0).fadeOut(200,function(){a(this).addClass("mejs-offscreen").css("display","block"),c.controlsAreVisible=!1,c.container.trigger("controlshidden")}),c.container.find(".mejs-control").stop(!0,!0).fadeOut(200,function(){a(this).addClass("mejs-offscreen").css("display","block")})):(c.controls.addClass("mejs-offscreen").css("display","block"),c.container.find(".mejs-control").addClass("mejs-offscreen").css("display","block"),c.controlsAreVisible=!1,c.container.trigger("controlshidden")))},controlsTimer:null,startControlsTimer:function(a){var b=this;a="undefined"!=typeof a?a:b.options.controlsTimeoutDefault,b.killControlsTimer("start"),b.controlsTimer=setTimeout(function(){b.hideControls(),b.killControlsTimer("hide")},a)},killControlsTimer:function(a){var b=this;null!==b.controlsTimer&&(clearTimeout(b.controlsTimer),delete b.controlsTimer,b.controlsTimer=null)},controlsEnabled:!0,disableControls:function(){var a=this;a.killControlsTimer(),a.hideControls(!1),this.controlsEnabled=!1},enableControls:function(){var a=this;a.showControls(!1),a.controlsEnabled=!0},meReady:function(b,c){var d,e,f=this,g=mejs.MediaFeatures,h=c.getAttribute("autoplay"),i=!("undefined"==typeof h||null===h||"false"===h);if(!f.created){if(f.created=!0,f.media=b,f.domNode=c,!(g.isAndroid&&f.options.AndroidUseNativeControls||g.isiPad&&f.options.iPadUseNativeControls||g.isiPhone&&f.options.iPhoneUseNativeControls)){if(!f.isVideo&&!f.options.features.length)return i&&"native"==b.pluginType&&f.play(),void(f.options.success&&("string"==typeof f.options.success?window[f.options.success](f.media,f.domNode,f):f.options.success(f.media,f.domNode,f)));f.buildposter(f,f.controls,f.layers,f.media),f.buildkeyboard(f,f.controls,f.layers,f.media),f.buildoverlays(f,f.controls,f.layers,f.media),f.findTracks();for(d in f.options.features)if(e=f.options.features[d],f["build"+e])try{f["build"+e](f,f.controls,f.layers,f.media)}catch(j){}f.container.trigger("controlsready"),f.setPlayerSize(f.width,f.height),f.setControlsSize(),f.isVideo&&(mejs.MediaFeatures.hasTouch&&!f.options.alwaysShowControls?f.$media.bind("touchstart",function(){f.controlsAreVisible?f.hideControls(!1):f.controlsEnabled&&f.showControls(!1)}):(f.clickToPlayPauseCallback=function(){if(f.options.clickToPlayPause){f.media.paused?f.play():f.pause();var a=f.$media.closest(".mejs-container").find(".mejs-overlay-button"),b=a.attr("aria-pressed");a.attr("aria-pressed",!b)}},f.media.addEventListener("click",f.clickToPlayPauseCallback,!1),f.container.bind("mouseenter",function(){f.controlsEnabled&&(f.options.alwaysShowControls||(f.killControlsTimer("enter"),f.showControls(),f.startControlsTimer(f.options.controlsTimeoutMouseEnter)))}).bind("mousemove",function(){f.controlsEnabled&&(f.controlsAreVisible||f.showControls(),f.options.alwaysShowControls||f.startControlsTimer(f.options.controlsTimeoutMouseEnter))}).bind("mouseleave",function(){f.controlsEnabled&&(f.media.paused||f.options.alwaysShowControls||f.startControlsTimer(f.options.controlsTimeoutMouseLeave))})),f.options.hideVideoControlsOnLoad&&f.hideControls(!1),i&&!f.options.alwaysShowControls&&f.hideControls(),f.options.enableAutosize&&f.media.addEventListener("loadedmetadata",function(a){f.options.videoHeight<=0&&null===f.domNode.getAttribute("height")&&!isNaN(a.target.videoHeight)&&(f.setPlayerSize(a.target.videoWidth,a.target.videoHeight),f.setControlsSize(),f.media.setVideoSize(a.target.videoWidth,a.target.videoHeight))},!1)),f.media.addEventListener("play",function(){var a;for(a in mejs.players){var b=mejs.players[a];b.id==f.id||!f.options.pauseOtherPlayers||b.paused||b.ended||b.pause(),b.hasFocus=!1}f.hasFocus=!0},!1),f.media.addEventListener("ended",function(b){if(f.options.autoRewind)try{f.media.setCurrentTime(0),window.setTimeout(function(){a(f.container).find(".mejs-overlay-loading").parent().hide()},20)}catch(c){}"youtube"===f.media.pluginType?f.media.stop():f.media.pause(),f.setProgressRail&&f.setProgressRail(),f.setCurrentRail&&f.setCurrentRail(),f.options.loop?f.play():!f.options.alwaysShowControls&&f.controlsEnabled&&f.showControls()},!1),f.media.addEventListener("loadedmetadata",function(){mejs.Utility.calculateTimeFormat(f.duration,f.options,f.options.framesPerSecond||25),f.updateDuration&&f.updateDuration(),f.updateCurrent&&f.updateCurrent(),f.isFullScreen||(f.setPlayerSize(f.width,f.height),f.setControlsSize())},!1);var k=null;f.media.addEventListener("timeupdate",function(){k!==this.duration&&(k=this.duration,mejs.Utility.calculateTimeFormat(k,f.options,f.options.framesPerSecond||25),f.updateDuration&&f.updateDuration(),f.updateCurrent&&f.updateCurrent(),f.setControlsSize())},!1),f.container.focusout(function(b){if(b.relatedTarget){var c=a(b.relatedTarget);f.keyboardAction&&0===c.parents(".mejs-container").length&&(f.keyboardAction=!1,f.isVideo&&!f.options.alwaysShowControls&&f.hideControls(!0))}}),setTimeout(function(){f.setPlayerSize(f.width,f.height),f.setControlsSize()},50),f.globalBind("resize",function(){f.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||f.setPlayerSize(f.width,f.height),f.setControlsSize()}),"youtube"==f.media.pluginType&&(g.isiOS||g.isAndroid)&&(f.container.find(".mejs-overlay-play").hide(),f.container.find(".mejs-poster").hide())}i&&"native"==b.pluginType&&f.play(),f.options.success&&("string"==typeof f.options.success?window[f.options.success](f.media,f.domNode,f):f.options.success(f.media,f.domNode,f))}},handleError:function(a){var b=this;b.controls&&b.controls.hide(),b.options.error&&b.options.error(a)},setPlayerSize:function(a,b){var c=this;if(!c.options.setDimensions)return!1;switch("undefined"!=typeof a&&(c.width=a),"undefined"!=typeof b&&(c.height=b),c.options.stretching){case"fill":c.isVideo?this.setFillMode():this.setDimensions(c.width,c.height);break;case"responsive":this.setResponsiveMode();break;case"none":this.setDimensions(c.width,c.height);break;default:this.hasFluidMode()===!0?this.setResponsiveMode():this.setDimensions(c.width,c.height)}},hasFluidMode:function(){var a=this;return a.height.toString().indexOf("%")>0||"none"!==a.$node.css("max-width")&&"t.width"!==a.$node.css("max-width")||a.$node[0].currentStyle&&"100%"===a.$node[0].currentStyle.maxWidth},setResponsiveMode:function(){var b=this,c=function(){return b.isVideo?b.media.videoWidth&&b.media.videoWidth>0?b.media.videoWidth:null!==b.media.getAttribute("width")?b.media.getAttribute("width"):b.options.defaultVideoWidth:b.options.defaultAudioWidth}(),d=function(){return b.isVideo?b.media.videoHeight&&b.media.videoHeight>0?b.media.videoHeight:null!==b.media.getAttribute("height")?b.media.getAttribute("height"):b.options.defaultVideoHeight:b.options.defaultAudioHeight}(),e=b.container.parent().closest(":visible").width(),f=b.container.parent().closest(":visible").height(),g=b.isVideo||!b.options.autosizeProgress?parseInt(e*d/c,10):d;(isNaN(g)||0!==f&&g>f&&f>d)&&(g=f),b.container.parent().length>0&&"body"===b.container.parent()[0].tagName.toLowerCase()&&(e=a(window).width(),g=a(window).height()),g&&e&&(b.container.width(e).height(g),b.$media.add(b.container.find(".mejs-shim")).width("100%").height("100%"),b.isVideo&&b.media.setVideoSize&&b.media.setVideoSize(e,g),b.layers.children(".mejs-layer").width("100%").height("100%"))},setFillMode:function(){var a=this,b=a.outerContainer;b.width()||b.height(a.$media.width()),b.height()||b.height(a.$media.height());var c=b.width(),d=b.height();a.setDimensions("100%","100%"),a.container.find(".mejs-poster img").css("display","block"),targetElement=a.container.find("object, embed, iframe, video");var e=a.height,f=a.width,g=c,h=e*c/f,i=f*d/e,j=d,k=!(i>c),l=k?Math.floor(g):Math.floor(i),m=k?Math.floor(h):Math.floor(j);k?(targetElement.height(m).width(c),a.media.setVideoSize&&a.media.setVideoSize(c,m)):(targetElement.height(d).width(l),a.media.setVideoSize&&a.media.setVideoSize(l,d)),targetElement.css({"margin-left":Math.floor((c-l)/2),"margin-top":0})},setDimensions:function(a,b){var c=this;c.container.width(a).height(b),c.layers.children(".mejs-layer").width(a).height(b)},setControlsSize:function(){var b=this,c=0,d=0,e=b.controls.find(".mejs-time-rail"),f=b.controls.find(".mejs-time-total"),g=e.siblings(),h=g.last(),i=null,j=b.options&&!b.options.autosizeProgress;if(b.container.is(":visible")&&e.length&&e.is(":visible")){j&&(d=parseInt(e.css("width"),10)),0!==d&&d||(g.each(function(){var b=a(this);"absolute"!=b.css("position")&&b.is(":visible")&&(c+=a(this).outerWidth(!0))}),d=b.controls.width()-c-(e.outerWidth(!0)-e.width()));do j||e.width(d),f.width(d-(f.outerWidth(!0)-f.width())),"absolute"!=h.css("position")&&(i=h.length?h.position():null,d--);while(null!==i&&i.top.toFixed(2)>0&&d>0);b.container.trigger("controlsresize")}},buildposter:function(b,c,d,e){var f=this,g=a('<div class="mejs-poster mejs-layer"></div>').appendTo(d),h=b.$media.attr("poster");""!==b.options.poster&&(h=b.options.poster),h?f.setPoster(h):g.hide(),e.addEventListener("play",function(){g.hide()},!1),b.options.showPosterWhenEnded&&b.options.autoRewind&&e.addEventListener("ended",function(){g.show()},!1)},setPoster:function(b){var c=this,d=c.container.find(".mejs-poster"),e=d.find("img");0===e.length&&(e=a('<img width="100%" height="100%" alt="" />').appendTo(d)),e.attr("src",b),d.css({"background-image":"url("+b+")"})},buildoverlays:function(b,c,d,e){var f=this;if(b.isVideo){var g=a('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(d),h=a('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(d),i=a('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button" role="button" aria-label="'+mejs.i18n.t("mejs.play")+'" aria-pressed="false"></div></div>').appendTo(d).bind("click",function(){if(f.options.clickToPlayPause){e.paused&&e.play();var b=a(this).find(".mejs-overlay-button"),c=b.attr("aria-pressed");b.attr("aria-pressed",!!c)}});e.addEventListener("play",function(){i.hide(),g.hide(),c.find(".mejs-time-buffering").hide(),h.hide()},!1),e.addEventListener("playing",function(){i.hide(),g.hide(),c.find(".mejs-time-buffering").hide(),h.hide()},!1),e.addEventListener("seeking",function(){g.show(),c.find(".mejs-time-buffering").show()},!1),e.addEventListener("seeked",function(){g.hide(),c.find(".mejs-time-buffering").hide()},!1),e.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||i.show()},!1),e.addEventListener("waiting",function(){g.show(),c.find(".mejs-time-buffering").show()},!1),e.addEventListener("loadeddata",function(){g.show(),c.find(".mejs-time-buffering").show(),mejs.MediaFeatures.isAndroid&&(e.canplayTimeout=window.setTimeout(function(){if(document.createEvent){var a=document.createEvent("HTMLEvents");return a.initEvent("canplay",!0,!0),e.dispatchEvent(a)}},300))},!1),e.addEventListener("canplay",function(){g.hide(),c.find(".mejs-time-buffering").hide(),clearTimeout(e.canplayTimeout)},!1),e.addEventListener("error",function(a){f.handleError(a),g.hide(),i.hide(),h.show(),h.find(".mejs-overlay-error").html("Error loading this resource")},!1),e.addEventListener("keydown",function(a){f.onkeydown(b,e,a)},!1)}},buildkeyboard:function(b,c,d,e){var f=this;f.container.keydown(function(){f.keyboardAction=!0}),f.globalBind("keydown",function(c){return b.hasFocus=0!==a(c.target).closest(".mejs-container").length&&a(c.target).closest(".mejs-container").attr("id")===b.$media.closest(".mejs-container").attr("id"),f.onkeydown(b,e,c)}),f.globalBind("click",function(c){b.hasFocus=0!==a(c.target).closest(".mejs-container").length})},onkeydown:function(a,b,c){if(a.hasFocus&&a.options.enableKeyboard)for(var d=0,e=a.options.keyActions.length;e>d;d++)for(var f=a.options.keyActions[d],g=0,h=f.keys.length;h>g;g++)if(c.keyCode==f.keys[g])return"function"==typeof c.preventDefault&&c.preventDefault(),f.action(a,b,c.keyCode,c),!1;return!0},findTracks:function(){var b=this,c=b.$media.find("track");b.tracks=[],c.each(function(c,d){d=a(d),b.tracks.push({srclang:d.attr("srclang")?d.attr("srclang").toLowerCase():"",src:d.attr("src"),kind:d.attr("kind"),label:d.attr("label")||"",entries:[],isLoaded:!1})})},changeSkin:function(a){this.container[0].className="mejs-container "+a,this.setPlayerSize(this.width,this.height),this.setControlsSize()},play:function(){this.load(),this.media.play()},pause:function(){try{this.media.pause()}catch(a){}},load:function(){this.isLoaded||this.media.load(),this.isLoaded=!0},setMuted:function(a){this.media.setMuted(a)},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){var b=this;if("youtube"===b.media.pluginType){var c;if("string"!=typeof a){var d,e;for(d=0;d<a.length;d++)if(e=a[d],this.canPlayType(e.type)){a=e.src;break}}if(-1!==a.lastIndexOf("youtu.be"))c=a.substr(a.lastIndexOf("/")+1),-1!==c.indexOf("?")&&(c=c.substr(0,c.indexOf("?")));else{var f=a.match(/[?&]v=([^&#]+)|&|#|$/);f&&(c=f[1])}null!==b.media.getAttribute("autoplay")?b.media.pluginApi.loadVideoById(c):b.media.pluginApi.cueVideoById(c)}else b.media.setSrc(a)},remove:function(){var a,b,c=this;c.container.prev(".mejs-offscreen").remove();for(a in c.options.features)if(b=c.options.features[a],c["clean"+b])try{c["clean"+b](c)}catch(d){}c.isDynamic?c.$node.insertBefore(c.container):(c.$media.prop("controls",!0),c.$node.clone().insertBefore(c.container).show(),c.$node.remove()),"native"!==c.media.pluginType&&c.media.remove(),delete mejs.players[c.id],"object"==typeof c.container&&c.container.remove(),c.globalUnbind(),delete c.node.player},rebuildtracks:function(){var a=this;a.findTracks(),a.buildtracks(a,a.controls,a.layers,a.media)},resetSize:function(){var a=this;setTimeout(function(){a.setPlayerSize(a.width,a.height),a.setControlsSize()},50)}},function(){function b(b,d){var e={d:[],w:[]};return a.each((b||"").split(" "),function(a,b){var f=b+"."+d;0===f.indexOf(".")?(e.d.push(f),e.w.push(f)):e[c.test(b)?"w":"d"].push(f)}),e.d=e.d.join(" "),e.w=e.w.join(" "),e}var c=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;mejs.MediaElementPlayer.prototype.globalBind=function(c,d,e){var f=this,g=f.node?f.node.ownerDocument:document;c=b(c,f.id),c.d&&a(g).bind(c.d,d,e),c.w&&a(window).bind(c.w,d,e)},mejs.MediaElementPlayer.prototype.globalUnbind=function(c,d){var e=this,f=e.node?e.node.ownerDocument:document;c=b(c,e.id),c.d&&a(f).unbind(c.d,d),c.w&&a(window).unbind(c.w,d)}}(),"undefined"!=typeof a&&(a.fn.mediaelementplayer=function(b){return b===!1?this.each(function(){var b=a(this).data("mediaelementplayer");b&&b.remove(),a(this).removeData("mediaelementplayer")}):this.each(function(){a(this).data("mediaelementplayer",new mejs.MediaElementPlayer(this,b))}),this},a(document).ready(function(){a(".mejs-player").mediaelementplayer()})),window.MediaElementPlayer=mejs.MediaElementPlayer}(mejs.$),function(a){a.extend(mejs.MepDefaults,{playText:"",pauseText:""}),a.extend(MediaElementPlayer.prototype,{buildplaypause:function(b,c,d,e){function f(a){"play"===a?(k.removeClass("mejs-play").addClass("mejs-pause"),l.attr({title:j,"aria-label":j})):(k.removeClass("mejs-pause").addClass("mejs-play"),l.attr({title:i,"aria-label":i}))}var g=this,h=g.options,i=h.playText?h.playText:mejs.i18n.t("mejs.play"),j=h.pauseText?h.pauseText:mejs.i18n.t("mejs.pause"),k=a('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+g.id+'" title="'+i+'" aria-label="'+j+'"></button></div>').appendTo(c).click(function(a){return a.preventDefault(),e.paused?e.play():e.pause(),!1}),l=k.find("button");f("pse"),e.addEventListener("play",function(){f("play")},!1),e.addEventListener("playing",function(){f("play")},!1),e.addEventListener("pause",function(){f("pse")},!1),e.addEventListener("paused",function(){f("pse")},!1)}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{stopText:"Stop"}),a.extend(MediaElementPlayer.prototype,{buildstop:function(b,c,d,e){var f=this;a('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+f.id+'" title="'+f.options.stopText+'" aria-label="'+f.options.stopText+'"></button></div>').appendTo(c).click(function(){e.paused||e.pause(),e.currentTime>0&&(e.setCurrentTime(0),e.pause(),c.find(".mejs-time-current").width("0px"),c.find(".mejs-time-handle").css("left","0px"),c.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0,b.options)),c.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0,b.options)),d.find(".mejs-poster").show())})}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{enableProgressTooltip:!0,progressHelpText:""}),a.extend(MediaElementPlayer.prototype,{buildprogress:function(b,c,d,e){var f=this,g=!1,h=!1,i=0,j=!1,k=b.options.autoRewind,l=(f.options.progressHelpText?f.options.progressHelpText:mejs.i18n.t("mejs.time-help-text"),b.options.enableProgressTooltip?'<span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span>':"");a('<div class="mejs-time-rail"><span class="mejs-time-total mejs-time-slider"><span class="mejs-time-buffering"></span><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span>'+l+"</span></div>").appendTo(c),c.find(".mejs-time-buffering").hide(),f.total=c.find(".mejs-time-total"),f.loaded=c.find(".mejs-time-loaded"),f.current=c.find(".mejs-time-current"),f.handle=c.find(".mejs-time-handle"),f.timefloat=c.find(".mejs-time-float"),f.timefloatcurrent=c.find(".mejs-time-float-current"),f.slider=c.find(".mejs-time-slider");var m=function(a){var c,d=f.total.offset(),h=f.total.width(),i=0,j=0,k=0;c=a.originalEvent&&a.originalEvent.changedTouches?a.originalEvent.changedTouches[0].pageX:a.changedTouches?a.changedTouches[0].pageX:a.pageX,e.duration&&(c<d.left?c=d.left:c>h+d.left&&(c=h+d.left),k=c-d.left,i=k/h,j=.02>=i?0:i*e.duration,g&&j!==e.currentTime&&e.setCurrentTime(j),mejs.MediaFeatures.hasTouch||(f.timefloat.css("left",k),f.timefloatcurrent.html(mejs.Utility.secondsToTimeCode(j,b.options)),f.timefloat.show()))},n=function(a){var c=e.currentTime,d=mejs.i18n.t("mejs.time-slider"),g=mejs.Utility.secondsToTimeCode(c,b.options),h=e.duration;f.slider.attr({"aria-label":d,"aria-valuemin":0,"aria-valuemax":h,"aria-valuenow":c,"aria-valuetext":g,role:"slider",tabindex:0})},o=function(){var a=new Date;a-i>=1e3&&e.play()};f.slider.bind("focus",function(a){b.options.autoRewind=!1}),f.slider.bind("blur",function(a){b.options.autoRewind=k}),f.slider.bind("keydown",function(a){new Date-i>=1e3&&(j=e.paused);var c=a.keyCode,d=e.duration,f=e.currentTime,g=b.options.defaultSeekForwardInterval(e),h=b.options.defaultSeekBackwardInterval(e);switch(c){case 37:case 40:f-=h;break;case 39:case 38:f+=g;break;case 36:f=0;break;case 35:f=d;break;case 32:case 13:return void(e.paused?e.play():e.pause());default:return}return f=0>f?0:f>=d?d:Math.floor(f),i=new Date,j||e.pause(),f<e.duration&&!j&&setTimeout(o,1100),e.setCurrentTime(f),a.preventDefault(),a.stopPropagation(),!1}),f.total.bind("mousedown touchstart",function(a){(1===a.which||0===a.which)&&(g=!0,m(a),f.globalBind("mousemove.dur touchmove.dur",function(a){m(a)}),f.globalBind("mouseup.dur touchend.dur",function(a){g=!1,"undefined"!=typeof f.timefloat&&f.timefloat.hide(),f.globalUnbind(".dur")}))}).bind("mouseenter",function(a){h=!0,f.globalBind("mousemove.dur",function(a){m(a)}),"undefined"==typeof f.timefloat||mejs.MediaFeatures.hasTouch||f.timefloat.show()}).bind("mouseleave",function(a){h=!1,g||(f.globalUnbind(".dur"),"undefined"!=typeof f.timefloat&&f.timefloat.hide())}),e.addEventListener("progress",function(a){b.setProgressRail(a),b.setCurrentRail(a)},!1),e.addEventListener("timeupdate",function(a){b.setProgressRail(a),b.setCurrentRail(a),n(a)},!1),f.container.on("controlsresize",function(a){b.setProgressRail(a),b.setCurrentRail(a)})},setProgressRail:function(a){var b=this,c=void 0!==a?a.target:b.media,d=null;c&&c.buffered&&c.buffered.length>0&&c.buffered.end&&c.duration?d=c.buffered.end(c.buffered.length-1)/c.duration:c&&void 0!==c.bytesTotal&&c.bytesTotal>0&&void 0!==c.bufferedBytes?d=c.bufferedBytes/c.bytesTotal:a&&a.lengthComputable&&0!==a.total&&(d=a.loaded/a.total),null!==d&&(d=Math.min(1,Math.max(0,d)),b.loaded&&b.total&&b.loaded.width(b.total.width()*d))},setCurrentRail:function(){var a=this;if(void 0!==a.media.currentTime&&a.media.duration&&a.total&&a.handle){var b=Math.round(a.total.width()*a.media.currentTime/a.media.duration),c=b-Math.round(a.handle.outerWidth(!0)/2);a.current.width(b),a.handle.css("left",c)}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:"<span> | </span>"}),a.extend(MediaElementPlayer.prototype,{buildcurrent:function(b,c,d,e){var f=this;a('<div class="mejs-time" role="timer" aria-live="off"><span class="mejs-currenttime">'+mejs.Utility.secondsToTimeCode(0,b.options)+"</span></div>").appendTo(c),f.currenttime=f.controls.find(".mejs-currenttime"),e.addEventListener("timeupdate",function(){f.controlsAreVisible&&b.updateCurrent()},!1)},buildduration:function(b,c,d,e){var f=this;c.children().last().find(".mejs-currenttime").length>0?a(f.options.timeAndDurationSeparator+'<span class="mejs-duration">'+mejs.Utility.secondsToTimeCode(f.options.duration,f.options)+"</span>").appendTo(c.find(".mejs-time")):(c.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container"),a('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+mejs.Utility.secondsToTimeCode(f.options.duration,f.options)+"</span></div>").appendTo(c)),f.durationD=f.controls.find(".mejs-duration"),e.addEventListener("timeupdate",function(){f.controlsAreVisible&&b.updateDuration()},!1)},updateCurrent:function(){var a=this,b=a.media.currentTime;isNaN(b)&&(b=0),a.currenttime&&a.currenttime.html(mejs.Utility.secondsToTimeCode(b,a.options))},updateDuration:function(){var a=this,b=a.media.duration;a.options.duration>0&&(b=a.options.duration),isNaN(b)&&(b=0),a.container.toggleClass("mejs-long-video",b>3600),a.durationD&&b>0&&a.durationD.html(mejs.Utility.secondsToTimeCode(b,a.options))}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{muteText:mejs.i18n.t("mejs.mute-toggle"),allyVolumeControlText:mejs.i18n.t("mejs.volume-help-text"),hideVolumeOnTouchDevices:!0,audioVolume:"horizontal",videoVolume:"vertical"}),a.extend(MediaElementPlayer.prototype,{buildvolume:function(b,c,d,e){if(!mejs.MediaFeatures.isAndroid&&!mejs.MediaFeatures.isiOS||!this.options.hideVolumeOnTouchDevices){var f=this,g=f.isVideo?f.options.videoVolume:f.options.audioVolume,h="horizontal"==g?a('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+f.id+'" title="'+f.options.muteText+'" aria-label="'+f.options.muteText+'"></button></div><a href="javascript:void(0);" class="mejs-horizontal-volume-slider"><span class="mejs-offscreen">'+f.options.allyVolumeControlText+'</span><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></a>').appendTo(c):a('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+f.id+'" title="'+f.options.muteText+'" aria-label="'+f.options.muteText+'"></button><a href="javascript:void(0);" class="mejs-volume-slider"><span class="mejs-offscreen">'+f.options.allyVolumeControlText+'</span><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></a></div>').appendTo(c),i=f.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),j=f.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),k=f.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),l=f.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),m=function(a,b){if(!i.is(":visible")&&"undefined"==typeof b)return i.show(),m(a,!0),void i.hide();a=Math.max(0,a),a=Math.min(a,1),0===a?(h.removeClass("mejs-mute").addClass("mejs-unmute"),h.children("button").attr("title",mejs.i18n.t("mejs.unmute")).attr("aria-label",mejs.i18n.t("mejs.unmute"))):(h.removeClass("mejs-unmute").addClass("mejs-mute"),h.children("button").attr("title",mejs.i18n.t("mejs.mute")).attr("aria-label",mejs.i18n.t("mejs.mute")));var c=j.position();if("vertical"==g){var d=j.height(),e=d-d*a;l.css("top",Math.round(c.top+e-l.height()/2)),k.height(d-e),k.css("top",c.top+e)}else{var f=j.width(),n=f*a;l.css("left",Math.round(c.left+n-l.width()/2)),k.width(Math.round(n))}},n=function(a){var b=null,c=j.offset();if("vertical"===g){var d=j.height(),f=a.pageY-c.top;if(b=(d-f)/d,0===c.top||0===c.left)return}else{var h=j.width(),i=a.pageX-c.left;b=i/h;
|
43 |
+
}b=Math.max(0,b),b=Math.min(b,1),m(b),0===b?e.setMuted(!0):e.setMuted(!1),e.setVolume(b)},o=!1,p=!1;h.hover(function(){i.show(),p=!0},function(){p=!1,o||"vertical"!=g||i.hide()});var q=function(a){var b=Math.floor(100*e.volume);i.attr({"aria-label":mejs.i18n.t("mejs.volume-slider"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":b,"aria-valuetext":b+"%",role:"slider",tabindex:0})};i.bind("mouseover",function(){p=!0}).bind("mousedown",function(a){return n(a),f.globalBind("mousemove.vol",function(a){n(a)}),f.globalBind("mouseup.vol",function(){o=!1,f.globalUnbind(".vol"),p||"vertical"!=g||i.hide()}),o=!0,!1}).bind("keydown",function(a){var b=a.keyCode,c=e.volume;switch(b){case 38:c=Math.min(c+.1,1);break;case 40:c=Math.max(0,c-.1);break;default:return!0}return o=!1,m(c),e.setVolume(c),!1}),h.find("button").click(function(){e.setMuted(!e.muted)}),h.find("button").bind("focus",function(){i.show()}),e.addEventListener("volumechange",function(a){o||(e.muted?(m(0),h.removeClass("mejs-mute").addClass("mejs-unmute")):(m(e.volume),h.removeClass("mejs-unmute").addClass("mejs-mute"))),q(a)},!1),0===b.options.startVolume&&e.setMuted(!0),"native"===e.pluginType&&e.setVolume(b.options.startVolume),f.container.on("controlsresize",function(){e.muted?(m(0),h.removeClass("mejs-mute").addClass("mejs-unmute")):(m(e.volume),h.removeClass("mejs-unmute").addClass("mejs-mute"))})}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{usePluginFullScreen:!0,newWindowCallback:function(){return""},fullscreenText:""}),a.extend(MediaElementPlayer.prototype,{isFullScreen:!1,isNativeFullScreen:!1,isInIframe:!1,fullscreenMode:"",buildfullscreen:function(b,c,d,e){if(b.isVideo){b.isInIframe=window.location!=window.parent.location,e.addEventListener("loadstart",function(){b.detectFullscreenMode()});var f=this,g=null,h=f.options.fullscreenText?f.options.fullscreenText:mejs.i18n.t("mejs.fullscreen"),i=a('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+f.id+'" title="'+h+'" aria-label="'+h+'"></button></div>').appendTo(c).on("click",function(){var a=mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||b.isFullScreen;a?b.exitFullScreen():b.enterFullScreen()}).on("mouseover",function(){if("plugin-hover"==f.fullscreenMode){null!==g&&(clearTimeout(g),delete g);var a=i.offset(),c=b.container.offset();e.positionFullscreenButton(a.left-c.left,a.top-c.top,!0)}}).on("mouseout",function(){"plugin-hover"==f.fullscreenMode&&(null!==g&&(clearTimeout(g),delete g),g=setTimeout(function(){e.hideFullscreenButton()},1500))});if(b.fullscreenBtn=i,f.globalBind("keydown",function(a){27==a.keyCode&&(mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||f.isFullScreen)&&b.exitFullScreen()}),f.normalHeight=0,f.normalWidth=0,mejs.MediaFeatures.hasTrueNativeFullScreen){var j=function(a){b.isFullScreen&&(mejs.MediaFeatures.isFullScreen()?(b.isNativeFullScreen=!0,b.setControlsSize()):(b.isNativeFullScreen=!1,b.exitFullScreen()))};b.globalBind(mejs.MediaFeatures.fullScreenEventName,j)}}},detectFullscreenMode:function(){var a=this,b="",c=mejs.MediaFeatures;return c.hasTrueNativeFullScreen&&"native"===a.media.pluginType?b="native-native":c.hasTrueNativeFullScreen&&"native"!==a.media.pluginType&&!c.hasFirefoxPluginMovingProblem?b="plugin-native":a.usePluginFullScreen?mejs.MediaFeatures.supportsPointerEvents?(b="plugin-click",a.createPluginClickThrough()):b="plugin-hover":b="fullwindow",a.fullscreenMode=b,b},isPluginClickThroughCreated:!1,createPluginClickThrough:function(){var b=this;if(!b.isPluginClickThroughCreated){var c,d,e=!1,f=function(){if(e){for(var a in g)g[a].hide();b.fullscreenBtn.css("pointer-events",""),b.controls.css("pointer-events",""),b.media.removeEventListener("click",b.clickToPlayPauseCallback),e=!1}},g={},h=["top","left","right","bottom"],i=function(){var a=fullscreenBtn.offset().left-b.container.offset().left,d=fullscreenBtn.offset().top-b.container.offset().top,e=fullscreenBtn.outerWidth(!0),f=fullscreenBtn.outerHeight(!0),h=b.container.width(),i=b.container.height();for(c in g)g[c].css({position:"absolute",top:0,left:0});g.top.width(h).height(d),g.left.width(a).height(f).css({top:d}),g.right.width(h-a-e).height(f).css({top:d,left:a+e}),g.bottom.width(h).height(i-f-d).css({top:d+f})};for(b.globalBind("resize",function(){i()}),c=0,d=h.length;d>c;c++)g[h[c]]=a('<div class="mejs-fullscreen-hover" />').appendTo(b.container).mouseover(f).hide();fullscreenBtn.on("mouseover",function(){if(!b.isFullScreen){var a=fullscreenBtn.offset(),d=player.container.offset();media.positionFullscreenButton(a.left-d.left,a.top-d.top,!1),b.fullscreenBtn.css("pointer-events","none"),b.controls.css("pointer-events","none"),b.media.addEventListener("click",b.clickToPlayPauseCallback);for(c in g)g[c].show();i(),e=!0}}),media.addEventListener("fullscreenchange",function(a){b.isFullScreen=!b.isFullScreen,b.isFullScreen?b.media.removeEventListener("click",b.clickToPlayPauseCallback):b.media.addEventListener("click",b.clickToPlayPauseCallback),f()}),b.globalBind("mousemove",function(a){if(e){var c=fullscreenBtn.offset();(a.pageY<c.top||a.pageY>c.top+fullscreenBtn.outerHeight(!0)||a.pageX<c.left||a.pageX>c.left+fullscreenBtn.outerWidth(!0))&&(fullscreenBtn.css("pointer-events",""),b.controls.css("pointer-events",""),e=!1)}}),b.isPluginClickThroughCreated=!0}},cleanfullscreen:function(a){a.exitFullScreen()},containerSizeTimeout:null,enterFullScreen:function(){var b=this;if(mejs.MediaFeatures.isiOS&&mejs.MediaFeatures.hasiOSFullScreen&&"function"==typeof b.media.webkitEnterFullscreen)return void b.media.webkitEnterFullscreen();a(document.documentElement).addClass("mejs-fullscreen"),b.normalHeight=b.container.height(),b.normalWidth=b.container.width(),"native-native"===b.fullscreenMode||"plugin-native"===b.fullscreenMode?(mejs.MediaFeatures.requestFullScreen(b.container[0]),b.isInIframe&&setTimeout(function d(){if(b.isNativeFullScreen){var c=.002,e=a(window).width(),f=screen.width,g=Math.abs(f-e),h=f*c;g>h?b.exitFullScreen():setTimeout(d,500)}},1e3)):"fullwindow"==b.fullscreeMode,b.container.addClass("mejs-container-fullscreen").width("100%").height("100%"),b.containerSizeTimeout=setTimeout(function(){b.container.css({width:"100%",height:"100%"}),b.setControlsSize()},500),"native"===b.media.pluginType?b.$media.width("100%").height("100%"):(b.container.find(".mejs-shim").width("100%").height("100%"),setTimeout(function(){var c=a(window),d=c.width(),e=c.height();b.media.setVideoSize(d,e)},500)),b.layers.children("div").width("100%").height("100%"),b.fullscreenBtn&&b.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen"),b.setControlsSize(),b.isFullScreen=!0;var c=Math.min(screen.width/b.width,screen.height/b.height);b.container.find(".mejs-captions-text").css("font-size",100*c+"%"),b.container.find(".mejs-captions-text").css("line-height","normal"),b.container.find(".mejs-captions-position").css("bottom","45px"),b.container.trigger("enteredfullscreen")},exitFullScreen:function(){var b=this;clearTimeout(b.containerSizeTimeout),mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||b.isFullScreen)&&mejs.MediaFeatures.cancelFullScreen(),a(document.documentElement).removeClass("mejs-fullscreen"),b.container.removeClass("mejs-container-fullscreen").width(b.normalWidth).height(b.normalHeight),"native"===b.media.pluginType?b.$media.width(b.normalWidth).height(b.normalHeight):(b.container.find(".mejs-shim").width(b.normalWidth).height(b.normalHeight),b.media.setVideoSize(b.normalWidth,b.normalHeight)),b.layers.children("div").width(b.normalWidth).height(b.normalHeight),b.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen"),b.setControlsSize(),b.isFullScreen=!1,b.container.find(".mejs-captions-text").css("font-size",""),b.container.find(".mejs-captions-text").css("line-height",""),b.container.find(".mejs-captions-position").css("bottom",""),b.container.trigger("exitedfullscreen")}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x"}),a.extend(MediaElementPlayer.prototype,{buildspeed:function(b,c,d,e){var f=this;if("native"==f.media.pluginType){for(var g=null,h=null,i=null,j=null,k=[],l=!1,m=0,n=f.options.speeds.length;n>m;m++){var o=f.options.speeds[m];"string"==typeof o?(k.push({name:o+f.options.speedChar,value:o}),o===f.options.defaultSpeed&&(l=!0)):(k.push(o),o.value===f.options.defaultSpeed&&(l=!0))}l||k.push({name:f.options.defaultSpeed+f.options.speedChar,value:f.options.defaultSpeed}),k.sort(function(a,b){return parseFloat(b.value)-parseFloat(a.value)});var p=function(a){for(m=0,n=k.length;n>m;m++)if(k[m].value===a)return k[m].name},q='<div class="mejs-button mejs-speed-button"><button type="button">'+p(f.options.defaultSpeed)+'</button><div class="mejs-speed-selector"><ul>';for(m=0,il=k.length;m<il;m++)j=f.id+"-speed-"+k[m].value,q+='<li><input type="radio" name="speed" value="'+k[m].value+'" id="'+j+'" '+(k[m].value===f.options.defaultSpeed?" checked":"")+' /><label for="'+j+'" '+(k[m].value===f.options.defaultSpeed?' class="mejs-speed-selected"':"")+">"+k[m].name+"</label></li>";q+="</ul></div></div>",g=a(q).appendTo(c),h=g.find(".mejs-speed-selector"),i=f.options.defaultSpeed,e.addEventListener("loadedmetadata",function(a){i&&(e.playbackRate=parseFloat(i))},!0),h.on("click",'input[type="radio"]',function(){var b=a(this).attr("value");i=b,e.playbackRate=parseFloat(b),g.find("button").html(p(b)),g.find(".mejs-speed-selected").removeClass("mejs-speed-selected"),g.find('input[type="radio"]:checked').next().addClass("mejs-speed-selected")}),g.one("mouseenter focusin",function(){h.height(g.find(".mejs-speed-selector ul").outerHeight(!0)+g.find(".mejs-speed-translations").outerHeight(!0)).css("top",-1*h.height()+"px")})}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{startLanguage:"",tracksText:"",tracksAriaLive:!1,hideCaptionsButtonWhenEmpty:!0,toggleCaptionsButtonWhenOnlyOne:!1,slidesSelector:""}),a.extend(MediaElementPlayer.prototype,{hasChapters:!1,cleartracks:function(a,b,c,d){a&&(a.captions&&a.captions.remove(),a.chapters&&a.chapters.remove(),a.captionsText&&a.captionsText.remove(),a.captionsButton&&a.captionsButton.remove())},buildtracks:function(b,c,d,e){if(0!==b.tracks.length){var f,g,h=this,i=h.options.tracksAriaLive?'role="log" aria-live="assertive" aria-atomic="false"':"",j=h.options.tracksText?h.options.tracksText:mejs.i18n.t("mejs.captions-subtitles");if(h.domNode.textTracks)for(f=h.domNode.textTracks.length-1;f>=0;f--)h.domNode.textTracks[f].mode="hidden";h.cleartracks(b,c,d,e),b.chapters=a('<div class="mejs-chapters mejs-layer"></div>').prependTo(d).hide(),b.captions=a('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover" '+i+'><span class="mejs-captions-text"></span></div></div>').prependTo(d).hide(),b.captionsText=b.captions.find(".mejs-captions-text"),b.captionsButton=a('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+h.id+'" title="'+j+'" aria-label="'+j+'"></button><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+b.id+'_captions" id="'+b.id+'_captions_none" value="none" checked="checked" /><label for="'+b.id+'_captions_none">'+mejs.i18n.t("mejs.none")+"</label></li></ul></div></div>").appendTo(c);var k=0;for(f=0;f<b.tracks.length;f++)g=b.tracks[f].kind,("subtitles"===g||"captions"===g)&&k++;for(h.options.toggleCaptionsButtonWhenOnlyOne&&1==k?b.captionsButton.on("click",function(){null===b.selectedTrack?lang=b.tracks[0].srclang:lang="none",b.setTrack(lang)}):(b.captionsButton.on("mouseenter focusin",function(){a(this).find(".mejs-captions-selector").removeClass("mejs-offscreen")}).on("click","input[type=radio]",function(){lang=this.value,b.setTrack(lang)}),b.captionsButton.on("mouseleave focusout",function(){a(this).find(".mejs-captions-selector").addClass("mejs-offscreen")})),b.options.alwaysShowControls?b.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):b.container.bind("controlsshown",function(){b.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("controlshidden",function(){e.paused||b.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")}),b.trackToLoad=-1,b.selectedTrack=null,b.isLoadingTrack=!1,f=0;f<b.tracks.length;f++)g=b.tracks[f].kind,("subtitles"===g||"captions"===g)&&b.addTrackButton(b.tracks[f].srclang,b.tracks[f].label);b.loadNextTrack(),e.addEventListener("timeupdate",function(){b.displayCaptions()},!1),""!==b.options.slidesSelector&&(b.slidesContainer=a(b.options.slidesSelector),e.addEventListener("timeupdate",function(){b.displaySlides()},!1)),e.addEventListener("loadedmetadata",function(){b.displayChapters()},!1),b.container.hover(function(){b.hasChapters&&(b.chapters.removeClass("mejs-offscreen"),b.chapters.fadeIn(200).height(b.chapters.find(".mejs-chapter").outerHeight()))},function(){b.hasChapters&&!e.paused&&b.chapters.fadeOut(200,function(){a(this).addClass("mejs-offscreen"),a(this).css("display","block")})}),h.container.on("controlsresize",function(){h.adjustLanguageBox()}),null!==b.node.getAttribute("autoplay")&&b.chapters.addClass("mejs-offscreen")}},setTrack:function(a){var b,c=this;if("none"==a)c.selectedTrack=null,c.captionsButton.removeClass("mejs-captions-enabled");else for(b=0;b<c.tracks.length;b++)if(c.tracks[b].srclang==a){null===c.selectedTrack&&c.captionsButton.addClass("mejs-captions-enabled"),c.selectedTrack=c.tracks[b],c.captions.attr("lang",c.selectedTrack.srclang),c.displayCaptions();break}},loadNextTrack:function(){var a=this;a.trackToLoad++,a.trackToLoad<a.tracks.length?(a.isLoadingTrack=!0,a.loadTrack(a.trackToLoad)):(a.isLoadingTrack=!1,a.checkForTracks())},loadTrack:function(b){var c=this,d=c.tracks[b],e=function(){d.isLoaded=!0,c.enableTrackButton(d.srclang,d.label),c.loadNextTrack()};(void 0!==d.src||""!==d.src)&&a.ajax({url:d.src,dataType:"text",success:function(a){"string"==typeof a&&/<tt\s+xml/gi.exec(a)?d.entries=mejs.TrackFormatParser.dfxp.parse(a):d.entries=mejs.TrackFormatParser.webvtt.parse(a),e(),"chapters"==d.kind&&c.media.addEventListener("play",function(){c.media.duration>0&&c.displayChapters(d)},!1),"slides"==d.kind&&c.setupSlides(d)},error:function(){c.removeTrackButton(d.srclang),c.loadNextTrack()}})},enableTrackButton:function(b,c){var d=this;""===c&&(c=mejs.language.codes[b]||b),d.captionsButton.find("input[value="+b+"]").prop("disabled",!1).siblings("label").html(c),d.options.startLanguage==b&&a("#"+d.id+"_captions_"+b).prop("checked",!0).trigger("click"),d.adjustLanguageBox()},removeTrackButton:function(a){var b=this;b.captionsButton.find("input[value="+a+"]").closest("li").remove(),b.adjustLanguageBox()},addTrackButton:function(b,c){var d=this;""===c&&(c=mejs.language.codes[b]||b),d.captionsButton.find("ul").append(a('<li><input type="radio" name="'+d.id+'_captions" id="'+d.id+"_captions_"+b+'" value="'+b+'" disabled="disabled" /><label for="'+d.id+"_captions_"+b+'">'+c+" (loading)</label></li>")),d.adjustLanguageBox(),d.container.find(".mejs-captions-translations option[value="+b+"]").remove()},adjustLanguageBox:function(){var a=this;a.captionsButton.find(".mejs-captions-selector").height(a.captionsButton.find(".mejs-captions-selector ul").outerHeight(!0)+a.captionsButton.find(".mejs-captions-translations").outerHeight(!0))},checkForTracks:function(){var a=this,b=!1;if(a.options.hideCaptionsButtonWhenEmpty){for(var c=0;c<a.tracks.length;c++){var d=a.tracks[c].kind;if(("subtitles"===d||"captions"===d)&&a.tracks[c].isLoaded){b=!0;break}}b||(a.captionsButton.hide(),a.setControlsSize())}},displayCaptions:function(){if("undefined"!=typeof this.tracks){var a,b=this,c=b.selectedTrack;if(null!==c&&c.isLoaded){for(a=0;a<c.entries.times.length;a++)if(b.media.currentTime>=c.entries.times[a].start&&b.media.currentTime<=c.entries.times[a].stop)return b.captionsText.html(c.entries.text[a]).attr("class","mejs-captions-text "+(c.entries.times[a].identifier||"")),void b.captions.show().height(0);b.captions.hide()}else b.captions.hide()}},setupSlides:function(a){var b=this;b.slides=a,b.slides.entries.imgs=[b.slides.entries.text.length],b.showSlide(0)},showSlide:function(b){if("undefined"!=typeof this.tracks&&"undefined"!=typeof this.slidesContainer){var c=this,d=c.slides.entries.text[b],e=c.slides.entries.imgs[b];"undefined"==typeof e||"undefined"==typeof e.fadeIn?c.slides.entries.imgs[b]=e=a('<img src="'+d+'">').on("load",function(){e.appendTo(c.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()}):e.is(":visible")||e.is(":animated")||e.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if("undefined"!=typeof this.slides){var a,b=this,c=b.slides;for(a=0;a<c.entries.times.length;a++)if(b.media.currentTime>=c.entries.times[a].start&&b.media.currentTime<=c.entries.times[a].stop)return void b.showSlide(a)}},displayChapters:function(){var a,b=this;for(a=0;a<b.tracks.length;a++)if("chapters"==b.tracks[a].kind&&b.tracks[a].isLoaded){b.drawChapters(b.tracks[a]),b.hasChapters=!0;break}},drawChapters:function(b){var c,d,e=this,f=0,g=0;for(e.chapters.empty(),c=0;c<b.entries.times.length;c++)d=b.entries.times[c].stop-b.entries.times[c].start,f=Math.floor(d/e.media.duration*100),(f+g>100||c==b.entries.times.length-1&&100>f+g)&&(f=100-g),e.chapters.append(a('<div class="mejs-chapter" rel="'+b.entries.times[c].start+'" style="left: '+g.toString()+"%;width: "+f.toString()+'%;"><div class="mejs-chapter-block'+(c==b.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+b.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(b.entries.times[c].start,e.options)+"–"+mejs.Utility.secondsToTimeCode(b.entries.times[c].stop,e.options)+"</span></div></div>")),g+=f;e.chapters.find("div.mejs-chapter").click(function(){e.media.setCurrentTime(parseFloat(a(this).attr("rel"))),e.media.paused&&e.media.play()}),e.chapters.show()}}),mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",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",fl:"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",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.TrackFormatParser={webvtt:{pattern_timecode:/^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(b){for(var c,d,e,f=0,g=mejs.TrackFormatParser.split2(b,/\r?\n/),h={text:[],times:[]};f<g.length;f++){if(c=this.pattern_timecode.exec(g[f]),c&&f<g.length){for(f-1>=0&&""!==g[f-1]&&(e=g[f-1]),f++,d=g[f],f++;""!==g[f]&&f<g.length;)d=d+"\n"+g[f],f++;d=a.trim(d).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>"),h.text.push(d),h.times.push({identifier:e,start:0===mejs.Utility.convertSMPTEtoSeconds(c[1])?.2:mejs.Utility.convertSMPTEtoSeconds(c[1]),stop:mejs.Utility.convertSMPTEtoSeconds(c[3]),settings:c[5]})}e=""}return h}},dfxp:{parse:function(b){b=a(b).filter("tt");var c,d,e=0,f=b.children("div").eq(0),g=f.find("p"),h=b.find("#"+f.attr("style")),i={text:[],times:[]};if(h.length){var j=h.removeAttr("id").get(0).attributes;if(j.length)for(c={},e=0;e<j.length;e++)c[j[e].name.split(":")[1]]=j[e].value}for(e=0;e<g.length;e++){var k,l={start:null,stop:null,style:null};if(g.eq(e).attr("begin")&&(l.start=mejs.Utility.convertSMPTEtoSeconds(g.eq(e).attr("begin"))),!l.start&&g.eq(e-1).attr("end")&&(l.start=mejs.Utility.convertSMPTEtoSeconds(g.eq(e-1).attr("end"))),g.eq(e).attr("end")&&(l.stop=mejs.Utility.convertSMPTEtoSeconds(g.eq(e).attr("end"))),!l.stop&&g.eq(e+1).attr("begin")&&(l.stop=mejs.Utility.convertSMPTEtoSeconds(g.eq(e+1).attr("begin"))),c){k="";for(var m in c)k+=m+":"+c[m]+";"}k&&(l.style=k),0===l.start&&(l.start=.2),i.times.push(l),d=a.trim(g.eq(e).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>"),i.text.push(d)}return i}},split2:function(a,b){return a.split(b)}},3!="x\n\ny".split(/\n/gi).length&&(mejs.TrackFormatParser.split2=function(a,b){var c,d=[],e="";for(c=0;c<a.length;c++)e+=a.substring(c,c+1),b.test(e)&&(d.push(e.replace(b,"")),e="");return d.push(e),d})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{sourcechooserText:""}),a.extend(MediaElementPlayer.prototype,{buildsourcechooser:function(b,c,d,e){var f,g=this,h=g.options.sourcechooserText?g.options.sourcechooserText:mejs.i18n.t("mejs.source-chooser");b.sourcechooserButton=a('<div class="mejs-button mejs-sourcechooser-button"><button type="button" role="button" aria-haspopup="true" aria-owns="'+g.id+'" title="'+h+'" aria-label="'+h+'"></button><div class="mejs-sourcechooser-selector mejs-offscreen" role="menu" aria-expanded="false" aria-hidden="true"><ul></ul></div></div>').appendTo(c).hover(function(){clearTimeout(f),b.showSourcechooserSelector()},function(){a(this);f=setTimeout(function(){b.hideSourcechooserSelector()},500)}).on("keydown",function(c){var d=c.keyCode;switch(d){case 32:mejs.MediaFeatures.isFirefox||b.showSourcechooserSelector(),a(this).find(".mejs-sourcechooser-selector").find("input[type=radio]:checked").first().focus();break;case 13:b.showSourcechooserSelector(),a(this).find(".mejs-sourcechooser-selector").find("input[type=radio]:checked").first().focus();break;case 27:b.hideSourcechooserSelector(),a(this).find("button").focus();break;default:return!0}}).on("focusout",mejs.Utility.debounce(function(c){setTimeout(function(){var c=a(document.activeElement).closest(".mejs-sourcechooser-selector");c.length||b.hideSourcechooserSelector()},0)},100)).delegate("input[type=radio]","click",function(){a(this).attr("aria-selected",!0).attr("checked","checked"),a(this).closest(".mejs-sourcechooser-selector").find("input[type=radio]").not(this).attr("aria-selected","false").removeAttr("checked");var b=this.value;if(e.currentSrc!=b){var c=e.currentTime,d=e.paused;e.pause(),e.setSrc(b),e.addEventListener("loadedmetadata",function(a){e.currentTime=c},!0);var f=function(a){d||e.play(),e.removeEventListener("canplay",f,!0)};e.addEventListener("canplay",f,!0),e.load()}}).delegate("button","click",function(c){a(this).siblings(".mejs-sourcechooser-selector").hasClass("mejs-offscreen")?(b.showSourcechooserSelector(),a(this).siblings(".mejs-sourcechooser-selector").find("input[type=radio]:checked").first().focus()):b.hideSourcechooserSelector()});for(var i in this.node.children){var j=this.node.children[i];"SOURCE"!==j.nodeName||"probably"!=e.canPlayType(j.type)&&"maybe"!=e.canPlayType(j.type)||b.addSourceButton(j.src,j.title,j.type,e.src==j.src)}},addSourceButton:function(b,c,d,e){var f=this;(""===c||void 0==c)&&(c=b),d=d.split("/")[1],f.sourcechooserButton.find("ul").append(a('<li><input type="radio" name="'+f.id+'_sourcechooser" id="'+f.id+"_sourcechooser_"+c+d+'" role="menuitemradio" value="'+b+'" '+(e?'checked="checked"':"")+'aria-selected="'+e+'" /><label for="'+f.id+"_sourcechooser_"+c+d+'" aria-hidden="true">'+c+" ("+d+")</label></li>")),f.adjustSourcechooserBox()},adjustSourcechooserBox:function(){var a=this;a.sourcechooserButton.find(".mejs-sourcechooser-selector").height(a.sourcechooserButton.find(".mejs-sourcechooser-selector ul").outerHeight(!0))},hideSourcechooserSelector:function(){this.sourcechooserButton.find(".mejs-sourcechooser-selector").addClass("mejs-offscreen").attr("aria-expanded","false").attr("aria-hidden","true").find("input[type=radio]").attr("tabindex","-1")},showSourcechooserSelector:function(){this.sourcechooserButton.find(".mejs-sourcechooser-selector").removeClass("mejs-offscreen").attr("aria-expanded","true").attr("aria-hidden","false").find("input[type=radio]").attr("tabindex","0")}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){return"undefined"==typeof a.enterFullScreen?null:a.isFullScreen?mejs.i18n.t("mejs.fullscreen-off"):mejs.i18n.t("mejs.fullscreen-on")},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?mejs.i18n.t("mejs.unmute"):mejs.i18n.t("mejs.mute")},click:function(a){a.media.muted?a.setMuted(!1):a.setMuted(!0)}},{isSeparator:!0},{render:function(a){return mejs.i18n.t("mejs.download-video")},click:function(a){window.location.href=a.media.currentSrc}}]}),a.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(b,c,d,e){b.contextMenu=a('<div class="mejs-contextmenu"></div>').appendTo(a("body")).hide(),b.container.bind("contextmenu",function(a){return b.isContextMenuEnabled?(a.preventDefault(),b.renderContextMenu(a.clientX-1,a.clientY-1),!1):void 0}),b.container.bind("click",function(){b.contextMenu.hide()}),b.contextMenu.bind("mouseleave",function(){b.startContextMenuTimer()})},cleancontextmenu:function(a){a.contextMenu.remove()},isContextMenuEnabled:!0,enableContextMenu:function(){this.isContextMenuEnabled=!0},disableContextMenu:function(){this.isContextMenuEnabled=!1},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer(),a.contextMenuTimer=setTimeout(function(){a.hideContextMenu(),a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;null!=a&&(clearTimeout(a),delete a,a=null)},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(b,c){for(var d=this,e="",f=d.options.contextMenuItems,g=0,h=f.length;h>g;g++)if(f[g].isSeparator)e+='<div class="mejs-contextmenu-separator"></div>';else{var i=f[g].render(d);null!=i&&(e+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+1e6*Math.random()+'">'+i+"</div>")}d.contextMenu.empty().append(a(e)).css({top:c,left:b}).show(),d.contextMenu.find(".mejs-contextmenu-item").each(function(){var b=a(this),c=parseInt(b.data("itemindex"),10),e=d.options.contextMenuItems[c];"undefined"!=typeof e.show&&e.show(b,d),b.click(function(){"undefined"!=typeof e.click&&e.click(d),d.contextMenu.hide()})}),setTimeout(function(){d.killControlsTimer("rev3")},100)}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{skipBackInterval:30,skipBackText:""}),a.extend(MediaElementPlayer.prototype,{buildskipback:function(b,c,d,e){var f=this,g=mejs.i18n.t("mejs.time-skip-back",f.options.skipBackInterval),h=f.options.skipBackText?f.options.skipBackText:g;a('<div class="mejs-button mejs-skip-back-button"><button type="button" aria-controls="'+f.id+'" title="'+h+'" aria-label="'+h+'">'+f.options.skipBackInterval+"</button></div>").appendTo(c).click(function(){e.setCurrentTime(Math.max(e.currentTime-f.options.skipBackInterval,0)),a(this).find("button").blur()})}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{postrollCloseText:""}),a.extend(MediaElementPlayer.prototype,{buildpostroll:function(b,c,d,e){var f=this,g=f.options.postrollCloseText?f.options.postrollCloseText:mejs.i18n.t("mejs.close"),h=f.container.find('link[rel="postroll"]').attr("href");"undefined"!=typeof h&&(b.postroll=a('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">'+g+'</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(d).hide(),f.media.addEventListener("ended",function(c){a.ajax({dataType:"html",url:h,success:function(a,b){d.find(".mejs-postroll-layer-content").html(a)}}),b.postroll.show()},!1))}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{markerColor:"#E9BC3D",markers:[],markerCallback:function(){}}),a.extend(MediaElementPlayer.prototype,{buildmarkers:function(a,b,c,d){var e=0,f=-1,g=-1,h=-1,i=-1;for(e=0;e<a.options.markers.length;++e)b.find(".mejs-time-total").append('<span class="mejs-time-marker"></span>');d.addEventListener("durationchange",function(c){a.setmarkers(b)}),d.addEventListener("timeupdate",function(b){for(f=Math.floor(d.currentTime),h>f?i>f&&(i=-1):h=f,e=0;e<a.options.markers.length;++e)g=Math.floor(a.options.markers[e]),f===g&&g!==i&&(a.options.markerCallback(d,d.currentTime),i=g)},!1)},setmarkers:function(b){var c,d=this,e=0;for(e=0;e<d.options.markers.length;++e)Math.floor(d.options.markers[e])<=d.media.duration&&Math.floor(d.options.markers[e])>=0&&(c=100*Math.floor(d.options.markers[e])/d.media.duration,a(b.find(".mejs-time-marker")[e]).css({width:"1px",left:c+"%",background:d.options.markerColor}))}})}(mejs.$);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mediaelement/mediaelement.js
CHANGED
@@ -1,21 +1,23 @@
|
|
1 |
/*!
|
2 |
-
*
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
|
|
|
14 |
// Namespace
|
15 |
var mejs = mejs || {};
|
16 |
|
17 |
// version number
|
18 |
-
mejs.version = '2.
|
|
|
19 |
|
20 |
// player number (for missing, same id attr)
|
21 |
mejs.meIndex = 0;
|
@@ -26,11 +28,12 @@ mejs.plugins = {
|
|
26 |
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','audio/mpeg']}
|
27 |
],
|
28 |
flash: [
|
29 |
-
{version: [9,0,124], types: ['video/mp4','video/m4v','video/mov','video/flv','video/rtmp','video/x-flv','audio/flv','audio/x-flv','audio/mp3','audio/m4a','audio/mpeg', 'video/
|
30 |
-
|
|
|
31 |
],
|
32 |
youtube: [
|
33 |
-
{version: null, types: ['video/youtube', 'video/x-youtube']}
|
34 |
],
|
35 |
vimeo: [
|
36 |
{version: null, types: ['video/vimeo', 'video/x-vimeo']}
|
@@ -56,47 +59,165 @@ mejs.Utility = {
|
|
56 |
var
|
57 |
i = 0,
|
58 |
j,
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
scripts = document.getElementsByTagName('script'),
|
63 |
il = scripts.length,
|
64 |
jl = scriptNames.length;
|
65 |
-
|
|
|
66 |
for (; i < il; i++) {
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
for (j = 0; j < jl; j++) {
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
72 |
break;
|
73 |
}
|
74 |
}
|
75 |
-
|
|
|
|
|
76 |
break;
|
77 |
}
|
78 |
}
|
79 |
-
|
|
|
|
|
80 |
},
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
fps = 25;
|
87 |
}
|
88 |
-
|
89 |
-
var
|
|
|
|
|
|
|
|
|
|
|
90 |
minutes = Math.floor(time / 60) % 60,
|
91 |
seconds = Math.floor(time % 60),
|
92 |
frames = Math.floor(((time % 1)*fps).toFixed(3)),
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
},
|
101 |
|
102 |
timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
|
@@ -148,7 +269,7 @@ mejs.Utility = {
|
|
148 |
/* borrowed from SWFObject: http://code.google.com/p/swfobject/source/browse/trunk/swfobject/src/swfobject.js#474 */
|
149 |
removeSwf: function(id) {
|
150 |
var obj = document.getElementById(id);
|
151 |
-
if (obj && obj.nodeName
|
152 |
if (mejs.MediaFeatures.isIE) {
|
153 |
obj.style.display = "none";
|
154 |
(function(){
|
@@ -173,6 +294,42 @@ mejs.Utility = {
|
|
173 |
}
|
174 |
obj.parentNode.removeChild(obj);
|
175 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
};
|
178 |
|
@@ -296,83 +453,145 @@ mejs.MediaFeatures = {
|
|
296 |
t.isiOS = t.isiPhone || t.isiPad;
|
297 |
t.isAndroid = (ua.match(/android/i) !== null);
|
298 |
t.isBustedAndroid = (ua.match(/android 2\.[12]/) !== null);
|
299 |
-
t.
|
|
|
300 |
t.isChrome = (ua.match(/chrome/gi) !== null);
|
|
|
301 |
t.isFirefox = (ua.match(/firefox/gi) !== null);
|
302 |
t.isWebkit = (ua.match(/webkit/gi) !== null);
|
303 |
-
t.isGecko = (ua.match(/gecko/gi) !== null) && !t.isWebkit;
|
304 |
t.isOpera = (ua.match(/opera/gi) !== null);
|
305 |
-
t.hasTouch = ('ontouchstart' in window);
|
306 |
-
|
307 |
-
//
|
308 |
-
|
309 |
-
|
|
|
310 |
|
311 |
// create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
|
312 |
for (i=0; i<html5Elements.length; i++) {
|
313 |
v = document.createElement(html5Elements[i]);
|
314 |
}
|
315 |
-
|
316 |
t.supportsMediaTag = (typeof v.canPlayType !== 'undefined' || t.isBustedAndroid);
|
317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
// detect native JavaScript fullscreen (Safari/Firefox only, Chrome still fails)
|
319 |
-
|
320 |
// iOS
|
321 |
-
t.
|
322 |
-
|
323 |
-
//
|
|
|
|
|
|
|
324 |
t.hasWebkitNativeFullScreen = (typeof v.webkitRequestFullScreen !== 'undefined');
|
325 |
t.hasMozNativeFullScreen = (typeof v.mozRequestFullScreen !== 'undefined');
|
326 |
-
|
327 |
-
|
|
|
328 |
t.nativeFullScreenEnabled = t.hasTrueNativeFullScreen;
|
|
|
|
|
329 |
if (t.hasMozNativeFullScreen) {
|
330 |
-
t.nativeFullScreenEnabled =
|
|
|
|
|
331 |
}
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
t.hasSemiNativeFullScreen = false;
|
336 |
}
|
337 |
-
|
338 |
if (t.hasTrueNativeFullScreen) {
|
339 |
-
|
340 |
-
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
t.isFullScreen = function() {
|
343 |
-
if (
|
344 |
return d.mozFullScreen;
|
345 |
-
|
|
|
346 |
return d.webkitIsFullScreen;
|
|
|
|
|
|
|
347 |
}
|
348 |
}
|
349 |
-
|
350 |
t.requestFullScreen = function(el) {
|
351 |
-
|
352 |
if (t.hasWebkitNativeFullScreen) {
|
353 |
el.webkitRequestFullScreen();
|
|
|
354 |
} else if (t.hasMozNativeFullScreen) {
|
355 |
el.mozRequestFullScreen();
|
|
|
|
|
|
|
|
|
356 |
}
|
357 |
}
|
358 |
-
|
359 |
-
t.cancelFullScreen = function() {
|
360 |
if (t.hasWebkitNativeFullScreen) {
|
361 |
document.webkitCancelFullScreen();
|
|
|
362 |
} else if (t.hasMozNativeFullScreen) {
|
363 |
document.mozCancelFullScreen();
|
|
|
|
|
|
|
|
|
364 |
}
|
365 |
-
}
|
366 |
-
|
367 |
}
|
368 |
-
|
369 |
-
|
370 |
// OS X 10.5 can't do this even if it says it can :(
|
371 |
-
if (t.
|
372 |
t.hasNativeFullScreen = false;
|
373 |
-
t.
|
374 |
}
|
375 |
-
|
376 |
}
|
377 |
};
|
378 |
mejs.MediaFeatures.init();
|
@@ -476,7 +695,7 @@ mejs.PluginMediaElement.prototype = {
|
|
476 |
// HTML5 methods
|
477 |
play: function () {
|
478 |
if (this.pluginApi != null) {
|
479 |
-
if (this.pluginType == 'youtube') {
|
480 |
this.pluginApi.playVideo();
|
481 |
} else {
|
482 |
this.pluginApi.playMedia();
|
@@ -486,7 +705,7 @@ mejs.PluginMediaElement.prototype = {
|
|
486 |
},
|
487 |
load: function () {
|
488 |
if (this.pluginApi != null) {
|
489 |
-
if (this.pluginType == 'youtube') {
|
490 |
} else {
|
491 |
this.pluginApi.loadMedia();
|
492 |
}
|
@@ -496,8 +715,10 @@ mejs.PluginMediaElement.prototype = {
|
|
496 |
},
|
497 |
pause: function () {
|
498 |
if (this.pluginApi != null) {
|
499 |
-
if (this.pluginType == 'youtube') {
|
500 |
-
|
|
|
|
|
501 |
} else {
|
502 |
this.pluginApi.pauseMedia();
|
503 |
}
|
@@ -508,7 +729,7 @@ mejs.PluginMediaElement.prototype = {
|
|
508 |
},
|
509 |
stop: function () {
|
510 |
if (this.pluginApi != null) {
|
511 |
-
if (this.pluginType == 'youtube') {
|
512 |
this.pluginApi.stopVideo();
|
513 |
} else {
|
514 |
this.pluginApi.stopMedia();
|
@@ -532,18 +753,18 @@ mejs.PluginMediaElement.prototype = {
|
|
532 |
for (j=0; j<pluginInfo.types.length; j++) {
|
533 |
// find plugin that can play the type
|
534 |
if (type == pluginInfo.types[j]) {
|
535 |
-
return
|
536 |
}
|
537 |
}
|
538 |
}
|
539 |
}
|
540 |
|
541 |
-
return
|
542 |
},
|
543 |
|
544 |
positionFullscreenButton: function(x,y,visibleAndAbove) {
|
545 |
if (this.pluginApi != null && this.pluginApi.positionFullscreenButton) {
|
546 |
-
this.pluginApi.positionFullscreenButton(x,y,visibleAndAbove);
|
547 |
}
|
548 |
},
|
549 |
|
@@ -569,7 +790,7 @@ mejs.PluginMediaElement.prototype = {
|
|
569 |
media = url[i];
|
570 |
if (this.canPlayType(media.type)) {
|
571 |
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
|
572 |
-
this.src = mejs.Utility.absolutizeUrl(
|
573 |
break;
|
574 |
}
|
575 |
}
|
@@ -578,7 +799,7 @@ mejs.PluginMediaElement.prototype = {
|
|
578 |
},
|
579 |
setCurrentTime: function (time) {
|
580 |
if (this.pluginApi != null) {
|
581 |
-
if (this.pluginType == 'youtube') {
|
582 |
this.pluginApi.seekTo(time);
|
583 |
} else {
|
584 |
this.pluginApi.setCurrentTime(time);
|
@@ -609,7 +830,7 @@ mejs.PluginMediaElement.prototype = {
|
|
609 |
this.pluginApi.unMute();
|
610 |
}
|
611 |
this.muted = muted;
|
612 |
-
this.dispatchEvent('volumechange');
|
613 |
} else {
|
614 |
this.pluginApi.setMuted(muted);
|
615 |
}
|
@@ -621,7 +842,7 @@ mejs.PluginMediaElement.prototype = {
|
|
621 |
setVideoSize: function (width, height) {
|
622 |
|
623 |
//if (this.pluginType == 'flash' || this.pluginType == 'silverlight') {
|
624 |
-
if ( this.pluginElement.style) {
|
625 |
this.pluginElement.style.width = width + 'px';
|
626 |
this.pluginElement.style.height = height + 'px';
|
627 |
}
|
@@ -660,7 +881,7 @@ mejs.PluginMediaElement.prototype = {
|
|
660 |
var callbacks = this.events[eventName];
|
661 |
if (!callbacks) return true;
|
662 |
if (!callback) { this.events[eventName] = []; return true; }
|
663 |
-
for (i = 0; i < callbacks.length; i++) {
|
664 |
if (callbacks[i] === callback) {
|
665 |
this.events[eventName].splice(i, 1);
|
666 |
return true;
|
@@ -668,15 +889,14 @@ mejs.PluginMediaElement.prototype = {
|
|
668 |
}
|
669 |
return false;
|
670 |
},
|
671 |
-
dispatchEvent: function (
|
672 |
var i,
|
673 |
args,
|
674 |
-
callbacks = this.events[
|
675 |
|
676 |
if (callbacks) {
|
677 |
-
args = Array.prototype.slice.call(arguments, 1);
|
678 |
for (i = 0; i < callbacks.length; i++) {
|
679 |
-
callbacks[i].apply(
|
680 |
}
|
681 |
}
|
682 |
},
|
@@ -693,7 +913,7 @@ mejs.PluginMediaElement.prototype = {
|
|
693 |
if (this.hasAttribute(name)) {
|
694 |
return this.attributes[name];
|
695 |
}
|
696 |
-
return
|
697 |
},
|
698 |
setAttribute: function(name, value){
|
699 |
this.attributes[name] = value;
|
@@ -704,80 +924,6 @@ mejs.PluginMediaElement.prototype = {
|
|
704 |
}
|
705 |
};
|
706 |
|
707 |
-
// Handles calls from Flash/Silverlight and reports them as native <video/audio> events and properties
|
708 |
-
mejs.MediaPluginBridge = {
|
709 |
-
|
710 |
-
pluginMediaElements:{},
|
711 |
-
htmlMediaElements:{},
|
712 |
-
|
713 |
-
registerPluginElement: function (id, pluginMediaElement, htmlMediaElement) {
|
714 |
-
this.pluginMediaElements[id] = pluginMediaElement;
|
715 |
-
this.htmlMediaElements[id] = htmlMediaElement;
|
716 |
-
},
|
717 |
-
|
718 |
-
// when Flash/Silverlight is ready, it calls out to this method
|
719 |
-
initPlugin: function (id) {
|
720 |
-
|
721 |
-
var pluginMediaElement = this.pluginMediaElements[id],
|
722 |
-
htmlMediaElement = this.htmlMediaElements[id];
|
723 |
-
|
724 |
-
if (pluginMediaElement) {
|
725 |
-
// find the javascript bridge
|
726 |
-
switch (pluginMediaElement.pluginType) {
|
727 |
-
case "flash":
|
728 |
-
pluginMediaElement.pluginElement = pluginMediaElement.pluginApi = document.getElementById(id);
|
729 |
-
break;
|
730 |
-
case "silverlight":
|
731 |
-
pluginMediaElement.pluginElement = document.getElementById(pluginMediaElement.id);
|
732 |
-
pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
|
733 |
-
break;
|
734 |
-
}
|
735 |
-
|
736 |
-
if (pluginMediaElement.pluginApi != null && pluginMediaElement.success) {
|
737 |
-
pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
|
738 |
-
}
|
739 |
-
}
|
740 |
-
},
|
741 |
-
|
742 |
-
// receives events from Flash/Silverlight and sends them out as HTML5 media events
|
743 |
-
// http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
|
744 |
-
fireEvent: function (id, eventName, values) {
|
745 |
-
|
746 |
-
var
|
747 |
-
e,
|
748 |
-
i,
|
749 |
-
bufferedTime,
|
750 |
-
pluginMediaElement = this.pluginMediaElements[id];
|
751 |
-
|
752 |
-
// fake event object to mimic real HTML media event.
|
753 |
-
e = {
|
754 |
-
type: eventName,
|
755 |
-
target: pluginMediaElement
|
756 |
-
};
|
757 |
-
|
758 |
-
// attach all values to element and event object
|
759 |
-
for (i in values) {
|
760 |
-
pluginMediaElement[i] = values[i];
|
761 |
-
e[i] = values[i];
|
762 |
-
}
|
763 |
-
|
764 |
-
// fake the newer W3C buffered TimeRange (loaded and total have been removed)
|
765 |
-
bufferedTime = values.bufferedTime || 0;
|
766 |
-
|
767 |
-
e.target.buffered = e.buffered = {
|
768 |
-
start: function(index) {
|
769 |
-
return 0;
|
770 |
-
},
|
771 |
-
end: function (index) {
|
772 |
-
return bufferedTime;
|
773 |
-
},
|
774 |
-
length: 1
|
775 |
-
};
|
776 |
-
|
777 |
-
pluginMediaElement.dispatchEvent(e.type, e);
|
778 |
-
}
|
779 |
-
};
|
780 |
-
|
781 |
/*
|
782 |
Default options
|
783 |
*/
|
@@ -793,6 +939,8 @@ mejs.MediaElementDefaults = {
|
|
793 |
plugins: ['flash','silverlight','youtube','vimeo'],
|
794 |
// shows debug errors on screen
|
795 |
enablePluginDebug: false,
|
|
|
|
|
796 |
// overrides the type specified, useful for dynamic instantiation
|
797 |
type: '',
|
798 |
// path to Flash and Silverlight plugins
|
@@ -801,8 +949,14 @@ mejs.MediaElementDefaults = {
|
|
801 |
flashName: 'flashmediaelement.swf',
|
802 |
// streamer for RTMP streaming
|
803 |
flashStreamer: '',
|
|
|
|
|
804 |
// turns on the smoothing filter in Flash
|
805 |
enablePluginSmoothing: false,
|
|
|
|
|
|
|
|
|
806 |
// name of silverlight file
|
807 |
silverlightName: 'silverlightmediaelement.xap',
|
808 |
// default if the <video width> is not specified
|
@@ -820,6 +974,9 @@ mejs.MediaElementDefaults = {
|
|
820 |
timerRate: 250,
|
821 |
// initial volume for player
|
822 |
startVolume: 0.8,
|
|
|
|
|
|
|
823 |
success: function () { },
|
824 |
error: function () { }
|
825 |
};
|
@@ -837,7 +994,7 @@ mejs.HtmlMediaElementShim = {
|
|
837 |
|
838 |
create: function(el, o) {
|
839 |
var
|
840 |
-
options =
|
841 |
htmlMediaElement = (typeof(el) == 'string') ? document.getElementById(el) : el,
|
842 |
tagName = htmlMediaElement.tagName.toLowerCase(),
|
843 |
isMediaTag = (tagName === 'audio' || tagName === 'video'),
|
@@ -850,9 +1007,13 @@ mejs.HtmlMediaElementShim = {
|
|
850 |
prop;
|
851 |
|
852 |
// extend options
|
|
|
|
|
|
|
853 |
for (prop in o) {
|
854 |
options[prop] = o[prop];
|
855 |
-
}
|
|
|
856 |
|
857 |
// clean up attributes
|
858 |
src = (typeof src == 'undefined' || src === null || src == '') ? null : src;
|
@@ -864,6 +1025,7 @@ mejs.HtmlMediaElementShim = {
|
|
864 |
// test for HTML5 and plugin capabilities
|
865 |
playback = this.determinePlayback(htmlMediaElement, options, mejs.MediaFeatures.supportsMediaTag, isMediaTag, src);
|
866 |
playback.url = (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '';
|
|
|
867 |
|
868 |
if (playback.method == 'native') {
|
869 |
// second fix for android
|
@@ -897,7 +1059,7 @@ mejs.HtmlMediaElementShim = {
|
|
897 |
l,
|
898 |
n,
|
899 |
type,
|
900 |
-
result = { method: '', url: '', htmlMediaElement: htmlMediaElement, isVideo: (htmlMediaElement.tagName.toLowerCase()
|
901 |
pluginName,
|
902 |
pluginVersions,
|
903 |
pluginInfo,
|
@@ -951,15 +1113,21 @@ mejs.HtmlMediaElementShim = {
|
|
951 |
// STEP 2: Test for playback method
|
952 |
|
953 |
// special case for Android which sadly doesn't implement the canPlayType function (always returns '')
|
954 |
-
if (mejs.MediaFeatures.isBustedAndroid) {
|
955 |
htmlMediaElement.canPlayType = function(type) {
|
956 |
return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'maybe' : '';
|
957 |
};
|
958 |
}
|
959 |
|
|
|
|
|
|
|
|
|
|
|
|
|
960 |
|
961 |
// test for native playback first
|
962 |
-
if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'auto_plugin' || options.mode === 'native')) {
|
963 |
|
964 |
if (!isMediaTag) {
|
965 |
|
@@ -974,9 +1142,11 @@ mejs.HtmlMediaElementShim = {
|
|
974 |
|
975 |
for (i=0; i<mediaFiles.length; i++) {
|
976 |
// normal check
|
977 |
-
if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
|
978 |
// special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
|
979 |
-
|| htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== ''
|
|
|
|
|
980 |
result.method = 'native';
|
981 |
result.url = mediaFiles[i].url;
|
982 |
break;
|
@@ -1021,7 +1191,7 @@ mejs.HtmlMediaElementShim = {
|
|
1021 |
// test for plugin playback types
|
1022 |
for (l=0; l<pluginInfo.types.length; l++) {
|
1023 |
// find plugin that can play the type
|
1024 |
-
if (type == pluginInfo.types[l]) {
|
1025 |
result.method = pluginName;
|
1026 |
result.url = mediaFiles[i].url;
|
1027 |
return result;
|
@@ -1048,8 +1218,6 @@ mejs.HtmlMediaElementShim = {
|
|
1048 |
},
|
1049 |
|
1050 |
formatType: function(url, type) {
|
1051 |
-
var ext;
|
1052 |
-
|
1053 |
// if no type is supplied, fake it with the extension
|
1054 |
if (url && !type) {
|
1055 |
return this.getTypeFromFile(url);
|
@@ -1068,33 +1236,46 @@ mejs.HtmlMediaElementShim = {
|
|
1068 |
|
1069 |
getTypeFromFile: function(url) {
|
1070 |
url = url.split('?')[0];
|
1071 |
-
var
|
1072 |
-
|
|
|
|
|
1073 |
},
|
1074 |
|
1075 |
-
getTypeFromExtension: function(ext) {
|
|
|
1076 |
|
1077 |
switch (ext) {
|
1078 |
case 'mp4':
|
1079 |
case 'm4v':
|
1080 |
-
|
|
|
|
|
|
|
|
|
|
|
1081 |
case 'webm':
|
1082 |
case 'webma':
|
1083 |
case 'webmv':
|
1084 |
-
return 'webm';
|
1085 |
case 'ogg':
|
1086 |
case 'oga':
|
1087 |
case 'ogv':
|
1088 |
-
return 'ogg';
|
|
|
|
|
|
|
|
|
1089 |
default:
|
1090 |
-
return ext;
|
1091 |
}
|
1092 |
},
|
1093 |
|
1094 |
createErrorMessage: function(playback, options, poster) {
|
1095 |
var
|
1096 |
htmlMediaElement = playback.htmlMediaElement,
|
1097 |
-
errorContainer = document.createElement('div')
|
|
|
1098 |
|
1099 |
errorContainer.className = 'me-cannotplay';
|
1100 |
|
@@ -1103,9 +1284,17 @@ mejs.HtmlMediaElementShim = {
|
|
1103 |
errorContainer.style.height = htmlMediaElement.height + 'px';
|
1104 |
} catch (e) {}
|
1105 |
|
1106 |
-
|
1107 |
-
'<a href="' + playback.url + '"
|
1108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1109 |
|
1110 |
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
|
1111 |
htmlMediaElement.style.display = 'none';
|
@@ -1126,20 +1315,22 @@ mejs.HtmlMediaElementShim = {
|
|
1126 |
initVars;
|
1127 |
|
1128 |
// copy tagName from html media element
|
1129 |
-
pluginMediaElement.tagName = htmlMediaElement.tagName
|
1130 |
|
1131 |
// copy attributes from html media element to plugin media element
|
1132 |
for (var i = 0; i < htmlMediaElement.attributes.length; i++) {
|
1133 |
var attribute = htmlMediaElement.attributes[i];
|
1134 |
-
if (attribute.specified
|
1135 |
pluginMediaElement.setAttribute(attribute.name, attribute.value);
|
1136 |
}
|
1137 |
}
|
1138 |
|
1139 |
// check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
|
1140 |
node = htmlMediaElement.parentNode;
|
1141 |
-
|
1142 |
-
|
|
|
|
|
1143 |
node.parentNode.parentNode.insertBefore(node, node.parentNode);
|
1144 |
break;
|
1145 |
}
|
@@ -1147,8 +1338,8 @@ mejs.HtmlMediaElementShim = {
|
|
1147 |
}
|
1148 |
|
1149 |
if (playback.isVideo) {
|
1150 |
-
width = (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
|
1151 |
-
height = (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
|
1152 |
|
1153 |
// in case of '%' make sure it's encoded
|
1154 |
width = mejs.Utility.encodeUrl(width);
|
@@ -1163,8 +1354,7 @@ mejs.HtmlMediaElementShim = {
|
|
1163 |
|
1164 |
// register plugin
|
1165 |
pluginMediaElement.success = options.success;
|
1166 |
-
|
1167 |
-
|
1168 |
// add container (must be added to DOM before inserting HTML for IE)
|
1169 |
container.className = 'me-plugin';
|
1170 |
container.id = pluginid + '_container';
|
@@ -1174,43 +1364,116 @@ mejs.HtmlMediaElementShim = {
|
|
1174 |
} else {
|
1175 |
document.body.insertBefore(container, document.body.childNodes[0]);
|
1176 |
}
|
|
|
|
|
1177 |
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
'flashstreamer=' + options.flashStreamer,
|
1188 |
-
'height=' + height];
|
1189 |
-
|
1190 |
-
if (playback.url !== null) {
|
1191 |
-
if (playback.method == 'flash') {
|
1192 |
-
initVars.push('file=' + mejs.Utility.encodeUrl(playback.url));
|
1193 |
-
} else {
|
1194 |
-
initVars.push('file=' + playback.url);
|
1195 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1196 |
}
|
1197 |
-
if (options.enablePluginDebug) {
|
1198 |
-
initVars.push('debug=true');
|
1199 |
-
}
|
1200 |
-
if (options.enablePluginSmoothing) {
|
1201 |
-
initVars.push('smoothing=true');
|
1202 |
-
}
|
1203 |
-
if (controls) {
|
1204 |
-
initVars.push('controls=true'); // shows controls in the plugin if desired
|
1205 |
-
}
|
1206 |
-
if (options.pluginVars) {
|
1207 |
-
initVars = initVars.concat(options.pluginVars);
|
1208 |
-
}
|
1209 |
|
1210 |
switch (playback.method) {
|
1211 |
case 'silverlight':
|
1212 |
container.innerHTML =
|
1213 |
-
'<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + pluginid + '" name="' + pluginid + '" width="' + width + '" height="' + height + '">' +
|
1214 |
'<param name="initParams" value="' + initVars.join(',') + '" />' +
|
1215 |
'<param name="windowless" value="true" />' +
|
1216 |
'<param name="background" value="black" />' +
|
@@ -1227,14 +1490,15 @@ mejs.HtmlMediaElementShim = {
|
|
1227 |
container.appendChild(specialIEContainer);
|
1228 |
specialIEContainer.outerHTML =
|
1229 |
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
|
1230 |
-
'id="' + pluginid + '" width="' + width + '" height="' + height + '">' +
|
1231 |
-
'<param name="movie" value="' + options.pluginPath + options.flashName + '?
|
1232 |
'<param name="flashvars" value="' + initVars.join('&') + '" />' +
|
1233 |
'<param name="quality" value="high" />' +
|
1234 |
'<param name="bgcolor" value="#000000" />' +
|
1235 |
'<param name="wmode" value="transparent" />' +
|
1236 |
-
'<param name="allowScriptAccess" value="
|
1237 |
'<param name="allowFullScreen" value="true" />' +
|
|
|
1238 |
'</object>';
|
1239 |
|
1240 |
} else {
|
@@ -1246,64 +1510,154 @@ mejs.HtmlMediaElementShim = {
|
|
1246 |
'quality="high" ' +
|
1247 |
'bgcolor="#000000" ' +
|
1248 |
'wmode="transparent" ' +
|
1249 |
-
'allowScriptAccess="
|
1250 |
'allowFullScreen="true" ' +
|
1251 |
'type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" ' +
|
1252 |
'src="' + options.pluginPath + options.flashName + '" ' +
|
1253 |
'flashvars="' + initVars.join('&') + '" ' +
|
1254 |
'width="' + width + '" ' +
|
1255 |
-
'height="' + height + '"
|
|
|
|
|
1256 |
}
|
1257 |
break;
|
1258 |
|
1259 |
case 'youtube':
|
1260 |
|
1261 |
|
1262 |
-
var
|
1263 |
-
|
1264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1265 |
container: container,
|
1266 |
containerId: container.id,
|
1267 |
pluginMediaElement: pluginMediaElement,
|
1268 |
pluginId: pluginid,
|
1269 |
videoId: videoId,
|
1270 |
height: height,
|
1271 |
-
width: width
|
|
|
|
|
1272 |
};
|
1273 |
|
1274 |
-
|
1275 |
-
|
1276 |
-
} else {
|
1277 |
mejs.YouTubeApi.enqueueIframe(youtubeSettings);
|
|
|
|
|
1278 |
}
|
1279 |
-
|
1280 |
break;
|
1281 |
|
1282 |
// DEMO Code. Does NOT work.
|
1283 |
case 'vimeo':
|
1284 |
-
|
1285 |
-
|
1286 |
pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1287 |
|
1288 |
-
container.innerHTML ='<iframe src="
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1301 |
break;
|
1302 |
}
|
1303 |
// hide original element
|
1304 |
htmlMediaElement.style.display = 'none';
|
1305 |
-
|
1306 |
-
|
1307 |
|
1308 |
return pluginMediaElement;
|
1309 |
},
|
@@ -1364,10 +1718,10 @@ mejs.HtmlMediaElementShim = {
|
|
1364 |
mejs.YouTubeApi = {
|
1365 |
isIframeStarted: false,
|
1366 |
isIframeLoaded: false,
|
1367 |
-
loadIframeApi: function() {
|
1368 |
if (!this.isIframeStarted) {
|
1369 |
var tag = document.createElement('script');
|
1370 |
-
tag.src = "
|
1371 |
var firstScriptTag = document.getElementsByTagName('script')[0];
|
1372 |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
1373 |
this.isIframeStarted = true;
|
@@ -1379,32 +1733,45 @@ mejs.YouTubeApi = {
|
|
1379 |
if (this.isLoaded) {
|
1380 |
this.createIframe(yt);
|
1381 |
} else {
|
1382 |
-
this.loadIframeApi();
|
1383 |
this.iframeQueue.push(yt);
|
1384 |
}
|
1385 |
},
|
1386 |
createIframe: function(settings) {
|
1387 |
-
|
1388 |
var
|
1389 |
-
pluginMediaElement = settings.pluginMediaElement,
|
|
|
1390 |
player = new YT.Player(settings.containerId, {
|
1391 |
height: settings.height,
|
1392 |
width: settings.width,
|
1393 |
videoId: settings.videoId,
|
1394 |
-
playerVars: {
|
1395 |
events: {
|
1396 |
-
'onReady': function() {
|
|
|
|
|
|
|
|
|
|
|
1397 |
|
1398 |
// hook up iframe object to MEjs
|
1399 |
settings.pluginMediaElement.pluginApi = player;
|
|
|
1400 |
|
1401 |
// init mejs
|
1402 |
-
|
|
|
|
|
1403 |
|
1404 |
// create timer
|
1405 |
setInterval(function() {
|
1406 |
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
|
1407 |
-
}, 250);
|
|
|
|
|
|
|
|
|
1408 |
},
|
1409 |
'onStateChange': function(e) {
|
1410 |
|
@@ -1416,7 +1783,7 @@ mejs.YouTubeApi = {
|
|
1416 |
},
|
1417 |
|
1418 |
createEvent: function (player, pluginMediaElement, eventName) {
|
1419 |
-
var
|
1420 |
type: eventName,
|
1421 |
target: pluginMediaElement
|
1422 |
};
|
@@ -1424,25 +1791,25 @@ mejs.YouTubeApi = {
|
|
1424 |
if (player && player.getDuration) {
|
1425 |
|
1426 |
// time
|
1427 |
-
pluginMediaElement.currentTime =
|
1428 |
-
pluginMediaElement.duration =
|
1429 |
|
1430 |
// state
|
1431 |
-
|
1432 |
-
|
1433 |
|
1434 |
// sound
|
1435 |
-
|
1436 |
-
|
1437 |
|
1438 |
// progress
|
1439 |
-
|
1440 |
-
|
1441 |
|
1442 |
// fake the W3C buffered TimeRange
|
1443 |
-
var bufferedTime =
|
1444 |
|
1445 |
-
|
1446 |
start: function(index) {
|
1447 |
return 0;
|
1448 |
},
|
@@ -1451,11 +1818,11 @@ mejs.YouTubeApi = {
|
|
1451 |
},
|
1452 |
length: 1
|
1453 |
};
|
1454 |
-
|
1455 |
}
|
1456 |
|
1457 |
// send event up the chain
|
1458 |
-
pluginMediaElement.dispatchEvent(
|
1459 |
},
|
1460 |
|
1461 |
iFrameReady: function() {
|
@@ -1477,32 +1844,32 @@ mejs.YouTubeApi = {
|
|
1477 |
|
1478 |
/*
|
1479 |
settings.container.innerHTML =
|
1480 |
-
'<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="
|
1481 |
-
'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; ">' +
|
1482 |
-
'<param name="allowScriptAccess" value="
|
1483 |
'<param name="wmode" value="transparent">' +
|
1484 |
'</object>';
|
1485 |
*/
|
1486 |
|
1487 |
var specialIEContainer,
|
1488 |
-
youtubeUrl = '
|
1489 |
|
1490 |
if (mejs.MediaFeatures.isIE) {
|
1491 |
|
1492 |
specialIEContainer = document.createElement('div');
|
1493 |
settings.container.appendChild(specialIEContainer);
|
1494 |
-
specialIEContainer.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
|
1495 |
-
'id="' + settings.pluginId + '" width="' + settings.width + '" height="' + settings.height + '">' +
|
1496 |
'<param name="movie" value="' + youtubeUrl + '" />' +
|
1497 |
'<param name="wmode" value="transparent" />' +
|
1498 |
-
'<param name="allowScriptAccess" value="
|
1499 |
'<param name="allowFullScreen" value="true" />' +
|
1500 |
'</object>';
|
1501 |
} else {
|
1502 |
settings.container.innerHTML =
|
1503 |
'<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="' + youtubeUrl + '" ' +
|
1504 |
-
'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; ">' +
|
1505 |
-
'<param name="allowScriptAccess" value="
|
1506 |
'<param name="wmode" value="transparent">' +
|
1507 |
'</object>';
|
1508 |
}
|
@@ -1518,7 +1885,8 @@ mejs.YouTubeApi = {
|
|
1518 |
// hook up and return to MediaELementPlayer.success
|
1519 |
pluginMediaElement.pluginApi =
|
1520 |
pluginMediaElement.pluginElement = player;
|
1521 |
-
|
|
|
1522 |
|
1523 |
// load the youtube video
|
1524 |
player.cueVideoById(settings.videoId);
|
@@ -1527,13 +1895,15 @@ mejs.YouTubeApi = {
|
|
1527 |
|
1528 |
window[callbackName] = function(e) {
|
1529 |
mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
|
1530 |
-
}
|
1531 |
|
1532 |
player.addEventListener('onStateChange', callbackName);
|
1533 |
|
1534 |
setInterval(function() {
|
1535 |
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
|
1536 |
}, 250);
|
|
|
|
|
1537 |
},
|
1538 |
|
1539 |
handleStateChange: function(youTubeState, player, pluginMediaElement) {
|
@@ -1572,219 +1942,437 @@ mejs.YouTubeApi = {
|
|
1572 |
}
|
1573 |
}
|
1574 |
// IFRAME
|
1575 |
-
function
|
1576 |
mejs.YouTubeApi.iFrameReady();
|
1577 |
-
}
|
1578 |
// FLASH
|
1579 |
-
function
|
1580 |
mejs.YouTubeApi.flashReady(id);
|
1581 |
-
}
|
1582 |
|
1583 |
window.mejs = mejs;
|
1584 |
window.MediaElement = mejs.MediaElement;
|
1585 |
|
1586 |
-
|
1587 |
-
*
|
1588 |
-
*
|
1589 |
-
* What is the concept beyond i18n?
|
1590 |
-
* http://en.wikipedia.org/wiki/Internationalization_and_localization
|
1591 |
-
*
|
1592 |
-
*
|
1593 |
-
* This file both i18n methods and locale which is used to translate
|
1594 |
-
* strings into other languages.
|
1595 |
-
*
|
1596 |
-
* Default translations are not available, you have to add them
|
1597 |
-
* through locale objects which are named exactly as the langcode
|
1598 |
-
* they stand for. The default language is always english (en).
|
1599 |
-
*
|
1600 |
-
*
|
1601 |
-
* Wrapper built to be able to attach the i18n object to
|
1602 |
-
* other objects without changing more than one line.
|
1603 |
-
*
|
1604 |
-
*
|
1605 |
-
* LICENSE:
|
1606 |
-
*
|
1607 |
-
* The i18n file uses methods from the Drupal project (drupal.js):
|
1608 |
-
* - i18n.methods.t() (modified)
|
1609 |
-
* - i18n.methods.checkPlain() (full copy)
|
1610 |
-
* - i18n.methods.formatString() (full copy)
|
1611 |
-
*
|
1612 |
-
* The Drupal project is (like mediaelementjs) licensed under GPLv2.
|
1613 |
-
* - http://drupal.org/licensing/faq/#q1
|
1614 |
-
* - https://github.com/johndyer/mediaelement
|
1615 |
-
* - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
1616 |
-
*
|
1617 |
-
*
|
1618 |
-
* @author
|
1619 |
-
* Tim Latz (latz.tim@gmail.com)
|
1620 |
-
*
|
1621 |
-
* @see
|
1622 |
-
* me-i18n-locale.js
|
1623 |
*
|
1624 |
-
*
|
1625 |
-
* - $ - zepto || jQuery ..
|
1626 |
-
* - context - document, iframe ..
|
1627 |
-
* - exports - CommonJS, window ..
|
1628 |
*
|
1629 |
*/
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1742 |
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1748 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1749 |
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
* @see i18n.methods.t()
|
1754 |
-
* @throws InvalidArgumentException
|
1755 |
-
*/
|
1756 |
-
i18n.t = function(str, args, options) {
|
1757 |
|
1758 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1759 |
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
|
|
|
|
|
|
1763 |
|
1764 |
-
|
1765 |
-
|
1766 |
-
};
|
1767 |
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1777 |
|
1778 |
-
|
1779 |
-
|
1780 |
-
}
|
|
|
|
|
1781 |
/*!
|
1782 |
* This is a i18n.locale language object.
|
1783 |
*
|
1784 |
-
|
1785 |
*
|
1786 |
* @author
|
1787 |
-
*
|
|
|
1788 |
*
|
1789 |
* @see
|
1790 |
* me-i18n.js
|
@@ -1792,15 +2380,62 @@ window.MediaElement = mejs.MediaElement;
|
|
1792 |
* @params
|
1793 |
* - exports - CommonJS, window ..
|
1794 |
*/
|
1795 |
-
|
1796 |
-
|
1797 |
"use strict";
|
1798 |
|
1799 |
-
exports.
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
|
|
|
|
|
|
|
|
|
|
1805 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1806 |
}(mejs.i18n.locale.strings));
|
1 |
/*!
|
2 |
+
*
|
3 |
+
* MediaElement.js
|
4 |
+
* HTML5 <video> and <audio> shim and player
|
5 |
+
* http://mediaelementjs.com/
|
6 |
+
*
|
7 |
+
* Creates a JavaScript object that mimics HTML5 MediaElement API
|
8 |
+
* for browsers that don't understand HTML5 or can't play the provided codec
|
9 |
+
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
10 |
+
*
|
11 |
+
* Copyright 2010-2014, John Dyer (http://j.hn)
|
12 |
+
* License: MIT
|
13 |
+
*
|
14 |
+
*/
|
15 |
// Namespace
|
16 |
var mejs = mejs || {};
|
17 |
|
18 |
// version number
|
19 |
+
mejs.version = '2.23.5';
|
20 |
+
|
21 |
|
22 |
// player number (for missing, same id attr)
|
23 |
mejs.meIndex = 0;
|
28 |
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','audio/mpeg']}
|
29 |
],
|
30 |
flash: [
|
31 |
+
{version: [9,0,124], types: ['video/mp4','video/m4v','video/mov','video/flv','video/rtmp','video/x-flv','audio/flv','audio/x-flv','audio/mp3','audio/m4a', 'audio/mp4', 'audio/mpeg', 'video/dailymotion', 'video/x-dailymotion', 'application/x-mpegURL', 'audio/ogg']}
|
32 |
+
// 'video/youtube', 'video/x-youtube',
|
33 |
+
// ,{version: [12,0], types: ['video/webm']} // for future reference (hopefully!)
|
34 |
],
|
35 |
youtube: [
|
36 |
+
{version: null, types: ['video/youtube', 'video/x-youtube', 'audio/youtube', 'audio/x-youtube']}
|
37 |
],
|
38 |
vimeo: [
|
39 |
{version: null, types: ['video/vimeo', 'video/x-vimeo']}
|
59 |
var
|
60 |
i = 0,
|
61 |
j,
|
62 |
+
codePath = '',
|
63 |
+
testname = '',
|
64 |
+
slashPos,
|
65 |
+
filenamePos,
|
66 |
+
scriptUrl,
|
67 |
+
scriptPath,
|
68 |
+
scriptFilename,
|
69 |
scripts = document.getElementsByTagName('script'),
|
70 |
il = scripts.length,
|
71 |
jl = scriptNames.length;
|
72 |
+
|
73 |
+
// go through all <script> tags
|
74 |
for (; i < il; i++) {
|
75 |
+
scriptUrl = scripts[i].src;
|
76 |
+
slashPos = scriptUrl.lastIndexOf('/');
|
77 |
+
if (slashPos > -1) {
|
78 |
+
scriptFilename = scriptUrl.substring(slashPos + 1);
|
79 |
+
scriptPath = scriptUrl.substring(0, slashPos + 1);
|
80 |
+
} else {
|
81 |
+
scriptFilename = scriptUrl;
|
82 |
+
scriptPath = '';
|
83 |
+
}
|
84 |
+
|
85 |
+
// see if any <script> tags have a file name that matches the
|
86 |
for (j = 0; j < jl; j++) {
|
87 |
+
testname = scriptNames[j];
|
88 |
+
filenamePos = scriptFilename.indexOf(testname);
|
89 |
+
if (filenamePos > -1) {
|
90 |
+
codePath = scriptPath;
|
91 |
break;
|
92 |
}
|
93 |
}
|
94 |
+
|
95 |
+
// if we found a path, then break and return it
|
96 |
+
if (codePath !== '') {
|
97 |
break;
|
98 |
}
|
99 |
}
|
100 |
+
|
101 |
+
// send the best path back
|
102 |
+
return codePath;
|
103 |
},
|
104 |
+
/*
|
105 |
+
* Calculate the time format to use. We have a default format set in the
|
106 |
+
* options but it can be imcomplete. We ajust it according to the media
|
107 |
+
* duration.
|
108 |
+
*
|
109 |
+
* We support format like 'hh:mm:ss:ff'.
|
110 |
+
*/
|
111 |
+
calculateTimeFormat: function(time, options, fps) {
|
112 |
+
if (time < 0) {
|
113 |
+
time = 0;
|
114 |
+
}
|
115 |
+
|
116 |
+
if(typeof fps == 'undefined') {
|
117 |
fps = 25;
|
118 |
}
|
119 |
+
|
120 |
+
var format = options.timeFormat,
|
121 |
+
firstChar = format[0],
|
122 |
+
firstTwoPlaces = (format[1] == format[0]),
|
123 |
+
separatorIndex = firstTwoPlaces? 2: 1,
|
124 |
+
separator = ':',
|
125 |
+
hours = Math.floor(time / 3600) % 24,
|
126 |
minutes = Math.floor(time / 60) % 60,
|
127 |
seconds = Math.floor(time % 60),
|
128 |
frames = Math.floor(((time % 1)*fps).toFixed(3)),
|
129 |
+
lis = [
|
130 |
+
[frames, 'f'],
|
131 |
+
[seconds, 's'],
|
132 |
+
[minutes, 'm'],
|
133 |
+
[hours, 'h']
|
134 |
+
];
|
135 |
+
|
136 |
+
// Try to get the separator from the format
|
137 |
+
if (format.length < separatorIndex) {
|
138 |
+
separator = format[separatorIndex];
|
139 |
+
}
|
140 |
+
|
141 |
+
var required = false;
|
142 |
+
|
143 |
+
for (var i=0, len=lis.length; i < len; i++) {
|
144 |
+
if (format.indexOf(lis[i][1]) !== -1) {
|
145 |
+
required=true;
|
146 |
+
}
|
147 |
+
else if (required) {
|
148 |
+
var hasNextValue = false;
|
149 |
+
for (var j=i; j < len; j++) {
|
150 |
+
if (lis[j][0] > 0) {
|
151 |
+
hasNextValue = true;
|
152 |
+
break;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
if (! hasNextValue) {
|
157 |
+
break;
|
158 |
+
}
|
159 |
+
|
160 |
+
if (!firstTwoPlaces) {
|
161 |
+
format = firstChar + format;
|
162 |
+
}
|
163 |
+
format = lis[i][1] + separator + format;
|
164 |
+
if (firstTwoPlaces) {
|
165 |
+
format = lis[i][1] + format;
|
166 |
+
}
|
167 |
+
firstChar = lis[i][1];
|
168 |
+
}
|
169 |
+
}
|
170 |
+
options.currentTimeFormat = format;
|
171 |
+
},
|
172 |
+
/*
|
173 |
+
* Prefix the given number by zero if it is lower than 10.
|
174 |
+
*/
|
175 |
+
twoDigitsString: function(n) {
|
176 |
+
if (n < 10) {
|
177 |
+
return '0' + n;
|
178 |
+
}
|
179 |
+
return String(n);
|
180 |
+
},
|
181 |
+
secondsToTimeCode: function(time, options) {
|
182 |
+
if (time < 0) {
|
183 |
+
time = 0;
|
184 |
+
}
|
185 |
+
|
186 |
+
// Maintain backward compatibility with method signature before v2.18.
|
187 |
+
if (typeof options !== 'object') {
|
188 |
+
var format = 'm:ss';
|
189 |
+
format = arguments[1] ? 'hh:mm:ss' : format; // forceHours
|
190 |
+
format = arguments[2] ? format + ':ff' : format; // showFrameCount
|
191 |
+
|
192 |
+
options = {
|
193 |
+
currentTimeFormat: format,
|
194 |
+
framesPerSecond: arguments[3] || 25
|
195 |
+
};
|
196 |
+
}
|
197 |
+
|
198 |
+
var fps = options.framesPerSecond;
|
199 |
+
if(typeof fps === 'undefined') {
|
200 |
+
fps = 25;
|
201 |
+
}
|
202 |
+
|
203 |
+
var format = options.currentTimeFormat,
|
204 |
+
hours = Math.floor(time / 3600) % 24,
|
205 |
+
minutes = Math.floor(time / 60) % 60,
|
206 |
+
seconds = Math.floor(time % 60),
|
207 |
+
frames = Math.floor(((time % 1)*fps).toFixed(3));
|
208 |
+
lis = [
|
209 |
+
[frames, 'f'],
|
210 |
+
[seconds, 's'],
|
211 |
+
[minutes, 'm'],
|
212 |
+
[hours, 'h']
|
213 |
+
];
|
214 |
+
|
215 |
+
var res = format;
|
216 |
+
for (i=0,len=lis.length; i < len; i++) {
|
217 |
+
res = res.replace(lis[i][1]+lis[i][1], this.twoDigitsString(lis[i][0]));
|
218 |
+
res = res.replace(lis[i][1], lis[i][0]);
|
219 |
+
}
|
220 |
+
return res;
|
221 |
},
|
222 |
|
223 |
timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
|
269 |
/* borrowed from SWFObject: http://code.google.com/p/swfobject/source/browse/trunk/swfobject/src/swfobject.js#474 */
|
270 |
removeSwf: function(id) {
|
271 |
var obj = document.getElementById(id);
|
272 |
+
if (obj && /object|embed/i.test(obj.nodeName)) {
|
273 |
if (mejs.MediaFeatures.isIE) {
|
274 |
obj.style.display = "none";
|
275 |
(function(){
|
294 |
}
|
295 |
obj.parentNode.removeChild(obj);
|
296 |
}
|
297 |
+
},
|
298 |
+
determineScheme: function(url) {
|
299 |
+
if (url && url.indexOf("://") != -1) {
|
300 |
+
return url.substr(0, url.indexOf("://")+3);
|
301 |
+
}
|
302 |
+
return "//"; // let user agent figure this out
|
303 |
+
},
|
304 |
+
|
305 |
+
// taken from underscore
|
306 |
+
debounce: function(func, wait, immediate) {
|
307 |
+
var timeout;
|
308 |
+
return function() {
|
309 |
+
var context = this, args = arguments;
|
310 |
+
var later = function() {
|
311 |
+
timeout = null;
|
312 |
+
if (!immediate) func.apply(context, args);
|
313 |
+
};
|
314 |
+
var callNow = immediate && !timeout;
|
315 |
+
clearTimeout(timeout);
|
316 |
+
timeout = setTimeout(later, wait);
|
317 |
+
if (callNow) func.apply(context, args);
|
318 |
+
};
|
319 |
+
},
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Returns true if targetNode appears after sourceNode in the dom.
|
323 |
+
* @param {HTMLElement} sourceNode - the source node for comparison
|
324 |
+
* @param {HTMLElement} targetNode - the node to compare against sourceNode
|
325 |
+
*/
|
326 |
+
isNodeAfter: function(sourceNode, targetNode) {
|
327 |
+
return !!(
|
328 |
+
sourceNode &&
|
329 |
+
targetNode &&
|
330 |
+
typeof sourceNode.compareDocumentPosition === 'function' &&
|
331 |
+
sourceNode.compareDocumentPosition(targetNode) & Node.DOCUMENT_POSITION_PRECEDING
|
332 |
+
);
|
333 |
}
|
334 |
};
|
335 |
|
453 |
t.isiOS = t.isiPhone || t.isiPad;
|
454 |
t.isAndroid = (ua.match(/android/i) !== null);
|
455 |
t.isBustedAndroid = (ua.match(/android 2\.[12]/) !== null);
|
456 |
+
t.isBustedNativeHTTPS = (location.protocol === 'https:' && (ua.match(/android [12]\./) !== null || ua.match(/macintosh.* version.* safari/) !== null));
|
457 |
+
t.isIE = (nav.appName.toLowerCase().indexOf("microsoft") != -1 || nav.appName.toLowerCase().match(/trident/gi) !== null);
|
458 |
t.isChrome = (ua.match(/chrome/gi) !== null);
|
459 |
+
t.isChromium = (ua.match(/chromium/gi) !== null);
|
460 |
t.isFirefox = (ua.match(/firefox/gi) !== null);
|
461 |
t.isWebkit = (ua.match(/webkit/gi) !== null);
|
462 |
+
t.isGecko = (ua.match(/gecko/gi) !== null) && !t.isWebkit && !t.isIE;
|
463 |
t.isOpera = (ua.match(/opera/gi) !== null);
|
464 |
+
t.hasTouch = ('ontouchstart' in window); // && window.ontouchstart != null); // this breaks iOS 7
|
465 |
+
|
466 |
+
// Borrowed from `Modernizr.svgasimg`, sources:
|
467 |
+
// - https://github.com/Modernizr/Modernizr/issues/687
|
468 |
+
// - https://github.com/Modernizr/Modernizr/pull/1209/files
|
469 |
+
t.svgAsImg = !!document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1');
|
470 |
|
471 |
// create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
|
472 |
for (i=0; i<html5Elements.length; i++) {
|
473 |
v = document.createElement(html5Elements[i]);
|
474 |
}
|
475 |
+
|
476 |
t.supportsMediaTag = (typeof v.canPlayType !== 'undefined' || t.isBustedAndroid);
|
477 |
|
478 |
+
// Fix for IE9 on Windows 7N / Windows 7KN (Media Player not installer)
|
479 |
+
try{
|
480 |
+
v.canPlayType("video/mp4");
|
481 |
+
}catch(e){
|
482 |
+
t.supportsMediaTag = false;
|
483 |
+
}
|
484 |
+
|
485 |
+
t.supportsPointerEvents = (function() {
|
486 |
+
// TAKEN FROM MODERNIZR
|
487 |
+
var element = document.createElement('x'),
|
488 |
+
documentElement = document.documentElement,
|
489 |
+
getComputedStyle = window.getComputedStyle,
|
490 |
+
supports;
|
491 |
+
if(!('pointerEvents' in element.style)){
|
492 |
+
return false;
|
493 |
+
}
|
494 |
+
element.style.pointerEvents = 'auto';
|
495 |
+
element.style.pointerEvents = 'x';
|
496 |
+
documentElement.appendChild(element);
|
497 |
+
supports = getComputedStyle &&
|
498 |
+
getComputedStyle(element, '').pointerEvents === 'auto';
|
499 |
+
documentElement.removeChild(element);
|
500 |
+
return !!supports;
|
501 |
+
})();
|
502 |
+
|
503 |
+
|
504 |
+
// Older versions of Firefox can't move plugins around without it resetting,
|
505 |
+
t.hasFirefoxPluginMovingProblem = false;
|
506 |
+
|
507 |
// detect native JavaScript fullscreen (Safari/Firefox only, Chrome still fails)
|
508 |
+
|
509 |
// iOS
|
510 |
+
t.hasiOSFullScreen = (typeof v.webkitEnterFullscreen !== 'undefined');
|
511 |
+
|
512 |
+
// W3C
|
513 |
+
t.hasNativeFullscreen = (typeof v.requestFullscreen !== 'undefined');
|
514 |
+
|
515 |
+
// webkit/firefox/IE11+
|
516 |
t.hasWebkitNativeFullScreen = (typeof v.webkitRequestFullScreen !== 'undefined');
|
517 |
t.hasMozNativeFullScreen = (typeof v.mozRequestFullScreen !== 'undefined');
|
518 |
+
t.hasMsNativeFullScreen = (typeof v.msRequestFullscreen !== 'undefined');
|
519 |
+
|
520 |
+
t.hasTrueNativeFullScreen = (t.hasWebkitNativeFullScreen || t.hasMozNativeFullScreen || t.hasMsNativeFullScreen);
|
521 |
t.nativeFullScreenEnabled = t.hasTrueNativeFullScreen;
|
522 |
+
|
523 |
+
// Enabled?
|
524 |
if (t.hasMozNativeFullScreen) {
|
525 |
+
t.nativeFullScreenEnabled = document.mozFullScreenEnabled;
|
526 |
+
} else if (t.hasMsNativeFullScreen) {
|
527 |
+
t.nativeFullScreenEnabled = document.msFullscreenEnabled;
|
528 |
}
|
529 |
+
|
530 |
+
if (t.isChrome) {
|
531 |
+
t.hasiOSFullScreen = false;
|
|
|
532 |
}
|
533 |
+
|
534 |
if (t.hasTrueNativeFullScreen) {
|
535 |
+
|
536 |
+
t.fullScreenEventName = '';
|
537 |
+
if (t.hasWebkitNativeFullScreen) {
|
538 |
+
t.fullScreenEventName = 'webkitfullscreenchange';
|
539 |
+
|
540 |
+
} else if (t.hasMozNativeFullScreen) {
|
541 |
+
t.fullScreenEventName = 'mozfullscreenchange';
|
542 |
+
|
543 |
+
} else if (t.hasMsNativeFullScreen) {
|
544 |
+
t.fullScreenEventName = 'MSFullscreenChange';
|
545 |
+
}
|
546 |
+
|
547 |
t.isFullScreen = function() {
|
548 |
+
if (t.hasMozNativeFullScreen) {
|
549 |
return d.mozFullScreen;
|
550 |
+
|
551 |
+
} else if (t.hasWebkitNativeFullScreen) {
|
552 |
return d.webkitIsFullScreen;
|
553 |
+
|
554 |
+
} else if (t.hasMsNativeFullScreen) {
|
555 |
+
return d.msFullscreenElement !== null;
|
556 |
}
|
557 |
}
|
558 |
+
|
559 |
t.requestFullScreen = function(el) {
|
560 |
+
|
561 |
if (t.hasWebkitNativeFullScreen) {
|
562 |
el.webkitRequestFullScreen();
|
563 |
+
|
564 |
} else if (t.hasMozNativeFullScreen) {
|
565 |
el.mozRequestFullScreen();
|
566 |
+
|
567 |
+
} else if (t.hasMsNativeFullScreen) {
|
568 |
+
el.msRequestFullscreen();
|
569 |
+
|
570 |
}
|
571 |
}
|
572 |
+
|
573 |
+
t.cancelFullScreen = function() {
|
574 |
if (t.hasWebkitNativeFullScreen) {
|
575 |
document.webkitCancelFullScreen();
|
576 |
+
|
577 |
} else if (t.hasMozNativeFullScreen) {
|
578 |
document.mozCancelFullScreen();
|
579 |
+
|
580 |
+
} else if (t.hasMsNativeFullScreen) {
|
581 |
+
document.msExitFullscreen();
|
582 |
+
|
583 |
}
|
584 |
+
}
|
585 |
+
|
586 |
}
|
587 |
+
|
588 |
+
|
589 |
// OS X 10.5 can't do this even if it says it can :(
|
590 |
+
if (t.hasiOSFullScreen && ua.match(/mac os x 10_5/i)) {
|
591 |
t.hasNativeFullScreen = false;
|
592 |
+
t.hasiOSFullScreen = false;
|
593 |
}
|
594 |
+
|
595 |
}
|
596 |
};
|
597 |
mejs.MediaFeatures.init();
|
695 |
// HTML5 methods
|
696 |
play: function () {
|
697 |
if (this.pluginApi != null) {
|
698 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
699 |
this.pluginApi.playVideo();
|
700 |
} else {
|
701 |
this.pluginApi.playMedia();
|
705 |
},
|
706 |
load: function () {
|
707 |
if (this.pluginApi != null) {
|
708 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
709 |
} else {
|
710 |
this.pluginApi.loadMedia();
|
711 |
}
|
715 |
},
|
716 |
pause: function () {
|
717 |
if (this.pluginApi != null) {
|
718 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
719 |
+
if( this.pluginApi.getPlayerState() == 1 ) {
|
720 |
+
this.pluginApi.pauseVideo();
|
721 |
+
}
|
722 |
} else {
|
723 |
this.pluginApi.pauseMedia();
|
724 |
}
|
729 |
},
|
730 |
stop: function () {
|
731 |
if (this.pluginApi != null) {
|
732 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
733 |
this.pluginApi.stopVideo();
|
734 |
} else {
|
735 |
this.pluginApi.stopMedia();
|
753 |
for (j=0; j<pluginInfo.types.length; j++) {
|
754 |
// find plugin that can play the type
|
755 |
if (type == pluginInfo.types[j]) {
|
756 |
+
return 'probably';
|
757 |
}
|
758 |
}
|
759 |
}
|
760 |
}
|
761 |
|
762 |
+
return '';
|
763 |
},
|
764 |
|
765 |
positionFullscreenButton: function(x,y,visibleAndAbove) {
|
766 |
if (this.pluginApi != null && this.pluginApi.positionFullscreenButton) {
|
767 |
+
this.pluginApi.positionFullscreenButton(Math.floor(x),Math.floor(y),visibleAndAbove);
|
768 |
}
|
769 |
},
|
770 |
|
790 |
media = url[i];
|
791 |
if (this.canPlayType(media.type)) {
|
792 |
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
|
793 |
+
this.src = mejs.Utility.absolutizeUrl(media.src);
|
794 |
break;
|
795 |
}
|
796 |
}
|
799 |
},
|
800 |
setCurrentTime: function (time) {
|
801 |
if (this.pluginApi != null) {
|
802 |
+
if (this.pluginType == 'youtube' || this.pluginType == 'vimeo') {
|
803 |
this.pluginApi.seekTo(time);
|
804 |
} else {
|
805 |
this.pluginApi.setCurrentTime(time);
|
830 |
this.pluginApi.unMute();
|
831 |
}
|
832 |
this.muted = muted;
|
833 |
+
this.dispatchEvent({type:'volumechange'});
|
834 |
} else {
|
835 |
this.pluginApi.setMuted(muted);
|
836 |
}
|
842 |
setVideoSize: function (width, height) {
|
843 |
|
844 |
//if (this.pluginType == 'flash' || this.pluginType == 'silverlight') {
|
845 |
+
if (this.pluginElement && this.pluginElement.style) {
|
846 |
this.pluginElement.style.width = width + 'px';
|
847 |
this.pluginElement.style.height = height + 'px';
|
848 |
}
|
881 |
var callbacks = this.events[eventName];
|
882 |
if (!callbacks) return true;
|
883 |
if (!callback) { this.events[eventName] = []; return true; }
|
884 |
+
for (var i = 0; i < callbacks.length; i++) {
|
885 |
if (callbacks[i] === callback) {
|
886 |
this.events[eventName].splice(i, 1);
|
887 |
return true;
|
889 |
}
|
890 |
return false;
|
891 |
},
|
892 |
+
dispatchEvent: function (event) {
|
893 |
var i,
|
894 |
args,
|
895 |
+
callbacks = this.events[event.type];
|
896 |
|
897 |
if (callbacks) {
|
|
|
898 |
for (i = 0; i < callbacks.length; i++) {
|
899 |
+
callbacks[i].apply(this, [event]);
|
900 |
}
|
901 |
}
|
902 |
},
|
913 |
if (this.hasAttribute(name)) {
|
914 |
return this.attributes[name];
|
915 |
}
|
916 |
+
return null;
|
917 |
},
|
918 |
setAttribute: function(name, value){
|
919 |
this.attributes[name] = value;
|
924 |
}
|
925 |
};
|
926 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
927 |
/*
|
928 |
Default options
|
929 |
*/
|
939 |
plugins: ['flash','silverlight','youtube','vimeo'],
|
940 |
// shows debug errors on screen
|
941 |
enablePluginDebug: false,
|
942 |
+
// use plugin for browsers that have trouble with Basic Authentication on HTTPS sites
|
943 |
+
httpsBasicAuthSite: false,
|
944 |
// overrides the type specified, useful for dynamic instantiation
|
945 |
type: '',
|
946 |
// path to Flash and Silverlight plugins
|
949 |
flashName: 'flashmediaelement.swf',
|
950 |
// streamer for RTMP streaming
|
951 |
flashStreamer: '',
|
952 |
+
// set to 'always' for CDN version
|
953 |
+
flashScriptAccess: 'sameDomain',
|
954 |
// turns on the smoothing filter in Flash
|
955 |
enablePluginSmoothing: false,
|
956 |
+
// enabled pseudo-streaming (seek) on .mp4 files
|
957 |
+
enablePseudoStreaming: false,
|
958 |
+
// start query parameter sent to server for pseudo-streaming
|
959 |
+
pseudoStreamingStartQueryParam: 'start',
|
960 |
// name of silverlight file
|
961 |
silverlightName: 'silverlightmediaelement.xap',
|
962 |
// default if the <video width> is not specified
|
974 |
timerRate: 250,
|
975 |
// initial volume for player
|
976 |
startVolume: 0.8,
|
977 |
+
// custom error message in case media cannot be played; otherwise, Download File
|
978 |
+
// link will be displayed
|
979 |
+
customError: "",
|
980 |
success: function () { },
|
981 |
error: function () { }
|
982 |
};
|
994 |
|
995 |
create: function(el, o) {
|
996 |
var
|
997 |
+
options = {},
|
998 |
htmlMediaElement = (typeof(el) == 'string') ? document.getElementById(el) : el,
|
999 |
tagName = htmlMediaElement.tagName.toLowerCase(),
|
1000 |
isMediaTag = (tagName === 'audio' || tagName === 'video'),
|
1007 |
prop;
|
1008 |
|
1009 |
// extend options
|
1010 |
+
for (prop in mejs.MediaElementDefaults) {
|
1011 |
+
options[prop] = mejs.MediaElementDefaults[prop];
|
1012 |
+
}
|
1013 |
for (prop in o) {
|
1014 |
options[prop] = o[prop];
|
1015 |
+
}
|
1016 |
+
|
1017 |
|
1018 |
// clean up attributes
|
1019 |
src = (typeof src == 'undefined' || src === null || src == '') ? null : src;
|
1025 |
// test for HTML5 and plugin capabilities
|
1026 |
playback = this.determinePlayback(htmlMediaElement, options, mejs.MediaFeatures.supportsMediaTag, isMediaTag, src);
|
1027 |
playback.url = (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '';
|
1028 |
+
playback.scheme = mejs.Utility.determineScheme(playback.url);
|
1029 |
|
1030 |
if (playback.method == 'native') {
|
1031 |
// second fix for android
|
1059 |
l,
|
1060 |
n,
|
1061 |
type,
|
1062 |
+
result = { method: '', url: '', htmlMediaElement: htmlMediaElement, isVideo: (htmlMediaElement.tagName.toLowerCase() !== 'audio'), scheme: ''},
|
1063 |
pluginName,
|
1064 |
pluginVersions,
|
1065 |
pluginInfo,
|
1113 |
// STEP 2: Test for playback method
|
1114 |
|
1115 |
// special case for Android which sadly doesn't implement the canPlayType function (always returns '')
|
1116 |
+
if (result.isVideo && mejs.MediaFeatures.isBustedAndroid) {
|
1117 |
htmlMediaElement.canPlayType = function(type) {
|
1118 |
return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'maybe' : '';
|
1119 |
};
|
1120 |
}
|
1121 |
|
1122 |
+
// special case for Chromium to specify natively supported video codecs (i.e. WebM and Theora)
|
1123 |
+
if (result.isVideo && mejs.MediaFeatures.isChromium) {
|
1124 |
+
htmlMediaElement.canPlayType = function(type) {
|
1125 |
+
return (type.match(/video\/(webm|ogv|ogg)/gi) !== null) ? 'maybe' : '';
|
1126 |
+
};
|
1127 |
+
}
|
1128 |
|
1129 |
// test for native playback first
|
1130 |
+
if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'auto_plugin' || options.mode === 'native') && !(mejs.MediaFeatures.isBustedNativeHTTPS && options.httpsBasicAuthSite === true)) {
|
1131 |
|
1132 |
if (!isMediaTag) {
|
1133 |
|
1142 |
|
1143 |
for (i=0; i<mediaFiles.length; i++) {
|
1144 |
// normal check
|
1145 |
+
if (mediaFiles[i].type == "video/m3u8" || htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
|
1146 |
// special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
|
1147 |
+
|| htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== ''
|
1148 |
+
// special case for m4a supported by detecting mp4 support
|
1149 |
+
|| htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/m4a/,'mp4')).replace(/no/, '') !== '') {
|
1150 |
result.method = 'native';
|
1151 |
result.url = mediaFiles[i].url;
|
1152 |
break;
|
1191 |
// test for plugin playback types
|
1192 |
for (l=0; l<pluginInfo.types.length; l++) {
|
1193 |
// find plugin that can play the type
|
1194 |
+
if (type.toLowerCase() == pluginInfo.types[l].toLowerCase()) {
|
1195 |
result.method = pluginName;
|
1196 |
result.url = mediaFiles[i].url;
|
1197 |
return result;
|
1218 |
},
|
1219 |
|
1220 |
formatType: function(url, type) {
|
|
|
|
|
1221 |
// if no type is supplied, fake it with the extension
|
1222 |
if (url && !type) {
|
1223 |
return this.getTypeFromFile(url);
|
1236 |
|
1237 |
getTypeFromFile: function(url) {
|
1238 |
url = url.split('?')[0];
|
1239 |
+
var
|
1240 |
+
ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase(),
|
1241 |
+
av = /(mp4|m4v|ogg|ogv|m3u8|webm|webmv|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video/' : 'audio/';
|
1242 |
+
return this.getTypeFromExtension(ext, av);
|
1243 |
},
|
1244 |
|
1245 |
+
getTypeFromExtension: function(ext, av) {
|
1246 |
+
av = av || '';
|
1247 |
|
1248 |
switch (ext) {
|
1249 |
case 'mp4':
|
1250 |
case 'm4v':
|
1251 |
+
case 'm4a':
|
1252 |
+
case 'f4v':
|
1253 |
+
case 'f4a':
|
1254 |
+
return av + 'mp4';
|
1255 |
+
case 'flv':
|
1256 |
+
return av + 'x-flv';
|
1257 |
case 'webm':
|
1258 |
case 'webma':
|
1259 |
case 'webmv':
|
1260 |
+
return av + 'webm';
|
1261 |
case 'ogg':
|
1262 |
case 'oga':
|
1263 |
case 'ogv':
|
1264 |
+
return av + 'ogg';
|
1265 |
+
case 'm3u8':
|
1266 |
+
return 'application/x-mpegurl';
|
1267 |
+
case 'ts':
|
1268 |
+
return av + 'mp2t';
|
1269 |
default:
|
1270 |
+
return av + ext;
|
1271 |
}
|
1272 |
},
|
1273 |
|
1274 |
createErrorMessage: function(playback, options, poster) {
|
1275 |
var
|
1276 |
htmlMediaElement = playback.htmlMediaElement,
|
1277 |
+
errorContainer = document.createElement('div'),
|
1278 |
+
errorContent = options.customError;
|
1279 |
|
1280 |
errorContainer.className = 'me-cannotplay';
|
1281 |
|
1284 |
errorContainer.style.height = htmlMediaElement.height + 'px';
|
1285 |
} catch (e) {}
|
1286 |
|
1287 |
+
if (!errorContent) {
|
1288 |
+
errorContent = '<a href="' + playback.url + '">';
|
1289 |
+
|
1290 |
+
if (poster !== '') {
|
1291 |
+
errorContent += '<img src="' + poster + '" width="100%" height="100%" alt="" />';
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
errorContent += '<span>' + mejs.i18n.t('mejs.download-file') + '</span></a>';
|
1295 |
+
}
|
1296 |
+
|
1297 |
+
errorContainer.innerHTML = errorContent;
|
1298 |
|
1299 |
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
|
1300 |
htmlMediaElement.style.display = 'none';
|
1315 |
initVars;
|
1316 |
|
1317 |
// copy tagName from html media element
|
1318 |
+
pluginMediaElement.tagName = htmlMediaElement.tagName;
|
1319 |
|
1320 |
// copy attributes from html media element to plugin media element
|
1321 |
for (var i = 0; i < htmlMediaElement.attributes.length; i++) {
|
1322 |
var attribute = htmlMediaElement.attributes[i];
|
1323 |
+
if (attribute.specified) {
|
1324 |
pluginMediaElement.setAttribute(attribute.name, attribute.value);
|
1325 |
}
|
1326 |
}
|
1327 |
|
1328 |
// check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
|
1329 |
node = htmlMediaElement.parentNode;
|
1330 |
+
|
1331 |
+
while (node !== null && node.tagName != null && node.tagName.toLowerCase() !== 'body' &&
|
1332 |
+
node.parentNode != null && node.parentNode.tagName != null && node.parentNode.constructor != null && node.parentNode.constructor.name === "ShadowRoot") {
|
1333 |
+
if (node.parentNode.tagName.toLowerCase() === 'p') {
|
1334 |
node.parentNode.parentNode.insertBefore(node, node.parentNode);
|
1335 |
break;
|
1336 |
}
|
1338 |
}
|
1339 |
|
1340 |
if (playback.isVideo) {
|
1341 |
+
width = (options.pluginWidth > 0) ? options.pluginWidth : (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
|
1342 |
+
height = (options.pluginHeight > 0) ? options.pluginHeight : (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
|
1343 |
|
1344 |
// in case of '%' make sure it's encoded
|
1345 |
width = mejs.Utility.encodeUrl(width);
|
1354 |
|
1355 |
// register plugin
|
1356 |
pluginMediaElement.success = options.success;
|
1357 |
+
|
|
|
1358 |
// add container (must be added to DOM before inserting HTML for IE)
|
1359 |
container.className = 'me-plugin';
|
1360 |
container.id = pluginid + '_container';
|
1364 |
} else {
|
1365 |
document.body.insertBefore(container, document.body.childNodes[0]);
|
1366 |
}
|
1367 |
+
|
1368 |
+
if (playback.method === 'flash' || playback.method === 'silverlight') {
|
1369 |
|
1370 |
+
var canPlayVideo = htmlMediaElement.getAttribute('type') === 'audio/mp4',
|
1371 |
+
childrenSources = htmlMediaElement.getElementsByTagName('source');
|
1372 |
+
|
1373 |
+
if (childrenSources && !canPlayVideo) {
|
1374 |
+
for (var i = 0, total = childrenSources.length; i < total; i++) {
|
1375 |
+
if (childrenSources[i].getAttribute('type') === 'audio/mp4') {
|
1376 |
+
canPlayVideo = true;
|
1377 |
+
}
|
1378 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1379 |
}
|
1380 |
+
|
1381 |
+
// flash/silverlight vars
|
1382 |
+
initVars = [
|
1383 |
+
'id=' + pluginid,
|
1384 |
+
'isvideo=' + ((playback.isVideo || canPlayVideo) ? "true" : "false"),
|
1385 |
+
'autoplay=' + ((autoplay) ? "true" : "false"),
|
1386 |
+
'preload=' + preload,
|
1387 |
+
'width=' + width,
|
1388 |
+
'startvolume=' + options.startVolume,
|
1389 |
+
'timerrate=' + options.timerRate,
|
1390 |
+
'flashstreamer=' + options.flashStreamer,
|
1391 |
+
'height=' + height,
|
1392 |
+
'pseudostreamstart=' + options.pseudoStreamingStartQueryParam];
|
1393 |
+
|
1394 |
+
if (playback.url !== null) {
|
1395 |
+
if (playback.method == 'flash') {
|
1396 |
+
initVars.push('file=' + mejs.Utility.encodeUrl(playback.url));
|
1397 |
+
} else {
|
1398 |
+
initVars.push('file=' + playback.url);
|
1399 |
+
}
|
1400 |
+
}
|
1401 |
+
if (options.enablePluginDebug) {
|
1402 |
+
initVars.push('debug=true');
|
1403 |
+
}
|
1404 |
+
if (options.enablePluginSmoothing) {
|
1405 |
+
initVars.push('smoothing=true');
|
1406 |
+
}
|
1407 |
+
if (options.enablePseudoStreaming) {
|
1408 |
+
initVars.push('pseudostreaming=true');
|
1409 |
+
}
|
1410 |
+
if (controls) {
|
1411 |
+
initVars.push('controls=true'); // shows controls in the plugin if desired
|
1412 |
+
}
|
1413 |
+
if (options.pluginVars) {
|
1414 |
+
initVars = initVars.concat(options.pluginVars);
|
1415 |
+
}
|
1416 |
+
|
1417 |
+
// call from plugin
|
1418 |
+
window[pluginid + '_init'] = function() {
|
1419 |
+
switch (pluginMediaElement.pluginType) {
|
1420 |
+
case 'flash':
|
1421 |
+
pluginMediaElement.pluginElement = pluginMediaElement.pluginApi = document.getElementById(pluginid);
|
1422 |
+
break;
|
1423 |
+
case 'silverlight':
|
1424 |
+
pluginMediaElement.pluginElement = document.getElementById(pluginMediaElement.id);
|
1425 |
+
pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
|
1426 |
+
break;
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
if (pluginMediaElement.pluginApi != null && pluginMediaElement.success) {
|
1430 |
+
pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
|
1431 |
+
}
|
1432 |
+
};
|
1433 |
+
|
1434 |
+
// event call from plugin
|
1435 |
+
window[pluginid + '_event'] = function(eventName, values) {
|
1436 |
+
|
1437 |
+
var
|
1438 |
+
e,
|
1439 |
+
i,
|
1440 |
+
bufferedTime;
|
1441 |
+
|
1442 |
+
// fake event object to mimic real HTML media event.
|
1443 |
+
e = {
|
1444 |
+
type: eventName,
|
1445 |
+
target: pluginMediaElement
|
1446 |
+
};
|
1447 |
+
|
1448 |
+
// attach all values to element and event object
|
1449 |
+
for (i in values) {
|
1450 |
+
pluginMediaElement[i] = values[i];
|
1451 |
+
e[i] = values[i];
|
1452 |
+
}
|
1453 |
+
|
1454 |
+
// fake the newer W3C buffered TimeRange (loaded and total have been removed)
|
1455 |
+
bufferedTime = values.bufferedTime || 0;
|
1456 |
+
|
1457 |
+
e.target.buffered = e.buffered = {
|
1458 |
+
start: function(index) {
|
1459 |
+
return 0;
|
1460 |
+
},
|
1461 |
+
end: function (index) {
|
1462 |
+
return bufferedTime;
|
1463 |
+
},
|
1464 |
+
length: 1
|
1465 |
+
};
|
1466 |
+
|
1467 |
+
pluginMediaElement.dispatchEvent(e);
|
1468 |
+
}
|
1469 |
+
|
1470 |
+
|
1471 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1472 |
|
1473 |
switch (playback.method) {
|
1474 |
case 'silverlight':
|
1475 |
container.innerHTML =
|
1476 |
+
'<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + pluginid + '" name="' + pluginid + '" width="' + width + '" height="' + height + '" class="mejs-shim">' +
|
1477 |
'<param name="initParams" value="' + initVars.join(',') + '" />' +
|
1478 |
'<param name="windowless" value="true" />' +
|
1479 |
'<param name="background" value="black" />' +
|
1490 |
container.appendChild(specialIEContainer);
|
1491 |
specialIEContainer.outerHTML =
|
1492 |
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
|
1493 |
+
'id="' + pluginid + '" width="' + width + '" height="' + height + '" class="mejs-shim">' +
|
1494 |
+
'<param name="movie" value="' + options.pluginPath + options.flashName + '?' + (new Date().getTime()) + '" />' +
|
1495 |
'<param name="flashvars" value="' + initVars.join('&') + '" />' +
|
1496 |
'<param name="quality" value="high" />' +
|
1497 |
'<param name="bgcolor" value="#000000" />' +
|
1498 |
'<param name="wmode" value="transparent" />' +
|
1499 |
+
'<param name="allowScriptAccess" value="' + options.flashScriptAccess + '" />' +
|
1500 |
'<param name="allowFullScreen" value="true" />' +
|
1501 |
+
'<param name="scale" value="default" />' +
|
1502 |
'</object>';
|
1503 |
|
1504 |
} else {
|
1510 |
'quality="high" ' +
|
1511 |
'bgcolor="#000000" ' +
|
1512 |
'wmode="transparent" ' +
|
1513 |
+
'allowScriptAccess="' + options.flashScriptAccess + '" ' +
|
1514 |
'allowFullScreen="true" ' +
|
1515 |
'type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" ' +
|
1516 |
'src="' + options.pluginPath + options.flashName + '" ' +
|
1517 |
'flashvars="' + initVars.join('&') + '" ' +
|
1518 |
'width="' + width + '" ' +
|
1519 |
+
'height="' + height + '" ' +
|
1520 |
+
'scale="default"' +
|
1521 |
+
'class="mejs-shim"></embed>';
|
1522 |
}
|
1523 |
break;
|
1524 |
|
1525 |
case 'youtube':
|
1526 |
|
1527 |
|
1528 |
+
var videoId;
|
1529 |
+
// youtu.be url from share button
|
1530 |
+
if (playback.url.lastIndexOf("youtu.be") != -1) {
|
1531 |
+
videoId = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1532 |
+
if (videoId.indexOf('?') != -1) {
|
1533 |
+
videoId = videoId.substr(0, videoId.indexOf('?'));
|
1534 |
+
}
|
1535 |
+
}
|
1536 |
+
else {
|
1537 |
+
// https://www.youtube.com/watch?v=
|
1538 |
+
var videoIdMatch = playback.url.match( /[?&]v=([^&#]+)|&|#|$/ );
|
1539 |
+
if ( videoIdMatch ) {
|
1540 |
+
videoId = videoIdMatch[1];
|
1541 |
+
}
|
1542 |
+
}
|
1543 |
+
youtubeSettings = {
|
1544 |
container: container,
|
1545 |
containerId: container.id,
|
1546 |
pluginMediaElement: pluginMediaElement,
|
1547 |
pluginId: pluginid,
|
1548 |
videoId: videoId,
|
1549 |
height: height,
|
1550 |
+
width: width,
|
1551 |
+
scheme: playback.scheme,
|
1552 |
+
variables: options.youtubeIframeVars
|
1553 |
};
|
1554 |
|
1555 |
+
// favor iframe version of YouTube
|
1556 |
+
if (window.postMessage) {
|
|
|
1557 |
mejs.YouTubeApi.enqueueIframe(youtubeSettings);
|
1558 |
+
} else if (mejs.PluginDetector.hasPluginVersion('flash', [10,0,0]) ) {
|
1559 |
+
mejs.YouTubeApi.createFlash(youtubeSettings, options);
|
1560 |
}
|
|
|
1561 |
break;
|
1562 |
|
1563 |
// DEMO Code. Does NOT work.
|
1564 |
case 'vimeo':
|
1565 |
+
var player_id = pluginid + "_player";
|
|
|
1566 |
pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1567 |
|
1568 |
+
container.innerHTML ='<iframe src="' + playback.scheme + 'player.vimeo.com/video/' + pluginMediaElement.vimeoid + '?api=1&portrait=0&byline=0&title=0&player_id=' + player_id + '" width="' + width +'" height="' + height +'" frameborder="0" class="mejs-shim" id="' + player_id + '" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
|
1569 |
+
if (typeof($f) == 'function') { // froogaloop available
|
1570 |
+
var player = $f(container.childNodes[0]),
|
1571 |
+
playerState = -1;
|
1572 |
+
|
1573 |
+
player.addEvent('ready', function() {
|
1574 |
+
|
1575 |
+
player.playVideo = function() {
|
1576 |
+
player.api( 'play' );
|
1577 |
+
};
|
1578 |
+
player.stopVideo = function() {
|
1579 |
+
player.api( 'unload' );
|
1580 |
+
};
|
1581 |
+
player.pauseVideo = function() {
|
1582 |
+
player.api( 'pause' );
|
1583 |
+
};
|
1584 |
+
player.seekTo = function( seconds ) {
|
1585 |
+
player.api( 'seekTo', seconds );
|
1586 |
+
};
|
1587 |
+
player.setVolume = function( volume ) {
|
1588 |
+
player.api( 'setVolume', volume );
|
1589 |
+
};
|
1590 |
+
player.setMuted = function( muted ) {
|
1591 |
+
if( muted ) {
|
1592 |
+
player.lastVolume = player.api( 'getVolume' );
|
1593 |
+
player.api( 'setVolume', 0 );
|
1594 |
+
} else {
|
1595 |
+
player.api( 'setVolume', player.lastVolume );
|
1596 |
+
delete player.lastVolume;
|
1597 |
+
}
|
1598 |
+
};
|
1599 |
+
// parity with YT player
|
1600 |
+
player.getPlayerState = function() {
|
1601 |
+
return playerState;
|
1602 |
+
};
|
1603 |
+
|
1604 |
+
function createEvent(player, pluginMediaElement, eventName, e) {
|
1605 |
+
var event = {
|
1606 |
+
type: eventName,
|
1607 |
+
target: pluginMediaElement
|
1608 |
+
};
|
1609 |
+
if (eventName == 'timeupdate') {
|
1610 |
+
pluginMediaElement.currentTime = event.currentTime = e.seconds;
|
1611 |
+
pluginMediaElement.duration = event.duration = e.duration;
|
1612 |
+
}
|
1613 |
+
pluginMediaElement.dispatchEvent(event);
|
1614 |
+
}
|
1615 |
+
|
1616 |
+
player.addEvent('play', function() {
|
1617 |
+
playerState = 1;
|
1618 |
+
createEvent(player, pluginMediaElement, 'play');
|
1619 |
+
createEvent(player, pluginMediaElement, 'playing');
|
1620 |
+
});
|
1621 |
+
|
1622 |
+
player.addEvent('pause', function() {
|
1623 |
+
playerState = 2;
|
1624 |
+
createEvent(player, pluginMediaElement, 'pause');
|
1625 |
+
});
|
1626 |
+
|
1627 |
+
player.addEvent('finish', function() {
|
1628 |
+
playerState = 0;
|
1629 |
+
createEvent(player, pluginMediaElement, 'ended');
|
1630 |
+
});
|
1631 |
+
|
1632 |
+
player.addEvent('playProgress', function(e) {
|
1633 |
+
createEvent(player, pluginMediaElement, 'timeupdate', e);
|
1634 |
+
});
|
1635 |
+
|
1636 |
+
player.addEvent('seek', function(e) {
|
1637 |
+
playerState = 3;
|
1638 |
+
createEvent(player, pluginMediaElement, 'seeked', e);
|
1639 |
+
});
|
1640 |
+
|
1641 |
+
player.addEvent('loadProgress', function(e) {
|
1642 |
+
playerState = 3;
|
1643 |
+
createEvent(player, pluginMediaElement, 'progress', e);
|
1644 |
+
});
|
1645 |
+
|
1646 |
+
pluginMediaElement.pluginElement = container;
|
1647 |
+
pluginMediaElement.pluginApi = player;
|
1648 |
+
|
1649 |
+
pluginMediaElement.success(pluginMediaElement, pluginMediaElement.pluginElement);
|
1650 |
+
});
|
1651 |
+
}
|
1652 |
+
else {
|
1653 |
+
console.warn("You need to include froogaloop for vimeo to work");
|
1654 |
+
}
|
1655 |
break;
|
1656 |
}
|
1657 |
// hide original element
|
1658 |
htmlMediaElement.style.display = 'none';
|
1659 |
+
// prevent browser from autoplaying when using a plugin
|
1660 |
+
htmlMediaElement.removeAttribute('autoplay');
|
1661 |
|
1662 |
return pluginMediaElement;
|
1663 |
},
|
1718 |
mejs.YouTubeApi = {
|
1719 |
isIframeStarted: false,
|
1720 |
isIframeLoaded: false,
|
1721 |
+
loadIframeApi: function(yt) {
|
1722 |
if (!this.isIframeStarted) {
|
1723 |
var tag = document.createElement('script');
|
1724 |
+
tag.src = yt.scheme + "www.youtube.com/player_api";
|
1725 |
var firstScriptTag = document.getElementsByTagName('script')[0];
|
1726 |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
1727 |
this.isIframeStarted = true;
|
1733 |
if (this.isLoaded) {
|
1734 |
this.createIframe(yt);
|
1735 |
} else {
|
1736 |
+
this.loadIframeApi(yt);
|
1737 |
this.iframeQueue.push(yt);
|
1738 |
}
|
1739 |
},
|
1740 |
createIframe: function(settings) {
|
1741 |
+
|
1742 |
var
|
1743 |
+
pluginMediaElement = settings.pluginMediaElement,
|
1744 |
+
defaultVars = {controls:0, wmode:'transparent'},
|
1745 |
player = new YT.Player(settings.containerId, {
|
1746 |
height: settings.height,
|
1747 |
width: settings.width,
|
1748 |
videoId: settings.videoId,
|
1749 |
+
playerVars: mejs.$.extend({}, defaultVars, settings.variables),
|
1750 |
events: {
|
1751 |
+
'onReady': function(e) {
|
1752 |
+
|
1753 |
+
// wrapper to match
|
1754 |
+
player.setVideoSize = function(width, height) {
|
1755 |
+
player.setSize(width, height);
|
1756 |
+
};
|
1757 |
|
1758 |
// hook up iframe object to MEjs
|
1759 |
settings.pluginMediaElement.pluginApi = player;
|
1760 |
+
settings.pluginMediaElement.pluginElement = document.getElementById(settings.containerId);
|
1761 |
|
1762 |
// init mejs
|
1763 |
+
pluginMediaElement.success(pluginMediaElement, pluginMediaElement.pluginElement);
|
1764 |
+
|
1765 |
+
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'canplay');
|
1766 |
|
1767 |
// create timer
|
1768 |
setInterval(function() {
|
1769 |
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
|
1770 |
+
}, 250);
|
1771 |
+
|
1772 |
+
if (typeof pluginMediaElement.attributes.autoplay !== 'undefined') {
|
1773 |
+
player.playVideo();
|
1774 |
+
}
|
1775 |
},
|
1776 |
'onStateChange': function(e) {
|
1777 |
|
1783 |
},
|
1784 |
|
1785 |
createEvent: function (player, pluginMediaElement, eventName) {
|
1786 |
+
var event = {
|
1787 |
type: eventName,
|
1788 |
target: pluginMediaElement
|
1789 |
};
|
1791 |
if (player && player.getDuration) {
|
1792 |
|
1793 |
// time
|
1794 |
+
pluginMediaElement.currentTime = event.currentTime = player.getCurrentTime();
|
1795 |
+
pluginMediaElement.duration = event.duration = player.getDuration();
|
1796 |
|
1797 |
// state
|
1798 |
+
event.paused = pluginMediaElement.paused;
|
1799 |
+
event.ended = pluginMediaElement.ended;
|
1800 |
|
1801 |
// sound
|
1802 |
+
event.muted = player.isMuted();
|
1803 |
+
event.volume = player.getVolume() / 100;
|
1804 |
|
1805 |
// progress
|
1806 |
+
event.bytesTotal = player.getVideoBytesTotal();
|
1807 |
+
event.bufferedBytes = player.getVideoBytesLoaded();
|
1808 |
|
1809 |
// fake the W3C buffered TimeRange
|
1810 |
+
var bufferedTime = event.bufferedBytes / event.bytesTotal * event.duration;
|
1811 |
|
1812 |
+
event.target.buffered = event.buffered = {
|
1813 |
start: function(index) {
|
1814 |
return 0;
|
1815 |
},
|
1818 |
},
|
1819 |
length: 1
|
1820 |
};
|
1821 |
+
|
1822 |
}
|
1823 |
|
1824 |
// send event up the chain
|
1825 |
+
pluginMediaElement.dispatchEvent(event);
|
1826 |
},
|
1827 |
|
1828 |
iFrameReady: function() {
|
1844 |
|
1845 |
/*
|
1846 |
settings.container.innerHTML =
|
1847 |
+
'<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="' + settings.scheme + 'www.youtube.com/apiplayer?enablejsapi=1&playerapiid=' + settings.pluginId + '&version=3&autoplay=0&controls=0&modestbranding=1&loop=0" ' +
|
1848 |
+
'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; " class="mejs-shim">' +
|
1849 |
+
'<param name="allowScriptAccess" value="sameDomain">' +
|
1850 |
'<param name="wmode" value="transparent">' +
|
1851 |
'</object>';
|
1852 |
*/
|
1853 |
|
1854 |
var specialIEContainer,
|
1855 |
+
youtubeUrl = settings.scheme + 'www.youtube.com/apiplayer?enablejsapi=1&playerapiid=' + settings.pluginId + '&version=3&autoplay=0&controls=0&modestbranding=1&loop=0';
|
1856 |
|
1857 |
if (mejs.MediaFeatures.isIE) {
|
1858 |
|
1859 |
specialIEContainer = document.createElement('div');
|
1860 |
settings.container.appendChild(specialIEContainer);
|
1861 |
+
specialIEContainer.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' + settings.scheme + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
|
1862 |
+
'id="' + settings.pluginId + '" width="' + settings.width + '" height="' + settings.height + '" class="mejs-shim">' +
|
1863 |
'<param name="movie" value="' + youtubeUrl + '" />' +
|
1864 |
'<param name="wmode" value="transparent" />' +
|
1865 |
+
'<param name="allowScriptAccess" value="' + options.flashScriptAccess + '" />' +
|
1866 |
'<param name="allowFullScreen" value="true" />' +
|
1867 |
'</object>';
|
1868 |
} else {
|
1869 |
settings.container.innerHTML =
|
1870 |
'<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="' + youtubeUrl + '" ' +
|
1871 |
+
'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; " class="mejs-shim">' +
|
1872 |
+
'<param name="allowScriptAccess" value="' + options.flashScriptAccess + '">' +
|
1873 |
'<param name="wmode" value="transparent">' +
|
1874 |
'</object>';
|
1875 |
}
|
1885 |
// hook up and return to MediaELementPlayer.success
|
1886 |
pluginMediaElement.pluginApi =
|
1887 |
pluginMediaElement.pluginElement = player;
|
1888 |
+
|
1889 |
+
settings.success(pluginMediaElement, pluginMediaElement.pluginElement);
|
1890 |
|
1891 |
// load the youtube video
|
1892 |
player.cueVideoById(settings.videoId);
|
1895 |
|
1896 |
window[callbackName] = function(e) {
|
1897 |
mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
|
1898 |
+
};
|
1899 |
|
1900 |
player.addEventListener('onStateChange', callbackName);
|
1901 |
|
1902 |
setInterval(function() {
|
1903 |
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
|
1904 |
}, 250);
|
1905 |
+
|
1906 |
+
mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'canplay');
|
1907 |
},
|
1908 |
|
1909 |
handleStateChange: function(youTubeState, player, pluginMediaElement) {
|
1942 |
}
|
1943 |
}
|
1944 |
// IFRAME
|
1945 |
+
window.onYouTubePlayerAPIReady = function() {
|
1946 |
mejs.YouTubeApi.iFrameReady();
|
1947 |
+
};
|
1948 |
// FLASH
|
1949 |
+
window.onYouTubePlayerReady = function(id) {
|
1950 |
mejs.YouTubeApi.flashReady(id);
|
1951 |
+
};
|
1952 |
|
1953 |
window.mejs = mejs;
|
1954 |
window.MediaElement = mejs.MediaElement;
|
1955 |
|
1956 |
+
/**
|
1957 |
+
* Localize strings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1958 |
*
|
1959 |
+
* Include translations from JS files and method to pluralize properly strings.
|
|
|
|
|
|
|
1960 |
*
|
1961 |
*/
|
1962 |
+
(function (doc, win, mejs, undefined) {
|
1963 |
+
|
1964 |
+
var i18n = {
|
1965 |
+
/**
|
1966 |
+
* @type {String}
|
1967 |
+
*/
|
1968 |
+
'default': 'en',
|
1969 |
+
|
1970 |
+
/**
|
1971 |
+
* @type {String[]}
|
1972 |
+
*/
|
1973 |
+
locale: {
|
1974 |
+
language: (mejs.i18n && mejs.i18n.locale.language) || '',
|
1975 |
+
strings: (mejs.i18n && mejs.i18n.locale.strings) || {}
|
1976 |
+
},
|
1977 |
+
|
1978 |
+
/**
|
1979 |
+
* Filters for available languages.
|
1980 |
+
*
|
1981 |
+
* This plural forms are grouped in family groups based on
|
1982 |
+
* https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plural_Rules
|
1983 |
+
* with some additions and corrections according to the Localization Guide list
|
1984 |
+
* (http://localization-guide.readthedocs.io/en/latest/l10n/pluralforms.html)
|
1985 |
+
*
|
1986 |
+
* Arguments are dynamic following the structure:
|
1987 |
+
* - argument1 : Number to determine form
|
1988 |
+
* - argument2...argumentN: Possible matches
|
1989 |
+
*
|
1990 |
+
* @type {Function[]}
|
1991 |
+
*/
|
1992 |
+
pluralForms: [
|
1993 |
+
// 0: Chinese, Japanese, Korean, Persian, Turkish, Thai, Lao, Aymará,
|
1994 |
+
// Tibetan, Chiga, Dzongkha, Indonesian, Lojban, Georgian, Kazakh, Khmer, Kyrgyz, Malay,
|
1995 |
+
// Burmese, Yakut, Sundanese, Tatar, Uyghur, Vietnamese, Wolof
|
1996 |
+
function () {
|
1997 |
+
return arguments[1];
|
1998 |
+
},
|
1999 |
+
// 1: Danish, Dutch, English, Faroese, Frisian, German, Norwegian, Swedish, Estonian, Finnish,
|
2000 |
+
// Hungarian, Basque, Greek, Hebrew, Italian, Portuguese, Spanish, Catalan, Afrikaans,
|
2001 |
+
// Angika, Assamese, Asturian, Azerbaijani, Bulgarian, Bengali, Bodo, Aragonese, Dogri,
|
2002 |
+
// Esperanto, Argentinean Spanish, Fulah, Friulian, Galician, Gujarati, Hausa,
|
2003 |
+
// Hindi, Chhattisgarhi, Armenian, Interlingua, Greenlandic, Kannada, Kurdish, Letzeburgesch,
|
2004 |
+
// Maithili, Malayalam, Mongolian, Manipuri, Marathi, Nahuatl, Neapolitan, Norwegian Bokmal,
|
2005 |
+
// Nepali, Norwegian Nynorsk, Norwegian (old code), Northern Sotho, Oriya, Punjabi, Papiamento,
|
2006 |
+
// Piemontese, Pashto, Romansh, Kinyarwanda, Santali, Scots, Sindhi, Northern Sami, Sinhala,
|
2007 |
+
// Somali, Songhay, Albanian, Swahili, Tamil, Telugu, Turkmen, Urdu, Yoruba
|
2008 |
+
function () {
|
2009 |
+
var args = arguments;
|
2010 |
+
if (args[0] === 1) {
|
2011 |
+
return args[1];
|
2012 |
+
} else {
|
2013 |
+
return args[2];
|
2014 |
+
}
|
2015 |
+
},
|
2016 |
+
// 2: French, Brazilian Portuguese, Acholi, Akan, Amharic, Mapudungun, Breton, Filipino,
|
2017 |
+
// Gun, Lingala, Mauritian Creole, Malagasy, Maori, Occitan, Tajik, Tigrinya, Uzbek, Walloon
|
2018 |
+
function () {
|
2019 |
+
var args = arguments;
|
2020 |
+
if ([0, 1].indexOf(args[0]) > -1) {
|
2021 |
+
return args[1];
|
2022 |
+
} else {
|
2023 |
+
return args[2];
|
2024 |
+
}
|
2025 |
+
},
|
2026 |
+
// 3: Latvian
|
2027 |
+
function () {
|
2028 |
+
var args = arguments;
|
2029 |
+
if (args[0] % 10 === 1 && args[0] % 100 !== 11) {
|
2030 |
+
return args[1];
|
2031 |
+
} else if (args[0] !== 0) {
|
2032 |
+
return args[2];
|
2033 |
+
} else {
|
2034 |
+
return args[3];
|
2035 |
+
}
|
2036 |
+
},
|
2037 |
+
// 4: Scottish Gaelic
|
2038 |
+
function () {
|
2039 |
+
var args = arguments;
|
2040 |
+
if (args[0] === 1 || args[0] === 11) {
|
2041 |
+
return args[1];
|
2042 |
+
} else if (args[0] === 2 || args[0] === 12) {
|
2043 |
+
return args[2];
|
2044 |
+
} else if (args[0] > 2 && args[0] < 20) {
|
2045 |
+
return args[3];
|
2046 |
+
} else {
|
2047 |
+
return args[4];
|
2048 |
+
}
|
2049 |
+
},
|
2050 |
+
// 5: Romanian
|
2051 |
+
function () {
|
2052 |
+
if (args[0] === 1) {
|
2053 |
+
return args[1];
|
2054 |
+
} else if (args[0] === 0 || (args[0] % 100 > 0 && args[0] % 100 < 20)) {
|
2055 |
+
return args[2];
|
2056 |
+
} else {
|
2057 |
+
return args[3];
|
2058 |
+
}
|
2059 |
+
},
|
2060 |
+
// 6: Lithuanian
|
2061 |
+
function () {
|
2062 |
+
var args = arguments;
|
2063 |
+
if (args[0] % 10 === 1 && args[0] % 100 !== 11) {
|
2064 |
+
return args[1];
|
2065 |
+
} else if (args[0] % 10 >= 2 && (args[0] % 100 < 10 || args[0] % 100 >= 20)) {
|
2066 |
+
return args[2];
|
2067 |
+
} else {
|
2068 |
+
return [3];
|
2069 |
+
}
|
2070 |
+
},
|
2071 |
+
// 7: Belarusian, Bosnian, Croatian, Serbian, Russian, Ukrainian
|
2072 |
+
function () {
|
2073 |
+
var args = arguments;
|
2074 |
+
if (args[0] % 10 === 1 && args[0] % 100 !== 11) {
|
2075 |
+
return args[1];
|
2076 |
+
} else if (args[0] % 10 >= 2 && args[0] % 10 <= 4 && (args[0] % 100 < 10 || args[0] % 100 >= 20)) {
|
2077 |
+
return args[2];
|
2078 |
+
} else {
|
2079 |
+
return args[3];
|
2080 |
+
}
|
2081 |
+
},
|
2082 |
+
// 8: Slovak, Czech
|
2083 |
+
function () {
|
2084 |
+
var args = arguments;
|
2085 |
+
if (args[0] === 1) {
|
2086 |
+
return args[1];
|
2087 |
+
} else if (args[0] >= 2 && args[0] <= 4) {
|
2088 |
+
return args[2];
|
2089 |
+
} else {
|
2090 |
+
return args[3];
|
2091 |
+
}
|
2092 |
+
},
|
2093 |
+
// 9: Polish
|
2094 |
+
function () {
|
2095 |
+
var args = arguments;
|
2096 |
+
if (args[0] === 1) {
|
2097 |
+
return args[1];
|
2098 |
+
} else if (args[0] % 10 >= 2 && args[0] % 10 <= 4 && (args[0] % 100 < 10 || args[0] % 100 >= 20)) {
|
2099 |
+
return args[2];
|
2100 |
+
} else {
|
2101 |
+
return args[3];
|
2102 |
+
}
|
2103 |
+
},
|
2104 |
+
// 10: Slovenian
|
2105 |
+
function () {
|
2106 |
+
var args = arguments;
|
2107 |
+
if (args[0] % 100 === 1) {
|
2108 |
+
return args[2];
|
2109 |
+
} else if (args[0] % 100 === 2) {
|
2110 |
+
return args[3];
|
2111 |
+
} else if (args[0] % 100 === 3 || args[0] % 100 === 4) {
|
2112 |
+
return args[4];
|
2113 |
+
} else {
|
2114 |
+
return args[1];
|
2115 |
+
}
|
2116 |
+
},
|
2117 |
+
// 11: Irish Gaelic
|
2118 |
+
function () {
|
2119 |
+
var args = arguments;
|
2120 |
+
if (args[0] === 1) {
|
2121 |
+
return args[1];
|
2122 |
+
} else if (args[0] === 2) {
|
2123 |
+
return args[2];
|
2124 |
+
} else if (args[0] > 2 && args[0] < 7) {
|
2125 |
+
return args[3];
|
2126 |
+
} else if (args[0] > 6 && args[0] < 11) {
|
2127 |
+
return args[4];
|
2128 |
+
} else {
|
2129 |
+
return args[5];
|
2130 |
+
}
|
2131 |
+
},
|
2132 |
+
// 12: Arabic
|
2133 |
+
function () {
|
2134 |
+
var args = arguments;
|
2135 |
+
if (args[0] === 0) {
|
2136 |
+
return args[1];
|
2137 |
+
} else if (args[0] === 1) {
|
2138 |
+
return args[2];
|
2139 |
+
} else if (args[0] === 2) {
|
2140 |
+
return args[3];
|
2141 |
+
} else if (args[0] % 100 >= 3 && args[0] % 100 <= 10) {
|
2142 |
+
return args[4];
|
2143 |
+
} else if (args[0] % 100 >= 11) {
|
2144 |
+
return args[5];
|
2145 |
+
} else {
|
2146 |
+
return args[6];
|
2147 |
+
}
|
2148 |
+
},
|
2149 |
+
// 13: Maltese
|
2150 |
+
function () {
|
2151 |
+
var args = arguments;
|
2152 |
+
if (args[0] === 1) {
|
2153 |
+
return args[1];
|
2154 |
+
} else if (args[0] === 0 || (args[0] % 100 > 1 && args[0] % 100 < 11)) {
|
2155 |
+
return args[2];
|
2156 |
+
} else if (args[0] % 100 > 10 && args[0] % 100 < 20) {
|
2157 |
+
return args[3];
|
2158 |
+
} else {
|
2159 |
+
return args[4];
|
2160 |
+
}
|
2161 |
|
2162 |
+
},
|
2163 |
+
// 14: Macedonian
|
2164 |
+
function () {
|
2165 |
+
var args = arguments;
|
2166 |
+
if (args[0] % 10 === 1) {
|
2167 |
+
return args[1];
|
2168 |
+
} else if (args[0] % 10 === 2) {
|
2169 |
+
return args[2];
|
2170 |
+
} else {
|
2171 |
+
return args[3];
|
2172 |
+
}
|
2173 |
+
},
|
2174 |
+
// 15: Icelandic
|
2175 |
+
function () {
|
2176 |
+
var args = arguments;
|
2177 |
+
if (args[0] !== 11 && args[0] % 10 === 1) {
|
2178 |
+
return args[1];
|
2179 |
+
} else {
|
2180 |
+
return args[2];
|
2181 |
+
}
|
2182 |
+
},
|
2183 |
+
// New additions
|
2184 |
+
|
2185 |
+
// 16: Kashubian
|
2186 |
+
// Note: in https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plural_Rules
|
2187 |
+
// Breton is listed as #16 but in the Localization Guide it belongs to the group 2
|
2188 |
+
function () {
|
2189 |
+
var args = arguments;
|
2190 |
+
if (args[0] === 1) {
|
2191 |
+
return args[1];
|
2192 |
+
} else if (args[0] % 10 >= 2 && args[0] % 10 <= 4 && (args[0] % 100 < 10 || args[0] % 100 >= 20)) {
|
2193 |
+
return args[2];
|
2194 |
+
} else {
|
2195 |
+
return args[3];
|
2196 |
+
}
|
2197 |
+
},
|
2198 |
+
// 17: Welsh
|
2199 |
+
function () {
|
2200 |
+
var args = arguments;
|
2201 |
+
if (args[0] === 1) {
|
2202 |
+
return args[1];
|
2203 |
+
} else if (args[0] === 2) {
|
2204 |
+
return args[2];
|
2205 |
+
} else if (args[0] !== 8 && args[0] !== 11) {
|
2206 |
+
return args[3];
|
2207 |
+
} else {
|
2208 |
+
return args[4];
|
2209 |
+
}
|
2210 |
+
},
|
2211 |
+
// 18: Javanese
|
2212 |
+
function () {
|
2213 |
+
var args = arguments;
|
2214 |
+
if (args[0] === 0) {
|
2215 |
+
return args[1];
|
2216 |
+
} else {
|
2217 |
+
return args[2];
|
2218 |
+
}
|
2219 |
+
},
|
2220 |
+
// 19: Cornish
|
2221 |
+
function () {
|
2222 |
+
var args = arguments;
|
2223 |
+
if (args[0] === 1) {
|
2224 |
+
return args[1];
|
2225 |
+
} else if (args[0] === 2) {
|
2226 |
+
return args[2];
|
2227 |
+
} else if (args[0] === 3) {
|
2228 |
+
return args[3];
|
2229 |
+
} else {
|
2230 |
+
return args[4];
|
2231 |
+
}
|
2232 |
+
},
|
2233 |
+
// 20: Mandinka
|
2234 |
+
function () {
|
2235 |
+
var args = arguments;
|
2236 |
+
if (args[0] === 0) {
|
2237 |
+
return args[1];
|
2238 |
+
} else if (args[0] === 1) {
|
2239 |
+
return args[2];
|
2240 |
+
} else {
|
2241 |
+
return args[3];
|
2242 |
+
}
|
2243 |
+
}
|
2244 |
+
],
|
2245 |
+
/**
|
2246 |
+
* Get specified language
|
2247 |
+
*
|
2248 |
+
*/
|
2249 |
+
getLanguage: function () {
|
2250 |
+
var language = i18n.locale.language || i18n['default'];
|
2251 |
+
return /^(x\-)?[a-z]{2,}(\-\w{2,})?(\-\w{2,})?$/.exec(language) ? language : i18n['default'];
|
2252 |
+
},
|
2253 |
+
|
2254 |
+
/**
|
2255 |
+
* Translate a string to a specified language, including optionally a number to pluralize translation
|
2256 |
+
*
|
2257 |
+
* @param {String} message
|
2258 |
+
* @param {Number} pluralParam
|
2259 |
+
* @return {String}
|
2260 |
+
*/
|
2261 |
+
t: function (message, pluralParam) {
|
2262 |
+
|
2263 |
+
if (typeof message === 'string' && message.length) {
|
2264 |
|
2265 |
+
var
|
2266 |
+
language = i18n.getLanguage(),
|
2267 |
+
str,
|
2268 |
+
pluralForm,
|
2269 |
+
/**
|
2270 |
+
* Modify string using algorithm to detect plural forms.
|
2271 |
+
*
|
2272 |
+
* @private
|
2273 |
+
* @see http://stackoverflow.com/questions/1353408/messageformat-in-javascript-parameters-in-localized-ui-strings
|
2274 |
+
* @param {String|String[]} input - String or array of strings to pick the plural form
|
2275 |
+
* @param {Number} number - Number to determine the proper plural form
|
2276 |
+
* @param {Number} form - Number of language family to apply plural form
|
2277 |
+
* @return {String}
|
2278 |
+
*/
|
2279 |
+
plural = function (input, number, form) {
|
2280 |
+
|
2281 |
+
if (typeof input !== 'object' || typeof number !== 'number' || typeof form !== 'number') {
|
2282 |
+
return input;
|
2283 |
+
}
|
2284 |
|
2285 |
+
if (typeof input === 'string') {
|
2286 |
+
return input;
|
2287 |
+
}
|
|
|
|
|
|
|
|
|
2288 |
|
2289 |
+
// Perform plural form or return original text
|
2290 |
+
return i18n.pluralForms[form].apply(null, [number].concat(input));
|
2291 |
+
},
|
2292 |
+
/**
|
2293 |
+
*
|
2294 |
+
* @param {String} input
|
2295 |
+
* @return {String}
|
2296 |
+
*/
|
2297 |
+
escapeHTML = function (input) {
|
2298 |
+
var map = {
|
2299 |
+
'&': '&',
|
2300 |
+
'<': '<',
|
2301 |
+
'>': '>',
|
2302 |
+
'"': '"'
|
2303 |
+
};
|
2304 |
+
|
2305 |
+
return input.replace(/[&<>"]/g, function(c) {
|
2306 |
+
return map[c];
|
2307 |
+
});
|
2308 |
+
}
|
2309 |
+
;
|
2310 |
+
|
2311 |
+
// Fetch the localized version of the string
|
2312 |
+
if (i18n.locale.strings && i18n.locale.strings[language]) {
|
2313 |
+
str = i18n.locale.strings[language][message];
|
2314 |
+
if (typeof pluralParam === 'number') {
|
2315 |
+
pluralForm = i18n.locale.strings[language]['mejs.plural-form'];
|
2316 |
+
str = plural.apply(null, [str, pluralParam, pluralForm]);
|
2317 |
+
}
|
2318 |
+
}
|
2319 |
|
2320 |
+
// Fallback to default language if requested uid is not translated
|
2321 |
+
if (!str && i18n.locale.strings && i18n.locale.strings[i18n['default']]) {
|
2322 |
+
str = i18n.locale.strings[i18n['default']][message];
|
2323 |
+
if (typeof pluralParam === 'number') {
|
2324 |
+
pluralForm = i18n.locale.strings[i18n['default']]['mejs.plural-form'];
|
2325 |
+
str = plural.apply(null, [str, pluralParam, pluralForm]);
|
2326 |
|
2327 |
+
}
|
2328 |
+
}
|
|
|
2329 |
|
2330 |
+
// As a last resort, use the requested uid, to mimic original behavior of i18n utils (in which uid was the english text)
|
2331 |
+
str = str || message;
|
2332 |
+
|
2333 |
+
// Replace token
|
2334 |
+
if (typeof pluralParam === 'number') {
|
2335 |
+
str = str.replace('%1', pluralParam);
|
2336 |
+
}
|
2337 |
+
|
2338 |
+
return escapeHTML(str);
|
2339 |
+
|
2340 |
+
}
|
2341 |
+
|
2342 |
+
return message;
|
2343 |
+
}
|
2344 |
+
|
2345 |
+
};
|
2346 |
+
|
2347 |
+
// i18n fixes for compatibility with WordPress
|
2348 |
+
if (typeof mejsL10n !== 'undefined') {
|
2349 |
+
i18n.locale.language = mejsL10n.language;
|
2350 |
+
}
|
2351 |
+
|
2352 |
+
// Register variable
|
2353 |
+
mejs.i18n = i18n;
|
2354 |
+
|
2355 |
+
|
2356 |
+
}(document, window, mejs));
|
2357 |
+
|
2358 |
+
// i18n fixes for compatibility with WordPress
|
2359 |
+
;(function (mejs, undefined) {
|
2360 |
+
|
2361 |
+
"use strict";
|
2362 |
|
2363 |
+
if (typeof mejsL10n !== 'undefined') {
|
2364 |
+
mejs[mejsL10n.language] = mejsL10n.strings;
|
2365 |
+
}
|
2366 |
+
|
2367 |
+
}(mejs.i18n.locale.strings));
|
2368 |
/*!
|
2369 |
* This is a i18n.locale language object.
|
2370 |
*
|
2371 |
+
* English; This can serve as a template for other languages to translate
|
2372 |
*
|
2373 |
* @author
|
2374 |
+
* TBD
|
2375 |
+
* Sascha Greuel (Twitter: @SoftCreatR)
|
2376 |
*
|
2377 |
* @see
|
2378 |
* me-i18n.js
|
2380 |
* @params
|
2381 |
* - exports - CommonJS, window ..
|
2382 |
*/
|
2383 |
+
(function (exports) {
|
|
|
2384 |
"use strict";
|
2385 |
|
2386 |
+
if (exports.en === undefined) {
|
2387 |
+
exports.en = {
|
2388 |
+
"mejs.plural-form": 1,
|
2389 |
+
|
2390 |
+
// me-shim
|
2391 |
+
"mejs.download-file": "Download File",
|
2392 |
+
|
2393 |
+
// mep-feature-contextmenu
|
2394 |
+
"mejs.fullscreen-off": "Turn off Fullscreen",
|
2395 |
+
"mejs.fullscreen-on": "Go Fullscreen",
|
2396 |
+
"mejs.download-video": "Download Video",
|
2397 |
|
2398 |
+
// mep-feature-fullscreen
|
2399 |
+
"mejs.fullscreen": "Fullscreen",
|
2400 |
+
|
2401 |
+
// mep-feature-jumpforward
|
2402 |
+
"mejs.time-jump-forward": ["Jump forward 1 second", "Jump forward %1 seconds"],
|
2403 |
+
|
2404 |
+
// mep-feature-playpause
|
2405 |
+
"mejs.play": "Play",
|
2406 |
+
"mejs.pause": "Pause",
|
2407 |
+
|
2408 |
+
// mep-feature-postroll
|
2409 |
+
"mejs.close": "Close",
|
2410 |
+
|
2411 |
+
// mep-feature-progress
|
2412 |
+
"mejs.time-slider": "Time Slider",
|
2413 |
+
"mejs.time-help-text": "Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.",
|
2414 |
+
|
2415 |
+
// mep-feature-skipback
|
2416 |
+
"mejs.time-skip-back": ["Skip back 1 second", "Skip back %1 seconds"],
|
2417 |
+
|
2418 |
+
// mep-feature-tracks
|
2419 |
+
"mejs.captions-subtitles": "Captions/Subtitles",
|
2420 |
+
"mejs.none": "None",
|
2421 |
+
|
2422 |
+
// mep-feature-volume
|
2423 |
+
"mejs.mute-toggle": "Mute Toggle",
|
2424 |
+
"mejs.volume-help-text": "Use Up/Down Arrow keys to increase or decrease volume.",
|
2425 |
+
"mejs.unmute": "Unmute",
|
2426 |
+
"mejs.mute": "Mute",
|
2427 |
+
"mejs.volume-slider": "Volume Slider",
|
2428 |
+
|
2429 |
+
// mep-player
|
2430 |
+
"mejs.video-player": "Video Player",
|
2431 |
+
"mejs.audio-player": "Audio Player",
|
2432 |
+
|
2433 |
+
// mep-feature-ads
|
2434 |
+
"mejs.ad-skip": "Skip ad",
|
2435 |
+
"mejs.ad-skip-info": ["Skip in 1 second", "Skip in %1 seconds"],
|
2436 |
+
|
2437 |
+
// mep-feature-sourcechooser
|
2438 |
+
"mejs.source-chooser": "Source Chooser"
|
2439 |
+
};
|
2440 |
+
}
|
2441 |
}(mejs.i18n.locale.strings));
|
mediaelement/mediaelement.min.js
CHANGED
@@ -1,64 +1,30 @@
|
|
1 |
/*!
|
2 |
-
*
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
-
*
|
13 |
-
|
14 |
-
|
15 |
-
mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().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="",g,f=document.getElementsByTagName("script"),h=f.length,l=a.length;b<h;b++){g=f[b].src;for(c=0;c<l;c++){e=a[c];if(g.indexOf(e)>
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
positionFullscreenButton:function(a,b,c){this.pluginApi!=null&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(a,b,c)},hideFullscreenButton:function(){this.pluginApi!=null&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},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));
|
32 |
-
this.src=mejs.Utility.absolutizeUrl(a);break}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.setVolume(a*100):this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){if(this.pluginType=="youtube"){a?this.pluginApi.mute():this.pluginApi.unMute();this.muted=a;this.dispatchEvent("volumechange")}else this.pluginApi.setMuted(a);
|
33 |
-
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&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.setFullscreen(true)},exitFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&
|
34 |
-
this.setFullscreen(false)},addEventListener:function(a,b){this.events[a]=this.events[a]||[];this.events[a].push(b)},removeEventListener:function(a,b){if(!a){this.events={};return true}var c=this.events[a];if(!c)return true;if(!b){this.events[a]=[];return true}for(i=0;i<c.length;i++)if(c[i]===b){this.events[a].splice(i,1);return true}return false},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)}},hasAttribute:function(a){return a in
|
35 |
-
this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){if(this.hasAttribute(a))return this.attributes[a];return""},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id)}};
|
36 |
-
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];if(b){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,
|
37 |
-
c)}},fireEvent:function(a,b,c){var d,e;a=this.pluginMediaElements[a];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)}};
|
38 |
-
mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:false,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",enablePluginSmoothing:false,silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:0.8,
|
39 |
-
success:function(){},error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
|
40 |
-
mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),g=e==="audio"||e==="video",f=g?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var h=d.getAttribute("autoplay"),l=d.getAttribute("preload"),j=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];f=typeof f=="undefined"||f===null||f==""?null:f;e=typeof e=="undefined"||e===null?"":e;l=typeof l=="undefined"||l===null||l==="false"?
|
41 |
-
"none":l;h=!(typeof h=="undefined"||h===null||h==="false");j=!(typeof j=="undefined"||j===null||j==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,g,f);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},false)}return this.updateNative(k,c,h,l)}else if(k.method!=="")return this.createPlugin(k,c,e,h,l,j);else{this.createErrorMessage(k,c,e);return this}},
|
42 |
-
determinePlayback:function(a,b,c,d,e){var g=[],f,h,l,j={method:"",url:"",htmlMediaElement:a,isVideo:a.tagName.toLowerCase()!="audio"},k;if(typeof b.type!="undefined"&&b.type!=="")if(typeof b.type=="string")g.push({type:b.type,url:e});else for(f=0;f<b.type.length;f++)g.push({type:b.type[f],url:e});else if(e!==null){l=this.formatType(e,a.getAttribute("type"));g.push({type:l,url:e})}else for(f=0;f<a.childNodes.length;f++){h=a.childNodes[f];if(h.nodeType==1&&h.tagName.toLowerCase()=="source"){e=h.getAttribute("src");
|
43 |
-
l=this.formatType(e,h.getAttribute("type"));h=h.getAttribute("media");if(!h||!window.matchMedia||window.matchMedia&&window.matchMedia(h).matches)g.push({type:l,url:e})}}if(!d&&g.length>0&&g[0].url!==null&&this.getTypeFromFile(g[0].url).indexOf("audio")>-1)j.isVideo=false;if(mejs.MediaFeatures.isBustedAndroid)a.canPlayType=function(m){return m.match(/video\/(mp4|m4v)/gi)!==null?"maybe":""};if(c&&(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="native")){if(!d){f=document.createElement(j.isVideo?
|
44 |
-
"video":"audio");a.parentNode.insertBefore(f,a);a.style.display="none";j.htmlMediaElement=a=f}for(f=0;f<g.length;f++)if(a.canPlayType(g[f].type).replace(/no/,"")!==""||a.canPlayType(g[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){j.method="native";j.url=g[f].url;break}if(j.method==="native"){if(j.url!==null)a.src=j.url;if(b.mode!=="auto_plugin")return j}}if(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="shim")for(f=0;f<g.length;f++){l=g[f].type;for(a=0;a<b.plugins.length;a++){e=b.plugins[a];
|
45 |
-
h=mejs.plugins[e];for(c=0;c<h.length;c++){k=h[c];if(k.version==null||mejs.PluginDetector.hasPluginVersion(e,k.version))for(d=0;d<k.types.length;d++)if(l==k.types[d]){j.method=e;j.url=g[f].url;return j}}}}if(b.mode==="auto_plugin"&&j.method==="native")return j;if(j.method===""&&g.length>0)j.url=g[0].url;return j},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},getTypeFromFile:function(a){a=a.split("?")[0];a=a.substring(a.lastIndexOf(".")+
|
46 |
-
1);return(/(mp4|m4v|ogg|ogv|webm|webmv|flv|wmv|mpeg|mov)/gi.test(a)?"video":"audio")+"/"+this.getTypeFromExtension(a)},getTypeFromExtension:function(a){switch(a){case "mp4":case "m4v":return"mp4";case "webm":case "webma":case "webmv":return"webm";case "ogg":case "oga":case "ogv":return"ogg";default:return a}},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className="me-cannotplay";try{e.style.width=d.width+"px";e.style.height=d.height+"px"}catch(g){}e.innerHTML=
|
47 |
-
c!==""?'<a href="'+a.url+'"><img src="'+c+'" width="100%" height="100%" /></a>':'<a href="'+a.url+'"><span>'+mejs.i18n.t("Download File")+"</span></a>";d.parentNode.insertBefore(e,d);d.style.display="none";b.error(d)},createPlugin:function(a,b,c,d,e,g){c=a.htmlMediaElement;var f=1,h=1,l="me_"+a.method+"_"+mejs.meIndex++,j=new mejs.PluginMediaElement(l,a.method,a.url),k=document.createElement("div"),m;j.tagName=c.tagName;for(m=0;m<c.attributes.length;m++){var n=c.attributes[m];n.specified==true&&j.setAttribute(n.name,
|
48 |
-
n.value)}for(m=c.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);break}m=m.parentNode}if(a.isVideo){f=b.videoWidth>0?b.videoWidth:c.getAttribute("width")!==null?c.getAttribute("width"):b.defaultVideoWidth;h=b.videoHeight>0?b.videoHeight:c.getAttribute("height")!==null?c.getAttribute("height"):b.defaultVideoHeight;f=mejs.Utility.encodeUrl(f);h=mejs.Utility.encodeUrl(h)}else if(b.enablePluginDebug){f=
|
49 |
-
320;h=240}j.success=b.success;mejs.MediaPluginBridge.registerPluginElement(l,j,c);k.className="me-plugin";k.id=l+"_container";a.isVideo?c.parentNode.insertBefore(k,c):document.body.insertBefore(k,document.body.childNodes[0]);d=["id="+l,"isvideo="+(a.isVideo?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+f,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"flashstreamer="+b.flashStreamer,"height="+h];if(a.url!==null)a.method=="flash"?d.push("file="+mejs.Utility.encodeUrl(a.url)):
|
50 |
-
d.push("file="+a.url);b.enablePluginDebug&&d.push("debug=true");b.enablePluginSmoothing&&d.push("smoothing=true");g&&d.push("controls=true");if(b.pluginVars)d=d.concat(b.pluginVars);switch(a.method){case "silverlight":k.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+l+'" name="'+l+'" width="'+f+'" height="'+h+'"><param name="initParams" value="'+d.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="'+
|
51 |
-
b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){a=document.createElement("div");k.appendChild(a);a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+l+'" width="'+f+'" height="'+h+'"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+d.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 k.innerHTML=
|
52 |
-
'<embed id="'+l+'" name="'+l+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+d.join("&")+'" width="'+f+'" height="'+h+'"></embed>';break;case "youtube":b=a.url.substr(a.url.lastIndexOf("=")+1);youtubeSettings={container:k,containerId:k.id,pluginMediaElement:j,pluginId:l,videoId:b,
|
53 |
-
height:h,width:f};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":j.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1);k.innerHTML='<iframe src="http://player.vimeo.com/video/'+j.vimeoid+'?portrait=0&byline=0&title=0" width="'+f+'" height="'+h+'" frameborder="0"></iframe>'}c.style.display="none";return j},updateNative:function(a,b){var c=a.htmlMediaElement,d;for(d in mejs.HtmlMediaElement)c[d]=
|
54 |
-
mejs.HtmlMediaElement[d];b.success(c,c);return c}};
|
55 |
-
mejs.YouTubeApi={isIframeStarted:false,isIframeLoaded:false,loadIframeApi:function(){if(!this.isIframeStarted){var a=document.createElement("script");a.src="http://www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);this.isIframeStarted=true}},iframeQueue:[],enqueueIframe:function(a){if(this.isLoaded)this.createIframe(a);else{this.loadIframeApi();this.iframeQueue.push(a)}},createIframe:function(a){var b=a.pluginMediaElement,c=new YT.Player(a.containerId,
|
56 |
-
{height:a.height,width:a.width,videoId:a.videoId,playerVars:{controls:0},events:{onReady:function(){a.pluginMediaElement.pluginApi=c;mejs.MediaPluginBridge.initPlugin(a.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(c,b,"timeupdate")},250)},onStateChange:function(d){mejs.YouTubeApi.handleStateChange(d.data,c,b)}}})},createEvent:function(a,b,c){c={type:c,target:b};if(a&&a.getDuration){b.currentTime=c.currentTime=a.getCurrentTime();b.duration=c.duration=a.getDuration();c.paused=b.paused;
|
57 |
-
c.ended=b.ended;c.muted=a.isMuted();c.volume=a.getVolume()/100;c.bytesTotal=a.getVideoBytesTotal();c.bufferedBytes=a.getVideoBytesLoaded();var d=c.bufferedBytes/c.bytesTotal*c.duration;c.target.buffered=c.buffered={start:function(){return 0},end:function(){return d},length:1}}b.dispatchEvent(c.type,c)},iFrameReady:function(){for(this.isIframeLoaded=this.isLoaded=true;this.iframeQueue.length>0;)this.createIframe(this.iframeQueue.pop())},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=
|
58 |
-
a;var b,c="http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+a.pluginId+"&version=3&autoplay=0&controls=0&modestbranding=1&loop=0";if(mejs.MediaFeatures.isIE){b=document.createElement("div");a.container.appendChild(b);b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'"><param name="movie" value="'+c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else a.container.innerHTML=
|
59 |
-
'<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; "><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c;mejs.MediaPluginBridge.initPlugin(a);c.cueVideoById(b.videoId);a=b.containerId+"_callback";window[a]=function(e){mejs.YouTubeApi.handleStateChange(e,
|
60 |
-
c,d)};c.addEventListener("onStateChange",a);setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250)},handleStateChange:function(a,b,c){switch(a){case -1:c.paused=true;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=false;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=false;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"play");mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=true;c.ended=false;mejs.YouTubeApi.createEvent(b,
|
61 |
-
c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress")}}};function onYouTubePlayerAPIReady(){mejs.YouTubeApi.iFrameReady()}function onYouTubePlayerReady(a){mejs.YouTubeApi.flashReady(a)}window.mejs=mejs;window.MediaElement=mejs.MediaElement;
|
62 |
-
(function(a,b,c){var d={locale:{strings:{}},methods:{}};d.locale.getLanguage=function(){return{language:navigator.language}};d.locale.INIT_LANGUAGE=d.locale.getLanguage();d.methods.checkPlain=function(e){var g,f,h={"&":"&",'"':""","<":"<",">":">"};e=String(e);for(g in h)if(h.hasOwnProperty(g)){f=RegExp(g,"g");e=e.replace(f,h[g])}return e};d.methods.formatString=function(e,g){for(var f in g){switch(f.charAt(0)){case "@":g[f]=d.methods.checkPlain(g[f]);break;case "!":break;default:g[f]=
|
63 |
-
'<em class="placeholder">'+d.methods.checkPlain(g[f])+"</em>"}e=e.replace(f,g[f])}return e};d.methods.t=function(e,g,f){if(d.locale.strings&&d.locale.strings[f.context]&&d.locale.strings[f.context][e])e=d.locale.strings[f.context][e];if(g)e=d.methods.formatString(e,g);return e};d.t=function(e,g,f){if(typeof e==="string"&&e.length>0){var h=d.locale.getLanguage();f=f||{context:h.language};return d.methods.t(e,g,f)}else throw{name:"InvalidArgumentException",message:"First argument is either not a string or empty."};
|
64 |
-
};c.i18n=d})(jQuery,document,mejs);(function(a){a.de={Fullscreen:"Vollbild","Go Fullscreen":"Vollbild an","Turn off Fullscreen":"Vollbild aus",Close:"Schlie\u00dfen"}})(mejs.i18n.locale.strings);
|
1 |
/*!
|
2 |
+
*
|
3 |
+
* MediaElement.js
|
4 |
+
* HTML5 <video> and <audio> shim and player
|
5 |
+
* http://mediaelementjs.com/
|
6 |
+
*
|
7 |
+
* Creates a JavaScript object that mimics HTML5 MediaElement API
|
8 |
+
* for browsers that don't understand HTML5 or can't play the provided codec
|
9 |
+
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
10 |
+
*
|
11 |
+
* Copyright 2010-2014, John Dyer (http://j.hn)
|
12 |
+
* License: MIT
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
var mejs=mejs||{};mejs.version="2.23.5",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","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/rtmp","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mp4","audio/mpeg","video/dailymotion","video/x-dailymotion","application/x-mpegURL","audio/ogg"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo","video/x-vimeo"]}]},mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&").split("<").join("<").split('"').join(""")},absolutizeUrl:function(a){var b=document.createElement("div");return b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>',b.firstChild.href},getScriptPath:function(a){for(var b,c,d,e,f,g,h=0,i="",j="",k=document.getElementsByTagName("script"),l=k.length,m=a.length;l>h;h++){for(e=k[h].src,c=e.lastIndexOf("/"),c>-1?(g=e.substring(c+1),f=e.substring(0,c+1)):(g=e,f=""),b=0;m>b;b++)if(j=a[b],d=g.indexOf(j),d>-1){i=f;break}if(""!==i)break}return i},calculateTimeFormat:function(a,b,c){0>a&&(a=0),"undefined"==typeof c&&(c=25);var d=b.timeFormat,e=d[0],f=d[1]==d[0],g=f?2:1,h=":",i=Math.floor(a/3600)%24,j=Math.floor(a/60)%60,k=Math.floor(a%60),l=Math.floor((a%1*c).toFixed(3)),m=[[l,"f"],[k,"s"],[j,"m"],[i,"h"]];d.length<g&&(h=d[g]);for(var n=!1,o=0,p=m.length;p>o;o++)if(-1!==d.indexOf(m[o][1]))n=!0;else if(n){for(var q=!1,r=o;p>r;r++)if(m[r][0]>0){q=!0;break}if(!q)break;f||(d=e+d),d=m[o][1]+h+d,f&&(d=m[o][1]+d),e=m[o][1]}b.currentTimeFormat=d},twoDigitsString:function(a){return 10>a?"0"+a:String(a)},secondsToTimeCode:function(a,b){if(0>a&&(a=0),"object"!=typeof b){var c="m:ss";c=arguments[1]?"hh:mm:ss":c,c=arguments[2]?c+":ff":c,b={currentTimeFormat:c,framesPerSecond:arguments[3]||25}}var d=b.framesPerSecond;"undefined"==typeof d&&(d=25);var c=b.currentTimeFormat,e=Math.floor(a/3600)%24,f=Math.floor(a/60)%60,g=Math.floor(a%60),h=Math.floor((a%1*d).toFixed(3));lis=[[h,"f"],[g,"s"],[f,"m"],[e,"h"]];var j=c;for(i=0,len=lis.length;i<len;i++)j=j.replace(lis[i][1]+lis[i][1],this.twoDigitsString(lis[i][0])),j=j.replace(lis[i][1],lis[i][0]);return j},timeCodeToSeconds:function(a,b,c,d){"undefined"==typeof c?c=!1:"undefined"==typeof d&&(d=25);var e=a.split(":"),f=parseInt(e[0],10),g=parseInt(e[1],10),h=parseInt(e[2],10),i=0,j=0;return c&&(i=parseInt(e[3])/d),j=3600*f+60*g+h+i},convertSMPTEtoSeconds:function(a){if("string"!=typeof a)return!1;a=a.replace(",",".");var b=0,c=-1!=a.indexOf(".")?a.split(".")[1].length:0,d=1;a=a.split(":").reverse();for(var e=0;e<a.length;e++)d=1,e>0&&(d=Math.pow(60,e)),b+=Number(a[e])*d;return Number(b.toFixed(c))},removeSwf:function(a){var b=document.getElementById(a);b&&/object|embed/i.test(b.nodeName)&&(mejs.MediaFeatures.isIE?(b.style.display="none",function(){4==b.readyState?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))},removeObjectInIE:function(a){var b=document.getElementById(a);if(b){for(var c in b)"function"==typeof b[c]&&(b[c]=null);b.parentNode.removeChild(b)}},determineScheme:function(a){return a&&-1!=a.indexOf("://")?a.substr(0,a.indexOf("://")+3):"//"},debounce:function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}},isNodeAfter:function(a,b){return!!(a&&b&&"function"==typeof a.compareDocumentPosition&&a.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_PRECEDING)}},mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];return b[1]=b[1]||0,b[2]=b[2]||0,c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?!0:!1},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,f,g,h=[0,0,0];if("undefined"!=typeof this.nav.plugins&&"object"==typeof this.nav.plugins[a]){if(e=this.nav.plugins[a].description,e&&("undefined"==typeof this.nav.mimeTypes||!this.nav.mimeTypes[b]||this.nav.mimeTypes[b].enabledPlugin))for(h=e.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split("."),f=0;f<h.length;f++)h[f]=parseInt(h[f].match(/\d+/),10)}else if("undefined"!=typeof window.ActiveXObject)try{g=new ActiveXObject(c),g&&(h=d(g))}catch(i){}return h}},mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[],c=a.GetVariable("$version");return c&&(c=c.split(" ")[1].split(","),b=[parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10)]),b}),mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(a,b,c,d){for(;a.isVersionSupported(b[0]+"."+b[1]+"."+b[2]+"."+b[3]);)b[c]+=d;b[c]-=d};return 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),b}),mejs.MediaFeatures={init:function(){var a,b,c=this,d=document,e=mejs.PluginDetector.nav,f=mejs.PluginDetector.ua.toLowerCase(),g=["source","track","audio","video"];c.isiPad=null!==f.match(/ipad/i),c.isiPhone=null!==f.match(/iphone/i),c.isiOS=c.isiPhone||c.isiPad,c.isAndroid=null!==f.match(/android/i),c.isBustedAndroid=null!==f.match(/android 2\.[12]/),c.isBustedNativeHTTPS="https:"===location.protocol&&(null!==f.match(/android [12]\./)||null!==f.match(/macintosh.* version.* safari/)),c.isIE=-1!=e.appName.toLowerCase().indexOf("microsoft")||null!==e.appName.toLowerCase().match(/trident/gi),c.isChrome=null!==f.match(/chrome/gi),c.isChromium=null!==f.match(/chromium/gi),c.isFirefox=null!==f.match(/firefox/gi),c.isWebkit=null!==f.match(/webkit/gi),c.isGecko=null!==f.match(/gecko/gi)&&!c.isWebkit&&!c.isIE,c.isOpera=null!==f.match(/opera/gi),c.hasTouch="ontouchstart"in window,c.svgAsImg=!!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1");for(a=0;a<g.length;a++)b=document.createElement(g[a]);c.supportsMediaTag="undefined"!=typeof b.canPlayType||c.isBustedAndroid;try{b.canPlayType("video/mp4")}catch(h){c.supportsMediaTag=!1}c.supportsPointerEvents=function(){var a,b=document.createElement("x"),c=document.documentElement,d=window.getComputedStyle;return"pointerEvents"in b.style?(b.style.pointerEvents="auto",b.style.pointerEvents="x",c.appendChild(b),a=d&&"auto"===d(b,"").pointerEvents,c.removeChild(b),!!a):!1}(),c.hasFirefoxPluginMovingProblem=!1,c.hasiOSFullScreen="undefined"!=typeof b.webkitEnterFullscreen,c.hasNativeFullscreen="undefined"!=typeof b.requestFullscreen,c.hasWebkitNativeFullScreen="undefined"!=typeof b.webkitRequestFullScreen,c.hasMozNativeFullScreen="undefined"!=typeof b.mozRequestFullScreen,c.hasMsNativeFullScreen="undefined"!=typeof b.msRequestFullscreen,c.hasTrueNativeFullScreen=c.hasWebkitNativeFullScreen||c.hasMozNativeFullScreen||c.hasMsNativeFullScreen,c.nativeFullScreenEnabled=c.hasTrueNativeFullScreen,c.hasMozNativeFullScreen?c.nativeFullScreenEnabled=document.mozFullScreenEnabled:c.hasMsNativeFullScreen&&(c.nativeFullScreenEnabled=document.msFullscreenEnabled),c.isChrome&&(c.hasiOSFullScreen=!1),c.hasTrueNativeFullScreen&&(c.fullScreenEventName="",c.hasWebkitNativeFullScreen?c.fullScreenEventName="webkitfullscreenchange":c.hasMozNativeFullScreen?c.fullScreenEventName="mozfullscreenchange":c.hasMsNativeFullScreen&&(c.fullScreenEventName="MSFullscreenChange"),c.isFullScreen=function(){return c.hasMozNativeFullScreen?d.mozFullScreen:c.hasWebkitNativeFullScreen?d.webkitIsFullScreen:c.hasMsNativeFullScreen?null!==d.msFullscreenElement:void 0},c.requestFullScreen=function(a){c.hasWebkitNativeFullScreen?a.webkitRequestFullScreen():c.hasMozNativeFullScreen?a.mozRequestFullScreen():c.hasMsNativeFullScreen&&a.msRequestFullscreen()},c.cancelFullScreen=function(){c.hasWebkitNativeFullScreen?document.webkitCancelFullScreen():c.hasMozNativeFullScreen?document.mozCancelFullScreen():c.hasMsNativeFullScreen&&document.msExitFullscreen()}),c.hasiOSFullScreen&&f.match(/mac os x 10_5/i)&&(c.hasNativeFullScreen=!1,c.hasiOSFullScreen=!1)}},mejs.MediaFeatures.init(),mejs.HtmlMediaElement={pluginType:"native",isFullScreen:!1,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){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if("string"==typeof a)this.src=a;else{var c,d;for(c=0;c<a.length;c++)if(d=a[c],this.canPlayType(d.type)){this.src=d.src;break}}},setVideoSize:function(a,b){this.width=a,this.height=b}},mejs.PluginMediaElement=function(a,b,c){this.id=a,this.pluginType=b,this.src=c,this.events={},this.attributes={}},mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:!1,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:!0,ended:!1,seeking:!1,duration:0,error:null,tagName:"",muted:!1,volume:1,currentTime:0,play:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.playVideo():this.pluginApi.playMedia(),this.paused=!1)},load:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType||this.pluginApi.loadMedia(),this.paused=!1)},pause:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?1==this.pluginApi.getPlayerState()&&this.pluginApi.pauseVideo():this.pluginApi.pauseMedia(),this.paused=!0)},stop:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.stopVideo():this.pluginApi.stopMedia(),this.paused=!0)},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++)if(d=e[b],mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return"probably";return""},positionFullscreenButton:function(a,b,c){null!=this.pluginApi&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(Math.floor(a),Math.floor(b),c)},hideFullscreenButton:function(){null!=this.pluginApi&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},setSrc:function(a){if("string"==typeof a)this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a)),this.src=mejs.Utility.absolutizeUrl(a);else{var b,c;for(b=0;b<a.length;b++)if(c=a[b],this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src)),this.src=mejs.Utility.absolutizeUrl(c.src);break}}},setCurrentTime:function(a){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a),this.currentTime=a)},setVolume:function(a){null!=this.pluginApi&&("youtube"==this.pluginType?this.pluginApi.setVolume(100*a):this.pluginApi.setVolume(a),this.volume=a)},setMuted:function(a){null!=this.pluginApi&&("youtube"==this.pluginType?(a?this.pluginApi.mute():this.pluginApi.unMute(),this.muted=a,this.dispatchEvent({type:"volumechange"})):this.pluginApi.setMuted(a),this.muted=a)},setVideoSize:function(a,b){this.pluginElement&&this.pluginElement.style&&(this.pluginElement.style.width=a+"px",this.pluginElement.style.height=b+"px"),null!=this.pluginApi&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.setFullscreen(!0)},exitFullScreen:function(){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.setFullscreen(!1)},addEventListener:function(a,b,c){this.events[a]=this.events[a]||[],this.events[a].push(b)},removeEventListener:function(a,b){if(!a)return this.events={},!0;var c=this.events[a];if(!c)return!0;if(!b)return this.events[a]=[],!0;for(var d=0;d<c.length;d++)if(c[d]===b)return this.events[a].splice(d,1),!0;return!1},dispatchEvent:function(a){var b,c=this.events[a.type];if(c)for(b=0;b<c.length;b++)c[b].apply(this,[a])},hasAttribute:function(a){return a in this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){return this.hasAttribute(a)?this.attributes[a]:null},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id)}},mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:!1,httpsBasicAuthSite:!1,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",flashScriptAccess:"sameDomain",enablePluginSmoothing:!1,enablePseudoStreaming:!1,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:.8,customError:"",success:function(){},error:function(){}},mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)},mejs.HtmlMediaElementShim={create:function(a,b){var c,d,e={},f="string"==typeof a?document.getElementById(a):a,g=f.tagName.toLowerCase(),h="audio"===g||"video"===g,i=h?f.getAttribute("src"):f.getAttribute("href"),j=f.getAttribute("poster"),k=f.getAttribute("autoplay"),l=f.getAttribute("preload"),m=f.getAttribute("controls");for(d in mejs.MediaElementDefaults)e[d]=mejs.MediaElementDefaults[d];for(d in b)e[d]=b[d];return i="undefined"==typeof i||null===i||""==i?null:i,j="undefined"==typeof j||null===j?"":j,l="undefined"==typeof l||null===l||"false"===l?"none":l,k=!("undefined"==typeof k||null===k||"false"===k),m=!("undefined"==typeof m||null===m||"false"===m),c=this.determinePlayback(f,e,mejs.MediaFeatures.supportsMediaTag,h,i),c.url=null!==c.url?mejs.Utility.absolutizeUrl(c.url):"",c.scheme=mejs.Utility.determineScheme(c.url),"native"==c.method?(mejs.MediaFeatures.isBustedAndroid&&(f.src=c.url,f.addEventListener("click",function(){f.play()},!1)),this.updateNative(c,e,k,l)):""!==c.method?this.createPlugin(c,e,j,k,l,m):(this.createErrorMessage(c,e,j),this)},determinePlayback:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=[],r={method:"",url:"",htmlMediaElement:a,isVideo:"audio"!==a.tagName.toLowerCase(),scheme:""};if("undefined"!=typeof b.type&&""!==b.type)if("string"==typeof b.type)q.push({type:b.type,url:e});else for(f=0;f<b.type.length;f++)q.push({type:b.type[f],url:e});else if(null!==e)k=this.formatType(e,a.getAttribute("type")),q.push({type:k,url:e});else for(f=0;f<a.childNodes.length;f++)j=a.childNodes[f],1==j.nodeType&&"source"==j.tagName.toLowerCase()&&(e=j.getAttribute("src"),k=this.formatType(e,j.getAttribute("type")),p=j.getAttribute("media"),(!p||!window.matchMedia||window.matchMedia&&window.matchMedia(p).matches)&&q.push({type:k,url:e}));if(!d&&q.length>0&&null!==q[0].url&&this.getTypeFromFile(q[0].url).indexOf("audio")>-1&&(r.isVideo=!1),r.isVideo&&mejs.MediaFeatures.isBustedAndroid&&(a.canPlayType=function(a){return null!==a.match(/video\/(mp4|m4v)/gi)?"maybe":""}),r.isVideo&&mejs.MediaFeatures.isChromium&&(a.canPlayType=function(a){return null!==a.match(/video\/(webm|ogv|ogg)/gi)?"maybe":""}),c&&("auto"===b.mode||"auto_plugin"===b.mode||"native"===b.mode)&&(!mejs.MediaFeatures.isBustedNativeHTTPS||b.httpsBasicAuthSite!==!0)){for(d||(o=document.createElement(r.isVideo?"video":"audio"),a.parentNode.insertBefore(o,a),a.style.display="none",r.htmlMediaElement=a=o),f=0;f<q.length;f++)if("video/m3u8"==q[f].type||""!==a.canPlayType(q[f].type).replace(/no/,"")||""!==a.canPlayType(q[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")||""!==a.canPlayType(q[f].type.replace(/m4a/,"mp4")).replace(/no/,"")){r.method="native",r.url=q[f].url;break}if("native"===r.method&&(null!==r.url&&(a.src=r.url),"auto_plugin"!==b.mode))return r}if("auto"===b.mode||"auto_plugin"===b.mode||"shim"===b.mode)for(f=0;f<q.length;f++)for(k=q[f].type,g=0;g<b.plugins.length;g++)for(l=b.plugins[g],m=mejs.plugins[l],h=0;h<m.length;h++)if(n=m[h],null==n.version||mejs.PluginDetector.hasPluginVersion(l,n.version))for(i=0;i<n.types.length;i++)if(k.toLowerCase()==n.types[i].toLowerCase())return r.method=l,r.url=q[f].url,r;return"auto_plugin"===b.mode&&"native"===r.method?r:(""===r.method&&q.length>0&&(r.url=q[0].url),r)},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},getTypeFromFile:function(a){a=a.split("?")[0];var b=a.substring(a.lastIndexOf(".")+1).toLowerCase(),c=/(mp4|m4v|ogg|ogv|m3u8|webm|webmv|flv|wmv|mpeg|mov)/gi.test(b)?"video/":"audio/";return this.getTypeFromExtension(b,c)},getTypeFromExtension:function(a,b){switch(b=b||"",a){case"mp4":case"m4v":case"m4a":case"f4v":case"f4a":return b+"mp4";case"flv":return b+"x-flv";case"webm":case"webma":case"webmv":return b+"webm";case"ogg":case"oga":case"ogv":return b+"ogg";case"m3u8":return"application/x-mpegurl";case"ts":return b+"mp2t";default:return b+a}},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div"),f=b.customError;e.className="me-cannotplay";try{e.style.width=d.width+"px",e.style.height=d.height+"px"}catch(g){}f||(f='<a href="'+a.url+'">',""!==c&&(f+='<img src="'+c+'" width="100%" height="100%" alt="" />'),f+="<span>"+mejs.i18n.t("mejs.download-file")+"</span></a>"),e.innerHTML=f,d.parentNode.insertBefore(e,d),d.style.display="none",b.error(d)},createPlugin:function(a,b,c,d,e,f){var g,h,i,j=a.htmlMediaElement,k=1,l=1,m="me_"+a.method+"_"+mejs.meIndex++,n=new mejs.PluginMediaElement(m,a.method,a.url),o=document.createElement("div");n.tagName=j.tagName;for(var p=0;p<j.attributes.length;p++){var q=j.attributes[p];q.specified&&n.setAttribute(q.name,q.value)}for(h=j.parentNode;null!==h&&null!=h.tagName&&"body"!==h.tagName.toLowerCase()&&null!=h.parentNode&&null!=h.parentNode.tagName&&null!=h.parentNode.constructor&&"ShadowRoot"===h.parentNode.constructor.name;){if("p"===h.parentNode.tagName.toLowerCase()){h.parentNode.parentNode.insertBefore(h,h.parentNode);break}h=h.parentNode}if(a.isVideo?(k=b.pluginWidth>0?b.pluginWidth:b.videoWidth>0?b.videoWidth:null!==j.getAttribute("width")?j.getAttribute("width"):b.defaultVideoWidth,l=b.pluginHeight>0?b.pluginHeight:b.videoHeight>0?b.videoHeight:null!==j.getAttribute("height")?j.getAttribute("height"):b.defaultVideoHeight,k=mejs.Utility.encodeUrl(k),l=mejs.Utility.encodeUrl(l)):b.enablePluginDebug&&(k=320,l=240),n.success=b.success,o.className="me-plugin",o.id=m+"_container",a.isVideo?j.parentNode.insertBefore(o,j):document.body.insertBefore(o,document.body.childNodes[0]),"flash"===a.method||"silverlight"===a.method){var r="audio/mp4"===j.getAttribute("type"),s=j.getElementsByTagName("source");if(s&&!r)for(var p=0,t=s.length;t>p;p++)"audio/mp4"===s[p].getAttribute("type")&&(r=!0);i=["id="+m,"isvideo="+(a.isVideo||r?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+k,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"flashstreamer="+b.flashStreamer,"height="+l,"pseudostreamstart="+b.pseudoStreamingStartQueryParam],null!==a.url&&("flash"==a.method?i.push("file="+mejs.Utility.encodeUrl(a.url)):i.push("file="+a.url)),b.enablePluginDebug&&i.push("debug=true"),b.enablePluginSmoothing&&i.push("smoothing=true"),b.enablePseudoStreaming&&i.push("pseudostreaming=true"),f&&i.push("controls=true"),b.pluginVars&&(i=i.concat(b.pluginVars)),window[m+"_init"]=function(){switch(n.pluginType){case"flash":n.pluginElement=n.pluginApi=document.getElementById(m);break;case"silverlight":n.pluginElement=document.getElementById(n.id),n.pluginApi=n.pluginElement.Content.MediaElementJS}null!=n.pluginApi&&n.success&&n.success(n,j)},window[m+"_event"]=function(a,b){var c,d,e;c={type:a,target:n};for(d in b)n[d]=b[d],c[d]=b[d];e=b.bufferedTime||0,c.target.buffered=c.buffered={start:function(a){return 0},end:function(a){return e},length:1},n.dispatchEvent(c)}}switch(a.method){case"silverlight":o.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+m+'" name="'+m+'" width="'+k+'" height="'+l+'" class="mejs-shim"><param name="initParams" value="'+i.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="'+b.pluginPath+b.silverlightName+'" /></object>';break;case"flash":mejs.MediaFeatures.isIE?(g=document.createElement("div"),o.appendChild(g),g.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+m+'" width="'+k+'" height="'+l+'" class="mejs-shim"><param name="movie" value="'+b.pluginPath+b.flashName+"?"+(new Date).getTime()+'" /><param name="flashvars" value="'+i.join("&")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="'+b.flashScriptAccess+'" /><param name="allowFullScreen" value="true" /><param name="scale" value="default" /></object>'):o.innerHTML='<embed id="'+m+'" name="'+m+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="'+b.flashScriptAccess+'" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+i.join("&")+'" width="'+k+'" height="'+l+'" scale="default"class="mejs-shim"></embed>';break;case"youtube":var u;if(-1!=a.url.lastIndexOf("youtu.be"))u=a.url.substr(a.url.lastIndexOf("/")+1),-1!=u.indexOf("?")&&(u=u.substr(0,u.indexOf("?")));else{var v=a.url.match(/[?&]v=([^&#]+)|&|#|$/);v&&(u=v[1])}youtubeSettings={container:o,containerId:o.id,pluginMediaElement:n,pluginId:m,videoId:u,height:l,width:k,scheme:a.scheme,variables:b.youtubeIframeVars},window.postMessage?mejs.YouTubeApi.enqueueIframe(youtubeSettings):mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])&&mejs.YouTubeApi.createFlash(youtubeSettings,b);break;case"vimeo":var w=m+"_player";if(n.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1),o.innerHTML='<iframe src="'+a.scheme+"player.vimeo.com/video/"+n.vimeoid+"?api=1&portrait=0&byline=0&title=0&player_id="+w+'" width="'+k+'" height="'+l+'" frameborder="0" class="mejs-shim" id="'+w+'" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',"function"==typeof $f){var x=$f(o.childNodes[0]),y=-1;x.addEvent("ready",function(){function a(a,b,c,d){var e={type:c,target:b};"timeupdate"==c&&(b.currentTime=e.currentTime=d.seconds,b.duration=e.duration=d.duration),b.dispatchEvent(e)}x.playVideo=function(){x.api("play")},x.stopVideo=function(){x.api("unload")},x.pauseVideo=function(){x.api("pause")},x.seekTo=function(a){x.api("seekTo",a)},x.setVolume=function(a){x.api("setVolume",a)},x.setMuted=function(a){a?(x.lastVolume=x.api("getVolume"),x.api("setVolume",0)):(x.api("setVolume",x.lastVolume),delete x.lastVolume)},x.getPlayerState=function(){return y},x.addEvent("play",function(){y=1,a(x,n,"play"),a(x,n,"playing")}),x.addEvent("pause",function(){y=2,a(x,n,"pause")}),x.addEvent("finish",function(){y=0,a(x,n,"ended")}),x.addEvent("playProgress",function(b){a(x,n,"timeupdate",b)}),x.addEvent("seek",function(b){y=3,a(x,n,"seeked",b)}),x.addEvent("loadProgress",function(b){y=3,a(x,n,"progress",b)}),n.pluginElement=o,n.pluginApi=x,n.success(n,n.pluginElement)})}else console.warn("You need to include froogaloop for vimeo to work")}return j.style.display="none",j.removeAttribute("autoplay"),n},updateNative:function(a,b,c,d){var e,f=a.htmlMediaElement;for(e in mejs.HtmlMediaElement)f[e]=mejs.HtmlMediaElement[e];return b.success(f,f),f}},mejs.YouTubeApi={isIframeStarted:!1,isIframeLoaded:!1,loadIframeApi:function(a){if(!this.isIframeStarted){var b=document.createElement("script");b.src=a.scheme+"www.youtube.com/player_api";var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c),this.isIframeStarted=!0}},iframeQueue:[],enqueueIframe:function(a){this.isLoaded?this.createIframe(a):(this.loadIframeApi(a),this.iframeQueue.push(a))},createIframe:function(a){var b=a.pluginMediaElement,c={controls:0,wmode:"transparent"},d=new YT.Player(a.containerId,{height:a.height,width:a.width,videoId:a.videoId,playerVars:mejs.$.extend({},c,a.variables),events:{onReady:function(c){d.setVideoSize=function(a,b){d.setSize(a,b)},a.pluginMediaElement.pluginApi=d,a.pluginMediaElement.pluginElement=document.getElementById(a.containerId),b.success(b,b.pluginElement),mejs.YouTubeApi.createEvent(d,b,"canplay"),setInterval(function(){mejs.YouTubeApi.createEvent(d,b,"timeupdate")},250),"undefined"!=typeof b.attributes.autoplay&&d.playVideo()},onStateChange:function(a){mejs.YouTubeApi.handleStateChange(a.data,d,b)}}})},createEvent:function(a,b,c){var d={type:c,target:b};if(a&&a.getDuration){b.currentTime=d.currentTime=a.getCurrentTime(),b.duration=d.duration=a.getDuration(),d.paused=b.paused,d.ended=b.ended,d.muted=a.isMuted(),d.volume=a.getVolume()/100,d.bytesTotal=a.getVideoBytesTotal(),d.bufferedBytes=a.getVideoBytesLoaded();var e=d.bufferedBytes/d.bytesTotal*d.duration;d.target.buffered=d.buffered={start:function(a){return 0},end:function(a){return e},length:1}}b.dispatchEvent(d)},iFrameReady:function(){for(this.isLoaded=!0,this.isIframeLoaded=!0;this.iframeQueue.length>0;){var a=this.iframeQueue.pop();this.createIframe(a)}},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=a;var b,c=a.scheme+"www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+a.pluginId+"&version=3&autoplay=0&controls=0&modestbranding=1&loop=0";mejs.MediaFeatures.isIE?(b=document.createElement("div"),a.container.appendChild(b),b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+a.scheme+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'" class="mejs-shim"><param name="movie" value="'+c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="'+options.flashScriptAccess+'" /><param name="allowFullScreen" value="true" /></object>'):a.container.innerHTML='<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; " class="mejs-shim"><param name="allowScriptAccess" value="'+options.flashScriptAccess+'"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c,b.success(d,d.pluginElement),c.cueVideoById(b.videoId);var e=b.containerId+"_callback";window[e]=function(a){mejs.YouTubeApi.handleStateChange(a,c,d)},c.addEventListener("onStateChange",e),setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250),mejs.YouTubeApi.createEvent(c,d,"canplay")},handleStateChange:function(a,b,c){switch(a){case-1:c.paused=!0,c.ended=!0,mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=!1,c.ended=!0,mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=!1,c.ended=!1,mejs.YouTubeApi.createEvent(b,c,"play"),mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=!0,c.ended=!1,mejs.YouTubeApi.createEvent(b,c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress");break;case 5:}}},window.onYouTubePlayerAPIReady=function(){mejs.YouTubeApi.iFrameReady()},window.onYouTubePlayerReady=function(a){mejs.YouTubeApi.flashReady(a)},window.mejs=mejs,window.MediaElement=mejs.MediaElement,function(a,b,c,d){var e={"default":"en",locale:{language:c.i18n&&c.i18n.locale.language||"",strings:c.i18n&&c.i18n.locale.strings||{}},pluralForms:[function(){return arguments[1]},function(){var a=arguments;return 1===a[0]?a[1]:a[2]},function(){var a=arguments;return[0,1].indexOf(a[0])>-1?a[1]:a[2]},function(){var a=arguments;return a[0]%10===1&&a[0]%100!==11?a[1]:0!==a[0]?a[2]:a[3]},function(){var a=arguments;return 1===a[0]||11===a[0]?a[1]:2===a[0]||12===a[0]?a[2]:a[0]>2&&a[0]<20?a[3]:a[4]},function(){return 1===args[0]?args[1]:0===args[0]||args[0]%100>0&&args[0]%100<20?args[2]:args[3]},function(){var a=arguments;return a[0]%10===1&&a[0]%100!==11?a[1]:a[0]%10>=2&&(a[0]%100<10||a[0]%100>=20)?a[2]:[3]},function(){var a=arguments;return a[0]%10===1&&a[0]%100!==11?a[1]:a[0]%10>=2&&a[0]%10<=4&&(a[0]%100<10||a[0]%100>=20)?a[2]:a[3]},function(){var a=arguments;return 1===a[0]?a[1]:a[0]>=2&&a[0]<=4?a[2]:a[3]},function(){var a=arguments;return 1===a[0]?a[1]:a[0]%10>=2&&a[0]%10<=4&&(a[0]%100<10||a[0]%100>=20)?a[2]:a[3]},function(){var a=arguments;return a[0]%100===1?a[2]:a[0]%100===2?a[3]:a[0]%100===3||a[0]%100===4?a[4]:a[1]},function(){var a=arguments;return 1===a[0]?a[1]:2===a[0]?a[2]:a[0]>2&&a[0]<7?a[3]:a[0]>6&&a[0]<11?a[4]:a[5]},function(){var a=arguments;return 0===a[0]?a[1]:1===a[0]?a[2]:2===a[0]?a[3]:a[0]%100>=3&&a[0]%100<=10?a[4]:a[0]%100>=11?a[5]:a[6]},function(){var a=arguments;return 1===a[0]?a[1]:0===a[0]||a[0]%100>1&&a[0]%100<11?a[2]:a[0]%100>10&&a[0]%100<20?a[3]:a[4]},function(){var a=arguments;return a[0]%10===1?a[1]:a[0]%10===2?a[2]:a[3]},function(){var a=arguments;return 11!==a[0]&&a[0]%10===1?a[1]:a[2]},function(){var a=arguments;return 1===a[0]?a[1]:a[0]%10>=2&&a[0]%10<=4&&(a[0]%100<10||a[0]%100>=20)?a[2]:a[3]},function(){var a=arguments;return 1===a[0]?a[1]:2===a[0]?a[2]:8!==a[0]&&11!==a[0]?a[3]:a[4]},function(){var a=arguments;return 0===a[0]?a[1]:a[2]},function(){var a=arguments;return 1===a[0]?a[1]:2===a[0]?a[2]:3===a[0]?a[3]:a[4]},function(){var a=arguments;return 0===a[0]?a[1]:1===a[0]?a[2]:a[3]}],getLanguage:function(){var a=e.locale.language||e["default"];return/^(x\-)?[a-z]{2,}(\-\w{2,})?(\-\w{2,})?$/.exec(a)?a:e["default"]},t:function(a,b){if("string"==typeof a&&a.length){var c,d,f=e.getLanguage(),g=function(a,b,c){return"object"!=typeof a||"number"!=typeof b||"number"!=typeof c?a:"string"==typeof a?a:e.pluralForms[c].apply(null,[b].concat(a))},h=function(a){var b={"&":"&","<":"<",">":">",'"':"""};return a.replace(/[&<>"]/g,function(a){return b[a]})};return e.locale.strings&&e.locale.strings[f]&&(c=e.locale.strings[f][a],"number"==typeof b&&(d=e.locale.strings[f]["mejs.plural-form"],c=g.apply(null,[c,b,d]))),!c&&e.locale.strings&&e.locale.strings[e["default"]]&&(c=e.locale.strings[e["default"]][a],"number"==typeof b&&(d=e.locale.strings[e["default"]]["mejs.plural-form"],c=g.apply(null,[c,b,d]))),c=c||a,"number"==typeof b&&(c=c.replace("%1",b)),h(c)}return a}};"undefined"!=typeof mejsL10n&&(e.locale.language=mejsL10n.language),c.i18n=e}(document,window,mejs),function(a,b){"use strict";"undefined"!=typeof mejsL10n&&(a[mejsL10n.language]=mejsL10n.strings)}(mejs.i18n.locale.strings),/*!
|
16 |
+
* This is a i18n.locale language object.
|
17 |
+
*
|
18 |
+
* English; This can serve as a template for other languages to translate
|
19 |
+
*
|
20 |
+
* @author
|
21 |
+
* TBD
|
22 |
+
* Sascha Greuel (Twitter: @SoftCreatR)
|
23 |
+
*
|
24 |
+
* @see
|
25 |
+
* me-i18n.js
|
26 |
+
*
|
27 |
+
* @params
|
28 |
+
* - exports - CommonJS, window ..
|
29 |
+
*/
|
30 |
+
function(a){"use strict";void 0===a.en&&(a.en={"mejs.plural-form":1,"mejs.download-file":"Download File","mejs.fullscreen-off":"Turn off Fullscreen","mejs.fullscreen-on":"Go Fullscreen","mejs.download-video":"Download Video","mejs.fullscreen":"Fullscreen","mejs.time-jump-forward":["Jump forward 1 second","Jump forward %1 seconds"],"mejs.play":"Play","mejs.pause":"Pause","mejs.close":"Close","mejs.time-slider":"Time Slider","mejs.time-help-text":"Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.","mejs.time-skip-back":["Skip back 1 second","Skip back %1 seconds"],"mejs.captions-subtitles":"Captions/Subtitles","mejs.none":"None","mejs.mute-toggle":"Mute Toggle","mejs.volume-help-text":"Use Up/Down Arrow keys to increase or decrease volume.","mejs.unmute":"Unmute","mejs.mute":"Mute","mejs.volume-slider":"Volume Slider","mejs.video-player":"Video Player","mejs.audio-player":"Audio Player","mejs.ad-skip":"Skip ad","mejs.ad-skip-info":["Skip in 1 second","Skip in %1 seconds"],"mejs.source-chooser":"Source Chooser"})}(mejs.i18n.locale.strings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mediaelement/mediaelementplayer.css
CHANGED
@@ -1,12 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.mejs-container {
|
2 |
position: relative;
|
3 |
background: #000;
|
4 |
-
font-family: Helvetica, Arial;
|
5 |
text-align: left;
|
6 |
vertical-align: top;
|
7 |
text-indent: 0;
|
8 |
}
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
.me-plugin {
|
11 |
position: absolute;
|
12 |
}
|
@@ -20,6 +44,11 @@
|
|
20 |
overflow: hidden;
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
.mejs-container-fullscreen {
|
24 |
position: fixed;
|
25 |
left: 0;
|
@@ -35,12 +64,17 @@
|
|
35 |
height: 100%;
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
38 |
/* Start: LAYERS */
|
39 |
.mejs-background {
|
40 |
position: absolute;
|
41 |
top: 0;
|
42 |
left: 0;
|
43 |
}
|
|
|
44 |
.mejs-mediaelement {
|
45 |
position: absolute;
|
46 |
top: 0;
|
@@ -48,25 +82,34 @@
|
|
48 |
width: 100%;
|
49 |
height: 100%;
|
50 |
}
|
|
|
51 |
.mejs-poster {
|
52 |
position: absolute;
|
53 |
top: 0;
|
54 |
left: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
|
|
56 |
.mejs-poster img {
|
57 |
border: 0;
|
58 |
padding: 0;
|
59 |
-
border: 0;
|
60 |
-
display: block;
|
61 |
}
|
|
|
62 |
.mejs-overlay {
|
63 |
position: absolute;
|
64 |
top: 0;
|
65 |
left: 0;
|
66 |
}
|
|
|
67 |
.mejs-overlay-play {
|
68 |
cursor: pointer;
|
69 |
}
|
|
|
70 |
.mejs-overlay-button {
|
71 |
position: absolute;
|
72 |
top: 50%;
|
@@ -74,14 +117,17 @@
|
|
74 |
width: 100px;
|
75 |
height: 100px;
|
76 |
margin: -50px 0 0 -50px;
|
77 |
-
background: url(bigplay.svg) no-repeat;
|
78 |
}
|
79 |
-
|
80 |
-
|
|
|
81 |
}
|
|
|
82 |
.mejs-overlay:hover .mejs-overlay-button {
|
83 |
background-position: 0 -100px ;
|
84 |
}
|
|
|
85 |
.mejs-overlay-loading {
|
86 |
position: absolute;
|
87 |
top: 50%;
|
@@ -90,7 +136,7 @@
|
|
90 |
height: 80px;
|
91 |
margin: -40px 0 0 -40px;
|
92 |
background: #333;
|
93 |
-
background: url(background.png);
|
94 |
background: rgba(0, 0, 0, 0.9);
|
95 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.9)), to(rgba(0,0,0,0.9)));
|
96 |
background: -webkit-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
|
@@ -99,11 +145,12 @@
|
|
99 |
background: -ms-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
|
100 |
background: linear-gradient(rgba(50,50,50,0.9), rgba(0,0,0,0.9));
|
101 |
}
|
|
|
102 |
.mejs-overlay-loading span {
|
103 |
display: block;
|
104 |
width: 80px;
|
105 |
height: 80px;
|
106 |
-
background: transparent url(loading.gif) 50% 50% no-repeat;
|
107 |
}
|
108 |
|
109 |
/* End: LAYERS */
|
@@ -111,20 +158,19 @@
|
|
111 |
/* Start: CONTROL BAR */
|
112 |
.mejs-container .mejs-controls {
|
113 |
position: absolute;
|
114 |
-
background: none;
|
115 |
list-style-type: none;
|
116 |
margin: 0;
|
117 |
padding: 0;
|
118 |
bottom: 0;
|
119 |
left: 0;
|
120 |
-
background: url(background.png);
|
121 |
background: rgba(0, 0, 0, 0.7);
|
122 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
|
123 |
-
background: -webkit-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
124 |
background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
125 |
-
background: -o-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
126 |
-
background: -ms-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
127 |
-
background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
128 |
height: 30px;
|
129 |
width: 100%;
|
130 |
}
|
@@ -139,8 +185,7 @@
|
|
139 |
height: 26px;
|
140 |
font-size: 11px;
|
141 |
line-height: 11px;
|
142 |
-
|
143 |
-
font-family: Helvetica, Arial;
|
144 |
border: 0;
|
145 |
}
|
146 |
|
@@ -156,68 +201,67 @@
|
|
156 |
height: 16px;
|
157 |
width: 16px;
|
158 |
border: 0;
|
159 |
-
background: transparent url(controls.svg) no-repeat;
|
160 |
}
|
161 |
|
162 |
-
.no-svg .mejs-controls .mejs-button button {
|
163 |
-
background-image: url(controls.png);
|
164 |
}
|
165 |
|
166 |
-
/* :focus for accessibility */
|
167 |
.mejs-controls .mejs-button button:focus {
|
168 |
-
outline:
|
169 |
}
|
170 |
|
171 |
/* End: CONTROL BAR */
|
172 |
|
173 |
-
/* Start: Time (
|
174 |
.mejs-container .mejs-controls .mejs-time {
|
175 |
color: #fff;
|
176 |
display: block;
|
177 |
height: 17px;
|
178 |
width: auto;
|
179 |
-
padding:
|
180 |
overflow: hidden;
|
181 |
text-align: center;
|
182 |
-
padding: auto 4px;
|
183 |
-moz-box-sizing: content-box;
|
184 |
-webkit-box-sizing: content-box;
|
185 |
box-sizing: content-box;
|
186 |
}
|
187 |
-
|
188 |
-
|
189 |
color: #fff;
|
|
|
190 |
line-height: 12px;
|
191 |
display: block;
|
192 |
float: left;
|
193 |
margin: 1px 2px 0 0;
|
194 |
width: auto;
|
195 |
}
|
196 |
-
/* End: Time (
|
197 |
-
|
198 |
|
199 |
-
/* Start: Play/
|
200 |
.mejs-controls .mejs-play button {
|
201 |
background-position: 0 0;
|
202 |
}
|
|
|
203 |
.mejs-controls .mejs-pause button {
|
204 |
background-position: 0 -16px;
|
205 |
}
|
206 |
-
/* End: Play/pause */
|
207 |
-
|
208 |
|
209 |
-
/* Stop */
|
210 |
.mejs-controls .mejs-stop button {
|
211 |
background-position: -112px 0;
|
212 |
}
|
213 |
-
/*
|
214 |
|
215 |
-
/* Start: Progress
|
216 |
.mejs-controls div.mejs-time-rail {
|
|
|
217 |
width: 200px;
|
218 |
padding-top: 5px;
|
219 |
}
|
220 |
-
|
|
|
221 |
display: block;
|
222 |
position: absolute;
|
223 |
width: 180px;
|
@@ -227,17 +271,19 @@
|
|
227 |
border-radius: 2px;
|
228 |
cursor: pointer;
|
229 |
}
|
|
|
230 |
.mejs-controls .mejs-time-rail .mejs-time-total {
|
231 |
margin: 5px;
|
232 |
background: #333;
|
233 |
background: rgba(50,50,50,0.8);
|
234 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
|
235 |
-
background: -webkit-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
236 |
background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
237 |
background: -o-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
238 |
background: -ms-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
239 |
background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
240 |
}
|
|
|
241 |
.mejs-controls .mejs-time-rail .mejs-time-buffering {
|
242 |
width: 100%;
|
243 |
background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
@@ -266,7 +312,7 @@
|
|
266 |
.mejs-controls .mejs-time-rail .mejs-time-loaded {
|
267 |
background: #3caac8;
|
268 |
background: rgba(60,170,200,0.8);
|
269 |
-
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(44,124,145,0.8)), to(rgba(78,183,212,0.8)));
|
270 |
background: -webkit-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
|
271 |
background: -moz-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
|
272 |
background: -o-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
|
@@ -274,16 +320,17 @@
|
|
274 |
background: linear-gradient(rgba(44,124,145,0.8), rgba(78,183,212,0.8));
|
275 |
width: 0;
|
276 |
}
|
|
|
277 |
.mejs-controls .mejs-time-rail .mejs-time-current {
|
278 |
-
width: 0;
|
279 |
background: #fff;
|
280 |
background: rgba(255,255,255,0.8);
|
281 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
|
282 |
background: -webkit-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
283 |
-
background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
284 |
background: -o-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
285 |
background: -ms-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
286 |
background: linear-gradient(rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
|
|
287 |
}
|
288 |
|
289 |
.mejs-controls .mejs-time-rail .mejs-time-handle {
|
@@ -349,19 +396,18 @@
|
|
349 |
left: 18px;
|
350 |
}
|
351 |
|
352 |
-
|
353 |
-
|
354 |
/*
|
355 |
.mejs-controls .mejs-time-rail:hover .mejs-time-handle {
|
356 |
visibility:visible;
|
357 |
}
|
358 |
*/
|
359 |
-
/* End: Progress
|
360 |
|
361 |
/* Start: Fullscreen */
|
362 |
.mejs-controls .mejs-fullscreen-button button {
|
363 |
background-position: -32px 0;
|
364 |
}
|
|
|
365 |
.mejs-controls .mejs-unfullscreen button {
|
366 |
background-position: -32px -16px;
|
367 |
}
|
@@ -388,7 +434,7 @@
|
|
388 |
display: none;
|
389 |
height: 115px;
|
390 |
width: 25px;
|
391 |
-
background: url(background.png);
|
392 |
background: rgba(50, 50, 50, 0.7);
|
393 |
-webkit-border-radius: 0;
|
394 |
-moz-border-radius: 0;
|
@@ -399,11 +445,13 @@
|
|
399 |
position: absolute;
|
400 |
margin: 0;
|
401 |
}
|
|
|
402 |
.mejs-controls .mejs-volume-button:hover {
|
403 |
-webkit-border-radius: 0 0 4px 4px;
|
404 |
-moz-border-radius: 0 0 4px 4px;
|
405 |
border-radius: 0 0 4px 4px;
|
406 |
}
|
|
|
407 |
/*
|
408 |
.mejs-controls .mejs-volume-button:hover .mejs-volume-slider {
|
409 |
display: block;
|
@@ -447,13 +495,14 @@
|
|
447 |
margin: 0;
|
448 |
}
|
449 |
|
450 |
-
|
451 |
/* horizontal version */
|
452 |
-
|
453 |
-
.mejs-controls div.mejs-horizontal-volume-slider {
|
454 |
height: 26px;
|
455 |
-
width:
|
456 |
position: relative;
|
|
|
|
|
|
|
457 |
}
|
458 |
|
459 |
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
|
@@ -465,20 +514,17 @@
|
|
465 |
margin: 0;
|
466 |
padding: 0;
|
467 |
font-size: 1px;
|
468 |
-
|
469 |
-webkit-border-radius: 2px;
|
470 |
-moz-border-radius: 2px;
|
471 |
-
border-radius: 2px;
|
472 |
-
|
473 |
background: #333;
|
474 |
background: rgba(50,50,50,0.8);
|
475 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
|
476 |
-
background: -webkit-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
477 |
background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
478 |
background: -o-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
479 |
background: -ms-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
480 |
background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
481 |
-
|
482 |
}
|
483 |
|
484 |
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
|
@@ -490,33 +536,26 @@
|
|
490 |
margin: 0;
|
491 |
padding: 0;
|
492 |
font-size: 1px;
|
493 |
-
|
494 |
-webkit-border-radius: 2px;
|
495 |
-moz-border-radius: 2px;
|
496 |
border-radius: 2px;
|
497 |
-
|
498 |
background: #fff;
|
499 |
background: rgba(255,255,255,0.8);
|
500 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
|
501 |
background: -webkit-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
502 |
-
background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
503 |
background: -o-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
504 |
background: -ms-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
505 |
background: linear-gradient(rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
506 |
-
|
507 |
}
|
508 |
|
509 |
-
|
510 |
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle {
|
511 |
display: none;
|
512 |
}
|
513 |
|
514 |
/* End: Mute/Volume */
|
515 |
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
/* Start: TRACK (Captions and Chapters) */
|
520 |
.mejs-controls .mejs-captions-button {
|
521 |
position: relative;
|
522 |
}
|
@@ -528,23 +567,22 @@
|
|
528 |
visibility: hidden;
|
529 |
position: absolute;
|
530 |
bottom: 26px;
|
531 |
-
right: -
|
532 |
-
width:
|
533 |
height: 100px;
|
534 |
-
background: url(background.png);
|
535 |
background: rgba(50,50,50,0.7);
|
536 |
border: solid 1px transparent;
|
537 |
-
padding: 10px;
|
538 |
overflow: hidden;
|
539 |
-webkit-border-radius: 0;
|
540 |
-moz-border-radius: 0;
|
541 |
border-radius: 0;
|
542 |
}
|
543 |
-
|
544 |
.mejs-controls .mejs-captions-button:hover .mejs-captions-selector {
|
545 |
visibility: visible;
|
546 |
}
|
547 |
-
*/
|
548 |
|
549 |
.mejs-controls .mejs-captions-button .mejs-captions-selector ul {
|
550 |
margin: 0;
|
@@ -553,6 +591,7 @@
|
|
553 |
list-style-type: none !important;
|
554 |
overflow: hidden;
|
555 |
}
|
|
|
556 |
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li {
|
557 |
margin: 0 0 6px 0;
|
558 |
padding: 0;
|
@@ -561,17 +600,19 @@
|
|
561 |
color: #fff;
|
562 |
overflow: hidden;
|
563 |
}
|
|
|
564 |
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li input {
|
565 |
clear: both;
|
566 |
float: left;
|
567 |
margin: 3px 3px 0 5px;
|
568 |
}
|
|
|
569 |
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li label {
|
570 |
-
width:
|
571 |
float: left;
|
572 |
padding: 4px 0 0 0;
|
573 |
line-height: 15px;
|
574 |
-
font-family:
|
575 |
font-size: 10px;
|
576 |
}
|
577 |
|
@@ -580,15 +621,15 @@
|
|
580 |
margin: 0 0 5px 0;
|
581 |
}
|
582 |
|
583 |
-
|
584 |
.mejs-chapters {
|
585 |
position: absolute;
|
586 |
top: 0;
|
587 |
left: 0;
|
588 |
-
-
|
589 |
width: 10000px;
|
590 |
z-index: 1;
|
591 |
}
|
|
|
592 |
.mejs-chapters .mejs-chapter {
|
593 |
position: absolute;
|
594 |
float: left;
|
@@ -599,11 +640,12 @@
|
|
599 |
background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
600 |
background: -o-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
601 |
background: -ms-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
602 |
-
background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
603 |
-
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#323232,endColorstr=#000000);
|
604 |
overflow: hidden;
|
605 |
border: 0;
|
606 |
}
|
|
|
607 |
.mejs-chapters .mejs-chapter .mejs-chapter-block {
|
608 |
font-size: 11px;
|
609 |
color: #fff;
|
@@ -613,12 +655,12 @@
|
|
613 |
border-bottom: solid 1px #333;
|
614 |
cursor: pointer;
|
615 |
}
|
|
|
616 |
.mejs-chapters .mejs-chapter .mejs-chapter-block-last {
|
617 |
border-right: none;
|
618 |
}
|
619 |
|
620 |
.mejs-chapters .mejs-chapter .mejs-chapter-block:hover {
|
621 |
-
/*background: #333;*/
|
622 |
background: #666;
|
623 |
background: rgba(102,102,102, 0.7);
|
624 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(102,102,102,0.7)), to(rgba(50,50,50,0.6)));
|
@@ -627,8 +669,9 @@
|
|
627 |
background: -o-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
|
628 |
background: -ms-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
|
629 |
background: linear-gradient(rgba(102,102,102,0.7), rgba(50,50,50,0.6));
|
630 |
-
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#666666,endColorstr=#323232);
|
631 |
}
|
|
|
632 |
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title {
|
633 |
font-size: 12px;
|
634 |
font-weight: bold;
|
@@ -638,6 +681,7 @@
|
|
638 |
margin: 0 0 3px 0;
|
639 |
line-height: 12px;
|
640 |
}
|
|
|
641 |
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan {
|
642 |
font-size: 12px;
|
643 |
line-height: 12px;
|
@@ -647,21 +691,21 @@
|
|
647 |
text-overflow: ellipsis;
|
648 |
}
|
649 |
|
650 |
-
|
651 |
.mejs-captions-layer {
|
652 |
position: absolute;
|
653 |
bottom: 0;
|
654 |
left: 0;
|
655 |
text-align:center;
|
656 |
-
|
657 |
-
|
658 |
-
font-size: 12px;
|
659 |
color: #fff;
|
660 |
}
|
|
|
661 |
.mejs-captions-layer a {
|
662 |
color: #fff;
|
663 |
text-decoration: underline;
|
664 |
}
|
|
|
665 |
.mejs-captions-layer[lang=ar] {
|
666 |
font-size: 20px;
|
667 |
font-weight: normal;
|
@@ -675,61 +719,61 @@
|
|
675 |
}
|
676 |
|
677 |
.mejs-captions-position-hover {
|
678 |
-
bottom:
|
679 |
}
|
680 |
|
681 |
.mejs-captions-text {
|
682 |
-
padding:
|
683 |
-
background: url(background.png);
|
684 |
-
background: rgba(20, 20, 20, 0.
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
.mejs-clear {
|
692 |
-
clear: both;
|
693 |
}
|
|
|
694 |
|
695 |
-
/* Start:
|
696 |
.me-cannotplay {
|
697 |
}
|
|
|
698 |
.me-cannotplay a {
|
699 |
color: #fff;
|
700 |
font-weight: bold;
|
701 |
}
|
|
|
702 |
.me-cannotplay span {
|
703 |
padding: 15px;
|
704 |
display: block;
|
705 |
}
|
706 |
-
/* End:
|
707 |
|
708 |
|
709 |
/* Start: Loop */
|
710 |
.mejs-controls .mejs-loop-off button {
|
711 |
background-position: -64px -16px;
|
712 |
}
|
|
|
713 |
.mejs-controls .mejs-loop-on button {
|
714 |
background-position: -64px 0;
|
715 |
}
|
|
|
716 |
/* End: Loop */
|
717 |
|
718 |
/* Start: backlight */
|
719 |
.mejs-controls .mejs-backlight-off button {
|
720 |
background-position: -80px -16px;
|
721 |
}
|
|
|
722 |
.mejs-controls .mejs-backlight-on button {
|
723 |
background-position: -80px 0;
|
724 |
}
|
725 |
/* End: backlight */
|
726 |
|
727 |
-
|
728 |
-
/* Start: picture controls */
|
729 |
.mejs-controls .mejs-picturecontrols-button {
|
730 |
background-position: -96px 0;
|
731 |
}
|
732 |
-
/* End:
|
733 |
|
734 |
|
735 |
/* context menu */
|
@@ -748,23 +792,22 @@
|
|
748 |
height: 1px;
|
749 |
font-size: 0;
|
750 |
margin: 5px 6px;
|
751 |
-
background: #333;
|
752 |
}
|
753 |
|
754 |
.mejs-contextmenu .mejs-contextmenu-item {
|
755 |
-
font-family: Helvetica, Arial;
|
756 |
font-size: 12px;
|
757 |
padding: 4px 6px;
|
758 |
cursor: pointer;
|
759 |
-
color: #333;
|
760 |
}
|
761 |
.mejs-contextmenu .mejs-contextmenu-item:hover {
|
762 |
background: #2C7C91;
|
763 |
color: #fff;
|
764 |
}
|
765 |
|
766 |
-
|
767 |
-
/* Start: SourceChooser */
|
768 |
.mejs-controls .mejs-sourcechooser-button {
|
769 |
position: relative;
|
770 |
}
|
@@ -772,14 +815,14 @@
|
|
772 |
.mejs-controls .mejs-sourcechooser-button button {
|
773 |
background-position: -128px 0;
|
774 |
}
|
|
|
775 |
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector {
|
776 |
-
visibility: hidden;
|
777 |
position: absolute;
|
778 |
bottom: 26px;
|
779 |
right: -10px;
|
780 |
width: 130px;
|
781 |
height: 100px;
|
782 |
-
background: url(background.png);
|
783 |
background: rgba(50,50,50,0.7);
|
784 |
border: solid 1px transparent;
|
785 |
padding: 10px;
|
@@ -796,6 +839,7 @@
|
|
796 |
list-style-type: none !important;
|
797 |
overflow: hidden;
|
798 |
}
|
|
|
799 |
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li {
|
800 |
margin: 0 0 6px 0;
|
801 |
padding: 0;
|
@@ -804,21 +848,22 @@
|
|
804 |
color: #fff;
|
805 |
overflow: hidden;
|
806 |
}
|
|
|
807 |
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input {
|
808 |
clear: both;
|
809 |
float: left;
|
810 |
margin: 3px 3px 0 5px;
|
811 |
}
|
|
|
812 |
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label {
|
813 |
width: 100px;
|
814 |
float: left;
|
815 |
padding: 4px 0 0 0;
|
816 |
line-height: 15px;
|
817 |
-
font-family:
|
818 |
font-size: 10px;
|
819 |
}
|
820 |
-
/* End:
|
821 |
-
|
822 |
|
823 |
/* Start: Postroll */
|
824 |
.mejs-postroll-layer {
|
@@ -827,7 +872,7 @@
|
|
827 |
left: 0;
|
828 |
width: 100%;
|
829 |
height: 100%;
|
830 |
-
background: url(background.png);
|
831 |
background: rgba(50,50,50,0.7);
|
832 |
z-index: 1000;
|
833 |
overflow: hidden;
|
@@ -840,7 +885,7 @@
|
|
840 |
position: absolute;
|
841 |
right: 0;
|
842 |
top: 0;
|
843 |
-
background: url(background.png);
|
844 |
background: rgba(50,50,50,0.7);
|
845 |
color: #fff;
|
846 |
padding: 4px;
|
@@ -848,3 +893,115 @@
|
|
848 |
cursor: pointer;
|
849 |
}
|
850 |
/* End: Postroll */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.mejs-offscreen{
|
2 |
+
/* Accessibility: hide screen reader texts (and prefer "top" for RTL languages). Reference: http://blog.rrwd.nl/2015/04/04/the-screen-reader-text-class-why-and-how/ */
|
3 |
+
clip: rect(1px 1px 1px 1px); /* IE6, IE7 - no likey commas */
|
4 |
+
clip: rect(1px, 1px, 1px, 1px); /* IE8-IE11 - we likey commas, no support for clip-path */
|
5 |
+
clip-path: polygon(0px 0px, 0px 0px,0px 0px, 0px 0px);
|
6 |
+
position: absolute !important;
|
7 |
+
height: 1px;
|
8 |
+
width: 1px;
|
9 |
+
overflow: hidden;
|
10 |
+
}
|
11 |
+
|
12 |
.mejs-container {
|
13 |
position: relative;
|
14 |
background: #000;
|
15 |
+
font-family: "Helvetica", Arial, serif;
|
16 |
text-align: left;
|
17 |
vertical-align: top;
|
18 |
text-indent: 0;
|
19 |
}
|
20 |
|
21 |
+
.mejs-fill-container,.mejs-fill-container .mejs-container{
|
22 |
+
width: 100%;
|
23 |
+
height: 100%;
|
24 |
+
}
|
25 |
+
|
26 |
+
.mejs-fill-container{
|
27 |
+
overflow: hidden;
|
28 |
+
}
|
29 |
+
|
30 |
+
.mejs-container:focus {
|
31 |
+
outline: none;
|
32 |
+
}
|
33 |
+
|
34 |
.me-plugin {
|
35 |
position: absolute;
|
36 |
}
|
44 |
overflow: hidden;
|
45 |
}
|
46 |
|
47 |
+
.mejs-fullscreen {
|
48 |
+
/* set it to not show scroll bars so 100% will work */
|
49 |
+
overflow: hidden !important;
|
50 |
+
}
|
51 |
+
|
52 |
.mejs-container-fullscreen {
|
53 |
position: fixed;
|
54 |
left: 0;
|
64 |
height: 100%;
|
65 |
}
|
66 |
|
67 |
+
.mejs-clear {
|
68 |
+
clear: both;
|
69 |
+
}
|
70 |
+
|
71 |
/* Start: LAYERS */
|
72 |
.mejs-background {
|
73 |
position: absolute;
|
74 |
top: 0;
|
75 |
left: 0;
|
76 |
}
|
77 |
+
|
78 |
.mejs-mediaelement {
|
79 |
position: absolute;
|
80 |
top: 0;
|
82 |
width: 100%;
|
83 |
height: 100%;
|
84 |
}
|
85 |
+
|
86 |
.mejs-poster {
|
87 |
position: absolute;
|
88 |
top: 0;
|
89 |
left: 0;
|
90 |
+
background-size: contain ;
|
91 |
+
background-position: 50% 50% ;
|
92 |
+
background-repeat: no-repeat ;
|
93 |
+
}
|
94 |
+
:root .mejs-poster img {
|
95 |
+
display: none ;
|
96 |
}
|
97 |
+
|
98 |
.mejs-poster img {
|
99 |
border: 0;
|
100 |
padding: 0;
|
|
|
|
|
101 |
}
|
102 |
+
|
103 |
.mejs-overlay {
|
104 |
position: absolute;
|
105 |
top: 0;
|
106 |
left: 0;
|
107 |
}
|
108 |
+
|
109 |
.mejs-overlay-play {
|
110 |
cursor: pointer;
|
111 |
}
|
112 |
+
|
113 |
.mejs-overlay-button {
|
114 |
position: absolute;
|
115 |
top: 50%;
|
117 |
width: 100px;
|
118 |
height: 100px;
|
119 |
margin: -50px 0 0 -50px;
|
120 |
+
background: url("bigplay.svg") no-repeat;
|
121 |
}
|
122 |
+
|
123 |
+
.no-svg .mejs-overlay-button {
|
124 |
+
background-image: url("bigplay.png");
|
125 |
}
|
126 |
+
|
127 |
.mejs-overlay:hover .mejs-overlay-button {
|
128 |
background-position: 0 -100px ;
|
129 |
}
|
130 |
+
|
131 |
.mejs-overlay-loading {
|
132 |
position: absolute;
|
133 |
top: 50%;
|
136 |
height: 80px;
|
137 |
margin: -40px 0 0 -40px;
|
138 |
background: #333;
|
139 |
+
background: url("background.png");
|
140 |
background: rgba(0, 0, 0, 0.9);
|
141 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.9)), to(rgba(0,0,0,0.9)));
|
142 |
background: -webkit-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
|
145 |
background: -ms-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
|
146 |
background: linear-gradient(rgba(50,50,50,0.9), rgba(0,0,0,0.9));
|
147 |
}
|
148 |
+
|
149 |
.mejs-overlay-loading span {
|
150 |
display: block;
|
151 |
width: 80px;
|
152 |
height: 80px;
|
153 |
+
background: transparent url("loading.gif") 50% 50% no-repeat;
|
154 |
}
|
155 |
|
156 |
/* End: LAYERS */
|
158 |
/* Start: CONTROL BAR */
|
159 |
.mejs-container .mejs-controls {
|
160 |
position: absolute;
|
|
|
161 |
list-style-type: none;
|
162 |
margin: 0;
|
163 |
padding: 0;
|
164 |
bottom: 0;
|
165 |
left: 0;
|
166 |
+
background: url("background.png");
|
167 |
background: rgba(0, 0, 0, 0.7);
|
168 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
|
169 |
+
background: -webkit-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
170 |
background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
171 |
+
background: -o-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
172 |
+
background: -ms-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
173 |
+
background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
174 |
height: 30px;
|
175 |
width: 100%;
|
176 |
}
|
185 |
height: 26px;
|
186 |
font-size: 11px;
|
187 |
line-height: 11px;
|
188 |
+
font-family: "Helvetica", Arial, serif;
|
|
|
189 |
border: 0;
|
190 |
}
|
191 |
|
201 |
height: 16px;
|
202 |
width: 16px;
|
203 |
border: 0;
|
204 |
+
background: transparent url("controls.svg") no-repeat;
|
205 |
}
|
206 |
|
207 |
+
.no-svg .mejs-controls .mejs-button button {
|
208 |
+
background-image: url("controls.png");
|
209 |
}
|
210 |
|
211 |
+
/* :focus for accessibility */
|
212 |
.mejs-controls .mejs-button button:focus {
|
213 |
+
outline: dotted 1px #999;
|
214 |
}
|
215 |
|
216 |
/* End: CONTROL BAR */
|
217 |
|
218 |
+
/* Start: Time (Current / Duration) */
|
219 |
.mejs-container .mejs-controls .mejs-time {
|
220 |
color: #fff;
|
221 |
display: block;
|
222 |
height: 17px;
|
223 |
width: auto;
|
224 |
+
padding: 10px 3px 0 3px ;
|
225 |
overflow: hidden;
|
226 |
text-align: center;
|
|
|
227 |
-moz-box-sizing: content-box;
|
228 |
-webkit-box-sizing: content-box;
|
229 |
box-sizing: content-box;
|
230 |
}
|
231 |
+
|
232 |
+
.mejs-container .mejs-controls .mejs-time a {
|
233 |
color: #fff;
|
234 |
+
font-size: 11px;
|
235 |
line-height: 12px;
|
236 |
display: block;
|
237 |
float: left;
|
238 |
margin: 1px 2px 0 0;
|
239 |
width: auto;
|
240 |
}
|
241 |
+
/* End: Time (Current / Duration) */
|
|
|
242 |
|
243 |
+
/* Start: Play/Pause/Stop */
|
244 |
.mejs-controls .mejs-play button {
|
245 |
background-position: 0 0;
|
246 |
}
|
247 |
+
|
248 |
.mejs-controls .mejs-pause button {
|
249 |
background-position: 0 -16px;
|
250 |
}
|
|
|
|
|
251 |
|
|
|
252 |
.mejs-controls .mejs-stop button {
|
253 |
background-position: -112px 0;
|
254 |
}
|
255 |
+
/* Start: Play/Pause/Stop */
|
256 |
|
257 |
+
/* Start: Progress Bar */
|
258 |
.mejs-controls div.mejs-time-rail {
|
259 |
+
direction: ltr;
|
260 |
width: 200px;
|
261 |
padding-top: 5px;
|
262 |
}
|
263 |
+
|
264 |
+
.mejs-controls .mejs-time-rail span, .mejs-controls .mejs-time-rail a {
|
265 |
display: block;
|
266 |
position: absolute;
|
267 |
width: 180px;
|
271 |
border-radius: 2px;
|
272 |
cursor: pointer;
|
273 |
}
|
274 |
+
|
275 |
.mejs-controls .mejs-time-rail .mejs-time-total {
|
276 |
margin: 5px;
|
277 |
background: #333;
|
278 |
background: rgba(50,50,50,0.8);
|
279 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
|
280 |
+
background: -webkit-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
281 |
background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
282 |
background: -o-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
283 |
background: -ms-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
284 |
background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
285 |
}
|
286 |
+
|
287 |
.mejs-controls .mejs-time-rail .mejs-time-buffering {
|
288 |
width: 100%;
|
289 |
background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
312 |
.mejs-controls .mejs-time-rail .mejs-time-loaded {
|
313 |
background: #3caac8;
|
314 |
background: rgba(60,170,200,0.8);
|
315 |
+
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(44,124,145,0.8)), to(rgba(78,183,212,0.8)));
|
316 |
background: -webkit-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
|
317 |
background: -moz-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
|
318 |
background: -o-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
|
320 |
background: linear-gradient(rgba(44,124,145,0.8), rgba(78,183,212,0.8));
|
321 |
width: 0;
|
322 |
}
|
323 |
+
|
324 |
.mejs-controls .mejs-time-rail .mejs-time-current {
|
|
|
325 |
background: #fff;
|
326 |
background: rgba(255,255,255,0.8);
|
327 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
|
328 |
background: -webkit-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
329 |
+
background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
330 |
background: -o-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
331 |
background: -ms-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
332 |
background: linear-gradient(rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
333 |
+
width: 0;
|
334 |
}
|
335 |
|
336 |
.mejs-controls .mejs-time-rail .mejs-time-handle {
|
396 |
left: 18px;
|
397 |
}
|
398 |
|
|
|
|
|
399 |
/*
|
400 |
.mejs-controls .mejs-time-rail:hover .mejs-time-handle {
|
401 |
visibility:visible;
|
402 |
}
|
403 |
*/
|
404 |
+
/* End: Progress Bar */
|
405 |
|
406 |
/* Start: Fullscreen */
|
407 |
.mejs-controls .mejs-fullscreen-button button {
|
408 |
background-position: -32px 0;
|
409 |
}
|
410 |
+
|
411 |
.mejs-controls .mejs-unfullscreen button {
|
412 |
background-position: -32px -16px;
|
413 |
}
|
434 |
display: none;
|
435 |
height: 115px;
|
436 |
width: 25px;
|
437 |
+
background: url("background.png");
|
438 |
background: rgba(50, 50, 50, 0.7);
|
439 |
-webkit-border-radius: 0;
|
440 |
-moz-border-radius: 0;
|
445 |
position: absolute;
|
446 |
margin: 0;
|
447 |
}
|
448 |
+
|
449 |
.mejs-controls .mejs-volume-button:hover {
|
450 |
-webkit-border-radius: 0 0 4px 4px;
|
451 |
-moz-border-radius: 0 0 4px 4px;
|
452 |
border-radius: 0 0 4px 4px;
|
453 |
}
|
454 |
+
|
455 |
/*
|
456 |
.mejs-controls .mejs-volume-button:hover .mejs-volume-slider {
|
457 |
display: block;
|
495 |
margin: 0;
|
496 |
}
|
497 |
|
|
|
498 |
/* horizontal version */
|
499 |
+
.mejs-controls a.mejs-horizontal-volume-slider {
|
|
|
500 |
height: 26px;
|
501 |
+
width: 56px;
|
502 |
position: relative;
|
503 |
+
display: block;
|
504 |
+
float: left;
|
505 |
+
vertical-align: middle;
|
506 |
}
|
507 |
|
508 |
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
|
514 |
margin: 0;
|
515 |
padding: 0;
|
516 |
font-size: 1px;
|
|
|
517 |
-webkit-border-radius: 2px;
|
518 |
-moz-border-radius: 2px;
|
519 |
+
border-radius: 2px;
|
|
|
520 |
background: #333;
|
521 |
background: rgba(50,50,50,0.8);
|
522 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
|
523 |
+
background: -webkit-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
524 |
background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
525 |
background: -o-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
526 |
background: -ms-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
527 |
background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
|
|
528 |
}
|
529 |
|
530 |
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
|
536 |
margin: 0;
|
537 |
padding: 0;
|
538 |
font-size: 1px;
|
|
|
539 |
-webkit-border-radius: 2px;
|
540 |
-moz-border-radius: 2px;
|
541 |
border-radius: 2px;
|
|
|
542 |
background: #fff;
|
543 |
background: rgba(255,255,255,0.8);
|
544 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
|
545 |
background: -webkit-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
546 |
+
background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
547 |
background: -o-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
548 |
background: -ms-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
549 |
background: linear-gradient(rgba(255,255,255,0.9), rgba(200,200,200,0.8));
|
|
|
550 |
}
|
551 |
|
|
|
552 |
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle {
|
553 |
display: none;
|
554 |
}
|
555 |
|
556 |
/* End: Mute/Volume */
|
557 |
|
558 |
+
/* Start: Track (Captions and Chapters) */
|
|
|
|
|
|
|
559 |
.mejs-controls .mejs-captions-button {
|
560 |
position: relative;
|
561 |
}
|
567 |
visibility: hidden;
|
568 |
position: absolute;
|
569 |
bottom: 26px;
|
570 |
+
right: -51px;
|
571 |
+
width: 85px;
|
572 |
height: 100px;
|
573 |
+
background: url("background.png");
|
574 |
background: rgba(50,50,50,0.7);
|
575 |
border: solid 1px transparent;
|
576 |
+
padding: 10px 10px 0 10px;
|
577 |
overflow: hidden;
|
578 |
-webkit-border-radius: 0;
|
579 |
-moz-border-radius: 0;
|
580 |
border-radius: 0;
|
581 |
}
|
582 |
+
|
583 |
.mejs-controls .mejs-captions-button:hover .mejs-captions-selector {
|
584 |
visibility: visible;
|
585 |
}
|
|
|
586 |
|
587 |
.mejs-controls .mejs-captions-button .mejs-captions-selector ul {
|
588 |
margin: 0;
|
591 |
list-style-type: none !important;
|
592 |
overflow: hidden;
|
593 |
}
|
594 |
+
|
595 |
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li {
|
596 |
margin: 0 0 6px 0;
|
597 |
padding: 0;
|
600 |
color: #fff;
|
601 |
overflow: hidden;
|
602 |
}
|
603 |
+
|
604 |
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li input {
|
605 |
clear: both;
|
606 |
float: left;
|
607 |
margin: 3px 3px 0 5px;
|
608 |
}
|
609 |
+
|
610 |
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li label {
|
611 |
+
width: 55px;
|
612 |
float: left;
|
613 |
padding: 4px 0 0 0;
|
614 |
line-height: 15px;
|
615 |
+
font-family: "Helvetica", Arial, serif;
|
616 |
font-size: 10px;
|
617 |
}
|
618 |
|
621 |
margin: 0 0 5px 0;
|
622 |
}
|
623 |
|
|
|
624 |
.mejs-chapters {
|
625 |
position: absolute;
|
626 |
top: 0;
|
627 |
left: 0;
|
628 |
+
border-right: solid 1px #fff;
|
629 |
width: 10000px;
|
630 |
z-index: 1;
|
631 |
}
|
632 |
+
|
633 |
.mejs-chapters .mejs-chapter {
|
634 |
position: absolute;
|
635 |
float: left;
|
640 |
background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
641 |
background: -o-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
642 |
background: -ms-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
643 |
+
background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
|
644 |
+
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#323232,endColorstr=#000000);
|
645 |
overflow: hidden;
|
646 |
border: 0;
|
647 |
}
|
648 |
+
|
649 |
.mejs-chapters .mejs-chapter .mejs-chapter-block {
|
650 |
font-size: 11px;
|
651 |
color: #fff;
|
655 |
border-bottom: solid 1px #333;
|
656 |
cursor: pointer;
|
657 |
}
|
658 |
+
|
659 |
.mejs-chapters .mejs-chapter .mejs-chapter-block-last {
|
660 |
border-right: none;
|
661 |
}
|
662 |
|
663 |
.mejs-chapters .mejs-chapter .mejs-chapter-block:hover {
|
|
|
664 |
background: #666;
|
665 |
background: rgba(102,102,102, 0.7);
|
666 |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(102,102,102,0.7)), to(rgba(50,50,50,0.6)));
|
669 |
background: -o-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
|
670 |
background: -ms-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
|
671 |
background: linear-gradient(rgba(102,102,102,0.7), rgba(50,50,50,0.6));
|
672 |
+
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#666666,endColorstr=#323232);
|
673 |
}
|
674 |
+
|
675 |
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title {
|
676 |
font-size: 12px;
|
677 |
font-weight: bold;
|
681 |
margin: 0 0 3px 0;
|
682 |
line-height: 12px;
|
683 |
}
|
684 |
+
|
685 |
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan {
|
686 |
font-size: 12px;
|
687 |
line-height: 12px;
|
691 |
text-overflow: ellipsis;
|
692 |
}
|
693 |
|
|
|
694 |
.mejs-captions-layer {
|
695 |
position: absolute;
|
696 |
bottom: 0;
|
697 |
left: 0;
|
698 |
text-align:center;
|
699 |
+
line-height: 20px;
|
700 |
+
font-size: 16px;
|
|
|
701 |
color: #fff;
|
702 |
}
|
703 |
+
|
704 |
.mejs-captions-layer a {
|
705 |
color: #fff;
|
706 |
text-decoration: underline;
|
707 |
}
|
708 |
+
|
709 |
.mejs-captions-layer[lang=ar] {
|
710 |
font-size: 20px;
|
711 |
font-weight: normal;
|
719 |
}
|
720 |
|
721 |
.mejs-captions-position-hover {
|
722 |
+
bottom: 35px;
|
723 |
}
|
724 |
|
725 |
.mejs-captions-text {
|
726 |
+
padding: 0;
|
727 |
+
background: url("background.png");
|
728 |
+
background: rgba(20, 20, 20, 0.5);
|
729 |
+
white-space: pre-wrap;
|
730 |
+
-webkit-box-shadow: 5px 0 0 rgba(20, 20, 20, 0.5), -5px 0 0 rgba(20, 20, 20, 0.5);
|
731 |
+
box-shadow: 5px 0 0 rgba(20, 20, 20, 0.5), -5px 0 0 rgba(20, 20, 20, 0.5);
|
|
|
|
|
|
|
|
|
|
|
732 |
}
|
733 |
+
/* End: Track (Captions and Chapters) */
|
734 |
|
735 |
+
/* Start: Error */
|
736 |
.me-cannotplay {
|
737 |
}
|
738 |
+
|
739 |
.me-cannotplay a {
|
740 |
color: #fff;
|
741 |
font-weight: bold;
|
742 |
}
|
743 |
+
|
744 |
.me-cannotplay span {
|
745 |
padding: 15px;
|
746 |
display: block;
|
747 |
}
|
748 |
+
/* End: Error */
|
749 |
|
750 |
|
751 |
/* Start: Loop */
|
752 |
.mejs-controls .mejs-loop-off button {
|
753 |
background-position: -64px -16px;
|
754 |
}
|
755 |
+
|
756 |
.mejs-controls .mejs-loop-on button {
|
757 |
background-position: -64px 0;
|
758 |
}
|
759 |
+
|
760 |
/* End: Loop */
|
761 |
|
762 |
/* Start: backlight */
|
763 |
.mejs-controls .mejs-backlight-off button {
|
764 |
background-position: -80px -16px;
|
765 |
}
|
766 |
+
|
767 |
.mejs-controls .mejs-backlight-on button {
|
768 |
background-position: -80px 0;
|
769 |
}
|
770 |
/* End: backlight */
|
771 |
|
772 |
+
/* Start: Picture Controls */
|
|
|
773 |
.mejs-controls .mejs-picturecontrols-button {
|
774 |
background-position: -96px 0;
|
775 |
}
|
776 |
+
/* End: Picture Controls */
|
777 |
|
778 |
|
779 |
/* context menu */
|
792 |
height: 1px;
|
793 |
font-size: 0;
|
794 |
margin: 5px 6px;
|
795 |
+
background: #333;
|
796 |
}
|
797 |
|
798 |
.mejs-contextmenu .mejs-contextmenu-item {
|
799 |
+
font-family: "Helvetica", Arial, serif;
|
800 |
font-size: 12px;
|
801 |
padding: 4px 6px;
|
802 |
cursor: pointer;
|
803 |
+
color: #333;
|
804 |
}
|
805 |
.mejs-contextmenu .mejs-contextmenu-item:hover {
|
806 |
background: #2C7C91;
|
807 |
color: #fff;
|
808 |
}
|
809 |
|
810 |
+
/* Start: Source Chooser */
|
|
|
811 |
.mejs-controls .mejs-sourcechooser-button {
|
812 |
position: relative;
|
813 |
}
|
815 |
.mejs-controls .mejs-sourcechooser-button button {
|
816 |
background-position: -128px 0;
|
817 |
}
|
818 |
+
|
819 |
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector {
|
|
|
820 |
position: absolute;
|
821 |
bottom: 26px;
|
822 |
right: -10px;
|
823 |
width: 130px;
|
824 |
height: 100px;
|
825 |
+
background: url("background.png");
|
826 |
background: rgba(50,50,50,0.7);
|
827 |
border: solid 1px transparent;
|
828 |
padding: 10px;
|
839 |
list-style-type: none !important;
|
840 |
overflow: hidden;
|
841 |
}
|
842 |
+
|
843 |
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li {
|
844 |
margin: 0 0 6px 0;
|
845 |
padding: 0;
|
848 |
color: #fff;
|
849 |
overflow: hidden;
|
850 |
}
|
851 |
+
|
852 |
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input {
|
853 |
clear: both;
|
854 |
float: left;
|
855 |
margin: 3px 3px 0 5px;
|
856 |
}
|
857 |
+
|
858 |
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label {
|
859 |
width: 100px;
|
860 |
float: left;
|
861 |
padding: 4px 0 0 0;
|
862 |
line-height: 15px;
|
863 |
+
font-family: "Helvetica", Arial, serif;
|
864 |
font-size: 10px;
|
865 |
}
|
866 |
+
/* End: Source Chooser */
|
|
|
867 |
|
868 |
/* Start: Postroll */
|
869 |
.mejs-postroll-layer {
|
872 |
left: 0;
|
873 |
width: 100%;
|
874 |
height: 100%;
|
875 |
+
background: url("background.png");
|
876 |
background: rgba(50,50,50,0.7);
|
877 |
z-index: 1000;
|
878 |
overflow: hidden;
|
885 |
position: absolute;
|
886 |
right: 0;
|
887 |
top: 0;
|
888 |
+
background: url("background.png");
|
889 |
background: rgba(50,50,50,0.7);
|
890 |
color: #fff;
|
891 |
padding: 4px;
|
893 |
cursor: pointer;
|
894 |
}
|
895 |
/* End: Postroll */
|
896 |
+
|
897 |
+
|
898 |
+
/* Start: Speed */
|
899 |
+
div.mejs-speed-button {
|
900 |
+
width: 46px !important;
|
901 |
+
position: relative;
|
902 |
+
}
|
903 |
+
|
904 |
+
.mejs-controls .mejs-button.mejs-speed-button button {
|
905 |
+
background: transparent;
|
906 |
+
width: 36px;
|
907 |
+
font-size: 11px;
|
908 |
+
line-height: normal;
|
909 |
+
color: #ffffff;
|
910 |
+
}
|
911 |
+
|
912 |
+
.mejs-controls .mejs-speed-button .mejs-speed-selector {
|
913 |
+
display: none;
|
914 |
+
position: absolute;
|
915 |
+
top: -100px;
|
916 |
+
left: -10px;
|
917 |
+
width: 60px;
|
918 |
+
height: 100px;
|
919 |
+
background: url("background.png");
|
920 |
+
background: rgba(50, 50, 50, 0.7);
|
921 |
+
border: solid 1px transparent;
|
922 |
+
padding: 0;
|
923 |
+
overflow: hidden;
|
924 |
+
-webkit-border-radius: 0;
|
925 |
+
-moz-border-radius: 0;
|
926 |
+
border-radius: 0;
|
927 |
+
}
|
928 |
+
|
929 |
+
|
930 |
+
.mejs-controls .mejs-speed-button:hover > .mejs-speed-selector {
|
931 |
+
display: block;
|
932 |
+
}
|
933 |
+
|
934 |
+
.mejs-controls .mejs-speed-button .mejs-speed-selector ul li label.mejs-speed-selected {
|
935 |
+
color: rgba(33, 248, 248, 1);
|
936 |
+
}
|
937 |
+
|
938 |
+
.mejs-controls .mejs-speed-button .mejs-speed-selector ul {
|
939 |
+
margin: 0;
|
940 |
+
padding: 0;
|
941 |
+
display: block;
|
942 |
+
list-style-type: none !important;
|
943 |
+
overflow: hidden;
|
944 |
+
}
|
945 |
+
|
946 |
+
.mejs-controls .mejs-speed-button .mejs-speed-selector ul li {
|
947 |
+
margin: 0 0 6px 0;
|
948 |
+
padding: 0 10px;
|
949 |
+
list-style-type: none !important;
|
950 |
+
display: block;
|
951 |
+
color: #fff;
|
952 |
+
overflow: hidden;
|
953 |
+
}
|
954 |
+
|
955 |
+
.mejs-controls .mejs-speed-button .mejs-speed-selector ul li input {
|
956 |
+
clear: both;
|
957 |
+
float: left;
|
958 |
+
margin: 3px 3px 0 5px;
|
959 |
+
display: none;
|
960 |
+
}
|
961 |
+
|
962 |
+
.mejs-controls .mejs-speed-button .mejs-speed-selector ul li label {
|
963 |
+
width: 60px;
|
964 |
+
float: left;
|
965 |
+
padding: 4px 0 0 0;
|
966 |
+
line-height: 15px;
|
967 |
+
font-family: "Helvetica", Arial, serif;
|
968 |
+
font-size: 11px;
|
969 |
+
color: white;
|
970 |
+
margin-left: 5px;
|
971 |
+
cursor: pointer;
|
972 |
+
}
|
973 |
+
|
974 |
+
.mejs-controls .mejs-speed-button .mejs-speed-selector ul li:hover {
|
975 |
+
background-color: rgb(200, 200, 200) !important;
|
976 |
+
background-color: rgba(255,255,255,.4) !important;
|
977 |
+
}
|
978 |
+
/* End: Speed */
|
979 |
+
|
980 |
+
/* Start: Jump Forward */
|
981 |
+
|
982 |
+
.mejs-controls .mejs-button.mejs-jump-forward-button {
|
983 |
+
background: transparent url("jumpforward.png") no-repeat 3px 3px;
|
984 |
+
}
|
985 |
+
.mejs-controls .mejs-button.mejs-jump-forward-button button {
|
986 |
+
background: transparent;
|
987 |
+
font-size: 9px;
|
988 |
+
line-height: normal;
|
989 |
+
color: #ffffff;
|
990 |
+
}
|
991 |
+
|
992 |
+
/* End: Jump Forward */
|
993 |
+
|
994 |
+
/* Start: Skip Back */
|
995 |
+
|
996 |
+
.mejs-controls .mejs-button.mejs-skip-back-button {
|
997 |
+
background: transparent url("skipback.png") no-repeat 3px 3px;
|
998 |
+
}
|
999 |
+
.mejs-controls .mejs-button.mejs-skip-back-button button {
|
1000 |
+
background: transparent;
|
1001 |
+
font-size: 9px;
|
1002 |
+
line-height: normal;
|
1003 |
+
color: #ffffff;
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
/* End: Skip Back */
|
1007 |
+
|
mediaelement/mediaelementplayer.js
CHANGED
@@ -1,16 +1,30 @@
|
|
1 |
/*!
|
|
|
2 |
* MediaElementPlayer
|
3 |
* http://mediaelementjs.com/
|
4 |
*
|
5 |
* Creates a controller bar for HTML5 <video> add <audio> tags
|
6 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
7 |
*
|
8 |
-
* Copyright 2010-
|
9 |
* License: MIT
|
10 |
*
|
11 |
*/
|
12 |
if (typeof jQuery != 'undefined') {
|
13 |
mejs.$ = jQuery;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
} else if (typeof ender != 'undefined') {
|
15 |
mejs.$ = ender;
|
16 |
}
|
@@ -20,6 +34,8 @@ if (typeof jQuery != 'undefined') {
|
|
20 |
mejs.MepDefaults = {
|
21 |
// url to poster (to fix iOS 3.x)
|
22 |
poster: '',
|
|
|
|
|
23 |
// default if the <video width> is not specified
|
24 |
defaultVideoWidth: 480,
|
25 |
// default if the <video height> is not specified
|
@@ -32,84 +48,120 @@ if (typeof jQuery != 'undefined') {
|
|
32 |
defaultAudioWidth: 400,
|
33 |
// default if the user doesn't specify
|
34 |
defaultAudioHeight: 30,
|
35 |
-
|
36 |
-
// default amount to move back when back key is pressed
|
37 |
defaultSeekBackwardInterval: function(media) {
|
38 |
return (media.duration * 0.05);
|
39 |
-
},
|
40 |
-
// default amount to move forward when forward key is pressed
|
41 |
defaultSeekForwardInterval: function(media) {
|
42 |
return (media.duration * 0.05);
|
43 |
-
},
|
44 |
-
|
|
|
45 |
// width of audio player
|
46 |
audioWidth: -1,
|
47 |
// height of audio player
|
48 |
-
audioHeight: -1,
|
49 |
// initial volume when the player starts (overrided by user cookie)
|
50 |
startVolume: 0.8,
|
51 |
// useful for <audio> player loops
|
52 |
loop: false,
|
53 |
// rewind to beginning when media ends
|
54 |
-
|
55 |
// resize to media dimensions
|
56 |
enableAutosize: true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
// forces the hour marker (##:00:00)
|
58 |
alwaysShowHours: false,
|
59 |
-
|
60 |
// show framecount in timecode (##:00:00:00)
|
61 |
showTimecodeFrameCount: false,
|
62 |
// used when showTimecodeFrameCount is set to true
|
63 |
framesPerSecond: 25,
|
64 |
-
|
65 |
// automatically calculate the width of the progress bar based on the sizes of other elements
|
66 |
autosizeProgress : true,
|
67 |
// Hide controls when playing and mouse is not over the video
|
68 |
alwaysShowControls: false,
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
// force iPad's native controls
|
72 |
iPadUseNativeControls: false,
|
73 |
// force iPhone's native controls
|
74 |
-
iPhoneUseNativeControls: false,
|
75 |
// force Android's native controls
|
76 |
-
AndroidUseNativeControls: false,
|
77 |
// features to show
|
78 |
features: ['playpause','current','progress','duration','tracks','volume','fullscreen'],
|
79 |
// only for dynamic
|
80 |
isVideo: true,
|
81 |
-
|
|
|
82 |
// turns keyboard support on and off for this instance
|
83 |
enableKeyboard: true,
|
84 |
-
|
85 |
-
// whenthis player starts, it will pause other players
|
86 |
pauseOtherPlayers: true,
|
87 |
-
|
88 |
// array of keyboard actions such as play pause
|
89 |
keyActions: [
|
90 |
{
|
91 |
keys: [
|
92 |
32, // SPACE
|
93 |
179 // GOOGLE play/pause button
|
94 |
-
|
95 |
-
action: function(player, media) {
|
|
|
|
|
96 |
if (media.paused || media.ended) {
|
97 |
-
|
98 |
} else {
|
99 |
-
|
100 |
-
}
|
|
|
101 |
}
|
102 |
},
|
103 |
{
|
104 |
keys: [38], // UP
|
105 |
-
action: function(player, media) {
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
var newVolume = Math.min(media.volume + 0.1, 1);
|
107 |
media.setVolume(newVolume);
|
108 |
}
|
109 |
},
|
110 |
{
|
111 |
keys: [40], // DOWN
|
112 |
-
action: function(player, media) {
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
var newVolume = Math.max(media.volume - 0.1, 0);
|
114 |
media.setVolume(newVolume);
|
115 |
}
|
@@ -119,13 +171,13 @@ if (typeof jQuery != 'undefined') {
|
|
119 |
37, // LEFT
|
120 |
227 // Google TV rewind
|
121 |
],
|
122 |
-
action: function(player, media) {
|
123 |
if (!isNaN(media.duration) && media.duration > 0) {
|
124 |
if (player.isVideo) {
|
125 |
player.showControls();
|
126 |
player.startControlsTimer();
|
127 |
}
|
128 |
-
|
129 |
// 5%
|
130 |
var newTime = Math.max(media.currentTime - player.options.defaultSeekBackwardInterval(media), 0);
|
131 |
media.setCurrentTime(newTime);
|
@@ -136,23 +188,23 @@ if (typeof jQuery != 'undefined') {
|
|
136 |
keys: [
|
137 |
39, // RIGHT
|
138 |
228 // Google TV forward
|
139 |
-
],
|
140 |
-
action: function(player, media) {
|
141 |
if (!isNaN(media.duration) && media.duration > 0) {
|
142 |
if (player.isVideo) {
|
143 |
player.showControls();
|
144 |
player.startControlsTimer();
|
145 |
}
|
146 |
-
|
147 |
// 5%
|
148 |
-
var newTime = Math.min(media.currentTime + player.options.defaultSeekForwardInterval(media), media.duration);
|
149 |
media.setCurrentTime(newTime);
|
150 |
}
|
151 |
}
|
152 |
},
|
153 |
{
|
154 |
-
keys: [70], //
|
155 |
-
action: function(player, media) {
|
156 |
if (typeof player.enterFullScreen != 'undefined') {
|
157 |
if (player.isFullScreen) {
|
158 |
player.exitFullScreen();
|
@@ -161,47 +213,79 @@ if (typeof jQuery != 'undefined') {
|
|
161 |
}
|
162 |
}
|
163 |
}
|
164 |
-
}
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
};
|
167 |
|
168 |
mejs.mepIndex = 0;
|
169 |
-
|
170 |
-
mejs.players =
|
171 |
|
172 |
// wraps a MediaElement object in player controls
|
173 |
mejs.MediaElementPlayer = function(node, o) {
|
174 |
// enforce object, even without "new" (via John Resig)
|
175 |
if ( !(this instanceof mejs.MediaElementPlayer) ) {
|
176 |
return new mejs.MediaElementPlayer(node, o);
|
177 |
-
}
|
178 |
|
179 |
var t = this;
|
180 |
-
|
181 |
// these will be reset after the MediaElement.success fires
|
182 |
t.$media = t.$node = $(node);
|
183 |
-
t.node = t.media = t.$media[0];
|
184 |
-
|
|
|
|
|
|
|
|
|
185 |
// check for existing player
|
186 |
if (typeof t.node.player != 'undefined') {
|
187 |
return t.node.player;
|
188 |
-
} else {
|
189 |
-
// attach player to DOM node for reference
|
190 |
-
t.node.player = t;
|
191 |
}
|
192 |
-
|
193 |
-
|
194 |
// try to get options from data-mejsoptions
|
195 |
if (typeof o == 'undefined') {
|
196 |
-
o = t.$node.data('mejsoptions');
|
197 |
}
|
198 |
-
|
199 |
// extend default options
|
200 |
t.options = $.extend({},mejs.MepDefaults,o);
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
// add to player array (for focus events)
|
203 |
-
mejs.players.
|
204 |
-
|
205 |
// start up
|
206 |
t.init();
|
207 |
|
@@ -210,11 +294,11 @@ if (typeof jQuery != 'undefined') {
|
|
210 |
|
211 |
// actual player
|
212 |
mejs.MediaElementPlayer.prototype = {
|
213 |
-
|
214 |
hasFocus: false,
|
215 |
-
|
216 |
controlsAreVisible: true,
|
217 |
-
|
218 |
init: function() {
|
219 |
|
220 |
var
|
@@ -226,49 +310,49 @@ if (typeof jQuery != 'undefined') {
|
|
226 |
error: function(e) { t.handleError(e);}
|
227 |
}),
|
228 |
tagName = t.media.tagName.toLowerCase();
|
229 |
-
|
230 |
t.isDynamic = (tagName !== 'audio' && tagName !== 'video');
|
231 |
-
|
232 |
-
if (t.isDynamic) {
|
233 |
-
// get video from src or href?
|
234 |
-
t.isVideo = t.options.isVideo;
|
235 |
} else {
|
236 |
t.isVideo = (tagName !== 'audio' && t.options.isVideo);
|
237 |
}
|
238 |
-
|
239 |
-
// use native controls in iPad, iPhone, and Android
|
240 |
if ((mf.isiPad && t.options.iPadUseNativeControls) || (mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
241 |
-
|
242 |
// add controls and stop
|
243 |
t.$media.attr('controls', 'controls');
|
244 |
|
245 |
// attempt to fix iOS 3 bug
|
246 |
//t.$media.removeAttr('poster');
|
247 |
-
|
248 |
|
249 |
// override Apple's autoplay override for iPads
|
250 |
if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
|
251 |
-
t.
|
252 |
-
t.media.play();
|
253 |
}
|
254 |
-
|
255 |
-
} else if (mf.isAndroid && t.AndroidUseNativeControls) {
|
256 |
-
|
257 |
// leave default player
|
258 |
|
259 |
-
} else {
|
260 |
|
261 |
// DESKTOP: use MediaElementPlayer controls
|
262 |
-
|
263 |
-
// remove native controls
|
264 |
-
t.$media.removeAttr('controls');
|
265 |
-
|
266 |
-
// unique ID
|
267 |
-
t.id = 'mep_' + mejs.mepIndex++;
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
// build container
|
270 |
t.container =
|
271 |
-
$('<div id="' + t.id + '" class="mejs-container ' + (mejs.MediaFeatures.
|
|
|
272 |
'<div class="mejs-inner">'+
|
273 |
'<div class="mejs-mediaelement"></div>'+
|
274 |
'<div class="mejs-layers"></div>'+
|
@@ -277,8 +361,39 @@ if (typeof jQuery != 'undefined') {
|
|
277 |
'</div>' +
|
278 |
'</div>')
|
279 |
.addClass(t.$media[0].className)
|
280 |
-
.insertBefore(t.$media)
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
// add classes for user and content
|
283 |
t.container.addClass(
|
284 |
(mf.isAndroid ? 'mejs-android ' : '') +
|
@@ -286,174 +401,167 @@ if (typeof jQuery != 'undefined') {
|
|
286 |
(mf.isiPad ? 'mejs-ipad ' : '') +
|
287 |
(mf.isiPhone ? 'mejs-iphone ' : '') +
|
288 |
(t.isVideo ? 'mejs-video ' : 'mejs-audio ')
|
289 |
-
);
|
290 |
-
|
291 |
|
292 |
// move the <video/video> tag into the right spot
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
t.container.find('.mejs-mediaelement').append($newMedia);
|
299 |
-
|
300 |
-
t.$media.remove();
|
301 |
-
t.$node = t.$media = $newMedia;
|
302 |
-
t.node = t.media = $newMedia[0]
|
303 |
-
|
304 |
-
} else {
|
305 |
-
|
306 |
-
// normal way of moving it into place (doesn't work on iOS)
|
307 |
-
t.container.find('.mejs-mediaelement').append(t.$media);
|
308 |
-
}
|
309 |
-
|
310 |
// find parts
|
311 |
t.controls = t.container.find('.mejs-controls');
|
312 |
t.layers = t.container.find('.mejs-layers');
|
313 |
|
314 |
// determine the size
|
315 |
-
|
316 |
/* size priority:
|
317 |
-
(1) videoWidth (forced),
|
318 |
(2) style="width;height;"
|
319 |
(3) width attribute,
|
320 |
(4) defaultVideoWidth (for unspecified cases)
|
321 |
*/
|
322 |
-
|
323 |
var tagType = (t.isVideo ? 'video' : 'audio'),
|
324 |
capsTagName = tagType.substring(0,1).toUpperCase() + tagType.substring(1);
|
325 |
-
|
326 |
-
|
|
|
327 |
if (t.options[tagType + 'Width'] > 0 || t.options[tagType + 'Width'].toString().indexOf('%') > -1) {
|
328 |
t.width = t.options[tagType + 'Width'];
|
329 |
} else if (t.media.style.width !== '' && t.media.style.width !== null) {
|
330 |
-
t.width = t.media.style.width;
|
331 |
} else if (t.media.getAttribute('width') !== null) {
|
332 |
t.width = t.$media.attr('width');
|
333 |
} else {
|
334 |
t.width = t.options['default' + capsTagName + 'Width'];
|
335 |
}
|
336 |
-
|
337 |
if (t.options[tagType + 'Height'] > 0 || t.options[tagType + 'Height'].toString().indexOf('%') > -1) {
|
338 |
t.height = t.options[tagType + 'Height'];
|
339 |
} else if (t.media.style.height !== '' && t.media.style.height !== null) {
|
340 |
t.height = t.media.style.height;
|
341 |
} else if (t.$media[0].getAttribute('height') !== null) {
|
342 |
-
t.height = t.$media.attr('height');
|
343 |
} else {
|
344 |
t.height = t.options['default' + capsTagName + 'Height'];
|
345 |
}
|
346 |
|
347 |
// set the size, while we wait for the plugins to load below
|
348 |
t.setPlayerSize(t.width, t.height);
|
349 |
-
|
350 |
// create MediaElementShim
|
351 |
-
meOptions.pluginWidth = t.
|
352 |
-
meOptions.pluginHeight = t.
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
-
|
355 |
-
|
356 |
|
357 |
// create MediaElement shim
|
358 |
mejs.MediaElement(t.$media[0], meOptions);
|
359 |
|
360 |
-
|
361 |
-
|
|
|
|
|
362 |
},
|
363 |
-
|
364 |
showControls: function(doAnimation) {
|
365 |
var t = this;
|
366 |
-
|
367 |
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
368 |
-
|
369 |
if (t.controlsAreVisible)
|
370 |
return;
|
371 |
-
|
372 |
if (doAnimation) {
|
373 |
t.controls
|
374 |
-
.
|
375 |
.stop(true, true).fadeIn(200, function() {
|
376 |
-
|
377 |
-
|
378 |
});
|
379 |
-
|
380 |
// any additional controls people might add and want to hide
|
381 |
t.container.find('.mejs-control')
|
382 |
-
.
|
383 |
-
.stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
|
384 |
-
|
385 |
} else {
|
386 |
t.controls
|
387 |
-
.
|
388 |
.css('display','block');
|
389 |
-
|
390 |
// any additional controls people might add and want to hide
|
391 |
t.container.find('.mejs-control')
|
392 |
-
.
|
393 |
.css('display','block');
|
394 |
-
|
395 |
t.controlsAreVisible = true;
|
396 |
t.container.trigger('controlsshown');
|
397 |
}
|
398 |
-
|
399 |
t.setControlsSize();
|
400 |
-
|
401 |
},
|
402 |
|
403 |
hideControls: function(doAnimation) {
|
404 |
var t = this;
|
405 |
-
|
406 |
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
407 |
-
|
408 |
-
if (!t.controlsAreVisible)
|
409 |
return;
|
410 |
-
|
411 |
if (doAnimation) {
|
412 |
// fade out main controls
|
413 |
t.controls.stop(true, true).fadeOut(200, function() {
|
414 |
$(this)
|
415 |
-
.
|
416 |
.css('display','block');
|
417 |
-
|
418 |
t.controlsAreVisible = false;
|
419 |
t.container.trigger('controlshidden');
|
420 |
-
});
|
421 |
-
|
422 |
// any additional controls people might add and want to hide
|
423 |
t.container.find('.mejs-control').stop(true, true).fadeOut(200, function() {
|
424 |
$(this)
|
425 |
-
.
|
426 |
.css('display','block');
|
427 |
-
});
|
428 |
} else {
|
429 |
-
|
430 |
// hide main controls
|
431 |
t.controls
|
432 |
-
.
|
433 |
-
.css('display','block');
|
434 |
-
|
435 |
// hide others
|
436 |
t.container.find('.mejs-control')
|
437 |
-
.
|
438 |
.css('display','block');
|
439 |
-
|
440 |
t.controlsAreVisible = false;
|
441 |
t.container.trigger('controlshidden');
|
442 |
}
|
443 |
-
},
|
444 |
|
445 |
controlsTimer: null,
|
446 |
|
447 |
startControlsTimer: function(timeout) {
|
448 |
|
449 |
var t = this;
|
450 |
-
|
451 |
-
timeout = typeof timeout != 'undefined' ? timeout :
|
452 |
|
453 |
t.killControlsTimer('start');
|
454 |
|
455 |
t.controlsTimer = setTimeout(function() {
|
456 |
-
//
|
457 |
t.hideControls();
|
458 |
t.killControlsTimer('hide');
|
459 |
}, timeout);
|
@@ -468,32 +576,31 @@ if (typeof jQuery != 'undefined') {
|
|
468 |
delete t.controlsTimer;
|
469 |
t.controlsTimer = null;
|
470 |
}
|
471 |
-
},
|
472 |
-
|
473 |
controlsEnabled: true,
|
474 |
-
|
475 |
disableControls: function() {
|
476 |
var t= this;
|
477 |
-
|
478 |
t.killControlsTimer();
|
479 |
t.hideControls(false);
|
480 |
this.controlsEnabled = false;
|
481 |
},
|
482 |
-
|
483 |
enableControls: function() {
|
484 |
var t= this;
|
485 |
-
|
486 |
t.showControls(false);
|
487 |
-
|
488 |
t.controlsEnabled = true;
|
489 |
-
},
|
490 |
-
|
491 |
|
492 |
// Sets up all controls and events
|
493 |
-
meReady: function(media, domNode) {
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
mf = mejs.MediaFeatures,
|
498 |
autoplayAttr = domNode.getAttribute('autoplay'),
|
499 |
autoplay = !(typeof autoplayAttr == 'undefined' || autoplayAttr === null || autoplayAttr === 'false'),
|
@@ -501,16 +608,40 @@ if (typeof jQuery != 'undefined') {
|
|
501 |
feature;
|
502 |
|
503 |
// make sure it can't create itself again if a plugin reloads
|
504 |
-
if (t.created)
|
505 |
return;
|
506 |
-
else
|
507 |
-
t.created = true;
|
|
|
508 |
|
509 |
t.media = media;
|
510 |
t.domNode = domNode;
|
511 |
-
|
512 |
-
if (!(mf.isAndroid && t.options.AndroidUseNativeControls) && !(mf.isiPad && t.options.iPadUseNativeControls) && !(mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
513 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
514 |
// two built in features
|
515 |
t.buildposter(t, t.controls, t.layers, t.media);
|
516 |
t.buildkeyboard(t, t.controls, t.layers, t.media);
|
@@ -528,30 +659,29 @@ if (typeof jQuery != 'undefined') {
|
|
528 |
} catch (e) {
|
529 |
// TODO: report control error
|
530 |
//throw e;
|
531 |
-
|
532 |
-
|
533 |
}
|
534 |
}
|
535 |
}
|
536 |
|
537 |
t.container.trigger('controlsready');
|
538 |
-
|
539 |
// reset all layers and controls
|
540 |
t.setPlayerSize(t.width, t.height);
|
541 |
t.setControlsSize();
|
542 |
-
|
543 |
|
544 |
// controls fade
|
545 |
if (t.isVideo) {
|
546 |
-
|
547 |
-
if (mejs.MediaFeatures.hasTouch) {
|
548 |
-
|
549 |
// for touch devices (iOS, Android)
|
550 |
// show/hide without animation on touch
|
551 |
-
|
552 |
t.$media.bind('touchstart', function() {
|
553 |
-
|
554 |
-
|
555 |
// toggle controls
|
556 |
if (t.controlsAreVisible) {
|
557 |
t.hideControls(false);
|
@@ -560,28 +690,39 @@ if (typeof jQuery != 'undefined') {
|
|
560 |
t.showControls(false);
|
561 |
}
|
562 |
}
|
563 |
-
});
|
564 |
-
|
565 |
} else {
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
// show/hide controls
|
578 |
t.container
|
579 |
-
.bind('mouseenter
|
580 |
if (t.controlsEnabled) {
|
581 |
-
if (!t.options.alwaysShowControls) {
|
582 |
t.killControlsTimer('enter');
|
583 |
t.showControls();
|
584 |
-
t.startControlsTimer(
|
585 |
}
|
586 |
}
|
587 |
})
|
@@ -590,21 +731,24 @@ if (typeof jQuery != 'undefined') {
|
|
590 |
if (!t.controlsAreVisible) {
|
591 |
t.showControls();
|
592 |
}
|
593 |
-
//t.killControlsTimer('move');
|
594 |
if (!t.options.alwaysShowControls) {
|
595 |
-
t.startControlsTimer(
|
596 |
}
|
597 |
}
|
598 |
})
|
599 |
.bind('mouseleave', function () {
|
600 |
if (t.controlsEnabled) {
|
601 |
if (!t.media.paused && !t.options.alwaysShowControls) {
|
602 |
-
t.startControlsTimer(
|
603 |
}
|
604 |
}
|
605 |
});
|
606 |
}
|
607 |
-
|
|
|
|
|
|
|
|
|
608 |
// check for autoplay
|
609 |
if (autoplay && !t.options.alwaysShowControls) {
|
610 |
t.hideControls();
|
@@ -623,110 +767,159 @@ if (typeof jQuery != 'undefined') {
|
|
623 |
}, false);
|
624 |
}
|
625 |
}
|
626 |
-
|
627 |
// EVENTS
|
628 |
|
629 |
-
// FOCUS: when a video starts playing, it takes focus from other players (
|
630 |
-
media.addEventListener('play', function() {
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
p.hasFocus = false;
|
639 |
}
|
640 |
-
|
641 |
-
|
|
|
|
|
642 |
},false);
|
643 |
-
|
644 |
|
645 |
// ended for all
|
646 |
t.media.addEventListener('ended', function (e) {
|
647 |
if(t.options.autoRewind) {
|
648 |
try{
|
649 |
t.media.setCurrentTime(0);
|
|
|
|
|
|
|
|
|
650 |
} catch (exp) {
|
651 |
-
|
652 |
}
|
653 |
}
|
654 |
-
t.media.
|
655 |
-
|
656 |
-
|
|
|
|
|
|
|
|
|
657 |
t.setProgressRail();
|
658 |
-
|
659 |
-
|
|
|
|
|
660 |
|
661 |
if (t.options.loop) {
|
662 |
-
t.
|
663 |
} else if (!t.options.alwaysShowControls && t.controlsEnabled) {
|
664 |
t.showControls();
|
665 |
}
|
666 |
}, false);
|
667 |
-
|
668 |
// resize on the first play
|
669 |
-
t.media.addEventListener('loadedmetadata', function(
|
|
|
|
|
|
|
670 |
if (t.updateDuration) {
|
671 |
t.updateDuration();
|
672 |
}
|
673 |
if (t.updateCurrent) {
|
674 |
t.updateCurrent();
|
675 |
}
|
676 |
-
|
677 |
if (!t.isFullScreen) {
|
678 |
t.setPlayerSize(t.width, t.height);
|
679 |
t.setControlsSize();
|
680 |
}
|
681 |
}, false);
|
682 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
|
684 |
// webkit has trouble doing this without a delay
|
685 |
setTimeout(function () {
|
686 |
t.setPlayerSize(t.width, t.height);
|
687 |
t.setControlsSize();
|
688 |
}, 50);
|
689 |
-
|
690 |
// adjust controls whenever window sizes (used to be in fullscreen only)
|
691 |
-
|
692 |
-
|
693 |
-
// don't resize for fullscreen mode
|
694 |
if ( !(t.isFullScreen || (mejs.MediaFeatures.hasTrueNativeFullScreen && document.webkitIsFullScreen)) ) {
|
695 |
t.setPlayerSize(t.width, t.height);
|
696 |
}
|
697 |
-
|
698 |
// always adjust controls
|
699 |
t.setControlsSize();
|
700 |
-
});
|
701 |
|
702 |
-
//
|
703 |
-
|
704 |
-
|
|
|
|
|
|
|
705 |
}
|
706 |
}
|
707 |
-
|
708 |
// force autoplay for HTML5
|
709 |
if (autoplay && media.pluginType == 'native') {
|
710 |
-
|
711 |
-
media.play();
|
712 |
}
|
713 |
|
714 |
|
715 |
if (t.options.success) {
|
716 |
-
|
717 |
if (typeof t.options.success == 'string') {
|
718 |
-
|
719 |
} else {
|
720 |
-
|
721 |
}
|
722 |
}
|
723 |
},
|
724 |
|
725 |
handleError: function(e) {
|
726 |
var t = this;
|
727 |
-
|
728 |
-
t.controls
|
729 |
-
|
|
|
|
|
730 |
// Tell user that the file cannot be played
|
731 |
if (t.options.error) {
|
732 |
t.options.error(e);
|
@@ -736,68 +929,188 @@ if (typeof jQuery != 'undefined') {
|
|
736 |
setPlayerSize: function(width,height) {
|
737 |
var t = this;
|
738 |
|
739 |
-
if
|
|
|
|
|
|
|
|
|
740 |
t.width = width;
|
741 |
-
|
742 |
-
if (typeof height != 'undefined')
|
743 |
-
t.height = height;
|
744 |
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
newHeight = t.isVideo || !t.options.autosizeProgress ? parseInt(parentWidth * nativeHeight/nativeWidth, 10) : nativeHeight;
|
754 |
-
|
755 |
-
if (t.container.parent()[0].tagName.toLowerCase() === 'body') { // && t.container.siblings().count == 0) {
|
756 |
-
parentWidth = $(window).width();
|
757 |
-
newHeight = $(window).height();
|
758 |
-
}
|
759 |
-
|
760 |
-
if ( newHeight != 0 && parentWidth != 0 ) {
|
761 |
-
// set outer container size
|
762 |
-
t.container
|
763 |
-
.width(parentWidth)
|
764 |
-
.height(newHeight);
|
765 |
-
|
766 |
-
// set native <video> or <audio>
|
767 |
-
t.$media
|
768 |
-
.width('100%')
|
769 |
-
.height('100%');
|
770 |
-
|
771 |
-
// set shims
|
772 |
-
t.container.find('object, embed, iframe')
|
773 |
-
.width('100%')
|
774 |
-
.height('100%');
|
775 |
-
|
776 |
-
// if shim is ready, send the size to the embeded plugin
|
777 |
if (t.isVideo) {
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
}
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
787 |
}
|
|
|
|
|
|
|
|
|
|
|
788 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
|
790 |
-
|
791 |
-
|
792 |
t.container
|
793 |
-
.width(
|
794 |
-
.height(
|
795 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
796 |
t.layers.children('.mejs-layer')
|
797 |
-
.width(
|
798 |
-
.height(
|
799 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
800 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
801 |
},
|
802 |
|
803 |
setControlsSize: function() {
|
@@ -806,47 +1119,65 @@ if (typeof jQuery != 'undefined') {
|
|
806 |
railWidth = 0,
|
807 |
rail = t.controls.find('.mejs-time-rail'),
|
808 |
total = t.controls.find('.mejs-time-total'),
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
|
|
|
|
|
|
|
|
|
|
813 |
|
814 |
// allow the size to come from custom CSS
|
815 |
-
if (
|
816 |
-
// Also, frontends devs can be more flexible
|
817 |
// due the opportunity of absolute positioning.
|
818 |
-
railWidth = parseInt(rail.css('width'));
|
819 |
}
|
820 |
-
|
821 |
// attempt to autosize
|
822 |
if (railWidth === 0 || !railWidth) {
|
823 |
-
|
824 |
// find the size of all the other controls besides the rail
|
825 |
others.each(function() {
|
826 |
-
|
|
|
827 |
usedWidth += $(this).outerWidth(true);
|
828 |
}
|
829 |
});
|
830 |
-
|
831 |
// fit the rail into the remaining space
|
832 |
railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.width());
|
833 |
}
|
834 |
|
835 |
-
//
|
836 |
-
|
837 |
-
//
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
},
|
845 |
|
846 |
|
847 |
buildposter: function(player, controls, layers, media) {
|
848 |
var t = this,
|
849 |
-
poster =
|
850 |
$('<div class="mejs-poster mejs-layer">' +
|
851 |
'</div>')
|
852 |
.appendTo(layers),
|
@@ -855,10 +1186,10 @@ if (typeof jQuery != 'undefined') {
|
|
855 |
// prioriy goes to option (this is useful if you need to support iOS 3.x (iOS completely fails with poster)
|
856 |
if (player.options.poster !== '') {
|
857 |
posterUrl = player.options.poster;
|
858 |
-
}
|
859 |
-
|
860 |
// second, try the real poster
|
861 |
-
if (
|
862 |
t.setPoster(posterUrl);
|
863 |
} else {
|
864 |
poster.hide();
|
@@ -867,61 +1198,70 @@ if (typeof jQuery != 'undefined') {
|
|
867 |
media.addEventListener('play',function() {
|
868 |
poster.hide();
|
869 |
}, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
870 |
},
|
871 |
-
|
872 |
setPoster: function(url) {
|
873 |
var t = this,
|
874 |
posterDiv = t.container.find('.mejs-poster'),
|
875 |
posterImg = posterDiv.find('img');
|
876 |
-
|
877 |
-
if (posterImg.length
|
878 |
-
posterImg = $('<img width="100%" height="100%" />').appendTo(posterDiv);
|
879 |
-
}
|
880 |
-
|
881 |
posterImg.attr('src', url);
|
|
|
882 |
},
|
883 |
|
884 |
buildoverlays: function(player, controls, layers, media) {
|
885 |
-
|
886 |
if (!player.isVideo)
|
887 |
return;
|
888 |
|
889 |
-
var
|
890 |
-
loading =
|
891 |
$('<div class="mejs-overlay mejs-layer">'+
|
892 |
'<div class="mejs-overlay-loading"><span></span></div>'+
|
893 |
'</div>')
|
894 |
.hide() // start out hidden
|
895 |
.appendTo(layers),
|
896 |
-
error =
|
897 |
$('<div class="mejs-overlay mejs-layer">'+
|
898 |
'<div class="mejs-overlay-error"></div>'+
|
899 |
'</div>')
|
900 |
.hide() // start out hidden
|
901 |
.appendTo(layers),
|
902 |
// this needs to come last so it's on top
|
903 |
-
bigPlay =
|
904 |
$('<div class="mejs-overlay mejs-layer mejs-overlay-play">'+
|
905 |
-
'<div class="mejs-overlay-button"></div>'+
|
906 |
'</div>')
|
907 |
.appendTo(layers)
|
908 |
-
.click
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
|
|
|
|
916 |
});
|
917 |
-
|
918 |
/*
|
919 |
if (mejs.MediaFeatures.isiOS || mejs.MediaFeatures.isAndroid) {
|
920 |
bigPlay.remove();
|
921 |
loading.remove();
|
922 |
}
|
923 |
*/
|
924 |
-
|
925 |
|
926 |
// show/hide big play button
|
927 |
media.addEventListener('play',function() {
|
@@ -929,13 +1269,13 @@ if (typeof jQuery != 'undefined') {
|
|
929 |
loading.hide();
|
930 |
controls.find('.mejs-time-buffering').hide();
|
931 |
error.hide();
|
932 |
-
}, false);
|
933 |
-
|
934 |
media.addEventListener('playing', function() {
|
935 |
bigPlay.hide();
|
936 |
loading.hide();
|
937 |
controls.find('.mejs-time-buffering').hide();
|
938 |
-
error.hide();
|
939 |
}, false);
|
940 |
|
941 |
media.addEventListener('seeking', function() {
|
@@ -947,75 +1287,99 @@ if (typeof jQuery != 'undefined') {
|
|
947 |
loading.hide();
|
948 |
controls.find('.mejs-time-buffering').hide();
|
949 |
}, false);
|
950 |
-
|
951 |
media.addEventListener('pause',function() {
|
952 |
if (!mejs.MediaFeatures.isiPhone) {
|
953 |
bigPlay.show();
|
954 |
}
|
955 |
}, false);
|
956 |
-
|
957 |
media.addEventListener('waiting', function() {
|
958 |
-
loading.show();
|
959 |
controls.find('.mejs-time-buffering').show();
|
960 |
-
}, false);
|
961 |
-
|
962 |
-
|
963 |
-
// show/hide loading
|
964 |
media.addEventListener('loadeddata',function() {
|
965 |
// for some reason Chrome is firing this event
|
966 |
//if (mejs.MediaFeatures.isChrome && media.getAttribute && media.getAttribute('preload') === 'none')
|
967 |
// return;
|
968 |
-
|
969 |
loading.show();
|
970 |
controls.find('.mejs-time-buffering').show();
|
971 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
972 |
media.addEventListener('canplay',function() {
|
973 |
loading.hide();
|
974 |
controls.find('.mejs-time-buffering').hide();
|
975 |
-
|
|
|
976 |
|
977 |
// error handling
|
978 |
-
media.addEventListener('error',function() {
|
|
|
979 |
loading.hide();
|
980 |
-
|
981 |
error.show();
|
982 |
-
error.find('mejs-overlay-error').html("Error loading this resource");
|
983 |
-
}, false);
|
|
|
|
|
|
|
|
|
984 |
},
|
985 |
-
|
986 |
buildkeyboard: function(player, controls, layers, media) {
|
987 |
|
988 |
var t = this;
|
989 |
-
|
|
|
|
|
|
|
|
|
990 |
// listen for key presses
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
// find a matching key
|
996 |
-
for (var i=0, il=player.options.keyActions.length; i<il; i++) {
|
997 |
-
var keyAction = player.options.keyActions[i];
|
998 |
-
|
999 |
-
for (var j=0, jl=keyAction.keys.length; j<jl; j++) {
|
1000 |
-
if (e.keyCode == keyAction.keys[j]) {
|
1001 |
-
e.preventDefault();
|
1002 |
-
keyAction.action(player, media, e.keyCode);
|
1003 |
-
return false;
|
1004 |
-
}
|
1005 |
-
}
|
1006 |
-
}
|
1007 |
-
}
|
1008 |
-
|
1009 |
-
return true;
|
1010 |
});
|
1011 |
-
|
|
|
1012 |
// check if someone clicked outside a player region, then kill its focus
|
1013 |
-
|
1014 |
-
|
1015 |
-
player.hasFocus = false;
|
1016 |
-
}
|
1017 |
});
|
1018 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1019 |
},
|
1020 |
|
1021 |
findTracks: function() {
|
@@ -1025,11 +1389,11 @@ if (typeof jQuery != 'undefined') {
|
|
1025 |
// store for use by plugins
|
1026 |
t.tracks = [];
|
1027 |
tracktags.each(function(index, track) {
|
1028 |
-
|
1029 |
track = $(track);
|
1030 |
-
|
1031 |
t.tracks.push({
|
1032 |
-
srclang: track.attr('srclang').toLowerCase(),
|
1033 |
src: track.attr('src'),
|
1034 |
kind: track.attr('kind'),
|
1035 |
label: track.attr('label') || '',
|
@@ -1044,13 +1408,20 @@ if (typeof jQuery != 'undefined') {
|
|
1044 |
this.setControlsSize();
|
1045 |
},
|
1046 |
play: function() {
|
|
|
1047 |
this.media.play();
|
1048 |
},
|
1049 |
pause: function() {
|
1050 |
-
|
|
|
|
|
1051 |
},
|
1052 |
load: function() {
|
1053 |
-
this.
|
|
|
|
|
|
|
|
|
1054 |
},
|
1055 |
setMuted: function(muted) {
|
1056 |
this.media.setMuted(muted);
|
@@ -1068,40 +1439,181 @@ if (typeof jQuery != 'undefined') {
|
|
1068 |
return this.media.volume;
|
1069 |
},
|
1070 |
setSrc: function(src) {
|
1071 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1072 |
},
|
1073 |
remove: function() {
|
1074 |
-
var t = this;
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1080 |
}
|
1081 |
-
|
1082 |
// grab video and put it back in place
|
1083 |
if (!t.isDynamic) {
|
1084 |
-
t.$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1085 |
}
|
1086 |
-
|
1087 |
-
t.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1088 |
}
|
1089 |
};
|
1090 |
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1096 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1097 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
1098 |
}
|
1099 |
-
|
1100 |
-
$(document).ready(function() {
|
1101 |
-
// auto enable using JSON attribute
|
1102 |
-
$('.mejs-player').mediaelementplayer();
|
1103 |
-
});
|
1104 |
-
|
1105 |
// push out to window
|
1106 |
window.MediaElementPlayer = mejs.MediaElementPlayer;
|
1107 |
|
@@ -1110,17 +1622,22 @@ if (typeof jQuery != 'undefined') {
|
|
1110 |
(function($) {
|
1111 |
|
1112 |
$.extend(mejs.MepDefaults, {
|
1113 |
-
|
|
|
1114 |
});
|
1115 |
|
|
|
1116 |
// PLAY/pause BUTTON
|
1117 |
$.extend(MediaElementPlayer.prototype, {
|
1118 |
buildplaypause: function(player, controls, layers, media) {
|
1119 |
var
|
1120 |
t = this,
|
1121 |
-
|
|
|
|
|
|
|
1122 |
$('<div class="mejs-button mejs-playpause-button mejs-play" >' +
|
1123 |
-
'<button type="button" aria-controls="' + t.id + '" title="' +
|
1124 |
'</div>')
|
1125 |
.appendTo(controls)
|
1126 |
.click(function(e) {
|
@@ -1133,26 +1650,47 @@ if (typeof jQuery != 'undefined') {
|
|
1133 |
}
|
1134 |
|
1135 |
return false;
|
1136 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1137 |
|
1138 |
media.addEventListener('play',function() {
|
1139 |
-
|
1140 |
}, false);
|
1141 |
media.addEventListener('playing',function() {
|
1142 |
-
|
1143 |
}, false);
|
1144 |
|
1145 |
|
1146 |
media.addEventListener('pause',function() {
|
1147 |
-
|
1148 |
}, false);
|
1149 |
media.addEventListener('paused',function() {
|
1150 |
-
|
1151 |
}, false);
|
1152 |
}
|
1153 |
});
|
1154 |
|
1155 |
})(mejs.$);
|
|
|
1156 |
(function($) {
|
1157 |
|
1158 |
$.extend(mejs.MepDefaults, {
|
@@ -1162,10 +1700,10 @@ if (typeof jQuery != 'undefined') {
|
|
1162 |
// STOP BUTTON
|
1163 |
$.extend(MediaElementPlayer.prototype, {
|
1164 |
buildstop: function(player, controls, layers, media) {
|
1165 |
-
var t = this
|
1166 |
-
|
1167 |
-
|
1168 |
-
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.stopText + '"></button>' +
|
1169 |
'</div>')
|
1170 |
.appendTo(controls)
|
1171 |
.click(function() {
|
@@ -1177,8 +1715,8 @@ if (typeof jQuery != 'undefined') {
|
|
1177 |
media.pause();
|
1178 |
controls.find('.mejs-time-current').width('0px');
|
1179 |
controls.find('.mejs-time-handle').css('left', '0px');
|
1180 |
-
controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0
|
1181 |
-
controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0
|
1182 |
layers.find('.mejs-poster').show();
|
1183 |
}
|
1184 |
});
|
@@ -1186,43 +1724,70 @@ if (typeof jQuery != 'undefined') {
|
|
1186 |
});
|
1187 |
|
1188 |
})(mejs.$);
|
|
|
1189 |
(function($) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1190 |
// progress/loaded bar
|
1191 |
$.extend(MediaElementPlayer.prototype, {
|
1192 |
buildprogress: function(player, controls, layers, media) {
|
1193 |
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
'</span>'+
|
1204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1205 |
'</div>')
|
1206 |
.appendTo(controls);
|
1207 |
-
|
1208 |
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
var
|
1220 |
-
|
1221 |
-
width = total.outerWidth(true),
|
1222 |
percentage = 0,
|
1223 |
newTime = 0,
|
1224 |
-
pos = 0
|
1225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1226 |
|
1227 |
if (media.duration) {
|
1228 |
if (x < offset.left) {
|
@@ -1230,7 +1795,7 @@ if (typeof jQuery != 'undefined') {
|
|
1230 |
} else if (x > width + offset.left) {
|
1231 |
x = width + offset.left;
|
1232 |
}
|
1233 |
-
|
1234 |
pos = x - offset.left;
|
1235 |
percentage = (pos / width);
|
1236 |
newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
|
@@ -1242,49 +1807,135 @@ if (typeof jQuery != 'undefined') {
|
|
1242 |
|
1243 |
// position floating time box
|
1244 |
if (!mejs.MediaFeatures.hasTouch) {
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
}
|
1249 |
}
|
1250 |
},
|
1251 |
-
|
1252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1253 |
|
1254 |
// handle clicks
|
1255 |
//controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
|
1256 |
-
total
|
1257 |
-
.bind('mousedown', function (e) {
|
1258 |
-
// only handle left clicks
|
1259 |
-
if (e.which === 1) {
|
1260 |
mouseIsDown = true;
|
1261 |
handleMouseMove(e);
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
timefloat.hide();
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
}
|
1273 |
})
|
1274 |
.bind('mouseenter', function(e) {
|
1275 |
mouseIsOver = true;
|
1276 |
-
|
1277 |
handleMouseMove(e);
|
1278 |
});
|
1279 |
-
if (!mejs.MediaFeatures.hasTouch) {
|
1280 |
-
timefloat.show();
|
1281 |
}
|
1282 |
})
|
1283 |
.bind('mouseleave',function(e) {
|
1284 |
mouseIsOver = false;
|
1285 |
if (!mouseIsDown) {
|
1286 |
-
|
1287 |
-
timefloat
|
|
|
|
|
1288 |
}
|
1289 |
});
|
1290 |
|
@@ -1298,37 +1949,36 @@ if (typeof jQuery != 'undefined') {
|
|
1298 |
media.addEventListener('timeupdate', function(e) {
|
1299 |
player.setProgressRail(e);
|
1300 |
player.setCurrentRail(e);
|
|
|
1301 |
}, false);
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
t.current = current;
|
1308 |
-
t.handle = handle;
|
1309 |
},
|
1310 |
setProgressRail: function(e) {
|
1311 |
|
1312 |
var
|
1313 |
t = this,
|
1314 |
-
target = (e
|
1315 |
-
percent = null;
|
1316 |
|
1317 |
// newest HTML5 spec has buffered array (FF4, Webkit)
|
1318 |
if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
|
1319 |
-
//
|
1320 |
-
percent = target.buffered.end(
|
1321 |
}
|
1322 |
// Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
|
1323 |
// to be anything other than 0. If the byte count is available we use this instead.
|
1324 |
// Browsers that support the else if do not seem to have the bufferedBytes value and
|
1325 |
// should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
|
1326 |
-
else if (target && target.bytesTotal
|
1327 |
percent = target.bufferedBytes / target.bytesTotal;
|
1328 |
}
|
1329 |
// Firefox 3 with an Ogg file seems to go this way
|
1330 |
-
else if (e && e.lengthComputable && e.total
|
1331 |
-
percent = e.loaded/e.total;
|
1332 |
}
|
1333 |
|
1334 |
// finally update the progress bar
|
@@ -1344,20 +1994,20 @@ if (typeof jQuery != 'undefined') {
|
|
1344 |
|
1345 |
var t = this;
|
1346 |
|
1347 |
-
if (t.media.currentTime
|
1348 |
|
1349 |
// update bar and handle
|
1350 |
if (t.total && t.handle) {
|
1351 |
var
|
1352 |
-
newWidth = t.total.width() * t.media.currentTime / t.media.duration,
|
1353 |
-
handlePos = newWidth - (t.handle.outerWidth(true) / 2);
|
1354 |
|
1355 |
t.current.width(newWidth);
|
1356 |
t.handle.css('left', handlePos);
|
1357 |
}
|
1358 |
}
|
1359 |
|
1360 |
-
}
|
1361 |
});
|
1362 |
})(mejs.$);
|
1363 |
|
@@ -1366,7 +2016,7 @@ if (typeof jQuery != 'undefined') {
|
|
1366 |
// options
|
1367 |
$.extend(mejs.MepDefaults, {
|
1368 |
duration: -1,
|
1369 |
-
timeAndDurationSeparator: '
|
1370 |
});
|
1371 |
|
1372 |
|
@@ -1375,16 +2025,20 @@ if (typeof jQuery != 'undefined') {
|
|
1375 |
buildcurrent: function(player, controls, layers, media) {
|
1376 |
var t = this;
|
1377 |
|
1378 |
-
$('<div class="mejs-time">'+
|
1379 |
-
'<span class="mejs-currenttime">' +
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
|
|
1383 |
|
1384 |
t.currenttime = t.controls.find('.mejs-currenttime');
|
1385 |
|
1386 |
media.addEventListener('timeupdate',function() {
|
1387 |
-
|
|
|
|
|
|
|
1388 |
}, false);
|
1389 |
},
|
1390 |
|
@@ -1395,10 +2049,7 @@ if (typeof jQuery != 'undefined') {
|
|
1395 |
if (controls.children().last().find('.mejs-currenttime').length > 0) {
|
1396 |
$(t.options.timeAndDurationSeparator +
|
1397 |
'<span class="mejs-duration">' +
|
1398 |
-
(t.options.duration
|
1399 |
-
mejs.Utility.secondsToTimeCode(t.options.duration, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25) :
|
1400 |
-
((player.options.alwaysShowHours ? '00:' : '') + (player.options.showTimecodeFrameCount? '00:00:00':'00:00'))
|
1401 |
-
) +
|
1402 |
'</span>')
|
1403 |
.appendTo(controls.find('.mejs-time'));
|
1404 |
} else {
|
@@ -1408,10 +2059,7 @@ if (typeof jQuery != 'undefined') {
|
|
1408 |
|
1409 |
$('<div class="mejs-time mejs-duration-container">'+
|
1410 |
'<span class="mejs-duration">' +
|
1411 |
-
(t.options.duration
|
1412 |
-
mejs.Utility.secondsToTimeCode(t.options.duration, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25) :
|
1413 |
-
((player.options.alwaysShowHours ? '00:' : '') + (player.options.showTimecodeFrameCount? '00:00:00':'00:00'))
|
1414 |
-
) +
|
1415 |
'</span>' +
|
1416 |
'</div>')
|
1417 |
.appendTo(controls);
|
@@ -1420,228 +2068,289 @@ if (typeof jQuery != 'undefined') {
|
|
1420 |
t.durationD = t.controls.find('.mejs-duration');
|
1421 |
|
1422 |
media.addEventListener('timeupdate',function() {
|
1423 |
-
|
|
|
|
|
1424 |
}, false);
|
1425 |
},
|
1426 |
|
1427 |
updateCurrent: function() {
|
1428 |
var t = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
1429 |
|
1430 |
if (t.currenttime) {
|
1431 |
-
t.currenttime.html(mejs.Utility.secondsToTimeCode(
|
1432 |
}
|
1433 |
},
|
1434 |
|
1435 |
-
updateDuration: function() {
|
1436 |
var t = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1437 |
|
1438 |
//Toggle the long video class if the video is longer than an hour.
|
1439 |
-
t.container.toggleClass("mejs-long-video",
|
1440 |
|
1441 |
-
if (t.
|
1442 |
-
t.durationD.html(mejs.Utility.secondsToTimeCode(
|
1443 |
}
|
1444 |
}
|
1445 |
});
|
1446 |
|
1447 |
})(mejs.$);
|
1448 |
-
|
|
|
1449 |
|
1450 |
$.extend(mejs.MepDefaults, {
|
1451 |
-
muteText: '
|
|
|
1452 |
hideVolumeOnTouchDevices: true,
|
1453 |
-
|
1454 |
audioVolume: 'horizontal',
|
1455 |
videoVolume: 'vertical'
|
1456 |
});
|
1457 |
|
1458 |
$.extend(MediaElementPlayer.prototype, {
|
1459 |
-
buildvolume: function(player, controls, layers, media) {
|
1460 |
-
|
1461 |
// Android and iOS don't support volume controls
|
1462 |
-
if (mejs.MediaFeatures.
|
1463 |
return;
|
1464 |
-
|
1465 |
var t = this,
|
1466 |
mode = (t.isVideo) ? t.options.videoVolume : t.options.audioVolume,
|
1467 |
mute = (mode == 'horizontal') ?
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
|
|
|
|
|
|
|
|
1479 |
.appendTo(controls) :
|
1480 |
-
|
1481 |
-
// vertical version
|
1482 |
-
$('<div class="mejs-button mejs-volume-button mejs-mute">'+
|
1483 |
-
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.muteText + '"></button>'+
|
1484 |
-
'<div class="mejs-volume-slider">'+ // outer background
|
1485 |
-
'<div class="mejs-volume-total"></div>'+ // line background
|
1486 |
-
'<div class="mejs-volume-current"></div>'+ // current volume
|
1487 |
-
'<div class="mejs-volume-handle"></div>'+ // handle
|
1488 |
-
'</div>'+
|
1489 |
-
'</div>')
|
1490 |
-
.appendTo(controls),
|
1491 |
-
volumeSlider = t.container.find('.mejs-volume-slider, .mejs-horizontal-volume-slider'),
|
1492 |
-
volumeTotal = t.container.find('.mejs-volume-total, .mejs-horizontal-volume-total'),
|
1493 |
-
volumeCurrent = t.container.find('.mejs-volume-current, .mejs-horizontal-volume-current'),
|
1494 |
-
volumeHandle = t.container.find('.mejs-volume-handle, .mejs-horizontal-volume-handle'),
|
1495 |
|
1496 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1497 |
|
1498 |
-
|
1499 |
-
volumeSlider.show();
|
1500 |
-
positionVolumeHandle(volume, true);
|
1501 |
-
volumeSlider.hide()
|
1502 |
-
return;
|
1503 |
-
}
|
1504 |
-
|
1505 |
-
// correct to 0-1
|
1506 |
-
volume = Math.max(0,volume);
|
1507 |
-
volume = Math.min(volume,1);
|
1508 |
-
|
1509 |
-
// ajust mute button style
|
1510 |
-
if (volume == 0) {
|
1511 |
-
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
1512 |
-
} else {
|
1513 |
-
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
1514 |
-
}
|
1515 |
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
// height of the full size volume slider background
|
1521 |
-
totalHeight = volumeTotal.height(),
|
1522 |
-
|
1523 |
-
// top/left of full size volume slider background
|
1524 |
-
totalPosition = volumeTotal.position(),
|
1525 |
-
|
1526 |
-
// the new top position based on the current volume
|
1527 |
-
// 70% volume on 100px height == top:30px
|
1528 |
-
newTop = totalHeight - (totalHeight * volume);
|
1529 |
-
|
1530 |
-
// handle
|
1531 |
-
volumeHandle.css('top', Math.round(totalPosition.top + newTop - (volumeHandle.height() / 2)));
|
1532 |
-
|
1533 |
-
// show the current visibility
|
1534 |
-
volumeCurrent.height(totalHeight - newTop );
|
1535 |
-
volumeCurrent.css('top', totalPosition.top + newTop);
|
1536 |
-
} else {
|
1537 |
-
var
|
1538 |
-
|
1539 |
-
// height of the full size volume slider background
|
1540 |
-
totalWidth = volumeTotal.width(),
|
1541 |
-
|
1542 |
-
// top/left of full size volume slider background
|
1543 |
-
totalPosition = volumeTotal.position(),
|
1544 |
-
|
1545 |
-
// the new left position based on the current volume
|
1546 |
-
newLeft = totalWidth * volume;
|
1547 |
-
|
1548 |
-
// handle
|
1549 |
-
volumeHandle.css('left', Math.round(totalPosition.left + newLeft - (volumeHandle.width() / 2)));
|
1550 |
-
|
1551 |
-
// rezize the current part of the volume bar
|
1552 |
-
volumeCurrent.width( Math.round(newLeft) );
|
1553 |
-
}
|
1554 |
-
},
|
1555 |
-
handleVolumeMove = function(e) {
|
1556 |
-
|
1557 |
-
var volume = null,
|
1558 |
-
totalOffset = volumeTotal.offset();
|
1559 |
-
|
1560 |
-
// calculate the new volume based on the moust position
|
1561 |
-
if (mode == 'vertical') {
|
1562 |
-
|
1563 |
-
var
|
1564 |
-
railHeight = volumeTotal.height(),
|
1565 |
-
totalTop = parseInt(volumeTotal.css('top').replace(/px/,''),10),
|
1566 |
-
newY = e.pageY - totalOffset.top;
|
1567 |
-
|
1568 |
-
volume = (railHeight - newY) / railHeight;
|
1569 |
-
|
1570 |
-
// the controls just hide themselves (usually when mouse moves too far up)
|
1571 |
-
if (totalOffset.top == 0 || totalOffset.left == 0)
|
1572 |
return;
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1599 |
|
1600 |
// SLIDER
|
1601 |
-
|
1602 |
mute
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1612 |
});
|
1613 |
-
|
|
|
|
|
1614 |
volumeSlider
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
|
|
|
|
1619 |
handleVolumeMove(e);
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
.bind('mouseup.vol', function () {
|
1625 |
-
mouseIsDown = false;
|
1626 |
-
$(document).unbind('.vol');
|
1627 |
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
});
|
1632 |
-
mouseIsDown = true;
|
1633 |
-
|
1634 |
-
return false;
|
1635 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1636 |
|
|
|
|
|
|
|
|
|
|
|
1637 |
|
1638 |
// MUTE button
|
1639 |
-
mute.find('button').click(function() {
|
1640 |
-
media.setMuted(
|
|
|
|
|
|
|
|
|
|
|
1641 |
});
|
1642 |
|
1643 |
// listen for volume change events from other sources
|
1644 |
-
media.addEventListener('volumechange', function(e) {
|
1645 |
if (!mouseIsDown) {
|
1646 |
if (media.muted) {
|
1647 |
positionVolumeHandle(0);
|
@@ -1651,20 +2360,31 @@ if (typeof jQuery != 'undefined') {
|
|
1651 |
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
1652 |
}
|
1653 |
}
|
|
|
1654 |
}, false);
|
1655 |
|
1656 |
-
if
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1665 |
}
|
1666 |
});
|
1667 |
-
|
1668 |
})(mejs.$);
|
1669 |
|
1670 |
(function($) {
|
@@ -1672,7 +2392,7 @@ if (typeof jQuery != 'undefined') {
|
|
1672 |
$.extend(mejs.MepDefaults, {
|
1673 |
usePluginFullScreen: true,
|
1674 |
newWindowCallback: function() { return '';},
|
1675 |
-
fullscreenText:
|
1676 |
});
|
1677 |
|
1678 |
$.extend(MediaElementPlayer.prototype, {
|
@@ -1681,334 +2401,360 @@ if (typeof jQuery != 'undefined') {
|
|
1681 |
|
1682 |
isNativeFullScreen: false,
|
1683 |
|
1684 |
-
docStyleOverflow: null,
|
1685 |
-
|
1686 |
isInIframe: false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1687 |
|
1688 |
buildfullscreen: function(player, controls, layers, media) {
|
1689 |
|
1690 |
if (!player.isVideo)
|
1691 |
return;
|
1692 |
-
|
1693 |
-
player.isInIframe = (window.location != window.parent.location);
|
1694 |
-
|
1695 |
-
//
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
var target = null;
|
1700 |
-
|
1701 |
-
if (mejs.MediaFeatures.hasMozNativeFullScreen) {
|
1702 |
-
target = $(document);
|
1703 |
-
} else {
|
1704 |
-
target = player.container;
|
1705 |
-
}
|
1706 |
-
|
1707 |
-
target.bind(mejs.MediaFeatures.fullScreenEventName, function(e) {
|
1708 |
-
|
1709 |
-
if (mejs.MediaFeatures.isFullScreen()) {
|
1710 |
-
player.isNativeFullScreen = true;
|
1711 |
-
// reset the controls once we are fully in full screen
|
1712 |
-
player.setControlsSize();
|
1713 |
-
} else {
|
1714 |
-
player.isNativeFullScreen = false;
|
1715 |
-
// when a user presses ESC
|
1716 |
-
// make sure to put the player back into place
|
1717 |
-
player.exitFullScreen();
|
1718 |
-
}
|
1719 |
-
});
|
1720 |
-
}
|
1721 |
-
|
1722 |
var t = this,
|
1723 |
-
|
1724 |
-
|
1725 |
-
container = player.container,
|
1726 |
fullscreenBtn =
|
1727 |
$('<div class="mejs-button mejs-fullscreen-button">' +
|
1728 |
-
'<button type="button" aria-controls="' + t.id + '" title="' +
|
1729 |
'</div>')
|
1730 |
-
.appendTo(controls)
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
fullscreenBtn.click(function() {
|
1735 |
var isFullScreen = (mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || player.isFullScreen;
|
1736 |
-
|
1737 |
if (isFullScreen) {
|
1738 |
player.exitFullScreen();
|
1739 |
} else {
|
1740 |
player.enterFullScreen();
|
1741 |
}
|
1742 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1743 |
|
1744 |
-
|
|
|
1745 |
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
documentElement = document.documentElement,
|
1751 |
-
getComputedStyle = window.getComputedStyle,
|
1752 |
-
supports;
|
1753 |
-
if(!('pointerEvents' in element.style)){
|
1754 |
-
return false;
|
1755 |
}
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
documentElement.removeChild(element);
|
1762 |
-
return !!supports;
|
1763 |
-
})();
|
1764 |
-
|
1765 |
-
//console.log('supportsPointerEvents', supportsPointerEvents);
|
1766 |
-
|
1767 |
-
if (supportsPointerEvents && !mejs.MediaFeatures.isOpera) { // opera doesn't allow this :(
|
1768 |
-
|
1769 |
-
// allows clicking through the fullscreen button and controls down directly to Flash
|
1770 |
-
|
1771 |
-
/*
|
1772 |
-
When a user puts his mouse over the fullscreen button, the controls are disabled
|
1773 |
-
So we put a div over the video and another one on iether side of the fullscreen button
|
1774 |
-
that caputre mouse movement
|
1775 |
-
and restore the controls once the mouse moves outside of the fullscreen button
|
1776 |
-
*/
|
1777 |
-
|
1778 |
-
var fullscreenIsDisabled = false,
|
1779 |
-
restoreControls = function() {
|
1780 |
-
if (fullscreenIsDisabled) {
|
1781 |
-
// hide the hovers
|
1782 |
-
videoHoverDiv.hide();
|
1783 |
-
controlsLeftHoverDiv.hide();
|
1784 |
-
controlsRightHoverDiv.hide();
|
1785 |
-
|
1786 |
-
// restore the control bar
|
1787 |
-
fullscreenBtn.css('pointer-events', '');
|
1788 |
-
t.controls.css('pointer-events', '');
|
1789 |
-
|
1790 |
-
// store for later
|
1791 |
-
fullscreenIsDisabled = false;
|
1792 |
-
}
|
1793 |
-
},
|
1794 |
-
videoHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
1795 |
-
controlsLeftHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
1796 |
-
controlsRightHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
1797 |
-
positionHoverDivs = function() {
|
1798 |
-
var style = {position: 'absolute', top: 0, left: 0}; //, backgroundColor: '#f00'};
|
1799 |
-
videoHoverDiv.css(style);
|
1800 |
-
controlsLeftHoverDiv.css(style);
|
1801 |
-
controlsRightHoverDiv.css(style);
|
1802 |
-
|
1803 |
-
// over video, but not controls
|
1804 |
-
videoHoverDiv
|
1805 |
-
.width( t.container.width() )
|
1806 |
-
.height( t.container.height() - t.controls.height() );
|
1807 |
-
|
1808 |
-
// over controls, but not the fullscreen button
|
1809 |
-
var fullScreenBtnOffset = fullscreenBtn.offset().left - t.container.offset().left;
|
1810 |
-
fullScreenBtnWidth = fullscreenBtn.outerWidth(true);
|
1811 |
-
|
1812 |
-
controlsLeftHoverDiv
|
1813 |
-
.width( fullScreenBtnOffset )
|
1814 |
-
.height( t.controls.height() )
|
1815 |
-
.css({top: t.container.height() - t.controls.height()});
|
1816 |
-
|
1817 |
-
// after the fullscreen button
|
1818 |
-
controlsRightHoverDiv
|
1819 |
-
.width( t.container.width() - fullScreenBtnOffset - fullScreenBtnWidth )
|
1820 |
-
.height( t.controls.height() )
|
1821 |
-
.css({top: t.container.height() - t.controls.height(),
|
1822 |
-
left: fullScreenBtnOffset + fullScreenBtnWidth});
|
1823 |
-
};
|
1824 |
|
1825 |
-
|
1826 |
-
positionHoverDivs();
|
1827 |
-
});
|
1828 |
|
1829 |
-
|
1830 |
-
fullscreenBtn
|
1831 |
-
.mouseover(function() {
|
1832 |
|
1833 |
-
|
1834 |
|
1835 |
-
|
1836 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1837 |
|
1838 |
-
|
1839 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1840 |
|
1841 |
-
|
1842 |
-
|
1843 |
-
t.controls.css('pointer-events', 'none');
|
1844 |
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1850 |
|
1851 |
-
|
1852 |
-
}
|
1853 |
|
1854 |
-
|
|
|
|
|
|
|
|
|
1855 |
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
|
|
|
|
|
|
1860 |
|
|
|
|
|
|
|
1861 |
|
1862 |
-
//
|
1863 |
-
|
1864 |
-
/*
|
1865 |
-
$(document).mousemove(function(e) {
|
1866 |
|
1867 |
-
|
1868 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1869 |
|
1870 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1871 |
|
|
|
|
|
|
|
1872 |
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
|
1877 |
-
|
1878 |
-
|
1879 |
|
1880 |
-
|
1881 |
-
}
|
1882 |
-
}
|
1883 |
-
});
|
1884 |
-
*/
|
1885 |
|
|
|
|
|
1886 |
|
1887 |
-
|
|
|
1888 |
|
1889 |
-
|
|
|
|
|
1890 |
|
1891 |
-
|
1892 |
-
|
1893 |
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
|
1899 |
-
|
1900 |
-
containerPos = player.container.offset();
|
1901 |
|
1902 |
-
|
|
|
1903 |
|
1904 |
-
|
1905 |
-
.mouseout(function() {
|
1906 |
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1911 |
|
1912 |
-
hideTimeout = setTimeout(function() {
|
1913 |
-
media.hideFullscreenButton();
|
1914 |
-
}, 1500);
|
1915 |
|
|
|
|
|
1916 |
|
1917 |
-
|
1918 |
-
}
|
1919 |
-
}
|
1920 |
|
1921 |
-
|
|
|
1922 |
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1926 |
}
|
1927 |
});
|
1928 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1929 |
},
|
|
|
|
|
|
|
1930 |
enterFullScreen: function() {
|
1931 |
|
1932 |
var t = this;
|
1933 |
|
1934 |
-
|
1935 |
-
|
1936 |
-
//t.media.setFullscreen(true);
|
1937 |
-
//player.isFullScreen = true;
|
1938 |
return;
|
1939 |
}
|
1940 |
|
1941 |
-
// store overflow
|
1942 |
-
docStyleOverflow = document.documentElement.style.overflow;
|
1943 |
// set it to not show scroll bars so 100% will work
|
1944 |
-
|
1945 |
|
1946 |
// store sizing
|
1947 |
-
normalHeight = t.container.height();
|
1948 |
-
normalWidth = t.container.width();
|
1949 |
-
|
1950 |
-
// attempt to do true fullscreen (Safari 5.1 and Firefox Nightly only for now)
|
1951 |
-
if (t.media.pluginType === 'native') {
|
1952 |
-
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
1953 |
-
|
1954 |
-
mejs.MediaFeatures.requestFullScreen(t.container[0]);
|
1955 |
-
//return;
|
1956 |
-
|
1957 |
-
if (t.isInIframe) {
|
1958 |
-
// sometimes exiting from fullscreen doesn't work
|
1959 |
-
// notably in Chrome <iframe>. Fixed in version 17
|
1960 |
-
setTimeout(function checkFullscreen() {
|
1961 |
-
|
1962 |
-
if (t.isNativeFullScreen) {
|
1963 |
-
|
1964 |
-
// check if the video is suddenly not really fullscreen
|
1965 |
-
if ($(window).width() !== screen.width) {
|
1966 |
-
// manually exit
|
1967 |
-
t.exitFullScreen();
|
1968 |
-
} else {
|
1969 |
-
// test again
|
1970 |
-
setTimeout(checkFullscreen, 500);
|
1971 |
-
}
|
1972 |
-
}
|
1973 |
|
1974 |
|
1975 |
-
}, 500);
|
1976 |
-
}
|
1977 |
|
1978 |
-
|
1979 |
-
|
1980 |
-
return;
|
1981 |
-
}
|
1982 |
-
}
|
1983 |
|
1984 |
-
|
1985 |
-
|
1986 |
-
var url = t.options.newWindowCallback(this);
|
1987 |
|
|
|
|
|
|
|
|
|
1988 |
|
1989 |
-
|
|
|
|
|
|
|
|
|
|
|
1990 |
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
if (!t.isNativeFullScreen) {
|
1999 |
-
t.pause();
|
2000 |
-
window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
|
2001 |
}
|
2002 |
-
}
|
2003 |
-
|
|
|
2004 |
}
|
2005 |
-
|
2006 |
-
}
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
// make full size
|
2013 |
t.container
|
2014 |
.addClass('mejs-container-fullscreen')
|
@@ -2019,24 +2765,28 @@ if (typeof jQuery != 'undefined') {
|
|
2019 |
// Only needed for safari 5.1 native full screen, can cause display issues elsewhere
|
2020 |
// Actually, it seems to be needed for IE8, too
|
2021 |
//if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
2022 |
-
setTimeout(function() {
|
2023 |
t.container.css({width: '100%', height: '100%'});
|
2024 |
t.setControlsSize();
|
2025 |
}, 500);
|
2026 |
//}
|
2027 |
|
2028 |
-
if (t.pluginType === 'native') {
|
2029 |
t.$media
|
2030 |
.width('100%')
|
2031 |
.height('100%');
|
2032 |
} else {
|
2033 |
-
t.container.find('
|
2034 |
.width('100%')
|
2035 |
-
.height('100%');
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
|
|
|
|
|
|
|
|
2040 |
}
|
2041 |
|
2042 |
t.layers.children('div')
|
@@ -2051,55 +2801,193 @@ if (typeof jQuery != 'undefined') {
|
|
2051 |
|
2052 |
t.setControlsSize();
|
2053 |
t.isFullScreen = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2054 |
},
|
2055 |
|
2056 |
exitFullScreen: function() {
|
2057 |
|
2058 |
var t = this;
|
2059 |
|
|
|
|
|
|
|
2060 |
// firefox can't adjust plugins
|
|
|
2061 |
if (t.media.pluginType !== 'native' && mejs.MediaFeatures.isFirefox) {
|
2062 |
t.media.setFullscreen(false);
|
2063 |
//player.isFullScreen = false;
|
2064 |
return;
|
2065 |
}
|
|
|
2066 |
|
2067 |
-
// come
|
2068 |
if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || t.isFullScreen)) {
|
2069 |
mejs.MediaFeatures.cancelFullScreen();
|
2070 |
}
|
2071 |
|
2072 |
// restore scroll bars to document
|
2073 |
-
|
2074 |
|
2075 |
t.container
|
2076 |
.removeClass('mejs-container-fullscreen')
|
2077 |
-
.width(normalWidth)
|
2078 |
-
.height(normalHeight);
|
2079 |
-
//.css({position: '', left: '', top: '', right: '', bottom: '', overflow: 'inherit', width: normalWidth + 'px', height: normalHeight + 'px', 'z-index': 1});
|
2080 |
|
2081 |
-
if (t.pluginType === 'native') {
|
2082 |
t.$media
|
2083 |
-
.width(normalWidth)
|
2084 |
-
.height(normalHeight);
|
2085 |
} else {
|
2086 |
-
t.container.find('
|
2087 |
-
.width(normalWidth)
|
2088 |
-
.height(normalHeight);
|
2089 |
|
2090 |
-
t.media.setVideoSize(normalWidth, normalHeight);
|
2091 |
}
|
2092 |
|
2093 |
-
t.layers.children('div')
|
2094 |
-
.width(normalWidth)
|
2095 |
-
.height(normalHeight);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2096 |
|
2097 |
-
|
2098 |
-
.removeClass('mejs-unfullscreen')
|
2099 |
-
.addClass('mejs-fullscreen');
|
2100 |
|
2101 |
-
|
2102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2103 |
}
|
2104 |
});
|
2105 |
|
@@ -2107,75 +2995,115 @@ if (typeof jQuery != 'undefined') {
|
|
2107 |
|
2108 |
(function($) {
|
2109 |
|
2110 |
-
// add extra default options
|
2111 |
$.extend(mejs.MepDefaults, {
|
2112 |
// this will automatically turn on a <track>
|
2113 |
startLanguage: '',
|
2114 |
-
|
2115 |
-
tracksText: '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2116 |
});
|
2117 |
|
2118 |
$.extend(MediaElementPlayer.prototype, {
|
2119 |
-
|
2120 |
hasChapters: false,
|
2121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2122 |
buildtracks: function(player, controls, layers, media) {
|
2123 |
-
if (
|
2124 |
-
return;
|
2125 |
-
|
2126 |
-
if (player.tracks.length == 0)
|
2127 |
return;
|
2128 |
|
2129 |
-
var t= this,
|
|
|
|
|
|
|
|
|
|
|
2130 |
|
2131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2132 |
$('<div class="mejs-chapters mejs-layer"></div>')
|
2133 |
.prependTo(layers).hide();
|
2134 |
-
player.captions =
|
2135 |
-
$('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position
|
|
|
2136 |
.prependTo(layers).hide();
|
2137 |
player.captionsText = player.captions.find('.mejs-captions-text');
|
2138 |
-
player.captionsButton =
|
2139 |
$('<div class="mejs-button mejs-captions-button">'+
|
2140 |
-
'<button type="button" aria-controls="' + t.id + '" title="' +
|
2141 |
'<div class="mejs-captions-selector">'+
|
2142 |
'<ul>'+
|
2143 |
'<li>'+
|
2144 |
'<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
|
2145 |
-
'<label for="' + player.id + '_captions_none">
|
2146 |
'</li>' +
|
2147 |
'</ul>'+
|
2148 |
'</div>'+
|
2149 |
'</div>')
|
2150 |
-
.appendTo(controls)
|
2151 |
-
|
2152 |
-
// hover
|
2153 |
-
.hover(function() {
|
2154 |
-
$(this).find('.mejs-captions-selector').css('visibility','visible');
|
2155 |
-
}, function() {
|
2156 |
-
$(this).find('.mejs-captions-selector').css('visibility','hidden');
|
2157 |
-
})
|
2158 |
-
|
2159 |
-
// handle clicks to the language radio buttons
|
2160 |
-
.delegate('input[type=radio]','click',function() {
|
2161 |
-
lang = this.value;
|
2162 |
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2179 |
|
2180 |
if (!player.options.alwaysShowControls) {
|
2181 |
// move with controls
|
@@ -2199,23 +3127,31 @@ if (typeof jQuery != 'undefined') {
|
|
2199 |
player.selectedTrack = null;
|
2200 |
player.isLoadingTrack = false;
|
2201 |
|
2202 |
-
|
2203 |
-
|
2204 |
// add to list
|
2205 |
for (i=0; i<player.tracks.length; i++) {
|
2206 |
-
|
|
|
2207 |
player.addTrackButton(player.tracks[i].srclang, player.tracks[i].label);
|
2208 |
}
|
2209 |
}
|
2210 |
|
|
|
2211 |
player.loadNextTrack();
|
2212 |
|
2213 |
-
|
2214 |
-
media.addEventListener('timeupdate',function(e) {
|
2215 |
player.displayCaptions();
|
2216 |
}, false);
|
2217 |
|
2218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2219 |
player.displayChapters();
|
2220 |
}, false);
|
2221 |
|
@@ -2223,22 +3159,48 @@ if (typeof jQuery != 'undefined') {
|
|
2223 |
function () {
|
2224 |
// chapters
|
2225 |
if (player.hasChapters) {
|
2226 |
-
player.chapters.
|
2227 |
player.chapters.fadeIn(200).height(player.chapters.find('.mejs-chapter').outerHeight());
|
2228 |
}
|
2229 |
},
|
2230 |
function () {
|
2231 |
if (player.hasChapters && !media.paused) {
|
2232 |
player.chapters.fadeOut(200, function() {
|
2233 |
-
$(this).
|
2234 |
$(this).css('display','block');
|
2235 |
});
|
2236 |
}
|
2237 |
});
|
2238 |
-
|
|
|
|
|
|
|
|
|
2239 |
// check for autoplay
|
2240 |
if (player.node.getAttribute('autoplay') !== null) {
|
2241 |
-
player.chapters.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2242 |
}
|
2243 |
},
|
2244 |
|
@@ -2252,6 +3214,8 @@ if (typeof jQuery != 'undefined') {
|
|
2252 |
} else {
|
2253 |
// add done?
|
2254 |
t.isLoadingTrack = false;
|
|
|
|
|
2255 |
}
|
2256 |
},
|
2257 |
|
@@ -2263,8 +3227,6 @@ if (typeof jQuery != 'undefined') {
|
|
2263 |
|
2264 |
track.isLoaded = true;
|
2265 |
|
2266 |
-
// create button
|
2267 |
-
//t.addTrackButton(track.srclang);
|
2268 |
t.enableTrackButton(track.srclang, track.label);
|
2269 |
|
2270 |
t.loadNextTrack();
|
@@ -2272,40 +3234,47 @@ if (typeof jQuery != 'undefined') {
|
|
2272 |
};
|
2273 |
|
2274 |
|
2275 |
-
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
|
|
2279 |
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
|
2286 |
-
|
2287 |
-
after();
|
2288 |
|
2289 |
-
|
2290 |
-
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2295 |
}
|
2296 |
-
}
|
2297 |
-
|
2298 |
-
t.loadNextTrack();
|
2299 |
-
}
|
2300 |
-
});
|
2301 |
},
|
2302 |
|
2303 |
enableTrackButton: function(lang, label) {
|
2304 |
var t = this;
|
2305 |
-
|
2306 |
if (label === '') {
|
2307 |
label = mejs.language.codes[lang] || lang;
|
2308 |
-
}
|
2309 |
|
2310 |
t.captionsButton
|
2311 |
.find('input[value=' + lang + ']')
|
@@ -2315,12 +3284,20 @@ if (typeof jQuery != 'undefined') {
|
|
2315 |
|
2316 |
// auto select
|
2317 |
if (t.options.startLanguage == lang) {
|
2318 |
-
$('#' + t.id + '_captions_' + lang).
|
2319 |
}
|
2320 |
|
2321 |
t.adjustLanguageBox();
|
2322 |
},
|
2323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2324 |
addTrackButton: function(lang, label) {
|
2325 |
var t = this;
|
2326 |
if (label === '') {
|
@@ -2349,6 +3326,28 @@ if (typeof jQuery != 'undefined') {
|
|
2349 |
);
|
2350 |
},
|
2351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2352 |
displayCaptions: function() {
|
2353 |
|
2354 |
if (typeof this.tracks == 'undefined')
|
@@ -2359,10 +3358,11 @@ if (typeof jQuery != 'undefined') {
|
|
2359 |
i,
|
2360 |
track = t.selectedTrack;
|
2361 |
|
2362 |
-
if (track
|
2363 |
for (i=0; i<track.entries.times.length; i++) {
|
2364 |
-
if (t.media.currentTime >= track.entries.times[i].start && t.media.currentTime <= track.entries.times[i].stop){
|
2365 |
-
|
|
|
2366 |
t.captions.show().height(0);
|
2367 |
return; // exit out if one is visible;
|
2368 |
}
|
@@ -2373,8 +3373,72 @@ if (typeof jQuery != 'undefined') {
|
|
2373 |
}
|
2374 |
},
|
2375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2376 |
displayChapters: function() {
|
2377 |
-
var
|
2378 |
t = this,
|
2379 |
i;
|
2380 |
|
@@ -2388,7 +3452,7 @@ if (typeof jQuery != 'undefined') {
|
|
2388 |
},
|
2389 |
|
2390 |
drawChapters: function(chapters) {
|
2391 |
-
var
|
2392 |
t = this,
|
2393 |
i,
|
2394 |
dur,
|
@@ -2414,10 +3478,10 @@ if (typeof jQuery != 'undefined') {
|
|
2414 |
//}
|
2415 |
|
2416 |
t.chapters.append( $(
|
2417 |
-
'<div class="mejs-chapter" rel="' + chapters.entries.times[i].start + '" style="left: ' + usedPercent.toString() + '%;width: ' + percent.toString() + '%;">' +
|
2418 |
-
'<div class="mejs-chapter-block' + ((i==chapters.entries.times.length-1) ? ' mejs-chapter-block-last' : '') + '">' +
|
2419 |
-
'<span class="ch-title">' + chapters.entries.text[i] + '</span>' +
|
2420 |
-
'<span class="ch-time">' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].start) + '–' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].stop) + '</span>' +
|
2421 |
'</div>' +
|
2422 |
'</div>'));
|
2423 |
usedPercent += percent;
|
@@ -2426,7 +3490,7 @@ if (typeof jQuery != 'undefined') {
|
|
2426 |
t.chapters.find('div.mejs-chapter').click(function() {
|
2427 |
t.media.setCurrentTime( parseFloat( $(this).attr('rel') ) );
|
2428 |
if (t.media.paused) {
|
2429 |
-
t.media.play();
|
2430 |
}
|
2431 |
});
|
2432 |
|
@@ -2453,7 +3517,7 @@ if (typeof jQuery != 'undefined') {
|
|
2453 |
nl:'Dutch',
|
2454 |
en:'English',
|
2455 |
et:'Estonian',
|
2456 |
-
|
2457 |
fi:'Finnish',
|
2458 |
fr:'French',
|
2459 |
gl:'Galician',
|
@@ -2478,7 +3542,7 @@ if (typeof jQuery != 'undefined') {
|
|
2478 |
fa:'Persian',
|
2479 |
pl:'Polish',
|
2480 |
pt:'Portuguese',
|
2481 |
-
//'pt-pt':'Portuguese (Portugal)',
|
2482 |
ro:'Romanian',
|
2483 |
ru:'Russian',
|
2484 |
sr:'Serbian',
|
@@ -2498,10 +3562,10 @@ if (typeof jQuery != 'undefined') {
|
|
2498 |
};
|
2499 |
|
2500 |
/*
|
2501 |
-
Parses
|
2502 |
================================
|
2503 |
WEBVTT
|
2504 |
-
|
2505 |
1
|
2506 |
00:00:01,1 --> 00:00:05,000
|
2507 |
A line of text
|
@@ -2509,51 +3573,50 @@ if (typeof jQuery != 'undefined') {
|
|
2509 |
2
|
2510 |
00:01:15,1 --> 00:02:05,000
|
2511 |
A second line of text
|
2512 |
-
|
2513 |
===============================
|
2514 |
|
2515 |
Adapted from: http://www.delphiki.com/html5/playr
|
2516 |
*/
|
2517 |
mejs.TrackFormatParser = {
|
2518 |
-
|
2519 |
-
|
2520 |
-
pattern_identifier: /^([a-zA-z]+-)?[0-9]+$/,
|
2521 |
-
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})?)(.*)$/,
|
2522 |
|
2523 |
parse: function(trackText) {
|
2524 |
-
var
|
2525 |
i = 0,
|
2526 |
lines = mejs.TrackFormatParser.split2(trackText, /\r?\n/),
|
2527 |
entries = {text:[], times:[]},
|
2528 |
timecode,
|
2529 |
-
text
|
|
|
2530 |
for(; i<lines.length; i++) {
|
2531 |
-
|
2532 |
-
if (this.pattern_identifier.exec(lines[i])){
|
2533 |
-
// skip to the next line where the start --> end time code should be
|
2534 |
-
i++;
|
2535 |
-
timecode = this.pattern_timecode.exec(lines[i]);
|
2536 |
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
2540 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2541 |
i++;
|
2542 |
-
while(lines[i] !== '' && i<lines.length){
|
2543 |
-
text = text + '\n' + lines[i];
|
2544 |
-
i++;
|
2545 |
-
}
|
2546 |
-
text = $.trim(text).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
|
2547 |
-
// Text is in a different array so I can use .join
|
2548 |
-
entries.text.push(text);
|
2549 |
-
entries.times.push(
|
2550 |
-
{
|
2551 |
-
start: (mejs.Utility.convertSMPTEtoSeconds(timecode[1]) == 0) ? 0.200 : mejs.Utility.convertSMPTEtoSeconds(timecode[1]),
|
2552 |
-
stop: mejs.Utility.convertSMPTEtoSeconds(timecode[3]),
|
2553 |
-
settings: timecode[5]
|
2554 |
-
});
|
2555 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2556 |
}
|
|
|
2557 |
}
|
2558 |
return entries;
|
2559 |
}
|
@@ -2562,14 +3625,12 @@ if (typeof jQuery != 'undefined') {
|
|
2562 |
dfxp: {
|
2563 |
parse: function(trackText) {
|
2564 |
trackText = $(trackText).filter("tt");
|
2565 |
-
var
|
2566 |
i = 0,
|
2567 |
container = trackText.children("div").eq(0),
|
2568 |
lines = container.find("p"),
|
2569 |
styleNode = trackText.find("#" + container.attr("style")),
|
2570 |
styles,
|
2571 |
-
begin,
|
2572 |
-
end,
|
2573 |
text,
|
2574 |
entries = {text:[], times:[]};
|
2575 |
|
@@ -2598,15 +3659,14 @@ if (typeof jQuery != 'undefined') {
|
|
2598 |
if (styles) {
|
2599 |
style = "";
|
2600 |
for (var _style in styles) {
|
2601 |
-
style += _style + ":" + styles[_style] + ";";
|
2602 |
}
|
2603 |
}
|
2604 |
if (style) _temp_times.style = style;
|
2605 |
-
if (_temp_times.start
|
2606 |
entries.times.push(_temp_times);
|
2607 |
text = $.trim(lines.eq(i).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
|
2608 |
entries.text.push(text);
|
2609 |
-
if (entries.times.start == 0) entries.times.start = 2;
|
2610 |
}
|
2611 |
return entries;
|
2612 |
}
|
@@ -2617,13 +3677,13 @@ if (typeof jQuery != 'undefined') {
|
|
2617 |
return text.split(regex);
|
2618 |
}
|
2619 |
};
|
2620 |
-
|
2621 |
// test for browsers with bad String.split method.
|
2622 |
if ('x\n\ny'.split(/\n/gi).length != 3) {
|
2623 |
// add super slow IE8 and below version
|
2624 |
mejs.TrackFormatParser.split2 = function(text, regex) {
|
2625 |
-
var
|
2626 |
-
parts = [],
|
2627 |
chunk = '',
|
2628 |
i;
|
2629 |
|
@@ -2636,8 +3696,179 @@ if (typeof jQuery != 'undefined') {
|
|
2636 |
}
|
2637 |
parts.push(chunk);
|
2638 |
return parts;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2639 |
}
|
2640 |
-
}
|
2641 |
|
2642 |
})(mejs.$);
|
2643 |
|
@@ -2660,9 +3891,9 @@ $.extend(mejs.MepDefaults,
|
|
2660 |
return null;
|
2661 |
|
2662 |
if (player.isFullScreen) {
|
2663 |
-
return
|
2664 |
} else {
|
2665 |
-
return
|
2666 |
}
|
2667 |
},
|
2668 |
click: function(player) {
|
@@ -2678,9 +3909,9 @@ $.extend(mejs.MepDefaults,
|
|
2678 |
{
|
2679 |
render: function(player) {
|
2680 |
if (player.media.muted) {
|
2681 |
-
return
|
2682 |
} else {
|
2683 |
-
return
|
2684 |
}
|
2685 |
},
|
2686 |
click: function(player) {
|
@@ -2699,7 +3930,7 @@ $.extend(mejs.MepDefaults,
|
|
2699 |
// demo of simple download video
|
2700 |
{
|
2701 |
render: function(player) {
|
2702 |
-
return
|
2703 |
},
|
2704 |
click: function(player) {
|
2705 |
window.location.href = player.media.currentSrc;
|
@@ -2730,11 +3961,15 @@ $.extend(mejs.MepDefaults,
|
|
2730 |
});
|
2731 |
player.contextMenu.bind('mouseleave', function() {
|
2732 |
|
2733 |
-
//
|
2734 |
player.startContextMenuTimer();
|
2735 |
|
2736 |
});
|
2737 |
},
|
|
|
|
|
|
|
|
|
2738 |
|
2739 |
isContextMenuEnabled: true,
|
2740 |
enableContextMenu: function() {
|
@@ -2746,7 +3981,7 @@ $.extend(mejs.MepDefaults,
|
|
2746 |
|
2747 |
contextMenuTimeout: null,
|
2748 |
startContextMenuTimer: function() {
|
2749 |
-
//
|
2750 |
|
2751 |
var t = this;
|
2752 |
|
@@ -2760,7 +3995,7 @@ $.extend(mejs.MepDefaults,
|
|
2760 |
killContextMenuTimer: function() {
|
2761 |
var timer = this.contextMenuTimer;
|
2762 |
|
2763 |
-
//
|
2764 |
|
2765 |
if (timer != null) {
|
2766 |
clearTimeout(timer);
|
@@ -2834,13 +4069,45 @@ $.extend(mejs.MepDefaults,
|
|
2834 |
});
|
2835 |
|
2836 |
})(mejs.$);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2837 |
/**
|
2838 |
* Postroll plugin
|
2839 |
*/
|
2840 |
(function($) {
|
2841 |
|
2842 |
$.extend(mejs.MepDefaults, {
|
2843 |
-
postrollCloseText:
|
2844 |
});
|
2845 |
|
2846 |
// Postroll
|
@@ -2848,11 +4115,12 @@ $.extend(mejs.MepDefaults,
|
|
2848 |
buildpostroll: function(player, controls, layers, media) {
|
2849 |
var
|
2850 |
t = this,
|
|
|
2851 |
postrollLink = t.container.find('link[rel="postroll"]').attr('href');
|
2852 |
|
2853 |
if (typeof postrollLink !== 'undefined') {
|
2854 |
player.postroll =
|
2855 |
-
$('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">' +
|
2856 |
|
2857 |
t.media.addEventListener('ended', function (e) {
|
2858 |
$.ajax({
|
@@ -2869,3 +4137,77 @@ $.extend(mejs.MepDefaults,
|
|
2869 |
});
|
2870 |
|
2871 |
})(mejs.$);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/*!
|
2 |
+
*
|
3 |
* MediaElementPlayer
|
4 |
* http://mediaelementjs.com/
|
5 |
*
|
6 |
* Creates a controller bar for HTML5 <video> add <audio> tags
|
7 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
8 |
*
|
9 |
+
* Copyright 2010-2013, John Dyer (http://j.hn/)
|
10 |
* License: MIT
|
11 |
*
|
12 |
*/
|
13 |
if (typeof jQuery != 'undefined') {
|
14 |
mejs.$ = jQuery;
|
15 |
+
} else if (typeof Zepto != 'undefined') {
|
16 |
+
mejs.$ = Zepto;
|
17 |
+
|
18 |
+
// define `outerWidth` method which has not been realized in Zepto
|
19 |
+
Zepto.fn.outerWidth = function(includeMargin) {
|
20 |
+
var width = $(this).width();
|
21 |
+
if (includeMargin) {
|
22 |
+
width += parseInt($(this).css('margin-right'), 10);
|
23 |
+
width += parseInt($(this).css('margin-left'), 10);
|
24 |
+
}
|
25 |
+
return width
|
26 |
+
}
|
27 |
+
|
28 |
} else if (typeof ender != 'undefined') {
|
29 |
mejs.$ = ender;
|
30 |
}
|
34 |
mejs.MepDefaults = {
|
35 |
// url to poster (to fix iOS 3.x)
|
36 |
poster: '',
|
37 |
+
// When the video is ended, we can show the poster.
|
38 |
+
showPosterWhenEnded: false,
|
39 |
// default if the <video width> is not specified
|
40 |
defaultVideoWidth: 480,
|
41 |
// default if the <video height> is not specified
|
48 |
defaultAudioWidth: 400,
|
49 |
// default if the user doesn't specify
|
50 |
defaultAudioHeight: 30,
|
51 |
+
// default amount to move back when back key is pressed
|
|
|
52 |
defaultSeekBackwardInterval: function(media) {
|
53 |
return (media.duration * 0.05);
|
54 |
+
},
|
55 |
+
// default amount to move forward when forward key is pressed
|
56 |
defaultSeekForwardInterval: function(media) {
|
57 |
return (media.duration * 0.05);
|
58 |
+
},
|
59 |
+
// set dimensions via JS instead of CSS
|
60 |
+
setDimensions: true,
|
61 |
// width of audio player
|
62 |
audioWidth: -1,
|
63 |
// height of audio player
|
64 |
+
audioHeight: -1,
|
65 |
// initial volume when the player starts (overrided by user cookie)
|
66 |
startVolume: 0.8,
|
67 |
// useful for <audio> player loops
|
68 |
loop: false,
|
69 |
// rewind to beginning when media ends
|
70 |
+
autoRewind: true,
|
71 |
// resize to media dimensions
|
72 |
enableAutosize: true,
|
73 |
+
/*
|
74 |
+
* Time format to use. Default: 'mm:ss'
|
75 |
+
* Supported units:
|
76 |
+
* h: hour
|
77 |
+
* m: minute
|
78 |
+
* s: second
|
79 |
+
* f: frame count
|
80 |
+
* When using 'hh', 'mm', 'ss' or 'ff' we always display 2 digits.
|
81 |
+
* If you use 'h', 'm', 's' or 'f' we display 1 digit if possible.
|
82 |
+
*
|
83 |
+
* Example to display 75 seconds:
|
84 |
+
* Format 'mm:ss': 01:15
|
85 |
+
* Format 'm:ss': 1:15
|
86 |
+
* Format 'm:s': 1:15
|
87 |
+
*/
|
88 |
+
timeFormat: '',
|
89 |
// forces the hour marker (##:00:00)
|
90 |
alwaysShowHours: false,
|
|
|
91 |
// show framecount in timecode (##:00:00:00)
|
92 |
showTimecodeFrameCount: false,
|
93 |
// used when showTimecodeFrameCount is set to true
|
94 |
framesPerSecond: 25,
|
|
|
95 |
// automatically calculate the width of the progress bar based on the sizes of other elements
|
96 |
autosizeProgress : true,
|
97 |
// Hide controls when playing and mouse is not over the video
|
98 |
alwaysShowControls: false,
|
99 |
+
// Display the video control
|
100 |
+
hideVideoControlsOnLoad: false,
|
101 |
+
// Enable click video element to toggle play/pause
|
102 |
+
clickToPlayPause: true,
|
103 |
+
// Time in ms to hide controls
|
104 |
+
controlsTimeoutDefault: 1500,
|
105 |
+
// Time in ms to trigger the timer when mouse moves
|
106 |
+
controlsTimeoutMouseEnter: 2500,
|
107 |
+
// Time in ms to trigger the timer when mouse leaves
|
108 |
+
controlsTimeoutMouseLeave: 1000,
|
109 |
// force iPad's native controls
|
110 |
iPadUseNativeControls: false,
|
111 |
// force iPhone's native controls
|
112 |
+
iPhoneUseNativeControls: false,
|
113 |
// force Android's native controls
|
114 |
+
AndroidUseNativeControls: false,
|
115 |
// features to show
|
116 |
features: ['playpause','current','progress','duration','tracks','volume','fullscreen'],
|
117 |
// only for dynamic
|
118 |
isVideo: true,
|
119 |
+
// stretching modes (auto, fill, responsive, none)
|
120 |
+
stretching: 'auto',
|
121 |
// turns keyboard support on and off for this instance
|
122 |
enableKeyboard: true,
|
123 |
+
// when this player starts, it will pause other players
|
|
|
124 |
pauseOtherPlayers: true,
|
|
|
125 |
// array of keyboard actions such as play pause
|
126 |
keyActions: [
|
127 |
{
|
128 |
keys: [
|
129 |
32, // SPACE
|
130 |
179 // GOOGLE play/pause button
|
131 |
+
],
|
132 |
+
action: function(player, media, key, event) {
|
133 |
+
|
134 |
+
if (!mejs.MediaFeatures.isFirefox) {
|
135 |
if (media.paused || media.ended) {
|
136 |
+
media.play();
|
137 |
} else {
|
138 |
+
media.pause();
|
139 |
+
}
|
140 |
+
}
|
141 |
}
|
142 |
},
|
143 |
{
|
144 |
keys: [38], // UP
|
145 |
+
action: function(player, media, key, event) {
|
146 |
+
player.container.find('.mejs-volume-slider').css('display','block');
|
147 |
+
if (player.isVideo) {
|
148 |
+
player.showControls();
|
149 |
+
player.startControlsTimer();
|
150 |
+
}
|
151 |
+
|
152 |
var newVolume = Math.min(media.volume + 0.1, 1);
|
153 |
media.setVolume(newVolume);
|
154 |
}
|
155 |
},
|
156 |
{
|
157 |
keys: [40], // DOWN
|
158 |
+
action: function(player, media, key, event) {
|
159 |
+
player.container.find('.mejs-volume-slider').css('display','block');
|
160 |
+
if (player.isVideo) {
|
161 |
+
player.showControls();
|
162 |
+
player.startControlsTimer();
|
163 |
+
}
|
164 |
+
|
165 |
var newVolume = Math.max(media.volume - 0.1, 0);
|
166 |
media.setVolume(newVolume);
|
167 |
}
|
171 |
37, // LEFT
|
172 |
227 // Google TV rewind
|
173 |
],
|
174 |
+
action: function(player, media, key, event) {
|
175 |
if (!isNaN(media.duration) && media.duration > 0) {
|
176 |
if (player.isVideo) {
|
177 |
player.showControls();
|
178 |
player.startControlsTimer();
|
179 |
}
|
180 |
+
|
181 |
// 5%
|
182 |
var newTime = Math.max(media.currentTime - player.options.defaultSeekBackwardInterval(media), 0);
|
183 |
media.setCurrentTime(newTime);
|
188 |
keys: [
|
189 |
39, // RIGHT
|
190 |
228 // Google TV forward
|
191 |
+
],
|
192 |
+
action: function(player, media, key, event) {
|
193 |
if (!isNaN(media.duration) && media.duration > 0) {
|
194 |
if (player.isVideo) {
|
195 |
player.showControls();
|
196 |
player.startControlsTimer();
|
197 |
}
|
198 |
+
|
199 |
// 5%
|
200 |
+
var newTime = Math.min(media.currentTime + player.options.defaultSeekForwardInterval(media), media.duration);
|
201 |
media.setCurrentTime(newTime);
|
202 |
}
|
203 |
}
|
204 |
},
|
205 |
{
|
206 |
+
keys: [70], // F
|
207 |
+
action: function(player, media, key, event) {
|
208 |
if (typeof player.enterFullScreen != 'undefined') {
|
209 |
if (player.isFullScreen) {
|
210 |
player.exitFullScreen();
|
213 |
}
|
214 |
}
|
215 |
}
|
216 |
+
},
|
217 |
+
{
|
218 |
+
keys: [77], // M
|
219 |
+
action: function(player, media, key, event) {
|
220 |
+
player.container.find('.mejs-volume-slider').css('display','block');
|
221 |
+
if (player.isVideo) {
|
222 |
+
player.showControls();
|
223 |
+
player.startControlsTimer();
|
224 |
+
}
|
225 |
+
if (player.media.muted) {
|
226 |
+
player.setMuted(false);
|
227 |
+
} else {
|
228 |
+
player.setMuted(true);
|
229 |
+
}
|
230 |
+
}
|
231 |
+
}
|
232 |
+
]
|
233 |
};
|
234 |
|
235 |
mejs.mepIndex = 0;
|
236 |
+
|
237 |
+
mejs.players = {};
|
238 |
|
239 |
// wraps a MediaElement object in player controls
|
240 |
mejs.MediaElementPlayer = function(node, o) {
|
241 |
// enforce object, even without "new" (via John Resig)
|
242 |
if ( !(this instanceof mejs.MediaElementPlayer) ) {
|
243 |
return new mejs.MediaElementPlayer(node, o);
|
244 |
+
}
|
245 |
|
246 |
var t = this;
|
247 |
+
|
248 |
// these will be reset after the MediaElement.success fires
|
249 |
t.$media = t.$node = $(node);
|
250 |
+
t.node = t.media = t.$media[0];
|
251 |
+
|
252 |
+
if(!t.node) {
|
253 |
+
return;
|
254 |
+
}
|
255 |
+
|
256 |
// check for existing player
|
257 |
if (typeof t.node.player != 'undefined') {
|
258 |
return t.node.player;
|
|
|
|
|
|
|
259 |
}
|
260 |
+
|
261 |
+
|
262 |
// try to get options from data-mejsoptions
|
263 |
if (typeof o == 'undefined') {
|
264 |
+
o = t.$node.data('mejsoptions');
|
265 |
}
|
266 |
+
|
267 |
// extend default options
|
268 |
t.options = $.extend({},mejs.MepDefaults,o);
|
269 |
+
|
270 |
+
if (!t.options.timeFormat) {
|
271 |
+
// Generate the time format according to options
|
272 |
+
t.options.timeFormat = 'mm:ss';
|
273 |
+
if (t.options.alwaysShowHours) {
|
274 |
+
t.options.timeFormat = 'hh:mm:ss';
|
275 |
+
}
|
276 |
+
if (t.options.showTimecodeFrameCount) {
|
277 |
+
t.options.timeFormat += ':ff';
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
mejs.Utility.calculateTimeFormat(0, t.options, t.options.framesPerSecond || 25);
|
282 |
+
|
283 |
+
// unique ID
|
284 |
+
t.id = 'mep_' + mejs.mepIndex++;
|
285 |
+
|
286 |
// add to player array (for focus events)
|
287 |
+
mejs.players[t.id] = t;
|
288 |
+
|
289 |
// start up
|
290 |
t.init();
|
291 |
|
294 |
|
295 |
// actual player
|
296 |
mejs.MediaElementPlayer.prototype = {
|
297 |
+
|
298 |
hasFocus: false,
|
299 |
+
|
300 |
controlsAreVisible: true,
|
301 |
+
|
302 |
init: function() {
|
303 |
|
304 |
var
|
310 |
error: function(e) { t.handleError(e);}
|
311 |
}),
|
312 |
tagName = t.media.tagName.toLowerCase();
|
313 |
+
|
314 |
t.isDynamic = (tagName !== 'audio' && tagName !== 'video');
|
315 |
+
|
316 |
+
if (t.isDynamic) {
|
317 |
+
// get video from src or href?
|
318 |
+
t.isVideo = t.options.isVideo;
|
319 |
} else {
|
320 |
t.isVideo = (tagName !== 'audio' && t.options.isVideo);
|
321 |
}
|
322 |
+
|
323 |
+
// use native controls in iPad, iPhone, and Android
|
324 |
if ((mf.isiPad && t.options.iPadUseNativeControls) || (mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
325 |
+
|
326 |
// add controls and stop
|
327 |
t.$media.attr('controls', 'controls');
|
328 |
|
329 |
// attempt to fix iOS 3 bug
|
330 |
//t.$media.removeAttr('poster');
|
331 |
+
// no Issue found on iOS3 -ttroxell
|
332 |
|
333 |
// override Apple's autoplay override for iPads
|
334 |
if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
|
335 |
+
t.play();
|
|
|
336 |
}
|
337 |
+
|
338 |
+
} else if (mf.isAndroid && t.options.AndroidUseNativeControls) {
|
339 |
+
|
340 |
// leave default player
|
341 |
|
342 |
+
} else if (t.isVideo || (!t.isVideo && t.options.features.length)) {
|
343 |
|
344 |
// DESKTOP: use MediaElementPlayer controls
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
+
// remove native controls
|
347 |
+
t.$media.removeAttr('controls');
|
348 |
+
var videoPlayerTitle = t.isVideo ?
|
349 |
+
mejs.i18n.t('mejs.video-player') : mejs.i18n.t('mejs.audio-player');
|
350 |
+
// insert description for screen readers
|
351 |
+
$('<span class="mejs-offscreen">' + videoPlayerTitle + '</span>').insertBefore(t.$media);
|
352 |
// build container
|
353 |
t.container =
|
354 |
+
$('<div id="' + t.id + '" class="mejs-container ' + (mejs.MediaFeatures.svgAsImg ? 'svg' : 'no-svg') +
|
355 |
+
'" tabindex="0" role="application" aria-label="' + videoPlayerTitle + '">'+
|
356 |
'<div class="mejs-inner">'+
|
357 |
'<div class="mejs-mediaelement"></div>'+
|
358 |
'<div class="mejs-layers"></div>'+
|
361 |
'</div>' +
|
362 |
'</div>')
|
363 |
.addClass(t.$media[0].className)
|
364 |
+
.insertBefore(t.$media)
|
365 |
+
.focus(function ( e ) {
|
366 |
+
if( !t.controlsAreVisible && !t.hasFocus && t.controlsEnabled) {
|
367 |
+
t.showControls(true);
|
368 |
+
// In versions older than IE11, the focus causes the playbar to be displayed
|
369 |
+
// if user clicks on the Play/Pause button in the control bar once it attempts
|
370 |
+
// to hide it
|
371 |
+
if (!t.hasMsNativeFullScreen) {
|
372 |
+
// If e.relatedTarget appears before container, send focus to play button,
|
373 |
+
// else send focus to last control button.
|
374 |
+
var btnSelector = '.mejs-playpause-button > button';
|
375 |
+
|
376 |
+
if (mejs.Utility.isNodeAfter(e.relatedTarget, t.container[0])) {
|
377 |
+
btnSelector = '.mejs-controls .mejs-button:last-child > button';
|
378 |
+
}
|
379 |
+
|
380 |
+
var button = t.container.find(btnSelector);
|
381 |
+
button.focus();
|
382 |
+
}
|
383 |
+
}
|
384 |
+
});
|
385 |
+
|
386 |
+
// When no elements in controls, hide bar completely
|
387 |
+
if (!t.options.features.length) {
|
388 |
+
t.container.css('background', 'transparent').find('.mejs-controls').hide();
|
389 |
+
}
|
390 |
+
|
391 |
+
if (t.isVideo && t.options.stretching === 'fill' && !t.container.parent('mejs-fill-container').length) {
|
392 |
+
// outer container
|
393 |
+
t.outerContainer = t.$media.parent();
|
394 |
+
t.container.wrap('<div class="mejs-fill-container"/>');
|
395 |
+
}
|
396 |
+
|
397 |
// add classes for user and content
|
398 |
t.container.addClass(
|
399 |
(mf.isAndroid ? 'mejs-android ' : '') +
|
401 |
(mf.isiPad ? 'mejs-ipad ' : '') +
|
402 |
(mf.isiPhone ? 'mejs-iphone ' : '') +
|
403 |
(t.isVideo ? 'mejs-video ' : 'mejs-audio ')
|
404 |
+
);
|
405 |
+
|
406 |
|
407 |
// move the <video/video> tag into the right spot
|
408 |
+
t.container.find('.mejs-mediaelement').append(t.$media);
|
409 |
+
|
410 |
+
// needs to be assigned here, after iOS remap
|
411 |
+
t.node.player = t;
|
412 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
// find parts
|
414 |
t.controls = t.container.find('.mejs-controls');
|
415 |
t.layers = t.container.find('.mejs-layers');
|
416 |
|
417 |
// determine the size
|
418 |
+
|
419 |
/* size priority:
|
420 |
+
(1) videoWidth (forced),
|
421 |
(2) style="width;height;"
|
422 |
(3) width attribute,
|
423 |
(4) defaultVideoWidth (for unspecified cases)
|
424 |
*/
|
425 |
+
|
426 |
var tagType = (t.isVideo ? 'video' : 'audio'),
|
427 |
capsTagName = tagType.substring(0,1).toUpperCase() + tagType.substring(1);
|
428 |
+
|
429 |
+
|
430 |
+
|
431 |
if (t.options[tagType + 'Width'] > 0 || t.options[tagType + 'Width'].toString().indexOf('%') > -1) {
|
432 |
t.width = t.options[tagType + 'Width'];
|
433 |
} else if (t.media.style.width !== '' && t.media.style.width !== null) {
|
434 |
+
t.width = t.media.style.width;
|
435 |
} else if (t.media.getAttribute('width') !== null) {
|
436 |
t.width = t.$media.attr('width');
|
437 |
} else {
|
438 |
t.width = t.options['default' + capsTagName + 'Width'];
|
439 |
}
|
440 |
+
|
441 |
if (t.options[tagType + 'Height'] > 0 || t.options[tagType + 'Height'].toString().indexOf('%') > -1) {
|
442 |
t.height = t.options[tagType + 'Height'];
|
443 |
} else if (t.media.style.height !== '' && t.media.style.height !== null) {
|
444 |
t.height = t.media.style.height;
|
445 |
} else if (t.$media[0].getAttribute('height') !== null) {
|
446 |
+
t.height = t.$media.attr('height');
|
447 |
} else {
|
448 |
t.height = t.options['default' + capsTagName + 'Height'];
|
449 |
}
|
450 |
|
451 |
// set the size, while we wait for the plugins to load below
|
452 |
t.setPlayerSize(t.width, t.height);
|
453 |
+
|
454 |
// create MediaElementShim
|
455 |
+
meOptions.pluginWidth = t.width;
|
456 |
+
meOptions.pluginHeight = t.height;
|
457 |
+
}
|
458 |
+
// Hide media completely for audio that doesn't have any features
|
459 |
+
else if (!t.isVideo && !t.options.features.length) {
|
460 |
+
t.$media.hide();
|
461 |
}
|
|
|
|
|
462 |
|
463 |
// create MediaElement shim
|
464 |
mejs.MediaElement(t.$media[0], meOptions);
|
465 |
|
466 |
+
if (typeof(t.container) !== 'undefined' && t.options.features.length && t.controlsAreVisible) {
|
467 |
+
// controls are shown when loaded
|
468 |
+
t.container.trigger('controlsshown');
|
469 |
+
}
|
470 |
},
|
471 |
+
|
472 |
showControls: function(doAnimation) {
|
473 |
var t = this;
|
474 |
+
|
475 |
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
476 |
+
|
477 |
if (t.controlsAreVisible)
|
478 |
return;
|
479 |
+
|
480 |
if (doAnimation) {
|
481 |
t.controls
|
482 |
+
.removeClass('mejs-offscreen')
|
483 |
.stop(true, true).fadeIn(200, function() {
|
484 |
+
t.controlsAreVisible = true;
|
485 |
+
t.container.trigger('controlsshown');
|
486 |
});
|
487 |
+
|
488 |
// any additional controls people might add and want to hide
|
489 |
t.container.find('.mejs-control')
|
490 |
+
.removeClass('mejs-offscreen')
|
491 |
+
.stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
|
492 |
+
|
493 |
} else {
|
494 |
t.controls
|
495 |
+
.removeClass('mejs-offscreen')
|
496 |
.css('display','block');
|
497 |
+
|
498 |
// any additional controls people might add and want to hide
|
499 |
t.container.find('.mejs-control')
|
500 |
+
.removeClass('mejs-offscreen')
|
501 |
.css('display','block');
|
502 |
+
|
503 |
t.controlsAreVisible = true;
|
504 |
t.container.trigger('controlsshown');
|
505 |
}
|
506 |
+
|
507 |
t.setControlsSize();
|
508 |
+
|
509 |
},
|
510 |
|
511 |
hideControls: function(doAnimation) {
|
512 |
var t = this;
|
513 |
+
|
514 |
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
515 |
+
|
516 |
+
if (!t.controlsAreVisible || t.options.alwaysShowControls || t.keyboardAction || t.media.paused || t.media.ended)
|
517 |
return;
|
518 |
+
|
519 |
if (doAnimation) {
|
520 |
// fade out main controls
|
521 |
t.controls.stop(true, true).fadeOut(200, function() {
|
522 |
$(this)
|
523 |
+
.addClass('mejs-offscreen')
|
524 |
.css('display','block');
|
525 |
+
|
526 |
t.controlsAreVisible = false;
|
527 |
t.container.trigger('controlshidden');
|
528 |
+
});
|
529 |
+
|
530 |
// any additional controls people might add and want to hide
|
531 |
t.container.find('.mejs-control').stop(true, true).fadeOut(200, function() {
|
532 |
$(this)
|
533 |
+
.addClass('mejs-offscreen')
|
534 |
.css('display','block');
|
535 |
+
});
|
536 |
} else {
|
537 |
+
|
538 |
// hide main controls
|
539 |
t.controls
|
540 |
+
.addClass('mejs-offscreen')
|
541 |
+
.css('display','block');
|
542 |
+
|
543 |
// hide others
|
544 |
t.container.find('.mejs-control')
|
545 |
+
.addClass('mejs-offscreen')
|
546 |
.css('display','block');
|
547 |
+
|
548 |
t.controlsAreVisible = false;
|
549 |
t.container.trigger('controlshidden');
|
550 |
}
|
551 |
+
},
|
552 |
|
553 |
controlsTimer: null,
|
554 |
|
555 |
startControlsTimer: function(timeout) {
|
556 |
|
557 |
var t = this;
|
558 |
+
|
559 |
+
timeout = typeof timeout != 'undefined' ? timeout : t.options.controlsTimeoutDefault;
|
560 |
|
561 |
t.killControlsTimer('start');
|
562 |
|
563 |
t.controlsTimer = setTimeout(function() {
|
564 |
+
//
|
565 |
t.hideControls();
|
566 |
t.killControlsTimer('hide');
|
567 |
}, timeout);
|
576 |
delete t.controlsTimer;
|
577 |
t.controlsTimer = null;
|
578 |
}
|
579 |
+
},
|
580 |
+
|
581 |
controlsEnabled: true,
|
582 |
+
|
583 |
disableControls: function() {
|
584 |
var t= this;
|
585 |
+
|
586 |
t.killControlsTimer();
|
587 |
t.hideControls(false);
|
588 |
this.controlsEnabled = false;
|
589 |
},
|
590 |
+
|
591 |
enableControls: function() {
|
592 |
var t= this;
|
593 |
+
|
594 |
t.showControls(false);
|
595 |
+
|
596 |
t.controlsEnabled = true;
|
597 |
+
},
|
|
|
598 |
|
599 |
// Sets up all controls and events
|
600 |
+
meReady: function(media, domNode) {
|
601 |
+
|
602 |
+
var
|
603 |
+
t = this,
|
604 |
mf = mejs.MediaFeatures,
|
605 |
autoplayAttr = domNode.getAttribute('autoplay'),
|
606 |
autoplay = !(typeof autoplayAttr == 'undefined' || autoplayAttr === null || autoplayAttr === 'false'),
|
608 |
feature;
|
609 |
|
610 |
// make sure it can't create itself again if a plugin reloads
|
611 |
+
if (t.created) {
|
612 |
return;
|
613 |
+
} else {
|
614 |
+
t.created = true;
|
615 |
+
}
|
616 |
|
617 |
t.media = media;
|
618 |
t.domNode = domNode;
|
619 |
+
|
620 |
+
if (!(mf.isAndroid && t.options.AndroidUseNativeControls) && !(mf.isiPad && t.options.iPadUseNativeControls) && !(mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
621 |
+
|
622 |
+
// In the event that no features are specified for audio,
|
623 |
+
// create only MediaElement instance rather than
|
624 |
+
// doing all the work to create a full player
|
625 |
+
if (!t.isVideo && !t.options.features.length) {
|
626 |
+
|
627 |
+
// force autoplay for HTML5
|
628 |
+
if (autoplay && media.pluginType == 'native') {
|
629 |
+
t.play();
|
630 |
+
}
|
631 |
+
|
632 |
+
|
633 |
+
if (t.options.success) {
|
634 |
+
|
635 |
+
if (typeof t.options.success == 'string') {
|
636 |
+
window[t.options.success](t.media, t.domNode, t);
|
637 |
+
} else {
|
638 |
+
t.options.success(t.media, t.domNode, t);
|
639 |
+
}
|
640 |
+
}
|
641 |
+
|
642 |
+
return;
|
643 |
+
}
|
644 |
+
|
645 |
// two built in features
|
646 |
t.buildposter(t, t.controls, t.layers, t.media);
|
647 |
t.buildkeyboard(t, t.controls, t.layers, t.media);
|
659 |
} catch (e) {
|
660 |
// TODO: report control error
|
661 |
//throw e;
|
662 |
+
|
663 |
+
|
664 |
}
|
665 |
}
|
666 |
}
|
667 |
|
668 |
t.container.trigger('controlsready');
|
669 |
+
|
670 |
// reset all layers and controls
|
671 |
t.setPlayerSize(t.width, t.height);
|
672 |
t.setControlsSize();
|
673 |
+
|
674 |
|
675 |
// controls fade
|
676 |
if (t.isVideo) {
|
677 |
+
|
678 |
+
if (mejs.MediaFeatures.hasTouch && !t.options.alwaysShowControls) {
|
679 |
+
|
680 |
// for touch devices (iOS, Android)
|
681 |
// show/hide without animation on touch
|
682 |
+
|
683 |
t.$media.bind('touchstart', function() {
|
684 |
+
|
|
|
685 |
// toggle controls
|
686 |
if (t.controlsAreVisible) {
|
687 |
t.hideControls(false);
|
690 |
t.showControls(false);
|
691 |
}
|
692 |
}
|
693 |
+
});
|
694 |
+
|
695 |
} else {
|
696 |
+
|
697 |
+
// create callback here since it needs access to current
|
698 |
+
// MediaElement object
|
699 |
+
t.clickToPlayPauseCallback = function() {
|
700 |
+
//
|
701 |
+
|
702 |
+
if (t.options.clickToPlayPause) {
|
703 |
+
if (t.media.paused) {
|
704 |
+
t.play();
|
705 |
+
} else {
|
706 |
+
t.pause();
|
707 |
+
}
|
708 |
+
|
709 |
+
var button = t.$media.closest('.mejs-container').find('.mejs-overlay-button'),
|
710 |
+
pressed = button.attr('aria-pressed');
|
711 |
+
button.attr('aria-pressed', !pressed);
|
712 |
+
}
|
713 |
+
};
|
714 |
+
|
715 |
+
// click to play/pause
|
716 |
+
t.media.addEventListener('click', t.clickToPlayPauseCallback, false);
|
717 |
+
|
718 |
// show/hide controls
|
719 |
t.container
|
720 |
+
.bind('mouseenter', function () {
|
721 |
if (t.controlsEnabled) {
|
722 |
+
if (!t.options.alwaysShowControls ) {
|
723 |
t.killControlsTimer('enter');
|
724 |
t.showControls();
|
725 |
+
t.startControlsTimer(t.options.controlsTimeoutMouseEnter);
|
726 |
}
|
727 |
}
|
728 |
})
|
731 |
if (!t.controlsAreVisible) {
|
732 |
t.showControls();
|
733 |
}
|
|
|
734 |
if (!t.options.alwaysShowControls) {
|
735 |
+
t.startControlsTimer(t.options.controlsTimeoutMouseEnter);
|
736 |
}
|
737 |
}
|
738 |
})
|
739 |
.bind('mouseleave', function () {
|
740 |
if (t.controlsEnabled) {
|
741 |
if (!t.media.paused && !t.options.alwaysShowControls) {
|
742 |
+
t.startControlsTimer(t.options.controlsTimeoutMouseLeave);
|
743 |
}
|
744 |
}
|
745 |
});
|
746 |
}
|
747 |
+
|
748 |
+
if(t.options.hideVideoControlsOnLoad) {
|
749 |
+
t.hideControls(false);
|
750 |
+
}
|
751 |
+
|
752 |
// check for autoplay
|
753 |
if (autoplay && !t.options.alwaysShowControls) {
|
754 |
t.hideControls();
|
767 |
}, false);
|
768 |
}
|
769 |
}
|
770 |
+
|
771 |
// EVENTS
|
772 |
|
773 |
+
// FOCUS: when a video starts playing, it takes focus from other players (possibly pausing them)
|
774 |
+
t.media.addEventListener('play', function() {
|
775 |
+
var playerIndex;
|
776 |
+
|
777 |
+
// go through all other players
|
778 |
+
for (playerIndex in mejs.players) {
|
779 |
+
var p = mejs.players[playerIndex];
|
780 |
+
if (p.id != t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended) {
|
781 |
+
p.pause();
|
|
|
782 |
}
|
783 |
+
p.hasFocus = false;
|
784 |
+
}
|
785 |
+
|
786 |
+
t.hasFocus = true;
|
787 |
},false);
|
788 |
+
|
789 |
|
790 |
// ended for all
|
791 |
t.media.addEventListener('ended', function (e) {
|
792 |
if(t.options.autoRewind) {
|
793 |
try{
|
794 |
t.media.setCurrentTime(0);
|
795 |
+
// Fixing an Android stock browser bug, where "seeked" isn't fired correctly after ending the video and jumping to the beginning
|
796 |
+
window.setTimeout(function(){
|
797 |
+
$(t.container).find('.mejs-overlay-loading').parent().hide();
|
798 |
+
}, 20);
|
799 |
} catch (exp) {
|
800 |
+
|
801 |
}
|
802 |
}
|
803 |
+
if (t.media.pluginType === 'youtube') {
|
804 |
+
t.media.stop();
|
805 |
+
} else {
|
806 |
+
t.media.pause();
|
807 |
+
}
|
808 |
+
|
809 |
+
if (t.setProgressRail) {
|
810 |
t.setProgressRail();
|
811 |
+
}
|
812 |
+
if (t.setCurrentRail) {
|
813 |
+
t.setCurrentRail();
|
814 |
+
}
|
815 |
|
816 |
if (t.options.loop) {
|
817 |
+
t.play();
|
818 |
} else if (!t.options.alwaysShowControls && t.controlsEnabled) {
|
819 |
t.showControls();
|
820 |
}
|
821 |
}, false);
|
822 |
+
|
823 |
// resize on the first play
|
824 |
+
t.media.addEventListener('loadedmetadata', function() {
|
825 |
+
|
826 |
+
mejs.Utility.calculateTimeFormat(t.duration, t.options, t.options.framesPerSecond || 25);
|
827 |
+
|
828 |
if (t.updateDuration) {
|
829 |
t.updateDuration();
|
830 |
}
|
831 |
if (t.updateCurrent) {
|
832 |
t.updateCurrent();
|
833 |
}
|
834 |
+
|
835 |
if (!t.isFullScreen) {
|
836 |
t.setPlayerSize(t.width, t.height);
|
837 |
t.setControlsSize();
|
838 |
}
|
839 |
}, false);
|
840 |
|
841 |
+
// Only change the time format when necessary
|
842 |
+
var duration = null;
|
843 |
+
t.media.addEventListener('timeupdate',function() {
|
844 |
+
if (duration !== this.duration) {
|
845 |
+
duration = this.duration;
|
846 |
+
mejs.Utility.calculateTimeFormat(duration, t.options, t.options.framesPerSecond || 25);
|
847 |
+
|
848 |
+
// make sure to fill in and resize the controls (e.g., 00:00 => 01:13:15
|
849 |
+
if (t.updateDuration) {
|
850 |
+
t.updateDuration();
|
851 |
+
}
|
852 |
+
if (t.updateCurrent) {
|
853 |
+
t.updateCurrent();
|
854 |
+
}
|
855 |
+
t.setControlsSize();
|
856 |
+
|
857 |
+
}
|
858 |
+
}, false);
|
859 |
+
|
860 |
+
t.container.focusout(function (e) {
|
861 |
+
if( e.relatedTarget ) { //FF is working on supporting focusout https://bugzilla.mozilla.org/show_bug.cgi?id=687787
|
862 |
+
var $target = $(e.relatedTarget);
|
863 |
+
if (t.keyboardAction && $target.parents('.mejs-container').length === 0) {
|
864 |
+
t.keyboardAction = false;
|
865 |
+
if (t.isVideo && !t.options.alwaysShowControls) {
|
866 |
+
t.hideControls(true);
|
867 |
+
}
|
868 |
+
|
869 |
+
}
|
870 |
+
}
|
871 |
+
});
|
872 |
|
873 |
// webkit has trouble doing this without a delay
|
874 |
setTimeout(function () {
|
875 |
t.setPlayerSize(t.width, t.height);
|
876 |
t.setControlsSize();
|
877 |
}, 50);
|
878 |
+
|
879 |
// adjust controls whenever window sizes (used to be in fullscreen only)
|
880 |
+
t.globalBind('resize', function() {
|
881 |
+
|
882 |
+
// don't resize for fullscreen mode
|
883 |
if ( !(t.isFullScreen || (mejs.MediaFeatures.hasTrueNativeFullScreen && document.webkitIsFullScreen)) ) {
|
884 |
t.setPlayerSize(t.width, t.height);
|
885 |
}
|
886 |
+
|
887 |
// always adjust controls
|
888 |
t.setControlsSize();
|
889 |
+
});
|
890 |
|
891 |
+
// This is a work-around for a bug in the YouTube iFrame player, which means
|
892 |
+
// we can't use the play() API for the initial playback on iOS or Android;
|
893 |
+
// user has to start playback directly by tapping on the iFrame.
|
894 |
+
if (t.media.pluginType == 'youtube' && ( mf.isiOS || mf.isAndroid ) ) {
|
895 |
+
t.container.find('.mejs-overlay-play').hide();
|
896 |
+
t.container.find('.mejs-poster').hide();
|
897 |
}
|
898 |
}
|
899 |
+
|
900 |
// force autoplay for HTML5
|
901 |
if (autoplay && media.pluginType == 'native') {
|
902 |
+
t.play();
|
|
|
903 |
}
|
904 |
|
905 |
|
906 |
if (t.options.success) {
|
907 |
+
|
908 |
if (typeof t.options.success == 'string') {
|
909 |
+
window[t.options.success](t.media, t.domNode, t);
|
910 |
} else {
|
911 |
+
t.options.success(t.media, t.domNode, t);
|
912 |
}
|
913 |
}
|
914 |
},
|
915 |
|
916 |
handleError: function(e) {
|
917 |
var t = this;
|
918 |
+
|
919 |
+
if (t.controls) {
|
920 |
+
t.controls.hide();
|
921 |
+
}
|
922 |
+
|
923 |
// Tell user that the file cannot be played
|
924 |
if (t.options.error) {
|
925 |
t.options.error(e);
|
929 |
setPlayerSize: function(width,height) {
|
930 |
var t = this;
|
931 |
|
932 |
+
if( !t.options.setDimensions ) {
|
933 |
+
return false;
|
934 |
+
}
|
935 |
+
|
936 |
+
if (typeof width != 'undefined') {
|
937 |
t.width = width;
|
938 |
+
}
|
|
|
|
|
939 |
|
940 |
+
if (typeof height != 'undefined') {
|
941 |
+
t.height = height;
|
942 |
+
}
|
943 |
+
|
944 |
+
// check stretching modes
|
945 |
+
switch (t.options.stretching) {
|
946 |
+
case 'fill':
|
947 |
+
// The 'fill' effect only makes sense on video; for audio we will set the dimensions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
948 |
if (t.isVideo) {
|
949 |
+
this.setFillMode();
|
950 |
+
} else {
|
951 |
+
this.setDimensions(t.width, t.height);
|
952 |
}
|
953 |
+
break;
|
954 |
+
case 'responsive':
|
955 |
+
this.setResponsiveMode();
|
956 |
+
break;
|
957 |
+
case 'none':
|
958 |
+
this.setDimensions(t.width, t.height);
|
959 |
+
break;
|
960 |
+
// This is the 'auto' mode
|
961 |
+
default:
|
962 |
+
if (this.hasFluidMode() === true) {
|
963 |
+
this.setResponsiveMode();
|
964 |
+
} else {
|
965 |
+
this.setDimensions(t.width, t.height);
|
966 |
+
}
|
967 |
+
break;
|
968 |
+
}
|
969 |
+
},
|
970 |
+
|
971 |
+
hasFluidMode: function() {
|
972 |
+
var t = this;
|
973 |
+
|
974 |
+
// detect 100% mode - use currentStyle for IE since css() doesn't return percentages
|
975 |
+
return (t.height.toString().indexOf('%') > 0 || (t.$node.css('max-width') !== 'none' && t.$node.css('max-width') !== 't.width') || (t.$node[0].currentStyle && t.$node[0].currentStyle.maxWidth === '100%'));
|
976 |
+
},
|
977 |
+
|
978 |
+
setResponsiveMode: function() {
|
979 |
+
var t = this;
|
980 |
+
|
981 |
+
// do we have the native dimensions yet?
|
982 |
+
var nativeWidth = (function() {
|
983 |
+
if (t.isVideo) {
|
984 |
+
if (t.media.videoWidth && t.media.videoWidth > 0) {
|
985 |
+
return t.media.videoWidth;
|
986 |
+
} else if (t.media.getAttribute('width') !== null) {
|
987 |
+
return t.media.getAttribute('width');
|
988 |
+
} else {
|
989 |
+
return t.options.defaultVideoWidth;
|
990 |
+
}
|
991 |
+
} else {
|
992 |
+
return t.options.defaultAudioWidth;
|
993 |
+
}
|
994 |
+
})();
|
995 |
+
|
996 |
+
var nativeHeight = (function() {
|
997 |
+
if (t.isVideo) {
|
998 |
+
if (t.media.videoHeight && t.media.videoHeight > 0) {
|
999 |
+
return t.media.videoHeight;
|
1000 |
+
} else if (t.media.getAttribute('height') !== null) {
|
1001 |
+
return t.media.getAttribute('height');
|
1002 |
+
} else {
|
1003 |
+
return t.options.defaultVideoHeight;
|
1004 |
+
}
|
1005 |
+
} else {
|
1006 |
+
return t.options.defaultAudioHeight;
|
1007 |
}
|
1008 |
+
})();
|
1009 |
+
|
1010 |
+
var parentWidth = t.container.parent().closest(':visible').width(),
|
1011 |
+
parentHeight = t.container.parent().closest(':visible').height(),
|
1012 |
+
newHeight = t.isVideo || !t.options.autosizeProgress ? parseInt(parentWidth * nativeHeight/nativeWidth, 10) : nativeHeight;
|
1013 |
|
1014 |
+
// When we use percent, the newHeight can't be calculated so we get the container height
|
1015 |
+
if (isNaN(newHeight) || ( parentHeight !== 0 && newHeight > parentHeight && parentHeight > nativeHeight)) {
|
1016 |
+
newHeight = parentHeight;
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
if (t.container.parent().length > 0 && t.container.parent()[0].tagName.toLowerCase() === 'body') { // && t.container.siblings().count == 0) {
|
1020 |
+
parentWidth = $(window).width();
|
1021 |
+
newHeight = $(window).height();
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
if ( newHeight && parentWidth ) {
|
1025 |
|
1026 |
+
// set outer container size
|
|
|
1027 |
t.container
|
1028 |
+
.width(parentWidth)
|
1029 |
+
.height(newHeight);
|
1030 |
+
|
1031 |
+
// set native <video> or <audio> and shims
|
1032 |
+
t.$media.add(t.container.find('.mejs-shim'))
|
1033 |
+
.width('100%')
|
1034 |
+
.height('100%');
|
1035 |
+
|
1036 |
+
// if shim is ready, send the size to the embeded plugin
|
1037 |
+
if (t.isVideo) {
|
1038 |
+
if (t.media.setVideoSize) {
|
1039 |
+
t.media.setVideoSize(parentWidth, newHeight);
|
1040 |
+
}
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
// set the layers
|
1044 |
t.layers.children('.mejs-layer')
|
1045 |
+
.width('100%')
|
1046 |
+
.height('100%');
|
1047 |
+
}
|
1048 |
+
},
|
1049 |
+
|
1050 |
+
setFillMode: function() {
|
1051 |
+
var t = this,
|
1052 |
+
parent = t.outerContainer;
|
1053 |
+
|
1054 |
+
if (!parent.width()) {
|
1055 |
+
parent.height(t.$media.width());
|
1056 |
+
}
|
1057 |
+
|
1058 |
+
if (!parent.height()) {
|
1059 |
+
parent.height(t.$media.height());
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
var parentWidth = parent.width(),
|
1063 |
+
parentHeight = parent.height();
|
1064 |
+
|
1065 |
+
t.setDimensions('100%', '100%');
|
1066 |
+
|
1067 |
+
// This prevents an issue when displaying poster
|
1068 |
+
t.container.find('.mejs-poster img').css('display', 'block');
|
1069 |
+
|
1070 |
+
targetElement = t.container.find('object, embed, iframe, video');
|
1071 |
+
|
1072 |
+
// calculate new width and height
|
1073 |
+
var initHeight = t.height,
|
1074 |
+
initWidth = t.width,
|
1075 |
+
// scale to the target width
|
1076 |
+
scaleX1 = parentWidth,
|
1077 |
+
scaleY1 = (initHeight * parentWidth) / initWidth,
|
1078 |
+
// scale to the target height
|
1079 |
+
scaleX2 = (initWidth * parentHeight) / initHeight,
|
1080 |
+
scaleY2 = parentHeight,
|
1081 |
+
// now figure out which one we should use
|
1082 |
+
bScaleOnWidth = !(scaleX2 > parentWidth),
|
1083 |
+
finalWidth = bScaleOnWidth ? Math.floor(scaleX1) : Math.floor(scaleX2),
|
1084 |
+
finalHeight = bScaleOnWidth ? Math.floor(scaleY1) : Math.floor(scaleY2);
|
1085 |
+
|
1086 |
+
if (bScaleOnWidth) {
|
1087 |
+
targetElement.height(finalHeight).width(parentWidth);
|
1088 |
+
if (t.media.setVideoSize) {
|
1089 |
+
t.media.setVideoSize(parentWidth, finalHeight);
|
1090 |
+
}
|
1091 |
+
} else {
|
1092 |
+
targetElement.height(parentHeight).width(finalWidth);
|
1093 |
+
if (t.media.setVideoSize) {
|
1094 |
+
t.media.setVideoSize(finalWidth, parentHeight);
|
1095 |
+
}
|
1096 |
}
|
1097 |
+
|
1098 |
+
targetElement.css({
|
1099 |
+
'margin-left': Math.floor((parentWidth - finalWidth) / 2),
|
1100 |
+
'margin-top': 0
|
1101 |
+
});
|
1102 |
+
},
|
1103 |
+
|
1104 |
+
setDimensions: function(width, height) {
|
1105 |
+
var t = this;
|
1106 |
+
|
1107 |
+
t.container
|
1108 |
+
.width(width)
|
1109 |
+
.height(height);
|
1110 |
+
|
1111 |
+
t.layers.children('.mejs-layer')
|
1112 |
+
.width(width)
|
1113 |
+
.height(height);
|
1114 |
},
|
1115 |
|
1116 |
setControlsSize: function() {
|
1119 |
railWidth = 0,
|
1120 |
rail = t.controls.find('.mejs-time-rail'),
|
1121 |
total = t.controls.find('.mejs-time-total'),
|
1122 |
+
others = rail.siblings(),
|
1123 |
+
lastControl = others.last(),
|
1124 |
+
lastControlPosition = null,
|
1125 |
+
avoidAutosizeProgress = t.options && !t.options.autosizeProgress;
|
1126 |
+
|
1127 |
+
// skip calculation if hidden
|
1128 |
+
if (!t.container.is(':visible') || !rail.length || !rail.is(':visible')) {
|
1129 |
+
return;
|
1130 |
+
}
|
1131 |
|
1132 |
// allow the size to come from custom CSS
|
1133 |
+
if (avoidAutosizeProgress) {
|
1134 |
+
// Also, frontends devs can be more flexible
|
1135 |
// due the opportunity of absolute positioning.
|
1136 |
+
railWidth = parseInt(rail.css('width'), 10);
|
1137 |
}
|
1138 |
+
|
1139 |
// attempt to autosize
|
1140 |
if (railWidth === 0 || !railWidth) {
|
1141 |
+
|
1142 |
// find the size of all the other controls besides the rail
|
1143 |
others.each(function() {
|
1144 |
+
var $this = $(this);
|
1145 |
+
if ($this.css('position') != 'absolute' && $this.is(':visible')) {
|
1146 |
usedWidth += $(this).outerWidth(true);
|
1147 |
}
|
1148 |
});
|
1149 |
+
|
1150 |
// fit the rail into the remaining space
|
1151 |
railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.width());
|
1152 |
}
|
1153 |
|
1154 |
+
// resize the rail,
|
1155 |
+
// but then check if the last control (say, the fullscreen button) got pushed down
|
1156 |
+
// this often happens when zoomed
|
1157 |
+
do {
|
1158 |
+
// outer area
|
1159 |
+
// we only want to set an inline style with the width of the rail
|
1160 |
+
// if we're trying to autosize.
|
1161 |
+
if (!avoidAutosizeProgress) {
|
1162 |
+
rail.width(railWidth);
|
1163 |
+
}
|
1164 |
+
|
1165 |
+
// dark space
|
1166 |
+
total.width(railWidth - (total.outerWidth(true) - total.width()));
|
1167 |
+
|
1168 |
+
if (lastControl.css('position') != 'absolute') {
|
1169 |
+
lastControlPosition = lastControl.length ? lastControl.position() : null;
|
1170 |
+
railWidth--;
|
1171 |
+
}
|
1172 |
+
} while (lastControlPosition !== null && lastControlPosition.top.toFixed(2) > 0 && railWidth > 0);
|
1173 |
+
|
1174 |
+
t.container.trigger('controlsresize');
|
1175 |
},
|
1176 |
|
1177 |
|
1178 |
buildposter: function(player, controls, layers, media) {
|
1179 |
var t = this,
|
1180 |
+
poster =
|
1181 |
$('<div class="mejs-poster mejs-layer">' +
|
1182 |
'</div>')
|
1183 |
.appendTo(layers),
|
1186 |
// prioriy goes to option (this is useful if you need to support iOS 3.x (iOS completely fails with poster)
|
1187 |
if (player.options.poster !== '') {
|
1188 |
posterUrl = player.options.poster;
|
1189 |
+
}
|
1190 |
+
|
1191 |
// second, try the real poster
|
1192 |
+
if ( posterUrl ) {
|
1193 |
t.setPoster(posterUrl);
|
1194 |
} else {
|
1195 |
poster.hide();
|
1198 |
media.addEventListener('play',function() {
|
1199 |
poster.hide();
|
1200 |
}, false);
|
1201 |
+
|
1202 |
+
if(player.options.showPosterWhenEnded && player.options.autoRewind){
|
1203 |
+
media.addEventListener('ended',function() {
|
1204 |
+
poster.show();
|
1205 |
+
}, false);
|
1206 |
+
}
|
1207 |
},
|
1208 |
+
|
1209 |
setPoster: function(url) {
|
1210 |
var t = this,
|
1211 |
posterDiv = t.container.find('.mejs-poster'),
|
1212 |
posterImg = posterDiv.find('img');
|
1213 |
+
|
1214 |
+
if (posterImg.length === 0) {
|
1215 |
+
posterImg = $('<img width="100%" height="100%" alt="" />').appendTo(posterDiv);
|
1216 |
+
}
|
1217 |
+
|
1218 |
posterImg.attr('src', url);
|
1219 |
+
posterDiv.css({'background-image' : 'url(' + url + ')'});
|
1220 |
},
|
1221 |
|
1222 |
buildoverlays: function(player, controls, layers, media) {
|
1223 |
+
var t = this;
|
1224 |
if (!player.isVideo)
|
1225 |
return;
|
1226 |
|
1227 |
+
var
|
1228 |
+
loading =
|
1229 |
$('<div class="mejs-overlay mejs-layer">'+
|
1230 |
'<div class="mejs-overlay-loading"><span></span></div>'+
|
1231 |
'</div>')
|
1232 |
.hide() // start out hidden
|
1233 |
.appendTo(layers),
|
1234 |
+
error =
|
1235 |
$('<div class="mejs-overlay mejs-layer">'+
|
1236 |
'<div class="mejs-overlay-error"></div>'+
|
1237 |
'</div>')
|
1238 |
.hide() // start out hidden
|
1239 |
.appendTo(layers),
|
1240 |
// this needs to come last so it's on top
|
1241 |
+
bigPlay =
|
1242 |
$('<div class="mejs-overlay mejs-layer mejs-overlay-play">'+
|
1243 |
+
'<div class="mejs-overlay-button" role="button" aria-label="' + mejs.i18n.t('mejs.play') + '" aria-pressed="false"></div>'+
|
1244 |
'</div>')
|
1245 |
.appendTo(layers)
|
1246 |
+
.bind('click', function() { // Removed 'touchstart' due issues on Samsung Android devices where a tap on bigPlay started and immediately stopped the video
|
1247 |
+
if (t.options.clickToPlayPause) {
|
1248 |
+
if (media.paused) {
|
1249 |
+
media.play();
|
1250 |
+
}
|
1251 |
+
|
1252 |
+
var button = $(this).find('.mejs-overlay-button'),
|
1253 |
+
pressed = button.attr('aria-pressed');
|
1254 |
+
button.attr('aria-pressed', !!pressed);
|
1255 |
+
}
|
1256 |
});
|
1257 |
+
|
1258 |
/*
|
1259 |
if (mejs.MediaFeatures.isiOS || mejs.MediaFeatures.isAndroid) {
|
1260 |
bigPlay.remove();
|
1261 |
loading.remove();
|
1262 |
}
|
1263 |
*/
|
1264 |
+
|
1265 |
|
1266 |
// show/hide big play button
|
1267 |
media.addEventListener('play',function() {
|
1269 |
loading.hide();
|
1270 |
controls.find('.mejs-time-buffering').hide();
|
1271 |
error.hide();
|
1272 |
+
}, false);
|
1273 |
+
|
1274 |
media.addEventListener('playing', function() {
|
1275 |
bigPlay.hide();
|
1276 |
loading.hide();
|
1277 |
controls.find('.mejs-time-buffering').hide();
|
1278 |
+
error.hide();
|
1279 |
}, false);
|
1280 |
|
1281 |
media.addEventListener('seeking', function() {
|
1287 |
loading.hide();
|
1288 |
controls.find('.mejs-time-buffering').hide();
|
1289 |
}, false);
|
1290 |
+
|
1291 |
media.addEventListener('pause',function() {
|
1292 |
if (!mejs.MediaFeatures.isiPhone) {
|
1293 |
bigPlay.show();
|
1294 |
}
|
1295 |
}, false);
|
1296 |
+
|
1297 |
media.addEventListener('waiting', function() {
|
1298 |
+
loading.show();
|
1299 |
controls.find('.mejs-time-buffering').show();
|
1300 |
+
}, false);
|
1301 |
+
|
1302 |
+
|
1303 |
+
// show/hide loading
|
1304 |
media.addEventListener('loadeddata',function() {
|
1305 |
// for some reason Chrome is firing this event
|
1306 |
//if (mejs.MediaFeatures.isChrome && media.getAttribute && media.getAttribute('preload') === 'none')
|
1307 |
// return;
|
1308 |
+
|
1309 |
loading.show();
|
1310 |
controls.find('.mejs-time-buffering').show();
|
1311 |
+
// Firing the 'canplay' event after a timeout which isn't getting fired on some Android 4.1 devices (https://github.com/johndyer/mediaelement/issues/1305)
|
1312 |
+
if (mejs.MediaFeatures.isAndroid) {
|
1313 |
+
media.canplayTimeout = window.setTimeout(
|
1314 |
+
function() {
|
1315 |
+
if (document.createEvent) {
|
1316 |
+
var evt = document.createEvent('HTMLEvents');
|
1317 |
+
evt.initEvent('canplay', true, true);
|
1318 |
+
return media.dispatchEvent(evt);
|
1319 |
+
}
|
1320 |
+
}, 300
|
1321 |
+
);
|
1322 |
+
}
|
1323 |
+
}, false);
|
1324 |
media.addEventListener('canplay',function() {
|
1325 |
loading.hide();
|
1326 |
controls.find('.mejs-time-buffering').hide();
|
1327 |
+
clearTimeout(media.canplayTimeout); // Clear timeout inside 'loadeddata' to prevent 'canplay' to fire twice
|
1328 |
+
}, false);
|
1329 |
|
1330 |
// error handling
|
1331 |
+
media.addEventListener('error',function(e) {
|
1332 |
+
t.handleError(e);
|
1333 |
loading.hide();
|
1334 |
+
bigPlay.hide();
|
1335 |
error.show();
|
1336 |
+
error.find('.mejs-overlay-error').html("Error loading this resource");
|
1337 |
+
}, false);
|
1338 |
+
|
1339 |
+
media.addEventListener('keydown', function(e) {
|
1340 |
+
t.onkeydown(player, media, e);
|
1341 |
+
}, false);
|
1342 |
},
|
1343 |
+
|
1344 |
buildkeyboard: function(player, controls, layers, media) {
|
1345 |
|
1346 |
var t = this;
|
1347 |
+
|
1348 |
+
t.container.keydown(function () {
|
1349 |
+
t.keyboardAction = true;
|
1350 |
+
});
|
1351 |
+
|
1352 |
// listen for key presses
|
1353 |
+
t.globalBind('keydown', function(event) {
|
1354 |
+
player.hasFocus = $(event.target).closest('.mejs-container').length !== 0
|
1355 |
+
&& $(event.target).closest('.mejs-container').attr('id') === player.$media.closest('.mejs-container').attr('id');
|
1356 |
+
return t.onkeydown(player, media, event);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1357 |
});
|
1358 |
+
|
1359 |
+
|
1360 |
// check if someone clicked outside a player region, then kill its focus
|
1361 |
+
t.globalBind('click', function(event) {
|
1362 |
+
player.hasFocus = $(event.target).closest('.mejs-container').length !== 0;
|
|
|
|
|
1363 |
});
|
1364 |
+
|
1365 |
+
},
|
1366 |
+
onkeydown: function(player, media, e) {
|
1367 |
+
if (player.hasFocus && player.options.enableKeyboard) {
|
1368 |
+
// find a matching key
|
1369 |
+
for (var i = 0, il = player.options.keyActions.length; i < il; i++) {
|
1370 |
+
var keyAction = player.options.keyActions[i];
|
1371 |
+
|
1372 |
+
for (var j = 0, jl = keyAction.keys.length; j < jl; j++) {
|
1373 |
+
if (e.keyCode == keyAction.keys[j]) {
|
1374 |
+
if (typeof(e.preventDefault) == "function") e.preventDefault();
|
1375 |
+
keyAction.action(player, media, e.keyCode, e);
|
1376 |
+
return false;
|
1377 |
+
}
|
1378 |
+
}
|
1379 |
+
}
|
1380 |
+
}
|
1381 |
+
|
1382 |
+
return true;
|
1383 |
},
|
1384 |
|
1385 |
findTracks: function() {
|
1389 |
// store for use by plugins
|
1390 |
t.tracks = [];
|
1391 |
tracktags.each(function(index, track) {
|
1392 |
+
|
1393 |
track = $(track);
|
1394 |
+
|
1395 |
t.tracks.push({
|
1396 |
+
srclang: (track.attr('srclang')) ? track.attr('srclang').toLowerCase() : '',
|
1397 |
src: track.attr('src'),
|
1398 |
kind: track.attr('kind'),
|
1399 |
label: track.attr('label') || '',
|
1408 |
this.setControlsSize();
|
1409 |
},
|
1410 |
play: function() {
|
1411 |
+
this.load();
|
1412 |
this.media.play();
|
1413 |
},
|
1414 |
pause: function() {
|
1415 |
+
try {
|
1416 |
+
this.media.pause();
|
1417 |
+
} catch (e) {}
|
1418 |
},
|
1419 |
load: function() {
|
1420 |
+
if (!this.isLoaded) {
|
1421 |
+
this.media.load();
|
1422 |
+
}
|
1423 |
+
|
1424 |
+
this.isLoaded = true;
|
1425 |
},
|
1426 |
setMuted: function(muted) {
|
1427 |
this.media.setMuted(muted);
|
1439 |
return this.media.volume;
|
1440 |
},
|
1441 |
setSrc: function(src) {
|
1442 |
+
var
|
1443 |
+
t = this;
|
1444 |
+
|
1445 |
+
// If using YouTube, its API is different to load a specific source
|
1446 |
+
if (t.media.pluginType === 'youtube') {
|
1447 |
+
var videoId;
|
1448 |
+
|
1449 |
+
if (typeof src !== 'string') {
|
1450 |
+
var i, media;
|
1451 |
+
|
1452 |
+
for (i=0; i<src.length; i++) {
|
1453 |
+
media = src[i];
|
1454 |
+
if (this.canPlayType(media.type)) {
|
1455 |
+
src = media.src;
|
1456 |
+
break;
|
1457 |
+
}
|
1458 |
+
}
|
1459 |
+
}
|
1460 |
+
|
1461 |
+
// youtu.be url from share button
|
1462 |
+
if (src.lastIndexOf('youtu.be') !== -1) {
|
1463 |
+
videoId = src.substr(src.lastIndexOf('/') + 1);
|
1464 |
+
|
1465 |
+
if (videoId.indexOf('?') !== -1) {
|
1466 |
+
videoId = videoId.substr(0, videoId.indexOf('?'));
|
1467 |
+
}
|
1468 |
+
|
1469 |
+
} else {
|
1470 |
+
// https://www.youtube.com/watch?v=
|
1471 |
+
var videoIdMatch = src.match(/[?&]v=([^&#]+)|&|#|$/);
|
1472 |
+
|
1473 |
+
if (videoIdMatch) {
|
1474 |
+
videoId = videoIdMatch[1];
|
1475 |
+
}
|
1476 |
+
}
|
1477 |
+
|
1478 |
+
if (t.media.getAttribute('autoplay') !== null) {
|
1479 |
+
t.media.pluginApi.loadVideoById(videoId);
|
1480 |
+
} else {
|
1481 |
+
t.media.pluginApi.cueVideoById(videoId);
|
1482 |
+
}
|
1483 |
+
|
1484 |
+
}
|
1485 |
+
else {
|
1486 |
+
t.media.setSrc(src);
|
1487 |
+
}
|
1488 |
},
|
1489 |
remove: function() {
|
1490 |
+
var t = this, featureIndex, feature;
|
1491 |
+
|
1492 |
+
t.container.prev('.mejs-offscreen').remove();
|
1493 |
+
|
1494 |
+
// invoke features cleanup
|
1495 |
+
for (featureIndex in t.options.features) {
|
1496 |
+
feature = t.options.features[featureIndex];
|
1497 |
+
if (t['clean' + feature]) {
|
1498 |
+
try {
|
1499 |
+
t['clean' + feature](t);
|
1500 |
+
} catch (e) {
|
1501 |
+
// TODO: report control error
|
1502 |
+
//throw e;
|
1503 |
+
//
|
1504 |
+
//
|
1505 |
+
}
|
1506 |
+
}
|
1507 |
}
|
1508 |
+
|
1509 |
// grab video and put it back in place
|
1510 |
if (!t.isDynamic) {
|
1511 |
+
t.$media.prop('controls', true);
|
1512 |
+
// detach events from the video
|
1513 |
+
// TODO: detach event listeners better than this;
|
1514 |
+
// also detach ONLY the events attached by this plugin!
|
1515 |
+
t.$node.clone().insertBefore(t.container).show();
|
1516 |
+
t.$node.remove();
|
1517 |
+
} else {
|
1518 |
+
t.$node.insertBefore(t.container);
|
1519 |
}
|
1520 |
+
|
1521 |
+
if (t.media.pluginType !== 'native') {
|
1522 |
+
t.media.remove();
|
1523 |
+
}
|
1524 |
+
|
1525 |
+
// Remove the player from the mejs.players object so that pauseOtherPlayers doesn't blow up when trying to pause a non existance flash api.
|
1526 |
+
delete mejs.players[t.id];
|
1527 |
+
|
1528 |
+
if (typeof t.container == 'object') {
|
1529 |
+
t.container.remove();
|
1530 |
+
}
|
1531 |
+
t.globalUnbind();
|
1532 |
+
delete t.node.player;
|
1533 |
+
},
|
1534 |
+
rebuildtracks: function(){
|
1535 |
+
var t = this;
|
1536 |
+
t.findTracks();
|
1537 |
+
t.buildtracks(t, t.controls, t.layers, t.media);
|
1538 |
+
},
|
1539 |
+
resetSize: function(){
|
1540 |
+
var t = this;
|
1541 |
+
// webkit has trouble doing this without a delay
|
1542 |
+
setTimeout(function () {
|
1543 |
+
//
|
1544 |
+
t.setPlayerSize(t.width, t.height);
|
1545 |
+
t.setControlsSize();
|
1546 |
+
}, 50);
|
1547 |
}
|
1548 |
};
|
1549 |
|
1550 |
+
(function(){
|
1551 |
+
var rwindow = /^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;
|
1552 |
+
|
1553 |
+
function splitEvents(events, id) {
|
1554 |
+
// add player ID as an event namespace so it's easier to unbind them all later
|
1555 |
+
var ret = {d: [], w: []};
|
1556 |
+
$.each((events || '').split(' '), function(k, v){
|
1557 |
+
var eventname = v + '.' + id;
|
1558 |
+
if (eventname.indexOf('.') === 0) {
|
1559 |
+
ret.d.push(eventname);
|
1560 |
+
ret.w.push(eventname);
|
1561 |
+
}
|
1562 |
+
else {
|
1563 |
+
ret[rwindow.test(v) ? 'w' : 'd'].push(eventname);
|
1564 |
+
}
|
1565 |
});
|
1566 |
+
ret.d = ret.d.join(' ');
|
1567 |
+
ret.w = ret.w.join(' ');
|
1568 |
+
return ret;
|
1569 |
+
}
|
1570 |
+
|
1571 |
+
mejs.MediaElementPlayer.prototype.globalBind = function(events, data, callback) {
|
1572 |
+
var t = this;
|
1573 |
+
var doc = t.node ? t.node.ownerDocument : document;
|
1574 |
+
|
1575 |
+
events = splitEvents(events, t.id);
|
1576 |
+
if (events.d) $(doc).bind(events.d, data, callback);
|
1577 |
+
if (events.w) $(window).bind(events.w, data, callback);
|
1578 |
+
};
|
1579 |
+
|
1580 |
+
mejs.MediaElementPlayer.prototype.globalUnbind = function(events, callback) {
|
1581 |
+
var t = this;
|
1582 |
+
var doc = t.node ? t.node.ownerDocument : document;
|
1583 |
+
|
1584 |
+
events = splitEvents(events, t.id);
|
1585 |
+
if (events.d) $(doc).unbind(events.d, callback);
|
1586 |
+
if (events.w) $(window).unbind(events.w, callback);
|
1587 |
+
};
|
1588 |
+
})();
|
1589 |
+
|
1590 |
+
// turn into jQuery plugin
|
1591 |
+
if (typeof $ != 'undefined') {
|
1592 |
+
$.fn.mediaelementplayer = function (options) {
|
1593 |
+
if (options === false) {
|
1594 |
+
this.each(function () {
|
1595 |
+
var player = $(this).data('mediaelementplayer');
|
1596 |
+
if (player) {
|
1597 |
+
player.remove();
|
1598 |
+
}
|
1599 |
+
$(this).removeData('mediaelementplayer');
|
1600 |
+
});
|
1601 |
+
}
|
1602 |
+
else {
|
1603 |
+
this.each(function () {
|
1604 |
+
$(this).data('mediaelementplayer', new mejs.MediaElementPlayer(this, options));
|
1605 |
+
});
|
1606 |
+
}
|
1607 |
+
return this;
|
1608 |
};
|
1609 |
+
|
1610 |
+
|
1611 |
+
$(document).ready(function() {
|
1612 |
+
// auto enable using JSON attribute
|
1613 |
+
$('.mejs-player').mediaelementplayer();
|
1614 |
+
});
|
1615 |
}
|
1616 |
+
|
|
|
|
|
|
|
|
|
|
|
1617 |
// push out to window
|
1618 |
window.MediaElementPlayer = mejs.MediaElementPlayer;
|
1619 |
|
1622 |
(function($) {
|
1623 |
|
1624 |
$.extend(mejs.MepDefaults, {
|
1625 |
+
playText: '',
|
1626 |
+
pauseText: ''
|
1627 |
});
|
1628 |
|
1629 |
+
|
1630 |
// PLAY/pause BUTTON
|
1631 |
$.extend(MediaElementPlayer.prototype, {
|
1632 |
buildplaypause: function(player, controls, layers, media) {
|
1633 |
var
|
1634 |
t = this,
|
1635 |
+
op = t.options,
|
1636 |
+
playTitle = op.playText ? op.playText : mejs.i18n.t('mejs.play'),
|
1637 |
+
pauseTitle = op.pauseText ? op.pauseText : mejs.i18n.t('mejs.pause'),
|
1638 |
+
play =
|
1639 |
$('<div class="mejs-button mejs-playpause-button mejs-play" >' +
|
1640 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + playTitle + '" aria-label="' + pauseTitle + '"></button>' +
|
1641 |
'</div>')
|
1642 |
.appendTo(controls)
|
1643 |
.click(function(e) {
|
1650 |
}
|
1651 |
|
1652 |
return false;
|
1653 |
+
}),
|
1654 |
+
play_btn = play.find('button');
|
1655 |
+
|
1656 |
+
|
1657 |
+
function togglePlayPause(which) {
|
1658 |
+
if ('play' === which) {
|
1659 |
+
play.removeClass('mejs-play').addClass('mejs-pause');
|
1660 |
+
play_btn.attr({
|
1661 |
+
'title': pauseTitle,
|
1662 |
+
'aria-label': pauseTitle
|
1663 |
+
});
|
1664 |
+
} else {
|
1665 |
+
play.removeClass('mejs-pause').addClass('mejs-play');
|
1666 |
+
play_btn.attr({
|
1667 |
+
'title': playTitle,
|
1668 |
+
'aria-label': playTitle
|
1669 |
+
});
|
1670 |
+
}
|
1671 |
+
};
|
1672 |
+
togglePlayPause('pse');
|
1673 |
+
|
1674 |
|
1675 |
media.addEventListener('play',function() {
|
1676 |
+
togglePlayPause('play');
|
1677 |
}, false);
|
1678 |
media.addEventListener('playing',function() {
|
1679 |
+
togglePlayPause('play');
|
1680 |
}, false);
|
1681 |
|
1682 |
|
1683 |
media.addEventListener('pause',function() {
|
1684 |
+
togglePlayPause('pse');
|
1685 |
}, false);
|
1686 |
media.addEventListener('paused',function() {
|
1687 |
+
togglePlayPause('pse');
|
1688 |
}, false);
|
1689 |
}
|
1690 |
});
|
1691 |
|
1692 |
})(mejs.$);
|
1693 |
+
|
1694 |
(function($) {
|
1695 |
|
1696 |
$.extend(mejs.MepDefaults, {
|
1700 |
// STOP BUTTON
|
1701 |
$.extend(MediaElementPlayer.prototype, {
|
1702 |
buildstop: function(player, controls, layers, media) {
|
1703 |
+
var t = this;
|
1704 |
+
|
1705 |
+
$('<div class="mejs-button mejs-stop-button mejs-stop">' +
|
1706 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.stopText + '" aria-label="' + t.options.stopText + '"></button>' +
|
1707 |
'</div>')
|
1708 |
.appendTo(controls)
|
1709 |
.click(function() {
|
1715 |
media.pause();
|
1716 |
controls.find('.mejs-time-current').width('0px');
|
1717 |
controls.find('.mejs-time-handle').css('left', '0px');
|
1718 |
+
controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0, player.options));
|
1719 |
+
controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0, player.options));
|
1720 |
layers.find('.mejs-poster').show();
|
1721 |
}
|
1722 |
});
|
1724 |
});
|
1725 |
|
1726 |
})(mejs.$);
|
1727 |
+
|
1728 |
(function($) {
|
1729 |
+
|
1730 |
+
$.extend(mejs.MepDefaults, {
|
1731 |
+
// Enable tooltip that shows time in progress bar
|
1732 |
+
enableProgressTooltip: true,
|
1733 |
+
progressHelpText: ''
|
1734 |
+
});
|
1735 |
+
|
1736 |
// progress/loaded bar
|
1737 |
$.extend(MediaElementPlayer.prototype, {
|
1738 |
buildprogress: function(player, controls, layers, media) {
|
1739 |
|
1740 |
+
var
|
1741 |
+
t = this,
|
1742 |
+
mouseIsDown = false,
|
1743 |
+
mouseIsOver = false,
|
1744 |
+
lastKeyPressTime = 0,
|
1745 |
+
startedPaused = false,
|
1746 |
+
autoRewindInitial = player.options.autoRewind,
|
1747 |
+
progressTitle = t.options.progressHelpText ? t.options.progressHelpText : mejs.i18n.t('mejs.time-help-text'),
|
1748 |
+
tooltip = player.options.enableProgressTooltip ? '<span class="mejs-time-float">' +
|
1749 |
+
'<span class="mejs-time-float-current">00:00</span>' +
|
1750 |
+
'<span class="mejs-time-float-corner"></span>' +
|
1751 |
+
'</span>' : "";
|
1752 |
+
|
1753 |
+
$('<div class="mejs-time-rail">' +
|
1754 |
+
'<span class="mejs-time-total mejs-time-slider">' +
|
1755 |
+
//'<span class="mejs-offscreen">' + progressTitle + '</span>' +
|
1756 |
+
'<span class="mejs-time-buffering"></span>' +
|
1757 |
+
'<span class="mejs-time-loaded"></span>' +
|
1758 |
+
'<span class="mejs-time-current"></span>' +
|
1759 |
+
'<span class="mejs-time-handle"></span>' +
|
1760 |
+
tooltip +
|
1761 |
+
'</span>' +
|
1762 |
'</div>')
|
1763 |
.appendTo(controls);
|
1764 |
+
controls.find('.mejs-time-buffering').hide();
|
1765 |
|
1766 |
+
t.total = controls.find('.mejs-time-total');
|
1767 |
+
t.loaded = controls.find('.mejs-time-loaded');
|
1768 |
+
t.current = controls.find('.mejs-time-current');
|
1769 |
+
t.handle = controls.find('.mejs-time-handle');
|
1770 |
+
t.timefloat = controls.find('.mejs-time-float');
|
1771 |
+
t.timefloatcurrent = controls.find('.mejs-time-float-current');
|
1772 |
+
t.slider = controls.find('.mejs-time-slider');
|
1773 |
+
|
1774 |
+
var handleMouseMove = function (e) {
|
1775 |
+
|
1776 |
+
var offset = t.total.offset(),
|
1777 |
+
width = t.total.width(),
|
|
|
1778 |
percentage = 0,
|
1779 |
newTime = 0,
|
1780 |
+
pos = 0,
|
1781 |
+
x;
|
1782 |
+
|
1783 |
+
// mouse or touch position relative to the object
|
1784 |
+
if (e.originalEvent && e.originalEvent.changedTouches) {
|
1785 |
+
x = e.originalEvent.changedTouches[0].pageX;
|
1786 |
+
} else if (e.changedTouches) { // for Zepto
|
1787 |
+
x = e.changedTouches[0].pageX;
|
1788 |
+
} else {
|
1789 |
+
x = e.pageX;
|
1790 |
+
}
|
1791 |
|
1792 |
if (media.duration) {
|
1793 |
if (x < offset.left) {
|
1795 |
} else if (x > width + offset.left) {
|
1796 |
x = width + offset.left;
|
1797 |
}
|
1798 |
+
|
1799 |
pos = x - offset.left;
|
1800 |
percentage = (pos / width);
|
1801 |
newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
|
1807 |
|
1808 |
// position floating time box
|
1809 |
if (!mejs.MediaFeatures.hasTouch) {
|
1810 |
+
t.timefloat.css('left', pos);
|
1811 |
+
t.timefloatcurrent.html( mejs.Utility.secondsToTimeCode(newTime, player.options) );
|
1812 |
+
t.timefloat.show();
|
1813 |
}
|
1814 |
}
|
1815 |
},
|
1816 |
+
// Accessibility for slider
|
1817 |
+
updateSlider = function (e) {
|
1818 |
+
|
1819 |
+
var seconds = media.currentTime,
|
1820 |
+
timeSliderText = mejs.i18n.t('mejs.time-slider'),
|
1821 |
+
time = mejs.Utility.secondsToTimeCode(seconds, player.options),
|
1822 |
+
duration = media.duration;
|
1823 |
+
|
1824 |
+
t.slider.attr({
|
1825 |
+
'aria-label': timeSliderText,
|
1826 |
+
'aria-valuemin': 0,
|
1827 |
+
'aria-valuemax': duration,
|
1828 |
+
'aria-valuenow': seconds,
|
1829 |
+
'aria-valuetext': time,
|
1830 |
+
'role': 'slider',
|
1831 |
+
'tabindex': 0
|
1832 |
+
});
|
1833 |
+
|
1834 |
+
},
|
1835 |
+
restartPlayer = function () {
|
1836 |
+
var now = new Date();
|
1837 |
+
if (now - lastKeyPressTime >= 1000) {
|
1838 |
+
media.play();
|
1839 |
+
}
|
1840 |
+
};
|
1841 |
+
|
1842 |
+
t.slider.bind('focus', function (e) {
|
1843 |
+
player.options.autoRewind = false;
|
1844 |
+
});
|
1845 |
+
|
1846 |
+
t.slider.bind('blur', function (e) {
|
1847 |
+
player.options.autoRewind = autoRewindInitial;
|
1848 |
+
});
|
1849 |
+
|
1850 |
+
t.slider.bind('keydown', function (e) {
|
1851 |
+
|
1852 |
+
if ((new Date() - lastKeyPressTime) >= 1000) {
|
1853 |
+
startedPaused = media.paused;
|
1854 |
+
}
|
1855 |
+
|
1856 |
+
var keyCode = e.keyCode,
|
1857 |
+
duration = media.duration,
|
1858 |
+
seekTime = media.currentTime,
|
1859 |
+
seekForward = player.options.defaultSeekForwardInterval(media),
|
1860 |
+
seekBackward = player.options.defaultSeekBackwardInterval(media);
|
1861 |
+
|
1862 |
+
switch (keyCode) {
|
1863 |
+
case 37: // left
|
1864 |
+
case 40: // Down
|
1865 |
+
seekTime -= seekBackward;
|
1866 |
+
break;
|
1867 |
+
case 39: // Right
|
1868 |
+
case 38: // Up
|
1869 |
+
seekTime += seekForward;
|
1870 |
+
break;
|
1871 |
+
case 36: // Home
|
1872 |
+
seekTime = 0;
|
1873 |
+
break;
|
1874 |
+
case 35: // end
|
1875 |
+
seekTime = duration;
|
1876 |
+
break;
|
1877 |
+
case 32: // space
|
1878 |
+
case 13: // enter
|
1879 |
+
media.paused ? media.play() : media.pause();
|
1880 |
+
return;
|
1881 |
+
default:
|
1882 |
+
return;
|
1883 |
+
}
|
1884 |
+
|
1885 |
+
seekTime = seekTime < 0 ? 0 : (seekTime >= duration ? duration : Math.floor(seekTime));
|
1886 |
+
lastKeyPressTime = new Date();
|
1887 |
+
if (!startedPaused) {
|
1888 |
+
media.pause();
|
1889 |
+
}
|
1890 |
+
|
1891 |
+
if (seekTime < media.duration && !startedPaused) {
|
1892 |
+
setTimeout(restartPlayer, 1100);
|
1893 |
+
}
|
1894 |
+
|
1895 |
+
media.setCurrentTime(seekTime);
|
1896 |
+
|
1897 |
+
e.preventDefault();
|
1898 |
+
e.stopPropagation();
|
1899 |
+
return false;
|
1900 |
+
});
|
1901 |
+
|
1902 |
|
1903 |
// handle clicks
|
1904 |
//controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
|
1905 |
+
t.total
|
1906 |
+
.bind('mousedown touchstart', function (e) {
|
1907 |
+
// only handle left clicks or touch
|
1908 |
+
if (e.which === 1 || e.which === 0) {
|
1909 |
mouseIsDown = true;
|
1910 |
handleMouseMove(e);
|
1911 |
+
t.globalBind('mousemove.dur touchmove.dur', function(e) {
|
1912 |
+
handleMouseMove(e);
|
1913 |
+
});
|
1914 |
+
t.globalBind('mouseup.dur touchend.dur', function (e) {
|
1915 |
+
mouseIsDown = false;
|
1916 |
+
if (typeof t.timefloat !== 'undefined') {
|
1917 |
+
t.timefloat.hide();
|
1918 |
+
}
|
1919 |
+
t.globalUnbind('.dur');
|
1920 |
+
});
|
1921 |
}
|
1922 |
})
|
1923 |
.bind('mouseenter', function(e) {
|
1924 |
mouseIsOver = true;
|
1925 |
+
t.globalBind('mousemove.dur', function(e) {
|
1926 |
handleMouseMove(e);
|
1927 |
});
|
1928 |
+
if (typeof t.timefloat !== 'undefined' && !mejs.MediaFeatures.hasTouch) {
|
1929 |
+
t.timefloat.show();
|
1930 |
}
|
1931 |
})
|
1932 |
.bind('mouseleave',function(e) {
|
1933 |
mouseIsOver = false;
|
1934 |
if (!mouseIsDown) {
|
1935 |
+
t.globalUnbind('.dur');
|
1936 |
+
if (typeof t.timefloat !== 'undefined') {
|
1937 |
+
t.timefloat.hide();
|
1938 |
+
}
|
1939 |
}
|
1940 |
});
|
1941 |
|
1949 |
media.addEventListener('timeupdate', function(e) {
|
1950 |
player.setProgressRail(e);
|
1951 |
player.setCurrentRail(e);
|
1952 |
+
updateSlider(e);
|
1953 |
}, false);
|
1954 |
+
|
1955 |
+
t.container.on('controlsresize', function(e) {
|
1956 |
+
player.setProgressRail(e);
|
1957 |
+
player.setCurrentRail(e);
|
1958 |
+
});
|
|
|
|
|
1959 |
},
|
1960 |
setProgressRail: function(e) {
|
1961 |
|
1962 |
var
|
1963 |
t = this,
|
1964 |
+
target = (e !== undefined) ? e.target : t.media,
|
1965 |
+
percent = null;
|
1966 |
|
1967 |
// newest HTML5 spec has buffered array (FF4, Webkit)
|
1968 |
if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
|
1969 |
+
// account for a real array with multiple values - always read the end of the last buffer
|
1970 |
+
percent = target.buffered.end(target.buffered.length - 1) / target.duration;
|
1971 |
}
|
1972 |
// Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
|
1973 |
// to be anything other than 0. If the byte count is available we use this instead.
|
1974 |
// Browsers that support the else if do not seem to have the bufferedBytes value and
|
1975 |
// should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
|
1976 |
+
else if (target && target.bytesTotal !== undefined && target.bytesTotal > 0 && target.bufferedBytes !== undefined) {
|
1977 |
percent = target.bufferedBytes / target.bytesTotal;
|
1978 |
}
|
1979 |
// Firefox 3 with an Ogg file seems to go this way
|
1980 |
+
else if (e && e.lengthComputable && e.total !== 0) {
|
1981 |
+
percent = e.loaded / e.total;
|
1982 |
}
|
1983 |
|
1984 |
// finally update the progress bar
|
1994 |
|
1995 |
var t = this;
|
1996 |
|
1997 |
+
if (t.media.currentTime !== undefined && t.media.duration) {
|
1998 |
|
1999 |
// update bar and handle
|
2000 |
if (t.total && t.handle) {
|
2001 |
var
|
2002 |
+
newWidth = Math.round(t.total.width() * t.media.currentTime / t.media.duration),
|
2003 |
+
handlePos = newWidth - Math.round(t.handle.outerWidth(true) / 2);
|
2004 |
|
2005 |
t.current.width(newWidth);
|
2006 |
t.handle.css('left', handlePos);
|
2007 |
}
|
2008 |
}
|
2009 |
|
2010 |
+
}
|
2011 |
});
|
2012 |
})(mejs.$);
|
2013 |
|
2016 |
// options
|
2017 |
$.extend(mejs.MepDefaults, {
|
2018 |
duration: -1,
|
2019 |
+
timeAndDurationSeparator: '<span> | </span>'
|
2020 |
});
|
2021 |
|
2022 |
|
2025 |
buildcurrent: function(player, controls, layers, media) {
|
2026 |
var t = this;
|
2027 |
|
2028 |
+
$('<div class="mejs-time" role="timer" aria-live="off">' +
|
2029 |
+
'<span class="mejs-currenttime">' +
|
2030 |
+
mejs.Utility.secondsToTimeCode(0, player.options) +
|
2031 |
+
'</span>'+
|
2032 |
+
'</div>')
|
2033 |
+
.appendTo(controls);
|
2034 |
|
2035 |
t.currenttime = t.controls.find('.mejs-currenttime');
|
2036 |
|
2037 |
media.addEventListener('timeupdate',function() {
|
2038 |
+
if (t.controlsAreVisible) {
|
2039 |
+
player.updateCurrent();
|
2040 |
+
}
|
2041 |
+
|
2042 |
}, false);
|
2043 |
},
|
2044 |
|
2049 |
if (controls.children().last().find('.mejs-currenttime').length > 0) {
|
2050 |
$(t.options.timeAndDurationSeparator +
|
2051 |
'<span class="mejs-duration">' +
|
2052 |
+
mejs.Utility.secondsToTimeCode(t.options.duration, t.options) +
|
|
|
|
|
|
|
2053 |
'</span>')
|
2054 |
.appendTo(controls.find('.mejs-time'));
|
2055 |
} else {
|
2059 |
|
2060 |
$('<div class="mejs-time mejs-duration-container">'+
|
2061 |
'<span class="mejs-duration">' +
|
2062 |
+
mejs.Utility.secondsToTimeCode(t.options.duration, t.options) +
|
|
|
|
|
|
|
2063 |
'</span>' +
|
2064 |
'</div>')
|
2065 |
.appendTo(controls);
|
2068 |
t.durationD = t.controls.find('.mejs-duration');
|
2069 |
|
2070 |
media.addEventListener('timeupdate',function() {
|
2071 |
+
if (t.controlsAreVisible) {
|
2072 |
+
player.updateDuration();
|
2073 |
+
}
|
2074 |
}, false);
|
2075 |
},
|
2076 |
|
2077 |
updateCurrent: function() {
|
2078 |
var t = this;
|
2079 |
+
|
2080 |
+
var currentTime = t.media.currentTime;
|
2081 |
+
|
2082 |
+
if (isNaN(currentTime)) {
|
2083 |
+
currentTime = 0;
|
2084 |
+
}
|
2085 |
|
2086 |
if (t.currenttime) {
|
2087 |
+
t.currenttime.html(mejs.Utility.secondsToTimeCode(currentTime, t.options));
|
2088 |
}
|
2089 |
},
|
2090 |
|
2091 |
+
updateDuration: function() {
|
2092 |
var t = this;
|
2093 |
+
|
2094 |
+
var duration = t.media.duration;
|
2095 |
+
if (t.options.duration > 0) {
|
2096 |
+
duration = t.options.duration;
|
2097 |
+
}
|
2098 |
+
|
2099 |
+
if (isNaN(duration)) {
|
2100 |
+
duration = 0;
|
2101 |
+
}
|
2102 |
|
2103 |
//Toggle the long video class if the video is longer than an hour.
|
2104 |
+
t.container.toggleClass("mejs-long-video", duration > 3600);
|
2105 |
|
2106 |
+
if (t.durationD && duration > 0) {
|
2107 |
+
t.durationD.html(mejs.Utility.secondsToTimeCode(duration, t.options));
|
2108 |
}
|
2109 |
}
|
2110 |
});
|
2111 |
|
2112 |
})(mejs.$);
|
2113 |
+
|
2114 |
+
(function ($) {
|
2115 |
|
2116 |
$.extend(mejs.MepDefaults, {
|
2117 |
+
muteText: mejs.i18n.t('mejs.mute-toggle'),
|
2118 |
+
allyVolumeControlText: mejs.i18n.t('mejs.volume-help-text'),
|
2119 |
hideVolumeOnTouchDevices: true,
|
2120 |
+
|
2121 |
audioVolume: 'horizontal',
|
2122 |
videoVolume: 'vertical'
|
2123 |
});
|
2124 |
|
2125 |
$.extend(MediaElementPlayer.prototype, {
|
2126 |
+
buildvolume: function (player, controls, layers, media) {
|
2127 |
+
|
2128 |
// Android and iOS don't support volume controls
|
2129 |
+
if ((mejs.MediaFeatures.isAndroid || mejs.MediaFeatures.isiOS) && this.options.hideVolumeOnTouchDevices)
|
2130 |
return;
|
2131 |
+
|
2132 |
var t = this,
|
2133 |
mode = (t.isVideo) ? t.options.videoVolume : t.options.audioVolume,
|
2134 |
mute = (mode == 'horizontal') ?
|
2135 |
+
|
2136 |
+
// horizontal version
|
2137 |
+
$('<div class="mejs-button mejs-volume-button mejs-mute">' +
|
2138 |
+
'<button type="button" aria-controls="' + t.id +
|
2139 |
+
'" title="' + t.options.muteText +
|
2140 |
+
'" aria-label="' + t.options.muteText +
|
2141 |
+
'"></button>' +
|
2142 |
+
'</div>' +
|
2143 |
+
'<a href="javascript:void(0);" class="mejs-horizontal-volume-slider">' + // outer background
|
2144 |
+
'<span class="mejs-offscreen">' + t.options.allyVolumeControlText + '</span>' +
|
2145 |
+
'<div class="mejs-horizontal-volume-total"></div>' + // line background
|
2146 |
+
'<div class="mejs-horizontal-volume-current"></div>' + // current volume
|
2147 |
+
'<div class="mejs-horizontal-volume-handle"></div>' + // handle
|
2148 |
+
'</a>'
|
2149 |
+
)
|
2150 |
.appendTo(controls) :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2151 |
|
2152 |
+
// vertical version
|
2153 |
+
$('<div class="mejs-button mejs-volume-button mejs-mute">' +
|
2154 |
+
'<button type="button" aria-controls="' + t.id +
|
2155 |
+
'" title="' + t.options.muteText +
|
2156 |
+
'" aria-label="' + t.options.muteText +
|
2157 |
+
'"></button>' +
|
2158 |
+
'<a href="javascript:void(0);" class="mejs-volume-slider">' + // outer background
|
2159 |
+
'<span class="mejs-offscreen">' + t.options.allyVolumeControlText + '</span>' +
|
2160 |
+
'<div class="mejs-volume-total"></div>' + // line background
|
2161 |
+
'<div class="mejs-volume-current"></div>' + // current volume
|
2162 |
+
'<div class="mejs-volume-handle"></div>' + // handle
|
2163 |
+
'</a>' +
|
2164 |
+
'</div>')
|
2165 |
+
.appendTo(controls),
|
2166 |
+
volumeSlider = t.container.find('.mejs-volume-slider, .mejs-horizontal-volume-slider'),
|
2167 |
+
volumeTotal = t.container.find('.mejs-volume-total, .mejs-horizontal-volume-total'),
|
2168 |
+
volumeCurrent = t.container.find('.mejs-volume-current, .mejs-horizontal-volume-current'),
|
2169 |
+
volumeHandle = t.container.find('.mejs-volume-handle, .mejs-horizontal-volume-handle'),
|
2170 |
|
2171 |
+
positionVolumeHandle = function (volume, secondTry) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2172 |
|
2173 |
+
if (!volumeSlider.is(':visible') && typeof secondTry == 'undefined') {
|
2174 |
+
volumeSlider.show();
|
2175 |
+
positionVolumeHandle(volume, true);
|
2176 |
+
volumeSlider.hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2177 |
return;
|
2178 |
+
}
|
2179 |
+
|
2180 |
+
// correct to 0-1
|
2181 |
+
volume = Math.max(0, volume);
|
2182 |
+
volume = Math.min(volume, 1);
|
2183 |
+
|
2184 |
+
// adjust mute button style
|
2185 |
+
if (volume === 0) {
|
2186 |
+
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
2187 |
+
mute.children('button').attr('title', mejs.i18n.t('mejs.unmute')).attr('aria-label', mejs.i18n.t('mejs.unmute'));
|
2188 |
+
} else {
|
2189 |
+
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
2190 |
+
mute.children('button').attr('title', mejs.i18n.t('mejs.mute')).attr('aria-label', mejs.i18n.t('mejs.mute'));
|
2191 |
+
}
|
2192 |
+
|
2193 |
+
// top/left of full size volume slider background
|
2194 |
+
var totalPosition = volumeTotal.position();
|
2195 |
+
// position slider
|
2196 |
+
if (mode == 'vertical') {
|
2197 |
+
var
|
2198 |
+
// height of the full size volume slider background
|
2199 |
+
totalHeight = volumeTotal.height(),
|
2200 |
+
|
2201 |
+
// the new top position based on the current volume
|
2202 |
+
// 70% volume on 100px height == top:30px
|
2203 |
+
newTop = totalHeight - (totalHeight * volume);
|
2204 |
+
|
2205 |
+
// handle
|
2206 |
+
volumeHandle.css('top', Math.round(totalPosition.top + newTop - (volumeHandle.height() / 2)));
|
2207 |
+
|
2208 |
+
// show the current visibility
|
2209 |
+
volumeCurrent.height(totalHeight - newTop);
|
2210 |
+
volumeCurrent.css('top', totalPosition.top + newTop);
|
2211 |
+
} else {
|
2212 |
+
var
|
2213 |
+
// height of the full size volume slider background
|
2214 |
+
totalWidth = volumeTotal.width(),
|
2215 |
+
|
2216 |
+
// the new left position based on the current volume
|
2217 |
+
newLeft = totalWidth * volume;
|
2218 |
+
|
2219 |
+
// handle
|
2220 |
+
volumeHandle.css('left', Math.round(totalPosition.left + newLeft - (volumeHandle.width() / 2)));
|
2221 |
+
|
2222 |
+
// rezize the current part of the volume bar
|
2223 |
+
volumeCurrent.width(Math.round(newLeft));
|
2224 |
+
}
|
2225 |
+
},
|
2226 |
+
handleVolumeMove = function (e) {
|
2227 |
+
|
2228 |
+
var volume = null,
|
2229 |
+
totalOffset = volumeTotal.offset();
|
2230 |
+
|
2231 |
+
// calculate the new volume based on the moust position
|
2232 |
+
if (mode === 'vertical') {
|
2233 |
+
|
2234 |
+
var
|
2235 |
+
railHeight = volumeTotal.height(),
|
2236 |
+
newY = e.pageY - totalOffset.top;
|
2237 |
+
|
2238 |
+
volume = (railHeight - newY) / railHeight;
|
2239 |
+
|
2240 |
+
// the controls just hide themselves (usually when mouse moves too far up)
|
2241 |
+
if (totalOffset.top === 0 || totalOffset.left === 0) {
|
2242 |
+
return;
|
2243 |
+
}
|
2244 |
+
|
2245 |
+
} else {
|
2246 |
+
var
|
2247 |
+
railWidth = volumeTotal.width(),
|
2248 |
+
newX = e.pageX - totalOffset.left;
|
2249 |
+
|
2250 |
+
volume = newX / railWidth;
|
2251 |
+
}
|
2252 |
+
|
2253 |
+
// ensure the volume isn't outside 0-1
|
2254 |
+
volume = Math.max(0, volume);
|
2255 |
+
volume = Math.min(volume, 1);
|
2256 |
+
|
2257 |
+
// position the slider and handle
|
2258 |
+
positionVolumeHandle(volume);
|
2259 |
+
|
2260 |
+
// set the media object (this will trigger the volumechanged event)
|
2261 |
+
if (volume === 0) {
|
2262 |
+
media.setMuted(true);
|
2263 |
+
} else {
|
2264 |
+
media.setMuted(false);
|
2265 |
+
}
|
2266 |
+
media.setVolume(volume);
|
2267 |
+
},
|
2268 |
+
mouseIsDown = false,
|
2269 |
+
mouseIsOver = false;
|
2270 |
|
2271 |
// SLIDER
|
2272 |
+
|
2273 |
mute
|
2274 |
+
.hover(function () {
|
2275 |
+
volumeSlider.show();
|
2276 |
+
mouseIsOver = true;
|
2277 |
+
}, function () {
|
2278 |
+
mouseIsOver = false;
|
2279 |
+
|
2280 |
+
if (!mouseIsDown && mode == 'vertical') {
|
2281 |
+
volumeSlider.hide();
|
2282 |
+
}
|
2283 |
+
});
|
2284 |
+
|
2285 |
+
var updateVolumeSlider = function (e) {
|
2286 |
+
|
2287 |
+
var volume = Math.floor(media.volume * 100);
|
2288 |
+
|
2289 |
+
volumeSlider.attr({
|
2290 |
+
'aria-label': mejs.i18n.t('mejs.volume-slider'),
|
2291 |
+
'aria-valuemin': 0,
|
2292 |
+
'aria-valuemax': 100,
|
2293 |
+
'aria-valuenow': volume,
|
2294 |
+
'aria-valuetext': volume + '%',
|
2295 |
+
'role': 'slider',
|
2296 |
+
'tabindex': 0
|
2297 |
});
|
2298 |
+
|
2299 |
+
};
|
2300 |
+
|
2301 |
volumeSlider
|
2302 |
+
.bind('mouseover', function () {
|
2303 |
+
mouseIsOver = true;
|
2304 |
+
})
|
2305 |
+
.bind('mousedown', function (e) {
|
2306 |
+
handleVolumeMove(e);
|
2307 |
+
t.globalBind('mousemove.vol', function (e) {
|
2308 |
handleVolumeMove(e);
|
2309 |
+
});
|
2310 |
+
t.globalBind('mouseup.vol', function () {
|
2311 |
+
mouseIsDown = false;
|
2312 |
+
t.globalUnbind('.vol');
|
|
|
|
|
|
|
2313 |
|
2314 |
+
if (!mouseIsOver && mode == 'vertical') {
|
2315 |
+
volumeSlider.hide();
|
2316 |
+
}
|
|
|
|
|
|
|
|
|
2317 |
});
|
2318 |
+
mouseIsDown = true;
|
2319 |
+
|
2320 |
+
return false;
|
2321 |
+
})
|
2322 |
+
.bind('keydown', function (e) {
|
2323 |
+
var keyCode = e.keyCode;
|
2324 |
+
var volume = media.volume;
|
2325 |
+
switch (keyCode) {
|
2326 |
+
case 38: // Up
|
2327 |
+
volume = Math.min(volume + 0.1, 1);
|
2328 |
+
break;
|
2329 |
+
case 40: // Down
|
2330 |
+
volume = Math.max(0, volume - 0.1);
|
2331 |
+
break;
|
2332 |
+
default:
|
2333 |
+
return true;
|
2334 |
+
}
|
2335 |
|
2336 |
+
mouseIsDown = false;
|
2337 |
+
positionVolumeHandle(volume);
|
2338 |
+
media.setVolume(volume);
|
2339 |
+
return false;
|
2340 |
+
});
|
2341 |
|
2342 |
// MUTE button
|
2343 |
+
mute.find('button').click(function () {
|
2344 |
+
media.setMuted(!media.muted);
|
2345 |
+
});
|
2346 |
+
|
2347 |
+
//Keyboard input
|
2348 |
+
mute.find('button').bind('focus', function () {
|
2349 |
+
volumeSlider.show();
|
2350 |
});
|
2351 |
|
2352 |
// listen for volume change events from other sources
|
2353 |
+
media.addEventListener('volumechange', function (e) {
|
2354 |
if (!mouseIsDown) {
|
2355 |
if (media.muted) {
|
2356 |
positionVolumeHandle(0);
|
2360 |
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
2361 |
}
|
2362 |
}
|
2363 |
+
updateVolumeSlider(e);
|
2364 |
}, false);
|
2365 |
|
2366 |
+
// mutes the media and sets the volume icon muted if the initial volume is set to 0
|
2367 |
+
if (player.options.startVolume === 0) {
|
2368 |
+
media.setMuted(true);
|
2369 |
+
}
|
2370 |
+
|
2371 |
+
// shim gets the startvolume as a parameter, but we have to set it on the native <video> and <audio> elements
|
2372 |
+
if (media.pluginType === 'native') {
|
2373 |
+
media.setVolume(player.options.startVolume);
|
2374 |
}
|
2375 |
+
|
2376 |
+
t.container.on('controlsresize', function () {
|
2377 |
+
if (media.muted) {
|
2378 |
+
positionVolumeHandle(0);
|
2379 |
+
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
2380 |
+
} else {
|
2381 |
+
positionVolumeHandle(media.volume);
|
2382 |
+
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
2383 |
+
}
|
2384 |
+
});
|
2385 |
}
|
2386 |
});
|
2387 |
+
|
2388 |
})(mejs.$);
|
2389 |
|
2390 |
(function($) {
|
2392 |
$.extend(mejs.MepDefaults, {
|
2393 |
usePluginFullScreen: true,
|
2394 |
newWindowCallback: function() { return '';},
|
2395 |
+
fullscreenText: ''
|
2396 |
});
|
2397 |
|
2398 |
$.extend(MediaElementPlayer.prototype, {
|
2401 |
|
2402 |
isNativeFullScreen: false,
|
2403 |
|
|
|
|
|
2404 |
isInIframe: false,
|
2405 |
+
|
2406 |
+
// Possible modes
|
2407 |
+
// (1) 'native-native' HTML5 video + browser fullscreen (IE10+, etc.)
|
2408 |
+
// (2) 'plugin-native' plugin video + browser fullscreen (fails in some versions of Firefox)
|
2409 |
+
// (3) 'fullwindow' Full window (retains all UI)
|
2410 |
+
// usePluginFullScreen = true
|
2411 |
+
// (4) 'plugin-click' Flash 1 - click through with pointer events
|
2412 |
+
// (5) 'plugin-hover' Flash 2 - hover popup in flash (IE6-8)
|
2413 |
+
fullscreenMode: '',
|
2414 |
|
2415 |
buildfullscreen: function(player, controls, layers, media) {
|
2416 |
|
2417 |
if (!player.isVideo)
|
2418 |
return;
|
2419 |
+
|
2420 |
+
player.isInIframe = (window.location != window.parent.location);
|
2421 |
+
|
2422 |
+
// detect on start
|
2423 |
+
media.addEventListener('loadstart', function() { player.detectFullscreenMode(); });
|
2424 |
+
|
2425 |
+
// build button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2426 |
var t = this,
|
2427 |
+
hideTimeout = null,
|
2428 |
+
fullscreenTitle = t.options.fullscreenText ? t.options.fullscreenText : mejs.i18n.t('mejs.fullscreen'),
|
|
|
2429 |
fullscreenBtn =
|
2430 |
$('<div class="mejs-button mejs-fullscreen-button">' +
|
2431 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + fullscreenTitle + '" aria-label="' + fullscreenTitle + '"></button>' +
|
2432 |
'</div>')
|
2433 |
+
.appendTo(controls)
|
2434 |
+
.on('click', function() {
|
2435 |
+
|
2436 |
+
// toggle fullscreen
|
|
|
2437 |
var isFullScreen = (mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || player.isFullScreen;
|
2438 |
+
|
2439 |
if (isFullScreen) {
|
2440 |
player.exitFullScreen();
|
2441 |
} else {
|
2442 |
player.enterFullScreen();
|
2443 |
}
|
2444 |
+
})
|
2445 |
+
.on('mouseover', function() {
|
2446 |
+
|
2447 |
+
// very old browsers with a plugin
|
2448 |
+
if (t.fullscreenMode == 'plugin-hover') {
|
2449 |
+
if (hideTimeout !== null) {
|
2450 |
+
clearTimeout(hideTimeout);
|
2451 |
+
delete hideTimeout;
|
2452 |
+
}
|
2453 |
+
|
2454 |
+
var buttonPos = fullscreenBtn.offset(),
|
2455 |
+
containerPos = player.container.offset();
|
2456 |
+
|
2457 |
+
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, true);
|
2458 |
+
}
|
2459 |
|
2460 |
+
})
|
2461 |
+
.on('mouseout', function() {
|
2462 |
|
2463 |
+
if (t.fullscreenMode == 'plugin-hover') {
|
2464 |
+
if (hideTimeout !== null) {
|
2465 |
+
clearTimeout(hideTimeout);
|
2466 |
+
delete hideTimeout;
|
|
|
|
|
|
|
|
|
|
|
2467 |
}
|
2468 |
+
|
2469 |
+
hideTimeout = setTimeout(function() {
|
2470 |
+
media.hideFullscreenButton();
|
2471 |
+
}, 1500);
|
2472 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2473 |
|
2474 |
+
});
|
|
|
|
|
2475 |
|
2476 |
+
|
|
|
|
|
2477 |
|
2478 |
+
player.fullscreenBtn = fullscreenBtn;
|
2479 |
|
2480 |
+
t.globalBind('keydown',function (e) {
|
2481 |
+
if (e.keyCode == 27 && ((mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || t.isFullScreen)) {
|
2482 |
+
player.exitFullScreen();
|
2483 |
+
}
|
2484 |
+
});
|
2485 |
+
|
2486 |
+
t.normalHeight = 0;
|
2487 |
+
t.normalWidth = 0;
|
2488 |
+
|
2489 |
+
// setup native fullscreen event
|
2490 |
+
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
2491 |
|
2492 |
+
// chrome doesn't alays fire this in an iframe
|
2493 |
+
var fullscreenChanged = function(e) {
|
2494 |
+
if (player.isFullScreen) {
|
2495 |
+
if (mejs.MediaFeatures.isFullScreen()) {
|
2496 |
+
player.isNativeFullScreen = true;
|
2497 |
+
// reset the controls once we are fully in full screen
|
2498 |
+
player.setControlsSize();
|
2499 |
+
} else {
|
2500 |
+
player.isNativeFullScreen = false;
|
2501 |
+
// when a user presses ESC
|
2502 |
+
// make sure to put the player back into place
|
2503 |
+
player.exitFullScreen();
|
2504 |
+
}
|
2505 |
+
}
|
2506 |
+
};
|
2507 |
|
2508 |
+
player.globalBind(mejs.MediaFeatures.fullScreenEventName, fullscreenChanged);
|
2509 |
+
}
|
|
|
2510 |
|
2511 |
+
},
|
2512 |
+
|
2513 |
+
detectFullscreenMode: function() {
|
2514 |
+
|
2515 |
+
var t = this,
|
2516 |
+
mode = '',
|
2517 |
+
features = mejs.MediaFeatures;
|
2518 |
+
|
2519 |
+
if (features.hasTrueNativeFullScreen && t.media.pluginType === 'native') {
|
2520 |
+
mode = 'native-native';
|
2521 |
+
} else if (features.hasTrueNativeFullScreen && t.media.pluginType !== 'native' && !features.hasFirefoxPluginMovingProblem) {
|
2522 |
+
mode = 'plugin-native';
|
2523 |
+
} else if (t.usePluginFullScreen) {
|
2524 |
+
if (mejs.MediaFeatures.supportsPointerEvents) {
|
2525 |
+
mode = 'plugin-click';
|
2526 |
+
// this needs some special setup
|
2527 |
+
t.createPluginClickThrough();
|
2528 |
+
} else {
|
2529 |
+
mode = 'plugin-hover';
|
2530 |
+
}
|
2531 |
+
|
2532 |
+
} else {
|
2533 |
+
mode = 'fullwindow';
|
2534 |
+
}
|
2535 |
+
|
2536 |
+
|
2537 |
+
t.fullscreenMode = mode;
|
2538 |
+
return mode;
|
2539 |
+
},
|
2540 |
+
|
2541 |
+
isPluginClickThroughCreated: false,
|
2542 |
+
|
2543 |
+
createPluginClickThrough: function() {
|
2544 |
+
|
2545 |
+
var t = this;
|
2546 |
+
|
2547 |
+
// don't build twice
|
2548 |
+
if (t.isPluginClickThroughCreated) {
|
2549 |
+
return;
|
2550 |
+
}
|
2551 |
|
2552 |
+
// allows clicking through the fullscreen button and controls down directly to Flash
|
|
|
2553 |
|
2554 |
+
/*
|
2555 |
+
When a user puts his mouse over the fullscreen button, we disable the controls so that mouse events can go down to flash (pointer-events)
|
2556 |
+
We then put a divs over the video and on either side of the fullscreen button
|
2557 |
+
to capture mouse movement and restore the controls once the mouse moves outside of the fullscreen button
|
2558 |
+
*/
|
2559 |
|
2560 |
+
var fullscreenIsDisabled = false,
|
2561 |
+
restoreControls = function() {
|
2562 |
+
if (fullscreenIsDisabled) {
|
2563 |
+
// hide the hovers
|
2564 |
+
for (var i in hoverDivs) {
|
2565 |
+
hoverDivs[i].hide();
|
2566 |
+
}
|
2567 |
|
2568 |
+
// restore the control bar
|
2569 |
+
t.fullscreenBtn.css('pointer-events', '');
|
2570 |
+
t.controls.css('pointer-events', '');
|
2571 |
|
2572 |
+
// prevent clicks from pausing video
|
2573 |
+
t.media.removeEventListener('click', t.clickToPlayPauseCallback);
|
|
|
|
|
2574 |
|
2575 |
+
// store for later
|
2576 |
+
fullscreenIsDisabled = false;
|
2577 |
+
}
|
2578 |
+
},
|
2579 |
+
hoverDivs = {},
|
2580 |
+
hoverDivNames = ['top', 'left', 'right', 'bottom'],
|
2581 |
+
i, len,
|
2582 |
+
positionHoverDivs = function() {
|
2583 |
+
var fullScreenBtnOffsetLeft = fullscreenBtn.offset().left - t.container.offset().left,
|
2584 |
+
fullScreenBtnOffsetTop = fullscreenBtn.offset().top - t.container.offset().top,
|
2585 |
+
fullScreenBtnWidth = fullscreenBtn.outerWidth(true),
|
2586 |
+
fullScreenBtnHeight = fullscreenBtn.outerHeight(true),
|
2587 |
+
containerWidth = t.container.width(),
|
2588 |
+
containerHeight = t.container.height();
|
2589 |
+
|
2590 |
+
for (i in hoverDivs) {
|
2591 |
+
hoverDivs[i].css({position: 'absolute', top: 0, left: 0}); //, backgroundColor: '#f00'});
|
2592 |
+
}
|
2593 |
|
2594 |
+
// over video, but not controls
|
2595 |
+
hoverDivs['top']
|
2596 |
+
.width( containerWidth )
|
2597 |
+
.height( fullScreenBtnOffsetTop );
|
2598 |
+
|
2599 |
+
// over controls, but not the fullscreen button
|
2600 |
+
hoverDivs['left']
|
2601 |
+
.width( fullScreenBtnOffsetLeft )
|
2602 |
+
.height( fullScreenBtnHeight )
|
2603 |
+
.css({top: fullScreenBtnOffsetTop});
|
2604 |
+
|
2605 |
+
// after the fullscreen button
|
2606 |
+
hoverDivs['right']
|
2607 |
+
.width( containerWidth - fullScreenBtnOffsetLeft - fullScreenBtnWidth )
|
2608 |
+
.height( fullScreenBtnHeight )
|
2609 |
+
.css({top: fullScreenBtnOffsetTop,
|
2610 |
+
left: fullScreenBtnOffsetLeft + fullScreenBtnWidth});
|
2611 |
+
|
2612 |
+
// under the fullscreen button
|
2613 |
+
hoverDivs['bottom']
|
2614 |
+
.width( containerWidth )
|
2615 |
+
.height( containerHeight - fullScreenBtnHeight - fullScreenBtnOffsetTop )
|
2616 |
+
.css({top: fullScreenBtnOffsetTop + fullScreenBtnHeight});
|
2617 |
+
};
|
2618 |
|
2619 |
+
t.globalBind('resize', function() {
|
2620 |
+
positionHoverDivs();
|
2621 |
+
});
|
2622 |
|
2623 |
+
for (i = 0, len = hoverDivNames.length; i < len; i++) {
|
2624 |
+
hoverDivs[hoverDivNames[i]] = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls).hide();
|
2625 |
+
}
|
2626 |
|
2627 |
+
// on hover, kill the fullscreen button's HTML handling, allowing clicks down to Flash
|
2628 |
+
fullscreenBtn.on('mouseover',function() {
|
2629 |
|
2630 |
+
if (!t.isFullScreen) {
|
|
|
|
|
|
|
|
|
2631 |
|
2632 |
+
var buttonPos = fullscreenBtn.offset(),
|
2633 |
+
containerPos = player.container.offset();
|
2634 |
|
2635 |
+
// move the button in Flash into place
|
2636 |
+
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, false);
|
2637 |
|
2638 |
+
// allows click through
|
2639 |
+
t.fullscreenBtn.css('pointer-events', 'none');
|
2640 |
+
t.controls.css('pointer-events', 'none');
|
2641 |
|
2642 |
+
// restore click-to-play
|
2643 |
+
t.media.addEventListener('click', t.clickToPlayPauseCallback);
|
2644 |
|
2645 |
+
// show the divs that will restore things
|
2646 |
+
for (i in hoverDivs) {
|
2647 |
+
hoverDivs[i].show();
|
2648 |
+
}
|
2649 |
|
2650 |
+
positionHoverDivs();
|
|
|
2651 |
|
2652 |
+
fullscreenIsDisabled = true;
|
2653 |
+
}
|
2654 |
|
2655 |
+
});
|
|
|
2656 |
|
2657 |
+
// restore controls anytime the user enters or leaves fullscreen
|
2658 |
+
media.addEventListener('fullscreenchange', function(e) {
|
2659 |
+
t.isFullScreen = !t.isFullScreen;
|
2660 |
+
// don't allow plugin click to pause video - messes with
|
2661 |
+
// plugin's controls
|
2662 |
+
if (t.isFullScreen) {
|
2663 |
+
t.media.removeEventListener('click', t.clickToPlayPauseCallback);
|
2664 |
+
} else {
|
2665 |
+
t.media.addEventListener('click', t.clickToPlayPauseCallback);
|
2666 |
+
}
|
2667 |
+
restoreControls();
|
2668 |
+
});
|
2669 |
|
|
|
|
|
|
|
2670 |
|
2671 |
+
// the mouseout event doesn't work on the fullscren button, because we already killed the pointer-events
|
2672 |
+
// so we use the document.mousemove event to restore controls when the mouse moves outside the fullscreen button
|
2673 |
|
2674 |
+
t.globalBind('mousemove', function(e) {
|
|
|
|
|
2675 |
|
2676 |
+
// if the mouse is anywhere but the fullsceen button, then restore it all
|
2677 |
+
if (fullscreenIsDisabled) {
|
2678 |
|
2679 |
+
var fullscreenBtnPos = fullscreenBtn.offset();
|
2680 |
+
|
2681 |
+
|
2682 |
+
if (e.pageY < fullscreenBtnPos.top || e.pageY > fullscreenBtnPos.top + fullscreenBtn.outerHeight(true) ||
|
2683 |
+
e.pageX < fullscreenBtnPos.left || e.pageX > fullscreenBtnPos.left + fullscreenBtn.outerWidth(true)
|
2684 |
+
) {
|
2685 |
+
|
2686 |
+
fullscreenBtn.css('pointer-events', '');
|
2687 |
+
t.controls.css('pointer-events', '');
|
2688 |
+
|
2689 |
+
fullscreenIsDisabled = false;
|
2690 |
+
}
|
2691 |
}
|
2692 |
});
|
2693 |
|
2694 |
+
|
2695 |
+
t.isPluginClickThroughCreated = true;
|
2696 |
+
},
|
2697 |
+
|
2698 |
+
cleanfullscreen: function(player) {
|
2699 |
+
player.exitFullScreen();
|
2700 |
},
|
2701 |
+
|
2702 |
+
containerSizeTimeout: null,
|
2703 |
+
|
2704 |
enterFullScreen: function() {
|
2705 |
|
2706 |
var t = this;
|
2707 |
|
2708 |
+
if (mejs.MediaFeatures.isiOS && mejs.MediaFeatures.hasiOSFullScreen && typeof t.media.webkitEnterFullscreen === 'function') {
|
2709 |
+
t.media.webkitEnterFullscreen();
|
|
|
|
|
2710 |
return;
|
2711 |
}
|
2712 |
|
|
|
|
|
2713 |
// set it to not show scroll bars so 100% will work
|
2714 |
+
$(document.documentElement).addClass('mejs-fullscreen');
|
2715 |
|
2716 |
// store sizing
|
2717 |
+
t.normalHeight = t.container.height();
|
2718 |
+
t.normalWidth = t.container.width();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2719 |
|
2720 |
|
|
|
|
|
2721 |
|
2722 |
+
// attempt to do true fullscreen
|
2723 |
+
if (t.fullscreenMode === 'native-native' || t.fullscreenMode === 'plugin-native') {
|
|
|
|
|
|
|
2724 |
|
2725 |
+
mejs.MediaFeatures.requestFullScreen(t.container[0]);
|
2726 |
+
//return;
|
|
|
2727 |
|
2728 |
+
if (t.isInIframe) {
|
2729 |
+
// sometimes exiting from fullscreen doesn't work
|
2730 |
+
// notably in Chrome <iframe>. Fixed in version 17
|
2731 |
+
setTimeout(function checkFullscreen() {
|
2732 |
|
2733 |
+
if (t.isNativeFullScreen) {
|
2734 |
+
var percentErrorMargin = 0.002, // 0.2%
|
2735 |
+
windowWidth = $(window).width(),
|
2736 |
+
screenWidth = screen.width,
|
2737 |
+
absDiff = Math.abs(screenWidth - windowWidth),
|
2738 |
+
marginError = screenWidth * percentErrorMargin;
|
2739 |
|
2740 |
+
// check if the video is suddenly not really fullscreen
|
2741 |
+
if (absDiff > marginError) {
|
2742 |
+
// manually exit
|
2743 |
+
t.exitFullScreen();
|
2744 |
+
} else {
|
2745 |
+
// test again
|
2746 |
+
setTimeout(checkFullscreen, 500);
|
|
|
|
|
|
|
2747 |
}
|
2748 |
+
}
|
2749 |
+
|
2750 |
+
}, 1000);
|
2751 |
}
|
2752 |
+
|
2753 |
+
} else if (t.fullscreeMode == 'fullwindow') {
|
2754 |
+
// move into position
|
2755 |
+
|
2756 |
+
}
|
2757 |
+
|
|
|
2758 |
// make full size
|
2759 |
t.container
|
2760 |
.addClass('mejs-container-fullscreen')
|
2765 |
// Only needed for safari 5.1 native full screen, can cause display issues elsewhere
|
2766 |
// Actually, it seems to be needed for IE8, too
|
2767 |
//if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
2768 |
+
t.containerSizeTimeout = setTimeout(function() {
|
2769 |
t.container.css({width: '100%', height: '100%'});
|
2770 |
t.setControlsSize();
|
2771 |
}, 500);
|
2772 |
//}
|
2773 |
|
2774 |
+
if (t.media.pluginType === 'native') {
|
2775 |
t.$media
|
2776 |
.width('100%')
|
2777 |
.height('100%');
|
2778 |
} else {
|
2779 |
+
t.container.find('.mejs-shim')
|
2780 |
.width('100%')
|
2781 |
+
.height('100%');
|
2782 |
+
|
2783 |
+
setTimeout(function() {
|
2784 |
+
var win = $(window),
|
2785 |
+
winW = win.width(),
|
2786 |
+
winH = win.height();
|
2787 |
+
|
2788 |
+
t.media.setVideoSize(winW,winH);
|
2789 |
+
}, 500);
|
2790 |
}
|
2791 |
|
2792 |
t.layers.children('div')
|
2801 |
|
2802 |
t.setControlsSize();
|
2803 |
t.isFullScreen = true;
|
2804 |
+
|
2805 |
+
var zoomFactor = Math.min(screen.width / t.width, screen.height / t.height);
|
2806 |
+
t.container.find('.mejs-captions-text').css('font-size', zoomFactor * 100 + '%');
|
2807 |
+
t.container.find('.mejs-captions-text').css('line-height', 'normal');
|
2808 |
+
t.container.find('.mejs-captions-position').css('bottom', '45px');
|
2809 |
+
|
2810 |
+
t.container.trigger('enteredfullscreen');
|
2811 |
},
|
2812 |
|
2813 |
exitFullScreen: function() {
|
2814 |
|
2815 |
var t = this;
|
2816 |
|
2817 |
+
// Prevent container from attempting to stretch a second time
|
2818 |
+
clearTimeout(t.containerSizeTimeout);
|
2819 |
+
|
2820 |
// firefox can't adjust plugins
|
2821 |
+
/*
|
2822 |
if (t.media.pluginType !== 'native' && mejs.MediaFeatures.isFirefox) {
|
2823 |
t.media.setFullscreen(false);
|
2824 |
//player.isFullScreen = false;
|
2825 |
return;
|
2826 |
}
|
2827 |
+
*/
|
2828 |
|
2829 |
+
// come out of native fullscreen
|
2830 |
if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || t.isFullScreen)) {
|
2831 |
mejs.MediaFeatures.cancelFullScreen();
|
2832 |
}
|
2833 |
|
2834 |
// restore scroll bars to document
|
2835 |
+
$(document.documentElement).removeClass('mejs-fullscreen');
|
2836 |
|
2837 |
t.container
|
2838 |
.removeClass('mejs-container-fullscreen')
|
2839 |
+
.width(t.normalWidth)
|
2840 |
+
.height(t.normalHeight);
|
|
|
2841 |
|
2842 |
+
if (t.media.pluginType === 'native') {
|
2843 |
t.$media
|
2844 |
+
.width(t.normalWidth)
|
2845 |
+
.height(t.normalHeight);
|
2846 |
} else {
|
2847 |
+
t.container.find('.mejs-shim')
|
2848 |
+
.width(t.normalWidth)
|
2849 |
+
.height(t.normalHeight);
|
2850 |
|
2851 |
+
t.media.setVideoSize(t.normalWidth, t.normalHeight);
|
2852 |
}
|
2853 |
|
2854 |
+
t.layers.children('div')
|
2855 |
+
.width(t.normalWidth)
|
2856 |
+
.height(t.normalHeight);
|
2857 |
+
|
2858 |
+
t.fullscreenBtn
|
2859 |
+
.removeClass('mejs-unfullscreen')
|
2860 |
+
.addClass('mejs-fullscreen');
|
2861 |
+
|
2862 |
+
t.setControlsSize();
|
2863 |
+
t.isFullScreen = false;
|
2864 |
+
|
2865 |
+
t.container.find('.mejs-captions-text').css('font-size','');
|
2866 |
+
t.container.find('.mejs-captions-text').css('line-height', '');
|
2867 |
+
t.container.find('.mejs-captions-position').css('bottom', '');
|
2868 |
+
|
2869 |
+
t.container.trigger('exitedfullscreen');
|
2870 |
+
}
|
2871 |
+
});
|
2872 |
+
|
2873 |
+
})(mejs.$);
|
2874 |
+
|
2875 |
+
(function($) {
|
2876 |
+
|
2877 |
+
// Speed
|
2878 |
+
$.extend(mejs.MepDefaults, {
|
2879 |
+
|
2880 |
+
// We also support to pass object like this:
|
2881 |
+
// [{name: 'Slow', value: '0.75'}, {name: 'Normal', value: '1.00'}, ...]
|
2882 |
+
speeds: ['2.00', '1.50', '1.25', '1.00', '0.75'],
|
2883 |
+
|
2884 |
+
defaultSpeed: '1.00',
|
2885 |
+
|
2886 |
+
speedChar: 'x'
|
2887 |
+
|
2888 |
+
});
|
2889 |
+
|
2890 |
+
$.extend(MediaElementPlayer.prototype, {
|
2891 |
+
|
2892 |
+
buildspeed: function(player, controls, layers, media) {
|
2893 |
+
var t = this;
|
2894 |
+
|
2895 |
+
if (t.media.pluginType == 'native') {
|
2896 |
+
var
|
2897 |
+
speedButton = null,
|
2898 |
+
speedSelector = null,
|
2899 |
+
playbackSpeed = null,
|
2900 |
+
inputId = null;
|
2901 |
+
|
2902 |
+
var speeds = [];
|
2903 |
+
var defaultInArray = false;
|
2904 |
+
for (var i=0, len=t.options.speeds.length; i < len; i++) {
|
2905 |
+
var s = t.options.speeds[i];
|
2906 |
+
if (typeof(s) === 'string'){
|
2907 |
+
speeds.push({
|
2908 |
+
name: s + t.options.speedChar,
|
2909 |
+
value: s
|
2910 |
+
});
|
2911 |
+
if(s === t.options.defaultSpeed) {
|
2912 |
+
defaultInArray = true;
|
2913 |
+
}
|
2914 |
+
}
|
2915 |
+
else {
|
2916 |
+
speeds.push(s);
|
2917 |
+
if(s.value === t.options.defaultSpeed) {
|
2918 |
+
defaultInArray = true;
|
2919 |
+
}
|
2920 |
+
}
|
2921 |
+
}
|
2922 |
+
|
2923 |
+
if (!defaultInArray) {
|
2924 |
+
speeds.push({
|
2925 |
+
name: t.options.defaultSpeed + t.options.speedChar,
|
2926 |
+
value: t.options.defaultSpeed
|
2927 |
+
});
|
2928 |
+
}
|
2929 |
+
|
2930 |
+
speeds.sort(function(a, b) {
|
2931 |
+
return parseFloat(b.value) - parseFloat(a.value);
|
2932 |
+
});
|
2933 |
+
|
2934 |
+
var getSpeedNameFromValue = function(value) {
|
2935 |
+
for(i=0,len=speeds.length; i <len; i++) {
|
2936 |
+
if (speeds[i].value === value) {
|
2937 |
+
return speeds[i].name;
|
2938 |
+
}
|
2939 |
+
}
|
2940 |
+
};
|
2941 |
+
|
2942 |
+
var html = '<div class="mejs-button mejs-speed-button">' +
|
2943 |
+
'<button type="button">' + getSpeedNameFromValue(t.options.defaultSpeed) + '</button>' +
|
2944 |
+
'<div class="mejs-speed-selector">' +
|
2945 |
+
'<ul>';
|
2946 |
+
|
2947 |
+
for (i = 0, il = speeds.length; i<il; i++) {
|
2948 |
+
inputId = t.id + '-speed-' + speeds[i].value;
|
2949 |
+
html += '<li>' +
|
2950 |
+
'<input type="radio" name="speed" ' +
|
2951 |
+
'value="' + speeds[i].value + '" ' +
|
2952 |
+
'id="' + inputId + '" ' +
|
2953 |
+
(speeds[i].value === t.options.defaultSpeed ? ' checked' : '') +
|
2954 |
+
' />' +
|
2955 |
+
'<label for="' + inputId + '" ' +
|
2956 |
+
(speeds[i].value === t.options.defaultSpeed ? ' class="mejs-speed-selected"' : '') +
|
2957 |
+
'>' + speeds[i].name + '</label>' +
|
2958 |
+
'</li>';
|
2959 |
+
}
|
2960 |
+
html += '</ul></div></div>';
|
2961 |
+
|
2962 |
+
speedButton = $(html).appendTo(controls);
|
2963 |
+
speedSelector = speedButton.find('.mejs-speed-selector');
|
2964 |
|
2965 |
+
playbackSpeed = t.options.defaultSpeed;
|
|
|
|
|
2966 |
|
2967 |
+
media.addEventListener('loadedmetadata', function(e) {
|
2968 |
+
if (playbackSpeed) {
|
2969 |
+
media.playbackRate = parseFloat(playbackSpeed);
|
2970 |
+
}
|
2971 |
+
}, true);
|
2972 |
+
|
2973 |
+
speedSelector
|
2974 |
+
.on('click', 'input[type="radio"]', function() {
|
2975 |
+
var newSpeed = $(this).attr('value');
|
2976 |
+
playbackSpeed = newSpeed;
|
2977 |
+
media.playbackRate = parseFloat(newSpeed);
|
2978 |
+
speedButton.find('button').html(getSpeedNameFromValue(newSpeed));
|
2979 |
+
speedButton.find('.mejs-speed-selected').removeClass('mejs-speed-selected');
|
2980 |
+
speedButton.find('input[type="radio"]:checked').next().addClass('mejs-speed-selected');
|
2981 |
+
});
|
2982 |
+
speedButton
|
2983 |
+
.one( 'mouseenter focusin', function() {
|
2984 |
+
speedSelector
|
2985 |
+
.height(
|
2986 |
+
speedButton.find('.mejs-speed-selector ul').outerHeight(true) +
|
2987 |
+
speedButton.find('.mejs-speed-translations').outerHeight(true))
|
2988 |
+
.css('top', (-1 * speedSelector.height()) + 'px');
|
2989 |
+
});
|
2990 |
+
}
|
2991 |
}
|
2992 |
});
|
2993 |
|
2995 |
|
2996 |
(function($) {
|
2997 |
|
2998 |
+
// add extra default options
|
2999 |
$.extend(mejs.MepDefaults, {
|
3000 |
// this will automatically turn on a <track>
|
3001 |
startLanguage: '',
|
3002 |
+
|
3003 |
+
tracksText: '',
|
3004 |
+
|
3005 |
+
// By default, no WAI-ARIA live region - don't make a
|
3006 |
+
// screen reader speak captions over an audio track.
|
3007 |
+
tracksAriaLive: false,
|
3008 |
+
|
3009 |
+
// option to remove the [cc] button when no <track kind="subtitles"> are present
|
3010 |
+
hideCaptionsButtonWhenEmpty: true,
|
3011 |
+
|
3012 |
+
// If true and we only have one track, change captions to popup
|
3013 |
+
toggleCaptionsButtonWhenOnlyOne: false,
|
3014 |
+
|
3015 |
+
// #id or .class
|
3016 |
+
slidesSelector: ''
|
3017 |
});
|
3018 |
|
3019 |
$.extend(MediaElementPlayer.prototype, {
|
3020 |
+
|
3021 |
hasChapters: false,
|
3022 |
|
3023 |
+
cleartracks: function(player, controls, layers, media){
|
3024 |
+
if(player) {
|
3025 |
+
if(player.captions) player.captions.remove();
|
3026 |
+
if(player.chapters) player.chapters.remove();
|
3027 |
+
if(player.captionsText) player.captionsText.remove();
|
3028 |
+
if(player.captionsButton) player.captionsButton.remove();
|
3029 |
+
}
|
3030 |
+
},
|
3031 |
buildtracks: function(player, controls, layers, media) {
|
3032 |
+
if (player.tracks.length === 0)
|
|
|
|
|
|
|
3033 |
return;
|
3034 |
|
3035 |
+
var t = this,
|
3036 |
+
attr = t.options.tracksAriaLive ?
|
3037 |
+
'role="log" aria-live="assertive" aria-atomic="false"' : '',
|
3038 |
+
tracksTitle = t.options.tracksText ? t.options.tracksText : mejs.i18n.t('mejs.captions-subtitles'),
|
3039 |
+
i,
|
3040 |
+
kind;
|
3041 |
|
3042 |
+
if (t.domNode.textTracks) { // if browser will do native captions, prefer mejs captions, loop through tracks and hide
|
3043 |
+
for (i = t.domNode.textTracks.length - 1; i >= 0; i--) {
|
3044 |
+
t.domNode.textTracks[i].mode = "hidden";
|
3045 |
+
}
|
3046 |
+
}
|
3047 |
+
t.cleartracks(player, controls, layers, media);
|
3048 |
+
player.chapters =
|
3049 |
$('<div class="mejs-chapters mejs-layer"></div>')
|
3050 |
.prependTo(layers).hide();
|
3051 |
+
player.captions =
|
3052 |
+
$('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover" ' +
|
3053 |
+
attr + '><span class="mejs-captions-text"></span></div></div>')
|
3054 |
.prependTo(layers).hide();
|
3055 |
player.captionsText = player.captions.find('.mejs-captions-text');
|
3056 |
+
player.captionsButton =
|
3057 |
$('<div class="mejs-button mejs-captions-button">'+
|
3058 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + tracksTitle + '" aria-label="' + tracksTitle + '"></button>'+
|
3059 |
'<div class="mejs-captions-selector">'+
|
3060 |
'<ul>'+
|
3061 |
'<li>'+
|
3062 |
'<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
|
3063 |
+
'<label for="' + player.id + '_captions_none">' + mejs.i18n.t('mejs.none') +'</label>'+
|
3064 |
'</li>' +
|
3065 |
'</ul>'+
|
3066 |
'</div>'+
|
3067 |
'</div>')
|
3068 |
+
.appendTo(controls);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3069 |
|
3070 |
+
|
3071 |
+
var subtitleCount = 0;
|
3072 |
+
for (i=0; i<player.tracks.length; i++) {
|
3073 |
+
kind = player.tracks[i].kind;
|
3074 |
+
if (kind === 'subtitles' || kind === 'captions') {
|
3075 |
+
subtitleCount++;
|
3076 |
+
}
|
3077 |
+
}
|
3078 |
+
|
3079 |
+
// if only one language then just make the button a toggle
|
3080 |
+
if (t.options.toggleCaptionsButtonWhenOnlyOne && subtitleCount == 1){
|
3081 |
+
// click
|
3082 |
+
player.captionsButton.on('click',function() {
|
3083 |
+
if (player.selectedTrack === null) {
|
3084 |
+
lang = player.tracks[0].srclang;
|
3085 |
+
} else {
|
3086 |
+
lang = 'none';
|
3087 |
+
}
|
3088 |
+
player.setTrack(lang);
|
3089 |
+
});
|
3090 |
+
} else {
|
3091 |
+
// hover or keyboard focus
|
3092 |
+
player.captionsButton.on( 'mouseenter focusin', function() {
|
3093 |
+
$(this).find('.mejs-captions-selector').removeClass('mejs-offscreen');
|
3094 |
+
})
|
3095 |
+
|
3096 |
+
// handle clicks to the language radio buttons
|
3097 |
+
.on('click','input[type=radio]',function() {
|
3098 |
+
lang = this.value;
|
3099 |
+
player.setTrack(lang);
|
3100 |
+
});
|
3101 |
+
|
3102 |
+
player.captionsButton.on( 'mouseleave focusout', function() {
|
3103 |
+
$(this).find(".mejs-captions-selector").addClass("mejs-offscreen");
|
3104 |
+
});
|
3105 |
+
|
3106 |
+
}
|
3107 |
|
3108 |
if (!player.options.alwaysShowControls) {
|
3109 |
// move with controls
|
3127 |
player.selectedTrack = null;
|
3128 |
player.isLoadingTrack = false;
|
3129 |
|
|
|
|
|
3130 |
// add to list
|
3131 |
for (i=0; i<player.tracks.length; i++) {
|
3132 |
+
kind = player.tracks[i].kind;
|
3133 |
+
if (kind === 'subtitles' || kind === 'captions') {
|
3134 |
player.addTrackButton(player.tracks[i].srclang, player.tracks[i].label);
|
3135 |
}
|
3136 |
}
|
3137 |
|
3138 |
+
// start loading tracks
|
3139 |
player.loadNextTrack();
|
3140 |
|
3141 |
+
media.addEventListener('timeupdate',function() {
|
|
|
3142 |
player.displayCaptions();
|
3143 |
}, false);
|
3144 |
|
3145 |
+
if (player.options.slidesSelector !== '') {
|
3146 |
+
player.slidesContainer = $(player.options.slidesSelector);
|
3147 |
+
|
3148 |
+
media.addEventListener('timeupdate',function() {
|
3149 |
+
player.displaySlides();
|
3150 |
+
}, false);
|
3151 |
+
|
3152 |
+
}
|
3153 |
+
|
3154 |
+
media.addEventListener('loadedmetadata', function() {
|
3155 |
player.displayChapters();
|
3156 |
}, false);
|
3157 |
|
3159 |
function () {
|
3160 |
// chapters
|
3161 |
if (player.hasChapters) {
|
3162 |
+
player.chapters.removeClass('mejs-offscreen');
|
3163 |
player.chapters.fadeIn(200).height(player.chapters.find('.mejs-chapter').outerHeight());
|
3164 |
}
|
3165 |
},
|
3166 |
function () {
|
3167 |
if (player.hasChapters && !media.paused) {
|
3168 |
player.chapters.fadeOut(200, function() {
|
3169 |
+
$(this).addClass('mejs-offscreen');
|
3170 |
$(this).css('display','block');
|
3171 |
});
|
3172 |
}
|
3173 |
});
|
3174 |
+
|
3175 |
+
t.container.on('controlsresize', function() {
|
3176 |
+
t.adjustLanguageBox();
|
3177 |
+
});
|
3178 |
+
|
3179 |
// check for autoplay
|
3180 |
if (player.node.getAttribute('autoplay') !== null) {
|
3181 |
+
player.chapters.addClass('mejs-offscreen');
|
3182 |
+
}
|
3183 |
+
},
|
3184 |
+
|
3185 |
+
setTrack: function(lang){
|
3186 |
+
|
3187 |
+
var t = this,
|
3188 |
+
i;
|
3189 |
+
|
3190 |
+
if (lang == 'none') {
|
3191 |
+
t.selectedTrack = null;
|
3192 |
+
t.captionsButton.removeClass('mejs-captions-enabled');
|
3193 |
+
} else {
|
3194 |
+
for (i=0; i<t.tracks.length; i++) {
|
3195 |
+
if (t.tracks[i].srclang == lang) {
|
3196 |
+
if (t.selectedTrack === null)
|
3197 |
+
t.captionsButton.addClass('mejs-captions-enabled');
|
3198 |
+
t.selectedTrack = t.tracks[i];
|
3199 |
+
t.captions.attr('lang', t.selectedTrack.srclang);
|
3200 |
+
t.displayCaptions();
|
3201 |
+
break;
|
3202 |
+
}
|
3203 |
+
}
|
3204 |
}
|
3205 |
},
|
3206 |
|
3214 |
} else {
|
3215 |
// add done?
|
3216 |
t.isLoadingTrack = false;
|
3217 |
+
|
3218 |
+
t.checkForTracks();
|
3219 |
}
|
3220 |
},
|
3221 |
|
3227 |
|
3228 |
track.isLoaded = true;
|
3229 |
|
|
|
|
|
3230 |
t.enableTrackButton(track.srclang, track.label);
|
3231 |
|
3232 |
t.loadNextTrack();
|
3234 |
};
|
3235 |
|
3236 |
|
3237 |
+
if (track.src !== undefined || track.src !== "") {
|
3238 |
+
$.ajax({
|
3239 |
+
url: track.src,
|
3240 |
+
dataType: "text",
|
3241 |
+
success: function(d) {
|
3242 |
|
3243 |
+
// parse the loaded file
|
3244 |
+
if (typeof d == "string" && (/<tt\s+xml/ig).exec(d)) {
|
3245 |
+
track.entries = mejs.TrackFormatParser.dfxp.parse(d);
|
3246 |
+
} else {
|
3247 |
+
track.entries = mejs.TrackFormatParser.webvtt.parse(d);
|
3248 |
+
}
|
|
|
|
|
3249 |
|
3250 |
+
after();
|
3251 |
+
|
3252 |
+
if (track.kind == 'chapters') {
|
3253 |
+
t.media.addEventListener('play', function() {
|
3254 |
+
if (t.media.duration > 0) {
|
3255 |
+
t.displayChapters(track);
|
3256 |
+
}
|
3257 |
+
}, false);
|
3258 |
+
}
|
3259 |
+
|
3260 |
+
if (track.kind == 'slides') {
|
3261 |
+
t.setupSlides(track);
|
3262 |
+
}
|
3263 |
+
},
|
3264 |
+
error: function() {
|
3265 |
+
t.removeTrackButton(track.srclang);
|
3266 |
+
t.loadNextTrack();
|
3267 |
}
|
3268 |
+
});
|
3269 |
+
}
|
|
|
|
|
|
|
3270 |
},
|
3271 |
|
3272 |
enableTrackButton: function(lang, label) {
|
3273 |
var t = this;
|
3274 |
+
|
3275 |
if (label === '') {
|
3276 |
label = mejs.language.codes[lang] || lang;
|
3277 |
+
}
|
3278 |
|
3279 |
t.captionsButton
|
3280 |
.find('input[value=' + lang + ']')
|
3284 |
|
3285 |
// auto select
|
3286 |
if (t.options.startLanguage == lang) {
|
3287 |
+
$('#' + t.id + '_captions_' + lang).prop('checked', true).trigger('click');
|
3288 |
}
|
3289 |
|
3290 |
t.adjustLanguageBox();
|
3291 |
},
|
3292 |
|
3293 |
+
removeTrackButton: function(lang) {
|
3294 |
+
var t = this;
|
3295 |
+
|
3296 |
+
t.captionsButton.find('input[value=' + lang + ']').closest('li').remove();
|
3297 |
+
|
3298 |
+
t.adjustLanguageBox();
|
3299 |
+
},
|
3300 |
+
|
3301 |
addTrackButton: function(lang, label) {
|
3302 |
var t = this;
|
3303 |
if (label === '') {
|
3326 |
);
|
3327 |
},
|
3328 |
|
3329 |
+
checkForTracks: function() {
|
3330 |
+
var
|
3331 |
+
t = this,
|
3332 |
+
hasSubtitles = false;
|
3333 |
+
|
3334 |
+
// check if any subtitles
|
3335 |
+
if (t.options.hideCaptionsButtonWhenEmpty) {
|
3336 |
+
for (var i=0; i<t.tracks.length; i++) {
|
3337 |
+
var kind = t.tracks[i].kind;
|
3338 |
+
if ((kind === 'subtitles' || kind === 'captions') && t.tracks[i].isLoaded) {
|
3339 |
+
hasSubtitles = true;
|
3340 |
+
break;
|
3341 |
+
}
|
3342 |
+
}
|
3343 |
+
|
3344 |
+
if (!hasSubtitles) {
|
3345 |
+
t.captionsButton.hide();
|
3346 |
+
t.setControlsSize();
|
3347 |
+
}
|
3348 |
+
}
|
3349 |
+
},
|
3350 |
+
|
3351 |
displayCaptions: function() {
|
3352 |
|
3353 |
if (typeof this.tracks == 'undefined')
|
3358 |
i,
|
3359 |
track = t.selectedTrack;
|
3360 |
|
3361 |
+
if (track !== null && track.isLoaded) {
|
3362 |
for (i=0; i<track.entries.times.length; i++) {
|
3363 |
+
if (t.media.currentTime >= track.entries.times[i].start && t.media.currentTime <= track.entries.times[i].stop) {
|
3364 |
+
// Set the line before the timecode as a class so the cue can be targeted if needed
|
3365 |
+
t.captionsText.html(track.entries.text[i]).attr('class', 'mejs-captions-text ' + (track.entries.times[i].identifier || ''));
|
3366 |
t.captions.show().height(0);
|
3367 |
return; // exit out if one is visible;
|
3368 |
}
|
3373 |
}
|
3374 |
},
|
3375 |
|
3376 |
+
setupSlides: function(track) {
|
3377 |
+
var t = this;
|
3378 |
+
|
3379 |
+
t.slides = track;
|
3380 |
+
t.slides.entries.imgs = [t.slides.entries.text.length];
|
3381 |
+
t.showSlide(0);
|
3382 |
+
|
3383 |
+
},
|
3384 |
+
|
3385 |
+
showSlide: function(index) {
|
3386 |
+
if (typeof this.tracks == 'undefined' || typeof this.slidesContainer == 'undefined') {
|
3387 |
+
return;
|
3388 |
+
}
|
3389 |
+
|
3390 |
+
var t = this,
|
3391 |
+
url = t.slides.entries.text[index],
|
3392 |
+
img = t.slides.entries.imgs[index];
|
3393 |
+
|
3394 |
+
if (typeof img == 'undefined' || typeof img.fadeIn == 'undefined') {
|
3395 |
+
|
3396 |
+
t.slides.entries.imgs[index] = img = $('<img src="' + url + '">')
|
3397 |
+
.on('load', function() {
|
3398 |
+
img.appendTo(t.slidesContainer)
|
3399 |
+
.hide()
|
3400 |
+
.fadeIn()
|
3401 |
+
.siblings(':visible')
|
3402 |
+
.fadeOut();
|
3403 |
+
|
3404 |
+
});
|
3405 |
+
|
3406 |
+
} else {
|
3407 |
+
|
3408 |
+
if (!img.is(':visible') && !img.is(':animated')) {
|
3409 |
+
|
3410 |
+
//
|
3411 |
+
|
3412 |
+
img.fadeIn()
|
3413 |
+
.siblings(':visible')
|
3414 |
+
.fadeOut();
|
3415 |
+
}
|
3416 |
+
}
|
3417 |
+
|
3418 |
+
},
|
3419 |
+
|
3420 |
+
displaySlides: function() {
|
3421 |
+
|
3422 |
+
if (typeof this.slides == 'undefined')
|
3423 |
+
return;
|
3424 |
+
|
3425 |
+
var
|
3426 |
+
t = this,
|
3427 |
+
slides = t.slides,
|
3428 |
+
i;
|
3429 |
+
|
3430 |
+
for (i=0; i<slides.entries.times.length; i++) {
|
3431 |
+
if (t.media.currentTime >= slides.entries.times[i].start && t.media.currentTime <= slides.entries.times[i].stop){
|
3432 |
+
|
3433 |
+
t.showSlide(i);
|
3434 |
+
|
3435 |
+
return; // exit out if one is visible;
|
3436 |
+
}
|
3437 |
+
}
|
3438 |
+
},
|
3439 |
+
|
3440 |
displayChapters: function() {
|
3441 |
+
var
|
3442 |
t = this,
|
3443 |
i;
|
3444 |
|
3452 |
},
|
3453 |
|
3454 |
drawChapters: function(chapters) {
|
3455 |
+
var
|
3456 |
t = this,
|
3457 |
i,
|
3458 |
dur,
|
3478 |
//}
|
3479 |
|
3480 |
t.chapters.append( $(
|
3481 |
+
'<div class="mejs-chapter" rel="' + chapters.entries.times[i].start + '" style="left: ' + usedPercent.toString() + '%;width: ' + percent.toString() + '%;">' +
|
3482 |
+
'<div class="mejs-chapter-block' + ((i==chapters.entries.times.length-1) ? ' mejs-chapter-block-last' : '') + '">' +
|
3483 |
+
'<span class="ch-title">' + chapters.entries.text[i] + '</span>' +
|
3484 |
+
'<span class="ch-time">' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].start, t.options) + '–' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].stop, t.options) + '</span>' +
|
3485 |
'</div>' +
|
3486 |
'</div>'));
|
3487 |
usedPercent += percent;
|
3490 |
t.chapters.find('div.mejs-chapter').click(function() {
|
3491 |
t.media.setCurrentTime( parseFloat( $(this).attr('rel') ) );
|
3492 |
if (t.media.paused) {
|
3493 |
+
t.media.play();
|
3494 |
}
|
3495 |
});
|
3496 |
|
3517 |
nl:'Dutch',
|
3518 |
en:'English',
|
3519 |
et:'Estonian',
|
3520 |
+
fl:'Filipino',
|
3521 |
fi:'Finnish',
|
3522 |
fr:'French',
|
3523 |
gl:'Galician',
|
3542 |
fa:'Persian',
|
3543 |
pl:'Polish',
|
3544 |
pt:'Portuguese',
|
3545 |
+
// 'pt-pt':'Portuguese (Portugal)',
|
3546 |
ro:'Romanian',
|
3547 |
ru:'Russian',
|
3548 |
sr:'Serbian',
|
3562 |
};
|
3563 |
|
3564 |
/*
|
3565 |
+
Parses WebVTT format which should be formatted as
|
3566 |
================================
|
3567 |
WEBVTT
|
3568 |
+
|
3569 |
1
|
3570 |
00:00:01,1 --> 00:00:05,000
|
3571 |
A line of text
|
3573 |
2
|
3574 |
00:01:15,1 --> 00:02:05,000
|
3575 |
A second line of text
|
3576 |
+
|
3577 |
===============================
|
3578 |
|
3579 |
Adapted from: http://www.delphiki.com/html5/playr
|
3580 |
*/
|
3581 |
mejs.TrackFormatParser = {
|
3582 |
+
webvtt: {
|
3583 |
+
pattern_timecode: /^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,
|
|
|
|
|
3584 |
|
3585 |
parse: function(trackText) {
|
3586 |
+
var
|
3587 |
i = 0,
|
3588 |
lines = mejs.TrackFormatParser.split2(trackText, /\r?\n/),
|
3589 |
entries = {text:[], times:[]},
|
3590 |
timecode,
|
3591 |
+
text,
|
3592 |
+
identifier;
|
3593 |
for(; i<lines.length; i++) {
|
3594 |
+
timecode = this.pattern_timecode.exec(lines[i]);
|
|
|
|
|
|
|
|
|
3595 |
|
3596 |
+
if (timecode && i<lines.length) {
|
3597 |
+
if ((i - 1) >= 0 && lines[i - 1] !== '') {
|
3598 |
+
identifier = lines[i - 1];
|
3599 |
+
}
|
3600 |
+
i++;
|
3601 |
+
// grab all the (possibly multi-line) text that follows
|
3602 |
+
text = lines[i];
|
3603 |
+
i++;
|
3604 |
+
while(lines[i] !== '' && i<lines.length){
|
3605 |
+
text = text + '\n' + lines[i];
|
3606 |
i++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3607 |
}
|
3608 |
+
text = $.trim(text).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
|
3609 |
+
// Text is in a different array so I can use .join
|
3610 |
+
entries.text.push(text);
|
3611 |
+
entries.times.push(
|
3612 |
+
{
|
3613 |
+
identifier: identifier,
|
3614 |
+
start: (mejs.Utility.convertSMPTEtoSeconds(timecode[1]) === 0) ? 0.200 : mejs.Utility.convertSMPTEtoSeconds(timecode[1]),
|
3615 |
+
stop: mejs.Utility.convertSMPTEtoSeconds(timecode[3]),
|
3616 |
+
settings: timecode[5]
|
3617 |
+
});
|
3618 |
}
|
3619 |
+
identifier = '';
|
3620 |
}
|
3621 |
return entries;
|
3622 |
}
|
3625 |
dfxp: {
|
3626 |
parse: function(trackText) {
|
3627 |
trackText = $(trackText).filter("tt");
|
3628 |
+
var
|
3629 |
i = 0,
|
3630 |
container = trackText.children("div").eq(0),
|
3631 |
lines = container.find("p"),
|
3632 |
styleNode = trackText.find("#" + container.attr("style")),
|
3633 |
styles,
|
|
|
|
|
3634 |
text,
|
3635 |
entries = {text:[], times:[]};
|
3636 |
|
3659 |
if (styles) {
|
3660 |
style = "";
|
3661 |
for (var _style in styles) {
|
3662 |
+
style += _style + ":" + styles[_style] + ";";
|
3663 |
}
|
3664 |
}
|
3665 |
if (style) _temp_times.style = style;
|
3666 |
+
if (_temp_times.start === 0) _temp_times.start = 0.200;
|
3667 |
entries.times.push(_temp_times);
|
3668 |
text = $.trim(lines.eq(i).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
|
3669 |
entries.text.push(text);
|
|
|
3670 |
}
|
3671 |
return entries;
|
3672 |
}
|
3677 |
return text.split(regex);
|
3678 |
}
|
3679 |
};
|
3680 |
+
|
3681 |
// test for browsers with bad String.split method.
|
3682 |
if ('x\n\ny'.split(/\n/gi).length != 3) {
|
3683 |
// add super slow IE8 and below version
|
3684 |
mejs.TrackFormatParser.split2 = function(text, regex) {
|
3685 |
+
var
|
3686 |
+
parts = [],
|
3687 |
chunk = '',
|
3688 |
i;
|
3689 |
|
3696 |
}
|
3697 |
parts.push(chunk);
|
3698 |
return parts;
|
3699 |
+
};
|
3700 |
+
}
|
3701 |
+
|
3702 |
+
})(mejs.$);
|
3703 |
+
|
3704 |
+
// Source Chooser Plugin
|
3705 |
+
(function($) {
|
3706 |
+
|
3707 |
+
$.extend(mejs.MepDefaults, {
|
3708 |
+
sourcechooserText: ''
|
3709 |
+
});
|
3710 |
+
|
3711 |
+
$.extend(MediaElementPlayer.prototype, {
|
3712 |
+
buildsourcechooser: function(player, controls, layers, media) {
|
3713 |
+
|
3714 |
+
var
|
3715 |
+
t = this,
|
3716 |
+
sourceTitle = t.options.sourcechooserText ? t.options.sourcechooserText : mejs.i18n.t('mejs.source-chooser'),
|
3717 |
+
hoverTimeout
|
3718 |
+
;
|
3719 |
+
|
3720 |
+
player.sourcechooserButton =
|
3721 |
+
$('<div class="mejs-button mejs-sourcechooser-button">'+
|
3722 |
+
'<button type="button" role="button" aria-haspopup="true" aria-owns="' + t.id + '" title="' + sourceTitle + '" aria-label="' + sourceTitle + '"></button>'+
|
3723 |
+
'<div class="mejs-sourcechooser-selector mejs-offscreen" role="menu" aria-expanded="false" aria-hidden="true">'+
|
3724 |
+
'<ul>'+
|
3725 |
+
'</ul>'+
|
3726 |
+
'</div>'+
|
3727 |
+
'</div>')
|
3728 |
+
.appendTo(controls)
|
3729 |
+
|
3730 |
+
// hover
|
3731 |
+
.hover(function() {
|
3732 |
+
clearTimeout(hoverTimeout);
|
3733 |
+
player.showSourcechooserSelector();
|
3734 |
+
}, function() {
|
3735 |
+
var self = $(this);
|
3736 |
+
hoverTimeout = setTimeout(function () {
|
3737 |
+
player.hideSourcechooserSelector();
|
3738 |
+
}, 500);
|
3739 |
+
})
|
3740 |
+
|
3741 |
+
// keyboard menu activation
|
3742 |
+
.on('keydown', function (e) {
|
3743 |
+
var keyCode = e.keyCode;
|
3744 |
+
|
3745 |
+
switch (keyCode) {
|
3746 |
+
case 32: // space
|
3747 |
+
if (!mejs.MediaFeatures.isFirefox) { // space sends the click event in Firefox
|
3748 |
+
player.showSourcechooserSelector();
|
3749 |
+
}
|
3750 |
+
$(this).find('.mejs-sourcechooser-selector')
|
3751 |
+
.find('input[type=radio]:checked').first().focus();
|
3752 |
+
break;
|
3753 |
+
case 13: // enter
|
3754 |
+
player.showSourcechooserSelector();
|
3755 |
+
$(this).find('.mejs-sourcechooser-selector')
|
3756 |
+
.find('input[type=radio]:checked').first().focus();
|
3757 |
+
break;
|
3758 |
+
case 27: // esc
|
3759 |
+
player.hideSourcechooserSelector();
|
3760 |
+
$(this).find('button').focus();
|
3761 |
+
break;
|
3762 |
+
default:
|
3763 |
+
return true;
|
3764 |
+
}
|
3765 |
+
})
|
3766 |
+
|
3767 |
+
// close menu when tabbing away
|
3768 |
+
.on('focusout', mejs.Utility.debounce(function (e) { // Safari triggers focusout multiple times
|
3769 |
+
// Firefox does NOT support e.relatedTarget to see which element
|
3770 |
+
// just lost focus, so wait to find the next focused element
|
3771 |
+
setTimeout(function () {
|
3772 |
+
var parent = $(document.activeElement).closest('.mejs-sourcechooser-selector');
|
3773 |
+
if (!parent.length) {
|
3774 |
+
// focus is outside the control; close menu
|
3775 |
+
player.hideSourcechooserSelector();
|
3776 |
+
}
|
3777 |
+
}, 0);
|
3778 |
+
}, 100))
|
3779 |
+
|
3780 |
+
// handle clicks to the source radio buttons
|
3781 |
+
.delegate('input[type=radio]', 'click', function() {
|
3782 |
+
// set aria states
|
3783 |
+
$(this).attr('aria-selected', true).attr('checked', 'checked');
|
3784 |
+
$(this).closest('.mejs-sourcechooser-selector').find('input[type=radio]').not(this).attr('aria-selected', 'false').removeAttr('checked');
|
3785 |
+
|
3786 |
+
var src = this.value;
|
3787 |
+
|
3788 |
+
if (media.currentSrc != src) {
|
3789 |
+
var currentTime = media.currentTime;
|
3790 |
+
var paused = media.paused;
|
3791 |
+
media.pause();
|
3792 |
+
media.setSrc(src);
|
3793 |
+
|
3794 |
+
media.addEventListener('loadedmetadata', function(e) {
|
3795 |
+
media.currentTime = currentTime;
|
3796 |
+
}, true);
|
3797 |
+
|
3798 |
+
var canPlayAfterSourceSwitchHandler = function(e) {
|
3799 |
+
if (!paused) {
|
3800 |
+
media.play();
|
3801 |
+
}
|
3802 |
+
media.removeEventListener("canplay", canPlayAfterSourceSwitchHandler, true);
|
3803 |
+
};
|
3804 |
+
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler, true);
|
3805 |
+
media.load();
|
3806 |
+
}
|
3807 |
+
})
|
3808 |
+
|
3809 |
+
// Handle click so that screen readers can toggle the menu
|
3810 |
+
.delegate('button', 'click', function (e) {
|
3811 |
+
if ($(this).siblings('.mejs-sourcechooser-selector').hasClass('mejs-offscreen')) {
|
3812 |
+
player.showSourcechooserSelector();
|
3813 |
+
$(this).siblings('.mejs-sourcechooser-selector').find('input[type=radio]:checked').first().focus();
|
3814 |
+
} else {
|
3815 |
+
player.hideSourcechooserSelector();
|
3816 |
+
}
|
3817 |
+
});
|
3818 |
+
|
3819 |
+
// add to list
|
3820 |
+
for (var i in this.node.children) {
|
3821 |
+
var src = this.node.children[i];
|
3822 |
+
if (src.nodeName === 'SOURCE' && (media.canPlayType(src.type) == 'probably' || media.canPlayType(src.type) == 'maybe')) {
|
3823 |
+
player.addSourceButton(src.src, src.title, src.type, media.src == src.src);
|
3824 |
+
}
|
3825 |
+
}
|
3826 |
+
},
|
3827 |
+
|
3828 |
+
addSourceButton: function(src, label, type, isCurrent) {
|
3829 |
+
var t = this;
|
3830 |
+
if (label === '' || label == undefined) {
|
3831 |
+
label = src;
|
3832 |
+
}
|
3833 |
+
type = type.split('/')[1];
|
3834 |
+
|
3835 |
+
t.sourcechooserButton.find('ul').append(
|
3836 |
+
$('<li>'+
|
3837 |
+
'<input type="radio" name="' + t.id + '_sourcechooser" id="' + t.id + '_sourcechooser_' + label + type + '" role="menuitemradio" value="' + src + '" ' + (isCurrent ? 'checked="checked"' : '') + 'aria-selected="' + isCurrent + '"' + ' />'+
|
3838 |
+
'<label for="' + t.id + '_sourcechooser_' + label + type + '" aria-hidden="true">' + label + ' (' + type + ')</label>'+
|
3839 |
+
'</li>')
|
3840 |
+
);
|
3841 |
+
|
3842 |
+
t.adjustSourcechooserBox();
|
3843 |
+
|
3844 |
+
},
|
3845 |
+
|
3846 |
+
adjustSourcechooserBox: function() {
|
3847 |
+
var t = this;
|
3848 |
+
// adjust the size of the outer box
|
3849 |
+
t.sourcechooserButton.find('.mejs-sourcechooser-selector').height(
|
3850 |
+
t.sourcechooserButton.find('.mejs-sourcechooser-selector ul').outerHeight(true)
|
3851 |
+
);
|
3852 |
+
},
|
3853 |
+
|
3854 |
+
hideSourcechooserSelector: function () {
|
3855 |
+
this.sourcechooserButton.find('.mejs-sourcechooser-selector')
|
3856 |
+
.addClass('mejs-offscreen')
|
3857 |
+
.attr('aria-expanded', 'false')
|
3858 |
+
.attr('aria-hidden', 'true')
|
3859 |
+
.find('input[type=radio]') // make radios not fucusable
|
3860 |
+
.attr('tabindex', '-1');
|
3861 |
+
},
|
3862 |
+
|
3863 |
+
showSourcechooserSelector: function () {
|
3864 |
+
this.sourcechooserButton.find('.mejs-sourcechooser-selector')
|
3865 |
+
.removeClass('mejs-offscreen')
|
3866 |
+
.attr('aria-expanded', 'true')
|
3867 |
+
.attr('aria-hidden', 'false')
|
3868 |
+
.find('input[type=radio]')
|
3869 |
+
.attr('tabindex', '0');
|
3870 |
}
|
3871 |
+
});
|
3872 |
|
3873 |
})(mejs.$);
|
3874 |
|
3891 |
return null;
|
3892 |
|
3893 |
if (player.isFullScreen) {
|
3894 |
+
return mejs.i18n.t('mejs.fullscreen-off');
|
3895 |
} else {
|
3896 |
+
return mejs.i18n.t('mejs.fullscreen-on');
|
3897 |
}
|
3898 |
},
|
3899 |
click: function(player) {
|
3909 |
{
|
3910 |
render: function(player) {
|
3911 |
if (player.media.muted) {
|
3912 |
+
return mejs.i18n.t('mejs.unmute');
|
3913 |
} else {
|
3914 |
+
return mejs.i18n.t('mejs.mute');
|
3915 |
}
|
3916 |
},
|
3917 |
click: function(player) {
|
3930 |
// demo of simple download video
|
3931 |
{
|
3932 |
render: function(player) {
|
3933 |
+
return mejs.i18n.t('mejs.download-video');
|
3934 |
},
|
3935 |
click: function(player) {
|
3936 |
window.location.href = player.media.currentSrc;
|
3961 |
});
|
3962 |
player.contextMenu.bind('mouseleave', function() {
|
3963 |
|
3964 |
+
//
|
3965 |
player.startContextMenuTimer();
|
3966 |
|
3967 |
});
|
3968 |
},
|
3969 |
+
|
3970 |
+
cleancontextmenu: function(player) {
|
3971 |
+
player.contextMenu.remove();
|
3972 |
+
},
|
3973 |
|
3974 |
isContextMenuEnabled: true,
|
3975 |
enableContextMenu: function() {
|
3981 |
|
3982 |
contextMenuTimeout: null,
|
3983 |
startContextMenuTimer: function() {
|
3984 |
+
//
|
3985 |
|
3986 |
var t = this;
|
3987 |
|
3995 |
killContextMenuTimer: function() {
|
3996 |
var timer = this.contextMenuTimer;
|
3997 |
|
3998 |
+
//
|
3999 |
|
4000 |
if (timer != null) {
|
4001 |
clearTimeout(timer);
|
4069 |
});
|
4070 |
|
4071 |
})(mejs.$);
|
4072 |
+
(function($) {
|
4073 |
+
// skip back button
|
4074 |
+
|
4075 |
+
$.extend(mejs.MepDefaults, {
|
4076 |
+
skipBackInterval: 30,
|
4077 |
+
// %1 will be replaced with skipBackInterval in this string
|
4078 |
+
skipBackText: ''
|
4079 |
+
});
|
4080 |
+
|
4081 |
+
$.extend(MediaElementPlayer.prototype, {
|
4082 |
+
buildskipback: function(player, controls, layers, media) {
|
4083 |
+
var
|
4084 |
+
t = this,
|
4085 |
+
defaultTitle = mejs.i18n.t('mejs.time-skip-back', t.options.skipBackInterval),
|
4086 |
+
skipTitle = t.options.skipBackText ? t.options.skipBackText : defaultTitle,
|
4087 |
+
// create the loop button
|
4088 |
+
loop =
|
4089 |
+
$('<div class="mejs-button mejs-skip-back-button">' +
|
4090 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + skipTitle + '" aria-label="' + skipTitle + '">' + t.options.skipBackInterval + '</button>' +
|
4091 |
+
'</div>')
|
4092 |
+
// append it to the toolbar
|
4093 |
+
.appendTo(controls)
|
4094 |
+
// add a click toggle event
|
4095 |
+
.click(function() {
|
4096 |
+
media.setCurrentTime(Math.max(media.currentTime - t.options.skipBackInterval, 0));
|
4097 |
+
$(this).find('button').blur();
|
4098 |
+
});
|
4099 |
+
}
|
4100 |
+
});
|
4101 |
+
|
4102 |
+
})(mejs.$);
|
4103 |
+
|
4104 |
/**
|
4105 |
* Postroll plugin
|
4106 |
*/
|
4107 |
(function($) {
|
4108 |
|
4109 |
$.extend(mejs.MepDefaults, {
|
4110 |
+
postrollCloseText: ''
|
4111 |
});
|
4112 |
|
4113 |
// Postroll
|
4115 |
buildpostroll: function(player, controls, layers, media) {
|
4116 |
var
|
4117 |
t = this,
|
4118 |
+
postrollTitle = t.options.postrollCloseText ? t.options.postrollCloseText : mejs.i18n.t('mejs.close'),
|
4119 |
postrollLink = t.container.find('link[rel="postroll"]').attr('href');
|
4120 |
|
4121 |
if (typeof postrollLink !== 'undefined') {
|
4122 |
player.postroll =
|
4123 |
+
$('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">' + postrollTitle + '</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(layers).hide();
|
4124 |
|
4125 |
t.media.addEventListener('ended', function (e) {
|
4126 |
$.ajax({
|
4137 |
});
|
4138 |
|
4139 |
})(mejs.$);
|
4140 |
+
/*
|
4141 |
+
MediaElement-Markers is a MediaElement.js plugin that lets you add Visual Cues in the progress time rail.
|
4142 |
+
This plugin also lets you register a custom callback function that will be called everytime the play position reaches a marker.
|
4143 |
+
Marker position and a reference to the MediaElement Player object is passed to the registered callback function for any post processing. Marker color is configurable.
|
4144 |
+
|
4145 |
+
*/
|
4146 |
+
|
4147 |
+
(function ($) {
|
4148 |
+
// markers
|
4149 |
+
|
4150 |
+
$.extend(mejs.MepDefaults, {
|
4151 |
+
markerColor: '#E9BC3D', //default marker color
|
4152 |
+
markers: [],
|
4153 |
+
markerCallback: function () {
|
4154 |
+
|
4155 |
+
}
|
4156 |
+
});
|
4157 |
+
|
4158 |
+
$.extend(MediaElementPlayer.prototype, {
|
4159 |
+
buildmarkers: function (player, controls, layers, media) {
|
4160 |
+
var t = this,
|
4161 |
+
i = 0,
|
4162 |
+
currentPos = -1,
|
4163 |
+
currentMarker = -1,
|
4164 |
+
lastPlayPos = -1, //Track backward seek
|
4165 |
+
lastMarkerCallBack = -1; //Prevents successive firing of callbacks
|
4166 |
+
|
4167 |
+
for (i = 0; i < player.options.markers.length; ++i) {
|
4168 |
+
controls.find('.mejs-time-total').append('<span class="mejs-time-marker"></span>');
|
4169 |
+
}
|
4170 |
+
|
4171 |
+
media.addEventListener('durationchange', function (e) {
|
4172 |
+
player.setmarkers(controls);
|
4173 |
+
});
|
4174 |
+
media.addEventListener('timeupdate', function (e) {
|
4175 |
+
currentPos = Math.floor(media.currentTime);
|
4176 |
+
if (lastPlayPos > currentPos) {
|
4177 |
+
if (lastMarkerCallBack > currentPos) {
|
4178 |
+
lastMarkerCallBack = -1;
|
4179 |
+
}
|
4180 |
+
} else {
|
4181 |
+
lastPlayPos = currentPos;
|
4182 |
+
}
|
4183 |
+
|
4184 |
+
for (i = 0; i < player.options.markers.length; ++i) {
|
4185 |
+
currentMarker = Math.floor(player.options.markers[i]);
|
4186 |
+
if (currentPos === currentMarker && currentMarker !== lastMarkerCallBack) {
|
4187 |
+
player.options.markerCallback(media, media.currentTime); //Fires the callback function
|
4188 |
+
lastMarkerCallBack = currentMarker;
|
4189 |
+
}
|
4190 |
+
}
|
4191 |
+
|
4192 |
+
}, false);
|
4193 |
+
|
4194 |
+
},
|
4195 |
+
setmarkers: function (controls) {
|
4196 |
+
var t = this,
|
4197 |
+
i = 0,
|
4198 |
+
left;
|
4199 |
+
|
4200 |
+
for (i = 0; i < t.options.markers.length; ++i) {
|
4201 |
+
if (Math.floor(t.options.markers[i]) <= t.media.duration && Math.floor(t.options.markers[i]) >= 0) {
|
4202 |
+
left = 100 * Math.floor(t.options.markers[i]) / t.media.duration;
|
4203 |
+
$(controls.find('.mejs-time-marker')[i]).css({
|
4204 |
+
"width": "1px",
|
4205 |
+
"left": left+"%",
|
4206 |
+
"background": t.options.markerColor
|
4207 |
+
});
|
4208 |
+
}
|
4209 |
+
}
|
4210 |
+
|
4211 |
+
}
|
4212 |
+
});
|
4213 |
+
})(mejs.$);
|
mediaelement/mediaelementplayer.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.mejs-container{position:relative;background:#000;font-family:Helvetica,Arial;text-align:left;vertical-align:top;text-indent:0;}.me-plugin{position:absolute;}.mejs-embed,.mejs-embed body{width:100%;height:100%;margin:0;padding:0;background:#000;overflow:hidden;}.mejs-container-fullscreen{position:fixed;left:0;top:0;right:0;bottom:0;overflow:hidden;z-index:1000;}.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;width:100%;height:100%;}.mejs-poster{position:absolute;top:0;left:0;}.mejs-poster img{border:0;padding:0;border:0;display:block;}.mejs-overlay{position:absolute;top:0;left:0;}.mejs-overlay-play{cursor:pointer;}.mejs-overlay-button{position:absolute;top:50%;left:50%;width:100px;height:100px;margin:-50px 0 0 -50px;background:url(bigplay.svg) no-repeat;}.no-svg .mejs-overlay-button{background-image:url(bigplay.png);}.mejs-overlay:hover .mejs-overlay-button{background-position:0 -100px;}.mejs-overlay-loading{position:absolute;top:50%;left:50%;width:80px;height:80px;margin:-40px 0 0 -40px;background:#333;background:url(background.png);background:rgba(0,0,0,0.9);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(50,50,50,0.9)),to(rgba(0,0,0,0.9)));background:-webkit-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:-moz-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:-o-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:-ms-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:linear-gradient(rgba(50,50,50,0.9),rgba(0,0,0,0.9));}.mejs-overlay-loading span{display:block;width:80px;height:80px;background:transparent url(loading.gif) 50% 50% no-repeat;}.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);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(50,50,50,0.7)),to(rgba(0,0,0,0.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-moz-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-o-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-ms-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:linear-gradient(rgba(50,50,50,0.7),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;background:0;font-family:Helvetica,Arial;border:0;}.mejs-controls .mejs-button button{cursor:pointer;display:block;font-size:0;line-height:0;text-decoration:none;margin:7px 5px;padding:0;position:absolute;height:16px;width:16px;border:0;background:transparent url(controls.svg) no-repeat;}.no-svg .mejs-controls .mejs-button button{background-image:url(controls.png);}.mejs-controls .mejs-button button:focus{outline:solid 1px yellow;}.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;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}.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 button{background-position:0 0;}.mejs-controls .mejs-pause button{background-position:0 -16px;}.mejs-controls .mejs-stop button{background-position:-112px 0;}.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,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(30,30,30,0.8)),to(rgba(60,60,60,0.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-moz-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-o-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-ms-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:linear-gradient(rgba(30,30,30,0.8),rgba(60,60,60,0.8));}.mejs-controls .mejs-time-rail .mejs-time-buffering{width:100%;background-image:-o-linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-ms-linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(-45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:15px 15px;-moz-background-size:15px 15px;-o-background-size:15px 15px;background-size:15px 15px;-webkit-animation:buffering-stripes 2s linear infinite;-moz-animation:buffering-stripes 2s linear infinite;-ms-animation:buffering-stripes 2s linear infinite;-o-animation:buffering-stripes 2s linear infinite;animation:buffering-stripes 2s linear infinite;}@-webkit-keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}@-moz-keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}@-ms-keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}@-o-keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}@keyframes buffering-stripes{from{background-position:0 0;}to{background-position:30px 0;}}.mejs-controls .mejs-time-rail .mejs-time-loaded{background:#3caac8;background:rgba(60,170,200,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(44,124,145,0.8)),to(rgba(78,183,212,0.8)));background:-webkit-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:-moz-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:-o-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:-ms-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:linear-gradient(rgba(44,124,145,0.8),rgba(78,183,212,0.8));width:0;}.mejs-controls .mejs-time-rail .mejs-time-current{width:0;background:#fff;background:rgba(255,255,255,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(255,255,255,0.9)),to(rgba(200,200,200,0.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-moz-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-o-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-ms-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:linear-gradient(rgba(255,255,255,0.9),rgba(200,200,200,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{position:absolute;display:none;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 .mejs-time-float-current{margin:2px;width:30px;display:block;text-align:center;left:0;}.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-long-video .mejs-controls .mejs-time-rail .mejs-time-float{width:48px;}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-current{width:44px;}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-corner{left:18px;}.mejs-controls .mejs-fullscreen-button button{background-position:-32px 0;}.mejs-controls .mejs-unfullscreen button{background-position:-32px -16px;}.mejs-controls .mejs-mute button{background-position:-16px -16px;}.mejs-controls .mejs-unmute button{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(50,50,50,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 .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 div.mejs-horizontal-volume-slider{height:26px;width:60px;position:relative;}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#333;background:rgba(50,50,50,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(30,30,30,0.8)),to(rgba(60,60,60,0.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-moz-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-o-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-ms-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:linear-gradient(rgba(30,30,30,0.8),rgba(60,60,60,0.8));}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#fff;background:rgba(255,255,255,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(255,255,255,0.9)),to(rgba(200,200,200,0.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-moz-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-o-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-ms-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:linear-gradient(rgba(255,255,255,0.9),rgba(200,200,200,0.8));}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle{display:none;}.mejs-controls .mejs-captions-button{position:relative;}.mejs-controls .mejs-captions-button button{background-position:-48px 0;}.mejs-controls .mejs-captions-button .mejs-captions-selector{visibility:hidden;position:absolute;bottom:26px;right:-10px;width:130px;height:100px;background:url(background.png);background:rgba(50,50,50,0.7);border:solid 1px transparent;padding:10px;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}.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;z-index:1;}.mejs-chapters .mejs-chapter{position:absolute;float:left;background:#222;background:rgba(0,0,0,0.7);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(50,50,50,0.7)),to(rgba(0,0,0,0.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-moz-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-o-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-ms-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:linear-gradient(rgba(50,50,50,0.7),rgba(0,0,0,0.7));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,startColorstr=#323232,endColorstr=#000000);overflow:hidden;border:0;}.mejs-chapters .mejs-chapter .mejs-chapter-block{font-size:11px;color:#fff;padding:5px;display:block;border-right:solid 1px #333;border-bottom:solid 1px #333;cursor:pointer;}.mejs-chapters .mejs-chapter .mejs-chapter-block-last{border-right:none;}.mejs-chapters .mejs-chapter .mejs-chapter-block:hover{background:#666;background:rgba(102,102,102,0.7);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(102,102,102,0.7)),to(rgba(50,50,50,0.6)));background:-webkit-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:-moz-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:-o-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:-ms-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:linear-gradient(rgba(102,102,102,0.7),rgba(50,50,50,0.6));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,startColorstr=#666666,endColorstr=#323232);}.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;left:0;}.mejs-captions-position-hover{bottom:45px;}.mejs-captions-text{padding:3px 5px;background:url(background.png);background:rgba(20,20,20,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 button{background-position:-64px -16px;}.mejs-controls .mejs-loop-on button{background-position:-64px 0;}.mejs-controls .mejs-backlight-off button{background-position:-80px -16px;}.mejs-controls .mejs-backlight-on button{background-position:-80px 0;}.mejs-controls .mejs-picturecontrols-button{background-position:-96px 0;}.mejs-contextmenu{position:absolute;width:150px;padding:10px;border-radius:4px;top:0;left:0;background:#fff;border:solid 1px #999;z-index:1001;}.mejs-contextmenu .mejs-contextmenu-separator{height:1px;font-size:0;margin:5px 6px;background:#333;}.mejs-contextmenu .mejs-contextmenu-item{font-family:Helvetica,Arial;font-size:12px;padding:4px 6px;cursor:pointer;color:#333;}.mejs-contextmenu .mejs-contextmenu-item:hover{background:#2C7C91;color:#fff;}.mejs-controls .mejs-sourcechooser-button{position:relative;}.mejs-controls .mejs-sourcechooser-button button{background-position:-128px 0;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector{visibility:hidden;position:absolute;bottom:26px;right:-10px;width:130px;height:100px;background:url(background.png);background:rgba(50,50,50,0.7);border:solid 1px transparent;padding:10px;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li{margin:0 0 6px 0;padding:0;list-style-type:none!important;display:block;color:#fff;overflow:hidden;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label{width:100px;float:left;padding:4px 0 0 0;line-height:15px;font-family:helvetica,arial;font-size:10px;}.mejs-postroll-layer{position:absolute;bottom:0;left:0;width:100%;height:100%;background:url(background.png);background:rgba(50,50,50,0.7);z-index:1000;overflow:hidden;}.mejs-postroll-layer-content{width:100%;height:100%;}.mejs-postroll-close{position:absolute;right:0;top:0;background:url(background.png);background:rgba(50,50,50,0.7);color:#fff;padding:4px;z-index:100;cursor:pointer;}
|
1 |
+
.mejs-offscreen{clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px);clip-path:polygon(0px 0,0 0,0 0,0 0);position:absolute!important;height:1px;width:1px;overflow:hidden}.mejs-container{position:relative;background:#000;font-family:Helvetica,Arial,serif;text-align:left;vertical-align:top;text-indent:0}.mejs-fill-container,.mejs-fill-container .mejs-container{width:100%;height:100%}.mejs-fill-container{overflow:hidden}.mejs-container:focus{outline:0}.me-plugin{position:absolute}.mejs-embed,.mejs-embed body{width:100%;height:100%;margin:0;padding:0;background:#000;overflow:hidden}.mejs-fullscreen{overflow:hidden!important}.mejs-container-fullscreen{position:fixed;left:0;top:0;right:0;bottom:0;overflow:hidden;z-index:1000}.mejs-container-fullscreen .mejs-mediaelement,.mejs-container-fullscreen video{width:100%;height:100%}.mejs-clear{clear:both}.mejs-background{position:absolute;top:0;left:0}.mejs-mediaelement{position:absolute;top:0;left:0;width:100%;height:100%}.mejs-poster{position:absolute;top:0;left:0;background-size:contain;background-position:50% 50%;background-repeat:no-repeat}:root .mejs-poster img{display:none}.mejs-poster img{border:0;padding:0}.mejs-overlay{position:absolute;top:0;left:0}.mejs-overlay-play{cursor:pointer}.mejs-overlay-button{position:absolute;top:50%;left:50%;width:100px;height:100px;margin:-50px 0 0 -50px;background:url(bigplay.svg) no-repeat}.no-svg .mejs-overlay-button{background-image:url(bigplay.png)}.mejs-overlay:hover .mejs-overlay-button{background-position:0 -100px}.mejs-overlay-loading{position:absolute;top:50%;left:50%;width:80px;height:80px;margin:-40px 0 0 -40px;background:#333;background:url(background.png);background:rgba(0,0,0,.9);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(50,50,50,.9)),to(rgba(0,0,0,.9)));background:-webkit-linear-gradient(top,rgba(50,50,50,.9),rgba(0,0,0,.9));background:-moz-linear-gradient(top,rgba(50,50,50,.9),rgba(0,0,0,.9));background:-o-linear-gradient(top,rgba(50,50,50,.9),rgba(0,0,0,.9));background:-ms-linear-gradient(top,rgba(50,50,50,.9),rgba(0,0,0,.9));background:linear-gradient(rgba(50,50,50,.9),rgba(0,0,0,.9))}.mejs-overlay-loading span{display:block;width:80px;height:80px;background:transparent url(loading.gif) 50% 50% no-repeat}.mejs-container .mejs-controls{position:absolute;list-style-type:none;margin:0;padding:0;bottom:0;left:0;background:url(background.png);background:rgba(0,0,0,.7);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(50,50,50,.7)),to(rgba(0,0,0,.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-moz-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-o-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-ms-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:linear-gradient(rgba(50,50,50,.7),rgba(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,serif;border:0}.mejs-controls .mejs-button button{cursor:pointer;display:block;font-size:0;line-height:0;text-decoration:none;margin:7px 5px;padding:0;position:absolute;height:16px;width:16px;border:0;background:transparent url(controls.svg) no-repeat}.no-svg .mejs-controls .mejs-button button{background-image:url(controls.png)}.mejs-controls .mejs-button button:focus{outline:dotted 1px #999}.mejs-container .mejs-controls .mejs-time{color:#fff;display:block;height:17px;width:auto;padding:10px 3px 0;overflow:hidden;text-align:center;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.mejs-container .mejs-controls .mejs-time a{color:#fff;font-size:11px;line-height:12px;display:block;float:left;margin:1px 2px 0 0;width:auto}.mejs-controls .mejs-play button{background-position:0 0}.mejs-controls .mejs-pause button{background-position:0 -16px}.mejs-controls .mejs-stop button{background-position:-112px 0}.mejs-controls div.mejs-time-rail{direction:ltr;width:200px;padding-top:5px}.mejs-controls .mejs-time-rail span,.mejs-controls .mejs-time-rail a{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);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(30,30,30,.8)),to(rgba(60,60,60,.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-moz-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-o-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-ms-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:linear-gradient(rgba(30,30,30,.8),rgba(60,60,60,.8))}.mejs-controls .mejs-time-rail .mejs-time-buffering{width:100%;background-image:-o-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,.15)),color-stop(0.75,rgba(255,255,255,.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-ms-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:15px 15px;-moz-background-size:15px 15px;-o-background-size:15px 15px;background-size:15px 15px;-webkit-animation:buffering-stripes 2s linear infinite;-moz-animation:buffering-stripes 2s linear infinite;-ms-animation:buffering-stripes 2s linear infinite;-o-animation:buffering-stripes 2s linear infinite;animation:buffering-stripes 2s linear infinite}@-webkit-keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}@-moz-keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}@-ms-keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}@-o-keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}@keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}.mejs-controls .mejs-time-rail .mejs-time-loaded{background:#3caac8;background:rgba(60,170,200,.8);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(44,124,145,.8)),to(rgba(78,183,212,.8)));background:-webkit-linear-gradient(top,rgba(44,124,145,.8),rgba(78,183,212,.8));background:-moz-linear-gradient(top,rgba(44,124,145,.8),rgba(78,183,212,.8));background:-o-linear-gradient(top,rgba(44,124,145,.8),rgba(78,183,212,.8));background:-ms-linear-gradient(top,rgba(44,124,145,.8),rgba(78,183,212,.8));background:linear-gradient(rgba(44,124,145,.8),rgba(78,183,212,.8));width:0}.mejs-controls .mejs-time-rail .mejs-time-current{background:#fff;background:rgba(255,255,255,.8);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.9)),to(rgba(200,200,200,.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-moz-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-o-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-ms-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:linear-gradient(rgba(255,255,255,.9),rgba(200,200,200,.8));width:0}.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{position:absolute;display:none;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 .mejs-time-float-current{margin:2px;width:30px;display:block;text-align:center;left:0}.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;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;top:15px;left:13px}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float{width:48px}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-current{width:44px}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-corner{left:18px}.mejs-controls .mejs-fullscreen-button button{background-position:-32px 0}.mejs-controls .mejs-unfullscreen button{background-position:-32px -16px}.mejs-controls .mejs-volume-button{}.mejs-controls .mejs-mute button{background-position:-16px -16px}.mejs-controls .mejs-unmute button{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(50,50,50,.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 .mejs-volume-slider .mejs-volume-total{position:absolute;left:11px;top:8px;width:2px;height:100px;background:#ddd;background:rgba(255,255,255,.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,.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,.9);cursor:N-resize;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;margin:0}.mejs-controls a.mejs-horizontal-volume-slider{height:26px;width:56px;position:relative;display:block;float:left;vertical-align:middle}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#333;background:rgba(50,50,50,.8);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(30,30,30,.8)),to(rgba(60,60,60,.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-moz-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-o-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-ms-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:linear-gradient(rgba(30,30,30,.8),rgba(60,60,60,.8))}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#fff;background:rgba(255,255,255,.8);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.9)),to(rgba(200,200,200,.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-moz-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-o-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-ms-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:linear-gradient(rgba(255,255,255,.9),rgba(200,200,200,.8))}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle{display:none}.mejs-controls .mejs-captions-button{position:relative}.mejs-controls .mejs-captions-button button{background-position:-48px 0}.mejs-controls .mejs-captions-button .mejs-captions-selector{visibility:hidden;position:absolute;bottom:26px;right:-51px;width:85px;height:100px;background:url(background.png);background:rgba(50,50,50,.7);border:solid 1px transparent;padding:10px 10px 0;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;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:55px;float:left;padding:4px 0 0;line-height:15px;font-family:Helvetica,Arial,serif;font-size:10px}.mejs-controls .mejs-captions-button .mejs-captions-translations{font-size:10px;margin:0 0 5px}.mejs-chapters{position:absolute;top:0;left:0;border-right:solid 1px #fff;width:10000px;z-index:1}.mejs-chapters .mejs-chapter{position:absolute;float:left;background:#222;background:rgba(0,0,0,.7);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(50,50,50,.7)),to(rgba(0,0,0,.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-moz-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-o-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-ms-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:linear-gradient(rgba(50,50,50,.7),rgba(0,0,0,.7));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#323232, endColorstr=#000000);overflow:hidden;border:0}.mejs-chapters .mejs-chapter .mejs-chapter-block{font-size:11px;color:#fff;padding:5px;display:block;border-right:solid 1px #333;border-bottom:solid 1px #333;cursor:pointer}.mejs-chapters .mejs-chapter .mejs-chapter-block-last{border-right:0}.mejs-chapters .mejs-chapter .mejs-chapter-block:hover{background:#666;background:rgba(102,102,102,.7);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(102,102,102,.7)),to(rgba(50,50,50,.6)));background:-webkit-linear-gradient(top,rgba(102,102,102,.7),rgba(50,50,50,.6));background:-moz-linear-gradient(top,rgba(102,102,102,.7),rgba(50,50,50,.6));background:-o-linear-gradient(top,rgba(102,102,102,.7),rgba(50,50,50,.6));background:-ms-linear-gradient(top,rgba(102,102,102,.7),rgba(50,50,50,.6));background:linear-gradient(rgba(102,102,102,.7),rgba(50,50,50,.6));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#666666, endColorstr=#323232)}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{font-size:12px;font-weight:700;display:block;white-space:nowrap;text-overflow:ellipsis;margin:0 0 3px;line-height:12px}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{font-size:12px;line-height:12px;margin:3px 0 4px;display:block;white-space:nowrap;text-overflow:ellipsis}.mejs-captions-layer{position:absolute;bottom:0;left:0;text-align:center;line-height:20px;font-size:16px;color:#fff}.mejs-captions-layer a{color:#fff;text-decoration:underline}.mejs-captions-layer[lang=ar]{font-size:20px;font-weight:400}.mejs-captions-position{position:absolute;width:100%;bottom:15px;left:0}.mejs-captions-position-hover{bottom:35px}.mejs-captions-text{padding:0;background:url(background.png);background:rgba(20,20,20,.5);white-space:pre-wrap;-webkit-box-shadow:5px 0 0 rgba(20,20,20,.5),-5px 0 0 rgba(20,20,20,.5);box-shadow:5px 0 0 rgba(20,20,20,.5),-5px 0 0 rgba(20,20,20,.5)}.me-cannotplay{}.me-cannotplay a{color:#fff;font-weight:700}.me-cannotplay span{padding:15px;display:block}.mejs-controls .mejs-loop-off button{background-position:-64px -16px}.mejs-controls .mejs-loop-on button{background-position:-64px 0}.mejs-controls .mejs-backlight-off button{background-position:-80px -16px}.mejs-controls .mejs-backlight-on button{background-position:-80px 0}.mejs-controls .mejs-picturecontrols-button{background-position:-96px 0}.mejs-contextmenu{position:absolute;width:150px;padding:10px;border-radius:4px;top:0;left:0;background:#fff;border:solid 1px #999;z-index:1001}.mejs-contextmenu .mejs-contextmenu-separator{height:1px;font-size:0;margin:5px 6px;background:#333}.mejs-contextmenu .mejs-contextmenu-item{font-family:Helvetica,Arial,serif;font-size:12px;padding:4px 6px;cursor:pointer;color:#333}.mejs-contextmenu .mejs-contextmenu-item:hover{background:#2C7C91;color:#fff}.mejs-controls .mejs-sourcechooser-button{position:relative}.mejs-controls .mejs-sourcechooser-button button{background-position:-128px 0}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector{position:absolute;bottom:26px;right:-10px;width:130px;height:100px;background:url(background.png);background:rgba(50,50,50,.7);border:solid 1px transparent;padding:10px;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li{margin:0 0 6px;padding:0;list-style-type:none!important;display:block;color:#fff;overflow:hidden}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label{width:100px;float:left;padding:4px 0 0;line-height:15px;font-family:Helvetica,Arial,serif;font-size:10px}.mejs-postroll-layer{position:absolute;bottom:0;left:0;width:100%;height:100%;background:url(background.png);background:rgba(50,50,50,.7);z-index:1000;overflow:hidden}.mejs-postroll-layer-content{width:100%;height:100%}.mejs-postroll-close{position:absolute;right:0;top:0;background:url(background.png);background:rgba(50,50,50,.7);color:#fff;padding:4px;z-index:100;cursor:pointer}div.mejs-speed-button{width:46px!important;position:relative}.mejs-controls .mejs-button.mejs-speed-button button{background:transparent;width:36px;font-size:11px;line-height:normal;color:#fff}.mejs-controls .mejs-speed-button .mejs-speed-selector{display:none;position:absolute;top:-100px;left:-10px;width:60px;height:100px;background:url(background.png);background:rgba(50,50,50,.7);border:solid 1px transparent;padding:0;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mejs-controls .mejs-speed-button:hover>.mejs-speed-selector{display:block}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li label.mejs-speed-selected{color:rgba(33,248,248,1)}.mejs-controls .mejs-speed-button .mejs-speed-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li{margin:0 0 6px;padding:0 10px;list-style-type:none!important;display:block;color:#fff;overflow:hidden}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px;display:none}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li label{width:60px;float:left;padding:4px 0 0;line-height:15px;font-family:Helvetica,Arial,serif;font-size:11px;color:#fff;margin-left:5px;cursor:pointer}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li:hover{background-color:#c8c8c8!important;background-color:rgba(255,255,255,.4)!important}.mejs-controls .mejs-button.mejs-jump-forward-button{background:transparent url(jumpforward.png) no-repeat 3px 3px}.mejs-controls .mejs-button.mejs-jump-forward-button button{background:transparent;font-size:9px;line-height:normal;color:#fff}.mejs-controls .mejs-button.mejs-skip-back-button{background:transparent url(skipback.png) no-repeat 3px 3px}.mejs-controls .mejs-button.mejs-skip-back-button button{background:transparent;font-size:9px;line-height:normal;color:#fff}
|
mediaelement/mediaelementplayer.min.js
CHANGED
@@ -1,94 +1,14 @@
|
|
1 |
/*!
|
|
|
2 |
* MediaElementPlayer
|
3 |
* http://mediaelementjs.com/
|
4 |
*
|
5 |
* Creates a controller bar for HTML5 <video> add <audio> tags
|
6 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
7 |
*
|
8 |
-
* Copyright 2010-
|
9 |
* License: MIT
|
10 |
*
|
11 |
-
*/
|
12 |
-
(function(f){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return a.duration*0.05},defaultSeekForwardInterval:function(a){return a.duration*0.05},audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,autoRewind:true,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,clickToPlayPause:true,
|
13 |
-
iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:true,enableKeyboard:true,pauseOtherPlayers:true,keyActions:[{keys:[32,179],action:function(a,b){b.paused||b.ended?b.play():b.pause()}},{keys:[38],action:function(a,b){b.setVolume(Math.min(b.volume+0.1,1))}},{keys:[40],action:function(a,b){b.setVolume(Math.max(b.volume-0.1,0))}},{keys:[37,227],action:function(a,b){if(!isNaN(b.duration)&&
|
14 |
-
b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.max(b.currentTime-a.options.defaultSeekBackwardInterval(b),0);b.setCurrentTime(c)}}},{keys:[39,228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.min(b.currentTime+a.options.defaultSeekForwardInterval(b),b.duration);b.setCurrentTime(c)}}},{keys:[70],action:function(a){if(typeof a.enterFullScreen!="undefined")a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}}]};
|
15 |
-
mejs.mepIndex=0;mejs.players=[];mejs.MediaElementPlayer=function(a,b){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,b);this.$media=this.$node=f(a);this.node=this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;if(typeof b=="undefined")b=this.$node.data("mejsoptions");this.options=f.extend({},mejs.MepDefaults,b);mejs.players.push(this);this.init();return this};mejs.MediaElementPlayer.prototype={hasFocus:false,
|
16 |
-
controlsAreVisible:true,init:function(){var a=this,b=mejs.MediaFeatures,c=f.extend(true,{},a.options,{success:function(e,g){a.meReady(e,g)},error:function(e){a.handleError(e)}}),d=a.media.tagName.toLowerCase();a.isDynamic=d!=="audio"&&d!=="video";a.isVideo=a.isDynamic?a.options.isVideo:d!=="audio"&&a.options.isVideo;if(b.isiPad&&a.options.iPadUseNativeControls||b.isiPhone&&a.options.iPhoneUseNativeControls){a.$media.attr("controls","controls");if(b.isiPad&&a.media.getAttribute("autoplay")!==null){a.media.load();
|
17 |
-
a.media.play()}}else if(!(b.isAndroid&&a.AndroidUseNativeControls)){a.$media.removeAttr("controls");a.id="mep_"+mejs.mepIndex++;a.container=f('<div id="'+a.id+'" class="mejs-container '+(mejs.MediaFeatures.svg?"svg":"no-svg")+'"><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.addClass((b.isAndroid?"mejs-android ":
|
18 |
-
"")+(b.isiOS?"mejs-ios ":"")+(b.isiPad?"mejs-ipad ":"")+(b.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio "));if(b.isiOS){b=a.$media.clone();a.container.find(".mejs-mediaelement").append(b);a.$media.remove();a.$node=a.$media=b;a.node=a.media=b[0]}else a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");b=a.isVideo?"video":"audio";d=b.substring(0,1).toUpperCase()+b.substring(1);a.width=a.options[b+
|
19 |
-
"Width"]>0||a.options[b+"Width"].toString().indexOf("%")>-1?a.options[b+"Width"]:a.media.style.width!==""&&a.media.style.width!==null?a.media.style.width:a.media.getAttribute("width")!==null?a.$media.attr("width"):a.options["default"+d+"Width"];a.height=a.options[b+"Height"]>0||a.options[b+"Height"].toString().indexOf("%")>-1?a.options[b+"Height"]:a.media.style.height!==""&&a.media.style.height!==null?a.media.style.height:a.$media[0].getAttribute("height")!==null?a.$media.attr("height"):a.options["default"+
|
20 |
-
d+"Height"];a.setPlayerSize(a.width,a.height);c.pluginWidth=a.height;c.pluginHeight=a.width}mejs.MediaElement(a.$media[0],c);a.container.trigger("controlsshown")},showControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!b.controlsAreVisible){if(a){b.controls.css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true;b.container.trigger("controlsshown")});b.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=
|
21 |
-
true})}else{b.controls.css("visibility","visible").css("display","block");b.container.find(".mejs-control").css("visibility","visible").css("display","block");b.controlsAreVisible=true;b.container.trigger("controlsshown")}b.setControlsSize()}},hideControls:function(a){var b=this;a=typeof a=="undefined"||a;if(b.controlsAreVisible)if(a){b.controls.stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")});
|
22 |
-
b.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block")})}else{b.controls.css("visibility","hidden").css("display","block");b.container.find(".mejs-control").css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")}},controlsTimer:null,startControlsTimer:function(a){var b=this;a=typeof a!="undefined"?a:1500;b.killControlsTimer("start");b.controlsTimer=setTimeout(function(){b.hideControls();
|
23 |
-
b.killControlsTimer("hide")},a)},killControlsTimer:function(){if(this.controlsTimer!==null){clearTimeout(this.controlsTimer);delete this.controlsTimer;this.controlsTimer=null}},controlsEnabled:true,disableControls:function(){this.killControlsTimer();this.hideControls(false);this.controlsEnabled=false},enableControls:function(){this.showControls(false);this.controlsEnabled=true},meReady:function(a,b){var c=this,d=mejs.MediaFeatures,e=b.getAttribute("autoplay");e=!(typeof e=="undefined"||e===null||
|
24 |
-
e==="false");var g;if(!c.created){c.created=true;c.media=a;c.domNode=b;if(!(d.isAndroid&&c.options.AndroidUseNativeControls)&&!(d.isiPad&&c.options.iPadUseNativeControls)&&!(d.isiPhone&&c.options.iPhoneUseNativeControls)){c.buildposter(c,c.controls,c.layers,c.media);c.buildkeyboard(c,c.controls,c.layers,c.media);c.buildoverlays(c,c.controls,c.layers,c.media);c.findTracks();for(g in c.options.features){d=c.options.features[g];if(c["build"+d])try{c["build"+d](c,c.controls,c.layers,c.media)}catch(k){}}c.container.trigger("controlsready");
|
25 |
-
c.setPlayerSize(c.width,c.height);c.setControlsSize();if(c.isVideo){if(mejs.MediaFeatures.hasTouch)c.$media.bind("touchstart",function(){if(c.controlsAreVisible)c.hideControls(false);else c.controlsEnabled&&c.showControls(false)});else{c.media.addEventListener("click",function(){if(c.options.clickToPlayPause)c.media.paused?c.media.play():c.media.pause()});c.container.bind("mouseenter mouseover",function(){if(c.controlsEnabled)if(!c.options.alwaysShowControls){c.killControlsTimer("enter");c.showControls();
|
26 |
-
c.startControlsTimer(2500)}}).bind("mousemove",function(){if(c.controlsEnabled){c.controlsAreVisible||c.showControls();c.options.alwaysShowControls||c.startControlsTimer(2500)}}).bind("mouseleave",function(){c.controlsEnabled&&!c.media.paused&&!c.options.alwaysShowControls&&c.startControlsTimer(1E3)})}e&&!c.options.alwaysShowControls&&c.hideControls();c.options.enableAutosize&&c.media.addEventListener("loadedmetadata",function(h){if(c.options.videoHeight<=0&&c.domNode.getAttribute("height")===null&&
|
27 |
-
!isNaN(h.target.videoHeight)){c.setPlayerSize(h.target.videoWidth,h.target.videoHeight);c.setControlsSize();c.media.setVideoSize(h.target.videoWidth,h.target.videoHeight)}},false)}a.addEventListener("play",function(){for(var h=0,o=mejs.players.length;h<o;h++){var n=mejs.players[h];n.id!=c.id&&c.options.pauseOtherPlayers&&!n.paused&&!n.ended&&n.pause();n.hasFocus=false}c.hasFocus=true},false);c.media.addEventListener("ended",function(){if(c.options.autoRewind)try{c.media.setCurrentTime(0)}catch(h){}c.media.pause();
|
28 |
-
c.setProgressRail&&c.setProgressRail();c.setCurrentRail&&c.setCurrentRail();if(c.options.loop)c.media.play();else!c.options.alwaysShowControls&&c.controlsEnabled&&c.showControls()},false);c.media.addEventListener("loadedmetadata",function(){c.updateDuration&&c.updateDuration();c.updateCurrent&&c.updateCurrent();if(!c.isFullScreen){c.setPlayerSize(c.width,c.height);c.setControlsSize()}},false);setTimeout(function(){c.setPlayerSize(c.width,c.height);c.setControlsSize()},50);f(window).resize(function(){c.isFullScreen||
|
29 |
-
mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||c.setPlayerSize(c.width,c.height);c.setControlsSize()});c.media.pluginType=="youtube"&&c.container.find(".mejs-overlay-play").hide()}if(e&&a.pluginType=="native"){a.load();a.play()}if(c.options.success)typeof c.options.success=="string"?window[c.options.success](c.media,c.domNode,c):c.options.success(c.media,c.domNode,c)}},handleError:function(a){this.controls.hide();this.options.error&&this.options.error(a)},setPlayerSize:function(a,
|
30 |
-
b){if(typeof a!="undefined")this.width=a;if(typeof b!="undefined")this.height=b;if(this.height.toString().indexOf("%")>0||this.$node.css("max-width")==="100%"||this.$node[0].currentStyle&&this.$node[0].currentStyle.maxWidth==="100%"){var c=this.isVideo?this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.options.defaultVideoWidth:this.options.defaultAudioWidth,d=this.isVideo?this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.options.defaultVideoHeight:
|
31 |
-
this.options.defaultAudioHeight,e=this.container.parent().closest(":visible").width();c=this.isVideo||!this.options.autosizeProgress?parseInt(e*d/c,10):d;if(this.container.parent()[0].tagName.toLowerCase()==="body"){e=f(window).width();c=f(window).height()}if(c!=0&&e!=0){this.container.width(e).height(c);this.$media.width("100%").height("100%");this.container.find("object, embed, iframe").width("100%").height("100%");this.isVideo&&this.media.setVideoSize&&this.media.setVideoSize(e,c);this.layers.children(".mejs-layer").width("100%").height("100%")}}else{this.container.width(this.width).height(this.height);
|
32 |
-
this.layers.children(".mejs-layer").width(this.width).height(this.height)}},setControlsSize:function(){var a=0,b=0,c=this.controls.find(".mejs-time-rail"),d=this.controls.find(".mejs-time-total");this.controls.find(".mejs-time-current");this.controls.find(".mejs-time-loaded");var e=c.siblings();if(this.options&&!this.options.autosizeProgress)b=parseInt(c.css("width"));if(b===0||!b){e.each(function(){if(f(this).css("position")!="absolute")a+=f(this).outerWidth(true)});b=this.controls.width()-a-(c.outerWidth(true)-
|
33 |
-
c.width())}c.width(b);d.width(b-(d.outerWidth(true)-d.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},buildposter:function(a,b,c,d){var e=f('<div class="mejs-poster mejs-layer"></div>').appendTo(c);b=a.$media.attr("poster");if(a.options.poster!=="")b=a.options.poster;b!==""&&b!=null?this.setPoster(b):e.hide();d.addEventListener("play",function(){e.hide()},false)},setPoster:function(a){var b=this.container.find(".mejs-poster"),c=b.find("img");if(c.length==
|
34 |
-
0)c=f('<img width="100%" height="100%" />').appendTo(b);c.attr("src",a)},buildoverlays:function(a,b,c,d){var e=this;if(a.isVideo){var g=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(c),k=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(c),h=f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(c).click(function(){if(e.options.clickToPlayPause)d.paused?
|
35 |
-
d.play():d.pause()});d.addEventListener("play",function(){h.hide();g.hide();b.find(".mejs-time-buffering").hide();k.hide()},false);d.addEventListener("playing",function(){h.hide();g.hide();b.find(".mejs-time-buffering").hide();k.hide()},false);d.addEventListener("seeking",function(){g.show();b.find(".mejs-time-buffering").show()},false);d.addEventListener("seeked",function(){g.hide();b.find(".mejs-time-buffering").hide()},false);d.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||h.show()},
|
36 |
-
false);d.addEventListener("waiting",function(){g.show();b.find(".mejs-time-buffering").show()},false);d.addEventListener("loadeddata",function(){g.show();b.find(".mejs-time-buffering").show()},false);d.addEventListener("canplay",function(){g.hide();b.find(".mejs-time-buffering").hide()},false);d.addEventListener("error",function(){g.hide();b.find(".mejs-time-buffering").hide();k.show();k.find("mejs-overlay-error").html("Error loading this resource")},false)}},buildkeyboard:function(a,b,c,d){f(document).keydown(function(e){if(a.hasFocus&&
|
37 |
-
a.options.enableKeyboard)for(var g=0,k=a.options.keyActions.length;g<k;g++)for(var h=a.options.keyActions[g],o=0,n=h.keys.length;o<n;o++)if(e.keyCode==h.keys[o]){e.preventDefault();h.action(a,d,e.keyCode);return false}return true});f(document).click(function(e){if(f(e.target).closest(".mejs-container").length==0)a.hasFocus=false})},findTracks:function(){var a=this,b=a.$media.find("track");a.tracks=[];b.each(function(c,d){d=f(d);a.tracks.push({srclang:d.attr("srclang").toLowerCase(),src:d.attr("src"),
|
38 |
-
kind:d.attr("kind"),label:d.attr("label")||"",entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize(this.width,this.height);this.setControlsSize()},play:function(){this.media.play()},pause:function(){this.media.pause()},load:function(){this.media.load()},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},
|
39 |
-
getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){if(this.media.pluginType==="flash")this.media.remove();else this.media.pluginType==="native"&&this.$media.prop("controls",true);this.isDynamic||this.$node.insertBefore(this.container);this.container.remove()}};if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){return this.each(function(){new mejs.MediaElementPlayer(this,a)})};f(document).ready(function(){f(".mejs-player").mediaelementplayer()});
|
40 |
-
window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
|
41 |
-
(function(f){f.extend(mejs.MepDefaults,{playpauseText:"Play/Pause"});f.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,b,c,d){var e=f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+this.id+'" title="'+this.options.playpauseText+'"></button></div>').appendTo(b).click(function(g){g.preventDefault();d.paused?d.play():d.pause();return false});d.addEventListener("play",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);
|
42 |
-
d.addEventListener("playing",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);d.addEventListener("pause",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false);d.addEventListener("paused",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);
|
43 |
-
(function(f){f.extend(mejs.MepDefaults,{stopText:"Stop"});f.extend(MediaElementPlayer.prototype,{buildstop:function(a,b,c,d){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="'+this.options.stopText+'"></button></div>').appendTo(b).click(function(){d.paused||d.pause();if(d.currentTime>0){d.setCurrentTime(0);d.pause();b.find(".mejs-time-current").width("0px");b.find(".mejs-time-handle").css("left","0px");b.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));
|
44 |
-
b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-poster").show()}})}})})(mejs.$);
|
45 |
-
(function(f){f.extend(MediaElementPlayer.prototype,{buildprogress:function(a,b,c,d){f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-buffering"></span><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(b);b.find(".mejs-time-buffering").hide();var e=
|
46 |
-
b.find(".mejs-time-total");c=b.find(".mejs-time-loaded");var g=b.find(".mejs-time-current"),k=b.find(".mejs-time-handle"),h=b.find(".mejs-time-float"),o=b.find(".mejs-time-float-current"),n=function(m){m=m.pageX;var q=e.offset(),i=e.outerWidth(true),j=0,l=j=0;if(d.duration){if(m<q.left)m=q.left;else if(m>i+q.left)m=i+q.left;l=m-q.left;j=l/i;j=j<=0.02?0:j*d.duration;p&&j!==d.currentTime&&d.setCurrentTime(j);if(!mejs.MediaFeatures.hasTouch){h.css("left",l);o.html(mejs.Utility.secondsToTimeCode(j));
|
47 |
-
h.show()}}},p=false;e.bind("mousedown",function(m){if(m.which===1){p=true;n(m);f(document).bind("mousemove.dur",function(q){n(q)}).bind("mouseup.dur",function(){p=false;h.hide();f(document).unbind(".dur")});return false}}).bind("mouseenter",function(){f(document).bind("mousemove.dur",function(m){n(m)});mejs.MediaFeatures.hasTouch||h.show()}).bind("mouseleave",function(){if(!p){f(document).unbind(".dur");h.hide()}});d.addEventListener("progress",function(m){a.setProgressRail(m);a.setCurrentRail(m)},
|
48 |
-
false);d.addEventListener("timeupdate",function(m){a.setProgressRail(m);a.setCurrentRail(m)},false);this.loaded=c;this.total=e;this.current=g;this.handle=k},setProgressRail:function(a){var b=a!=undefined?a.target:this.media,c=null;if(b&&b.buffered&&b.buffered.length>0&&b.buffered.end&&b.duration)c=b.buffered.end(0)/b.duration;else if(b&&b.bytesTotal!=undefined&&b.bytesTotal>0&&b.bufferedBytes!=undefined)c=b.bufferedBytes/b.bytesTotal;else if(a&&a.lengthComputable&&a.total!=0)c=a.loaded/a.total;if(c!==
|
49 |
-
null){c=Math.min(1,Math.max(0,c));this.loaded&&this.total&&this.loaded.width(this.total.width()*c)}},setCurrentRail:function(){if(this.media.currentTime!=undefined&&this.media.duration)if(this.total&&this.handle){var a=this.total.width()*this.media.currentTime/this.media.duration,b=a-this.handle.outerWidth(true)/2;this.current.width(a);this.handle.css("left",b)}}})})(mejs.$);
|
50 |
-
(function(f){f.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:" <span> | </span> "});f.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,b,c,d){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(b);this.currenttime=this.controls.find(".mejs-currenttime");d.addEventListener("timeupdate",function(){a.updateCurrent()},false)},buildduration:function(a,
|
51 |
-
b,c,d){if(b.children().last().find(".mejs-currenttime").length>0)f(this.options.timeAndDurationSeparator+'<span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span>").appendTo(b.find(".mejs-time"));else{b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");
|
52 |
-
f('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span></div>").appendTo(b)}this.durationD=this.controls.find(".mejs-duration");d.addEventListener("timeupdate",function(){a.updateDuration()},
|
53 |
-
false)},updateCurrent:function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))},updateDuration:function(){this.container.toggleClass("mejs-long-video",this.media.duration>3600);if(this.media.duration&&this.durationD)this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,
|
54 |
-
this.options.framesPerSecond||25))}})})(mejs.$);
|
55 |
-
(function(f){f.extend(mejs.MepDefaults,{muteText:"Mute Toggle",hideVolumeOnTouchDevices:true,audioVolume:"horizontal",videoVolume:"vertical"});f.extend(MediaElementPlayer.prototype,{buildvolume:function(a,b,c,d){if(!(mejs.MediaFeatures.hasTouch&&this.options.hideVolumeOnTouchDevices)){var e=this.isVideo?this.options.videoVolume:this.options.audioVolume,g=e=="horizontal"?f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+this.id+'" title="'+this.options.muteText+
|
56 |
-
'"></button></div><div class="mejs-horizontal-volume-slider"><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></div>').appendTo(b):f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+this.id+'" title="'+this.options.muteText+'"></button><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(b),
|
57 |
-
k=this.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),h=this.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),o=this.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),n=this.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),p=function(j,l){if(!k.is(":visible")&&typeof l=="undefined"){k.show();p(j,true);k.hide()}else{j=Math.max(0,j);j=Math.min(j,1);j==0?g.removeClass("mejs-mute").addClass("mejs-unmute"):g.removeClass("mejs-unmute").addClass("mejs-mute");
|
58 |
-
if(e=="vertical"){var r=h.height(),s=h.position(),t=r-r*j;n.css("top",Math.round(s.top+t-n.height()/2));o.height(r-t);o.css("top",s.top+t)}else{r=h.width();s=h.position();r=r*j;n.css("left",Math.round(s.left+r-n.width()/2));o.width(Math.round(r))}}},m=function(j){var l=null,r=h.offset();if(e=="vertical"){l=h.height();parseInt(h.css("top").replace(/px/,""),10);l=(l-(j.pageY-r.top))/l;if(r.top==0||r.left==0)return}else{l=h.width();l=(j.pageX-r.left)/l}l=Math.max(0,l);l=Math.min(l,1);p(l);l==0?d.setMuted(true):
|
59 |
-
d.setMuted(false);d.setVolume(l)},q=false,i=false;g.hover(function(){k.show();i=true},function(){i=false;!q&&e=="vertical"&&k.hide()});k.bind("mouseover",function(){i=true}).bind("mousedown",function(j){m(j);f(document).bind("mousemove.vol",function(l){m(l)}).bind("mouseup.vol",function(){q=false;f(document).unbind(".vol");!i&&e=="vertical"&&k.hide()});q=true;return false});g.find("button").click(function(){d.setMuted(!d.muted)});d.addEventListener("volumechange",function(){if(!q)if(d.muted){p(0);
|
60 |
-
g.removeClass("mejs-mute").addClass("mejs-unmute")}else{p(d.volume);g.removeClass("mejs-unmute").addClass("mejs-mute")}},false);if(this.container.is(":visible")){p(a.options.startVolume);d.pluginType==="native"&&d.setVolume(a.options.startVolume)}}}})})(mejs.$);
|
61 |
-
(function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:true,newWindowCallback:function(){return""},fullscreenText:mejs.i18n.t("Fullscreen")});f.extend(MediaElementPlayer.prototype,{isFullScreen:false,isNativeFullScreen:false,docStyleOverflow:null,isInIframe:false,buildfullscreen:function(a,b,c,d){if(a.isVideo){a.isInIframe=window.location!=window.parent.location;if(mejs.MediaFeatures.hasTrueNativeFullScreen){c=null;c=mejs.MediaFeatures.hasMozNativeFullScreen?f(document):a.container;c.bind(mejs.MediaFeatures.fullScreenEventName,
|
62 |
-
function(){if(mejs.MediaFeatures.isFullScreen()){a.isNativeFullScreen=true;a.setControlsSize()}else{a.isNativeFullScreen=false;a.exitFullScreen()}})}var e=this,g=f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+e.id+'" title="'+e.options.fullscreenText+'"></button></div>').appendTo(b);if(e.media.pluginType==="native"||!e.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||
|
63 |
-
a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});else{var k=null;if(function(){var i=document.createElement("x"),j=document.documentElement,l=window.getComputedStyle;if(!("pointerEvents"in i.style))return false;i.style.pointerEvents="auto";i.style.pointerEvents="x";j.appendChild(i);l=l&&l(i,"").pointerEvents==="auto";j.removeChild(i);return!!l}()&&!mejs.MediaFeatures.isOpera){var h=false,o=function(){if(h){n.hide();p.hide();m.hide();g.css("pointer-events","");e.controls.css("pointer-events",
|
64 |
-
"");h=false}},n=f('<div class="mejs-fullscreen-hover" />').appendTo(e.container).mouseover(o),p=f('<div class="mejs-fullscreen-hover" />').appendTo(e.container).mouseover(o),m=f('<div class="mejs-fullscreen-hover" />').appendTo(e.container).mouseover(o),q=function(){var i={position:"absolute",top:0,left:0};n.css(i);p.css(i);m.css(i);n.width(e.container.width()).height(e.container.height()-e.controls.height());i=g.offset().left-e.container.offset().left;fullScreenBtnWidth=g.outerWidth(true);p.width(i).height(e.controls.height()).css({top:e.container.height()-
|
65 |
-
e.controls.height()});m.width(e.container.width()-i-fullScreenBtnWidth).height(e.controls.height()).css({top:e.container.height()-e.controls.height(),left:i+fullScreenBtnWidth})};f(document).resize(function(){q()});g.mouseover(function(){if(!e.isFullScreen){var i=g.offset(),j=a.container.offset();d.positionFullscreenButton(i.left-j.left,i.top-j.top,false);g.css("pointer-events","none");e.controls.css("pointer-events","none");n.show();m.show();p.show();q();h=true}});d.addEventListener("fullscreenchange",
|
66 |
-
function(){o()})}else g.mouseover(function(){if(k!==null){clearTimeout(k);delete k}var i=g.offset(),j=a.container.offset();d.positionFullscreenButton(i.left-j.left,i.top-j.top,true)}).mouseout(function(){if(k!==null){clearTimeout(k);delete k}k=setTimeout(function(){d.hideFullscreenButton()},1500)})}a.fullscreenBtn=g;f(document).bind("keydown",function(i){if((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||e.isFullScreen)&&i.keyCode==27)a.exitFullScreen()})}},enterFullScreen:function(){var a=
|
67 |
-
this;if(!(a.media.pluginType!=="native"&&(mejs.MediaFeatures.isFirefox||a.options.usePluginFullScreen))){docStyleOverflow=document.documentElement.style.overflow;document.documentElement.style.overflow="hidden";normalHeight=a.container.height();normalWidth=a.container.width();if(a.media.pluginType==="native")if(mejs.MediaFeatures.hasTrueNativeFullScreen){mejs.MediaFeatures.requestFullScreen(a.container[0]);a.isInIframe&&setTimeout(function c(){if(a.isNativeFullScreen)f(window).width()!==screen.width?
|
68 |
-
a.exitFullScreen():setTimeout(c,500)},500)}else if(mejs.MediaFeatures.hasSemiNativeFullScreen){a.media.webkitEnterFullscreen();return}if(a.isInIframe){var b=a.options.newWindowCallback(this);if(b!=="")if(mejs.MediaFeatures.hasTrueNativeFullScreen)setTimeout(function(){if(!a.isNativeFullScreen){a.pause();window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}},250);else{a.pause();window.open(b,a.id,"top=0,left=0,width="+
|
69 |
-
screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");return}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);if(a.pluginType==="native")a.$media.width("100%").height("100%");else{a.container.find("object, embed, iframe").width("100%").height("100%");a.media.setVideoSize(f(window).width(),f(window).height())}a.layers.children("div").width("100%").height("100%");
|
70 |
-
a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=true}},exitFullScreen:function(){if(this.media.pluginType!=="native"&&mejs.MediaFeatures.isFirefox)this.media.setFullscreen(false);else{if(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen))mejs.MediaFeatures.cancelFullScreen();document.documentElement.style.overflow=docStyleOverflow;this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight);
|
71 |
-
if(this.pluginType==="native")this.$media.width(normalWidth).height(normalHeight);else{this.container.find("object embed").width(normalWidth).height(normalHeight);this.media.setVideoSize(normalWidth,normalHeight)}this.layers.children("div").width(normalWidth).height(normalHeight);this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");this.setControlsSize();this.isFullScreen=false}}})})(mejs.$);
|
72 |
-
(function(f){f.extend(mejs.MepDefaults,{startLanguage:"",tracksText:"Captions/Subtitles"});f.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(a,b,c,d){if(a.isVideo)if(a.tracks.length!=0){var e;a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(c).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(c).hide();a.captionsText=a.captions.find(".mejs-captions-text");
|
73 |
-
a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+this.id+'" title="'+this.options.tracksText+'"></button><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(b).hover(function(){f(this).find(".mejs-captions-selector").css("visibility","visible")},function(){f(this).find(".mejs-captions-selector").css("visibility",
|
74 |
-
"hidden")}).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];a.captions.attr("lang",a.selectedTrack.srclang);a.displayCaptions();break}});a.options.alwaysShowControls?a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):a.container.bind("controlsshown",function(){a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("controlshidden",
|
75 |
-
function(){d.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;for(e=0;e<a.tracks.length;e++)a.tracks[e].kind=="subtitles"&&a.addTrackButton(a.tracks[e].srclang,a.tracks[e].label);a.loadNextTrack();d.addEventListener("timeupdate",function(){a.displayCaptions()},false);d.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){if(a.hasChapters){a.chapters.css("visibility",
|
76 |
-
"visible");a.chapters.fadeIn(200).height(a.chapters.find(".mejs-chapter").outerHeight())}},function(){a.hasChapters&&!d.paused&&a.chapters.fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});a.node.getAttribute("autoplay")!==null&&a.chapters.css("visibility","hidden")}},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 b=
|
77 |
-
this,c=b.tracks[a];f.ajax({url:c.src,dataType:"text",success:function(d){c.entries=typeof d=="string"&&/<tt\s+xml/ig.exec(d)?mejs.TrackFormatParser.dfxp.parse(d):mejs.TrackFormatParser.webvvt.parse(d);c.isLoaded=true;b.enableTrackButton(c.srclang,c.label);b.loadNextTrack();c.kind=="chapters"&&b.media.addEventListener("play",function(){b.media.duration>0&&b.displayChapters(c)},false)},error:function(){b.loadNextTrack()}})},enableTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("input[value="+
|
78 |
-
a+"]").prop("disabled",false).siblings("label").html(b);this.options.startLanguage==a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,b){if(b==="")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+" (loading)</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+
|
79 |
-
a+"]").remove()},adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},displayCaptions:function(){if(typeof this.tracks!="undefined"){var a,b=this.selectedTrack;if(b!=null&&b.isLoaded)for(a=0;a<b.entries.times.length;a++)if(this.media.currentTime>=b.entries.times[a].start&&this.media.currentTime<=b.entries.times[a].stop){this.captionsText.html(b.entries.text[a]);
|
80 |
-
this.captions.show().height(0);return}this.captions.hide()}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind=="chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);this.hasChapters=true;break}},drawChapters:function(a){var b=this,c,d,e=d=0;b.chapters.empty();for(c=0;c<a.entries.times.length;c++){d=a.entries.times[c].stop-a.entries.times[c].start;d=Math.floor(d/b.media.duration*100);if(d+e>100||c==a.entries.times.length-1&&d+e<100)d=100-e;b.chapters.append(f('<div class="mejs-chapter" rel="'+
|
81 |
-
a.entries.times[c].start+'" style="left: '+e.toString()+"%;width: "+d.toString()+'%;"><div class="mejs-chapter-block'+(c==a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[c].start)+"–"+mejs.Utility.secondsToTimeCode(a.entries.times[c].stop)+"</span></div></div>"));e+=d}b.chapters.find("div.mejs-chapter").click(function(){b.media.setCurrentTime(parseFloat(f(this).attr("rel")));
|
82 |
-
b.media.paused&&b.media.play()});b.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",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",
|
83 |
-
ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",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.TrackFormatParser={webvvt:{pattern_identifier:/^([a-zA-z]+-)?[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})?)(.*)$/,
|
84 |
-
parse:function(a){var b=0;a=mejs.TrackFormatParser.split2(a,/\r?\n/);for(var c={text:[],times:[]},d,e;b<a.length;b++)if(this.pattern_identifier.exec(a[b])){b++;if((d=this.pattern_timecode.exec(a[b]))&&b<a.length){b++;e=a[b];for(b++;a[b]!==""&&b<a.length;){e=e+"\n"+a[b];b++}e=f.trim(e).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,"<a href='$1' target='_blank'>$1</a>");c.text.push(e);c.times.push({start:mejs.Utility.convertSMPTEtoSeconds(d[1])==0?0.2:mejs.Utility.convertSMPTEtoSeconds(d[1]),
|
85 |
-
stop:mejs.Utility.convertSMPTEtoSeconds(d[3]),settings:d[5]})}}return c}},dfxp:{parse:function(a){a=f(a).filter("tt");var b=0;b=a.children("div").eq(0);var c=b.find("p");b=a.find("#"+b.attr("style"));var d,e;a={text:[],times:[]};if(b.length){e=b.removeAttr("id").get(0).attributes;if(e.length){d={};for(b=0;b<e.length;b++)d[e[b].name.split(":")[1]]=e[b].value}}for(b=0;b<c.length;b++){var g;e={start:null,stop:null,style:null};if(c.eq(b).attr("begin"))e.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("begin"));
|
86 |
-
if(!e.start&&c.eq(b-1).attr("end"))e.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b-1).attr("end"));if(c.eq(b).attr("end"))e.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("end"));if(!e.stop&&c.eq(b+1).attr("begin"))e.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b+1).attr("begin"));if(d){g="";for(var k in d)g+=k+":"+d[k]+";"}if(g)e.style=g;if(e.start==0)e.start=0.2;a.times.push(e);e=f.trim(c.eq(b).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
|
87 |
-
"<a href='$1' target='_blank'>$1</a>");a.text.push(e);if(a.times.start==0)a.times.start=2}return a}},split2:function(a,b){return a.split(b)}};if("x\n\ny".split(/\n/gi).length!=3)mejs.TrackFormatParser.split2=function(a,b){var c=[],d="",e;for(e=0;e<a.length;e++){d+=a.substring(e,e+1);if(b.test(d)){c.push(d.replace(b,""));d=""}}c.push(d);return c}})(mejs.$);
|
88 |
-
(function(f){f.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){if(typeof a.enterFullScreen=="undefined")return null;return a.isFullScreen?"Turn off Fullscreen":"Go Fullscreen"},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?"Unmute":"Mute"},click:function(a){a.media.muted?a.setMuted(false):a.setMuted(true)}},{isSeparator:true},{render:function(){return"Download Video"},click:function(a){window.location.href=a.media.currentSrc}}]});
|
89 |
-
f.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a){a.contextMenu=f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide();a.container.bind("contextmenu",function(b){if(a.isContextMenuEnabled){b.preventDefault();a.renderContextMenu(b.clientX-1,b.clientY-1);return false}});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=
|
90 |
-
true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;if(a!=null){clearTimeout(a);delete a}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(a,b){for(var c=this,d="",e=c.options.contextMenuItems,g=0,k=e.length;g<
|
91 |
-
k;g++)if(e[g].isSeparator)d+='<div class="mejs-contextmenu-separator"></div>';else{var h=e[g].render(c);if(h!=null)d+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+Math.random()*1E6+'">'+h+"</div>"}c.contextMenu.empty().append(f(d)).css({top:b,left:a}).show();c.contextMenu.find(".mejs-contextmenu-item").each(function(){var o=f(this),n=parseInt(o.data("itemindex"),10),p=c.options.contextMenuItems[n];typeof p.show!="undefined"&&p.show(o,c);o.click(function(){typeof p.click!=
|
92 |
-
"undefined"&&p.click(c);c.contextMenu.hide()})});setTimeout(function(){c.killControlsTimer("rev3")},100)}})})(mejs.$);
|
93 |
-
(function(f){f.extend(mejs.MepDefaults,{postrollCloseText:mejs.i18n.t("Close")});f.extend(MediaElementPlayer.prototype,{buildpostroll:function(a,b,c){var d=this.container.find('link[rel="postroll"]').attr("href");if(typeof d!=="undefined"){a.postroll=f('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">'+this.options.postrollCloseText+'</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(c).hide();this.media.addEventListener("ended",
|
94 |
-
function(){f.ajax({dataType:"html",url:d,success:function(e){c.find(".mejs-postroll-layer-content").html(e)}});a.postroll.show()},false)}}})})(mejs.$);
|
1 |
/*!
|
2 |
+
*
|
3 |
* MediaElementPlayer
|
4 |
* http://mediaelementjs.com/
|
5 |
*
|
6 |
* Creates a controller bar for HTML5 <video> add <audio> tags
|
7 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
8 |
*
|
9 |
+
* Copyright 2010-2013, John Dyer (http://j.hn/)
|
10 |
* License: MIT
|
11 |
*
|
12 |
+
*/
|
13 |
+
"undefined"!=typeof jQuery?mejs.$=jQuery:"undefined"!=typeof Zepto?(mejs.$=Zepto,Zepto.fn.outerWidth=function(a){var b=$(this).width();return a&&(b+=parseInt($(this).css("margin-right"),10),b+=parseInt($(this).css("margin-left"),10)),b}):"undefined"!=typeof ender&&(mejs.$=ender),function(a){mejs.MepDefaults={poster:"",showPosterWhenEnded:!1,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return.05*a.duration},defaultSeekForwardInterval:function(a){return.05*a.duration},setDimensions:!0,audioWidth:-1,audioHeight:-1,startVolume:.8,loop:!1,autoRewind:!0,enableAutosize:!0,timeFormat:"",alwaysShowHours:!1,showTimecodeFrameCount:!1,framesPerSecond:25,autosizeProgress:!0,alwaysShowControls:!1,hideVideoControlsOnLoad:!1,clickToPlayPause:!0,controlsTimeoutDefault:1500,controlsTimeoutMouseEnter:2500,controlsTimeoutMouseLeave:1e3,iPadUseNativeControls:!1,iPhoneUseNativeControls:!1,AndroidUseNativeControls:!1,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:!0,stretching:"auto",enableKeyboard:!0,pauseOtherPlayers:!0,keyActions:[{keys:[32,179],action:function(a,b,c,d){mejs.MediaFeatures.isFirefox||(b.paused||b.ended?b.play():b.pause())}},{keys:[38],action:function(a,b,c,d){a.container.find(".mejs-volume-slider").css("display","block"),a.isVideo&&(a.showControls(),a.startControlsTimer());var e=Math.min(b.volume+.1,1);b.setVolume(e)}},{keys:[40],action:function(a,b,c,d){a.container.find(".mejs-volume-slider").css("display","block"),a.isVideo&&(a.showControls(),a.startControlsTimer());var e=Math.max(b.volume-.1,0);b.setVolume(e)}},{keys:[37,227],action:function(a,b,c,d){if(!isNaN(b.duration)&&b.duration>0){a.isVideo&&(a.showControls(),a.startControlsTimer());var e=Math.max(b.currentTime-a.options.defaultSeekBackwardInterval(b),0);b.setCurrentTime(e)}}},{keys:[39,228],action:function(a,b,c,d){if(!isNaN(b.duration)&&b.duration>0){a.isVideo&&(a.showControls(),a.startControlsTimer());var e=Math.min(b.currentTime+a.options.defaultSeekForwardInterval(b),b.duration);b.setCurrentTime(e)}}},{keys:[70],action:function(a,b,c,d){"undefined"!=typeof a.enterFullScreen&&(a.isFullScreen?a.exitFullScreen():a.enterFullScreen())}},{keys:[77],action:function(a,b,c,d){a.container.find(".mejs-volume-slider").css("display","block"),a.isVideo&&(a.showControls(),a.startControlsTimer()),a.media.muted?a.setMuted(!1):a.setMuted(!0)}}]},mejs.mepIndex=0,mejs.players={},mejs.MediaElementPlayer=function(b,c){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(b,c);var d=this;return d.$media=d.$node=a(b),d.node=d.media=d.$media[0],d.node?"undefined"!=typeof d.node.player?d.node.player:("undefined"==typeof c&&(c=d.$node.data("mejsoptions")),d.options=a.extend({},mejs.MepDefaults,c),d.options.timeFormat||(d.options.timeFormat="mm:ss",d.options.alwaysShowHours&&(d.options.timeFormat="hh:mm:ss"),d.options.showTimecodeFrameCount&&(d.options.timeFormat+=":ff")),mejs.Utility.calculateTimeFormat(0,d.options,d.options.framesPerSecond||25),d.id="mep_"+mejs.mepIndex++,mejs.players[d.id]=d,d.init(),d):void 0},mejs.MediaElementPlayer.prototype={hasFocus:!1,controlsAreVisible:!0,init:function(){var b=this,c=mejs.MediaFeatures,d=a.extend(!0,{},b.options,{success:function(a,c){b.meReady(a,c)},error:function(a){b.handleError(a)}}),e=b.media.tagName.toLowerCase();if(b.isDynamic="audio"!==e&&"video"!==e,b.isDynamic?b.isVideo=b.options.isVideo:b.isVideo="audio"!==e&&b.options.isVideo,c.isiPad&&b.options.iPadUseNativeControls||c.isiPhone&&b.options.iPhoneUseNativeControls)b.$media.attr("controls","controls"),c.isiPad&&null!==b.media.getAttribute("autoplay")&&b.play();else if(c.isAndroid&&b.options.AndroidUseNativeControls);else if(b.isVideo||!b.isVideo&&b.options.features.length){b.$media.removeAttr("controls");var f=b.isVideo?mejs.i18n.t("mejs.video-player"):mejs.i18n.t("mejs.audio-player");a('<span class="mejs-offscreen">'+f+"</span>").insertBefore(b.$media),b.container=a('<div id="'+b.id+'" class="mejs-container '+(mejs.MediaFeatures.svgAsImg?"svg":"no-svg")+'" tabindex="0" role="application" aria-label="'+f+'"><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(b.$media[0].className).insertBefore(b.$media).focus(function(a){if(!b.controlsAreVisible&&!b.hasFocus&&b.controlsEnabled&&(b.showControls(!0),!b.hasMsNativeFullScreen)){var c=".mejs-playpause-button > button";mejs.Utility.isNodeAfter(a.relatedTarget,b.container[0])&&(c=".mejs-controls .mejs-button:last-child > button");var d=b.container.find(c);d.focus()}}),b.options.features.length||b.container.css("background","transparent").find(".mejs-controls").hide(),b.isVideo&&"fill"===b.options.stretching&&!b.container.parent("mejs-fill-container").length&&(b.outerContainer=b.$media.parent(),b.container.wrap('<div class="mejs-fill-container"/>')),b.container.addClass((c.isAndroid?"mejs-android ":"")+(c.isiOS?"mejs-ios ":"")+(c.isiPad?"mejs-ipad ":"")+(c.isiPhone?"mejs-iphone ":"")+(b.isVideo?"mejs-video ":"mejs-audio ")),b.container.find(".mejs-mediaelement").append(b.$media),b.node.player=b,b.controls=b.container.find(".mejs-controls"),b.layers=b.container.find(".mejs-layers");var g=b.isVideo?"video":"audio",h=g.substring(0,1).toUpperCase()+g.substring(1);b.options[g+"Width"]>0||b.options[g+"Width"].toString().indexOf("%")>-1?b.width=b.options[g+"Width"]:""!==b.media.style.width&&null!==b.media.style.width?b.width=b.media.style.width:null!==b.media.getAttribute("width")?b.width=b.$media.attr("width"):b.width=b.options["default"+h+"Width"],b.options[g+"Height"]>0||b.options[g+"Height"].toString().indexOf("%")>-1?b.height=b.options[g+"Height"]:""!==b.media.style.height&&null!==b.media.style.height?b.height=b.media.style.height:null!==b.$media[0].getAttribute("height")?b.height=b.$media.attr("height"):b.height=b.options["default"+h+"Height"],b.setPlayerSize(b.width,b.height),d.pluginWidth=b.width,d.pluginHeight=b.height}else b.isVideo||b.options.features.length||b.$media.hide();mejs.MediaElement(b.$media[0],d),"undefined"!=typeof b.container&&b.options.features.length&&b.controlsAreVisible&&b.container.trigger("controlsshown")},showControls:function(a){var b=this;a="undefined"==typeof a||a,b.controlsAreVisible||(a?(b.controls.removeClass("mejs-offscreen").stop(!0,!0).fadeIn(200,function(){b.controlsAreVisible=!0,b.container.trigger("controlsshown")}),b.container.find(".mejs-control").removeClass("mejs-offscreen").stop(!0,!0).fadeIn(200,function(){b.controlsAreVisible=!0})):(b.controls.removeClass("mejs-offscreen").css("display","block"),b.container.find(".mejs-control").removeClass("mejs-offscreen").css("display","block"),b.controlsAreVisible=!0,b.container.trigger("controlsshown")),b.setControlsSize())},hideControls:function(b){var c=this;b="undefined"==typeof b||b,!c.controlsAreVisible||c.options.alwaysShowControls||c.keyboardAction||c.media.paused||c.media.ended||(b?(c.controls.stop(!0,!0).fadeOut(200,function(){a(this).addClass("mejs-offscreen").css("display","block"),c.controlsAreVisible=!1,c.container.trigger("controlshidden")}),c.container.find(".mejs-control").stop(!0,!0).fadeOut(200,function(){a(this).addClass("mejs-offscreen").css("display","block")})):(c.controls.addClass("mejs-offscreen").css("display","block"),c.container.find(".mejs-control").addClass("mejs-offscreen").css("display","block"),c.controlsAreVisible=!1,c.container.trigger("controlshidden")))},controlsTimer:null,startControlsTimer:function(a){var b=this;a="undefined"!=typeof a?a:b.options.controlsTimeoutDefault,b.killControlsTimer("start"),b.controlsTimer=setTimeout(function(){b.hideControls(),b.killControlsTimer("hide")},a)},killControlsTimer:function(a){var b=this;null!==b.controlsTimer&&(clearTimeout(b.controlsTimer),delete b.controlsTimer,b.controlsTimer=null)},controlsEnabled:!0,disableControls:function(){var a=this;a.killControlsTimer(),a.hideControls(!1),this.controlsEnabled=!1},enableControls:function(){var a=this;a.showControls(!1),a.controlsEnabled=!0},meReady:function(b,c){var d,e,f=this,g=mejs.MediaFeatures,h=c.getAttribute("autoplay"),i=!("undefined"==typeof h||null===h||"false"===h);if(!f.created){if(f.created=!0,f.media=b,f.domNode=c,!(g.isAndroid&&f.options.AndroidUseNativeControls||g.isiPad&&f.options.iPadUseNativeControls||g.isiPhone&&f.options.iPhoneUseNativeControls)){if(!f.isVideo&&!f.options.features.length)return i&&"native"==b.pluginType&&f.play(),void(f.options.success&&("string"==typeof f.options.success?window[f.options.success](f.media,f.domNode,f):f.options.success(f.media,f.domNode,f)));f.buildposter(f,f.controls,f.layers,f.media),f.buildkeyboard(f,f.controls,f.layers,f.media),f.buildoverlays(f,f.controls,f.layers,f.media),f.findTracks();for(d in f.options.features)if(e=f.options.features[d],f["build"+e])try{f["build"+e](f,f.controls,f.layers,f.media)}catch(j){}f.container.trigger("controlsready"),f.setPlayerSize(f.width,f.height),f.setControlsSize(),f.isVideo&&(mejs.MediaFeatures.hasTouch&&!f.options.alwaysShowControls?f.$media.bind("touchstart",function(){f.controlsAreVisible?f.hideControls(!1):f.controlsEnabled&&f.showControls(!1)}):(f.clickToPlayPauseCallback=function(){if(f.options.clickToPlayPause){f.media.paused?f.play():f.pause();var a=f.$media.closest(".mejs-container").find(".mejs-overlay-button"),b=a.attr("aria-pressed");a.attr("aria-pressed",!b)}},f.media.addEventListener("click",f.clickToPlayPauseCallback,!1),f.container.bind("mouseenter",function(){f.controlsEnabled&&(f.options.alwaysShowControls||(f.killControlsTimer("enter"),f.showControls(),f.startControlsTimer(f.options.controlsTimeoutMouseEnter)))}).bind("mousemove",function(){f.controlsEnabled&&(f.controlsAreVisible||f.showControls(),f.options.alwaysShowControls||f.startControlsTimer(f.options.controlsTimeoutMouseEnter))}).bind("mouseleave",function(){f.controlsEnabled&&(f.media.paused||f.options.alwaysShowControls||f.startControlsTimer(f.options.controlsTimeoutMouseLeave))})),f.options.hideVideoControlsOnLoad&&f.hideControls(!1),i&&!f.options.alwaysShowControls&&f.hideControls(),f.options.enableAutosize&&f.media.addEventListener("loadedmetadata",function(a){f.options.videoHeight<=0&&null===f.domNode.getAttribute("height")&&!isNaN(a.target.videoHeight)&&(f.setPlayerSize(a.target.videoWidth,a.target.videoHeight),f.setControlsSize(),f.media.setVideoSize(a.target.videoWidth,a.target.videoHeight))},!1)),f.media.addEventListener("play",function(){var a;for(a in mejs.players){var b=mejs.players[a];b.id==f.id||!f.options.pauseOtherPlayers||b.paused||b.ended||b.pause(),b.hasFocus=!1}f.hasFocus=!0},!1),f.media.addEventListener("ended",function(b){if(f.options.autoRewind)try{f.media.setCurrentTime(0),window.setTimeout(function(){a(f.container).find(".mejs-overlay-loading").parent().hide()},20)}catch(c){}"youtube"===f.media.pluginType?f.media.stop():f.media.pause(),f.setProgressRail&&f.setProgressRail(),f.setCurrentRail&&f.setCurrentRail(),f.options.loop?f.play():!f.options.alwaysShowControls&&f.controlsEnabled&&f.showControls()},!1),f.media.addEventListener("loadedmetadata",function(){mejs.Utility.calculateTimeFormat(f.duration,f.options,f.options.framesPerSecond||25),f.updateDuration&&f.updateDuration(),f.updateCurrent&&f.updateCurrent(),f.isFullScreen||(f.setPlayerSize(f.width,f.height),f.setControlsSize())},!1);var k=null;f.media.addEventListener("timeupdate",function(){k!==this.duration&&(k=this.duration,mejs.Utility.calculateTimeFormat(k,f.options,f.options.framesPerSecond||25),f.updateDuration&&f.updateDuration(),f.updateCurrent&&f.updateCurrent(),f.setControlsSize())},!1),f.container.focusout(function(b){if(b.relatedTarget){var c=a(b.relatedTarget);f.keyboardAction&&0===c.parents(".mejs-container").length&&(f.keyboardAction=!1,f.isVideo&&!f.options.alwaysShowControls&&f.hideControls(!0))}}),setTimeout(function(){f.setPlayerSize(f.width,f.height),f.setControlsSize()},50),f.globalBind("resize",function(){f.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||f.setPlayerSize(f.width,f.height),f.setControlsSize()}),"youtube"==f.media.pluginType&&(g.isiOS||g.isAndroid)&&(f.container.find(".mejs-overlay-play").hide(),f.container.find(".mejs-poster").hide())}i&&"native"==b.pluginType&&f.play(),f.options.success&&("string"==typeof f.options.success?window[f.options.success](f.media,f.domNode,f):f.options.success(f.media,f.domNode,f))}},handleError:function(a){var b=this;b.controls&&b.controls.hide(),b.options.error&&b.options.error(a)},setPlayerSize:function(a,b){var c=this;if(!c.options.setDimensions)return!1;switch("undefined"!=typeof a&&(c.width=a),"undefined"!=typeof b&&(c.height=b),c.options.stretching){case"fill":c.isVideo?this.setFillMode():this.setDimensions(c.width,c.height);break;case"responsive":this.setResponsiveMode();break;case"none":this.setDimensions(c.width,c.height);break;default:this.hasFluidMode()===!0?this.setResponsiveMode():this.setDimensions(c.width,c.height)}},hasFluidMode:function(){var a=this;return a.height.toString().indexOf("%")>0||"none"!==a.$node.css("max-width")&&"t.width"!==a.$node.css("max-width")||a.$node[0].currentStyle&&"100%"===a.$node[0].currentStyle.maxWidth},setResponsiveMode:function(){var b=this,c=function(){return b.isVideo?b.media.videoWidth&&b.media.videoWidth>0?b.media.videoWidth:null!==b.media.getAttribute("width")?b.media.getAttribute("width"):b.options.defaultVideoWidth:b.options.defaultAudioWidth}(),d=function(){return b.isVideo?b.media.videoHeight&&b.media.videoHeight>0?b.media.videoHeight:null!==b.media.getAttribute("height")?b.media.getAttribute("height"):b.options.defaultVideoHeight:b.options.defaultAudioHeight}(),e=b.container.parent().closest(":visible").width(),f=b.container.parent().closest(":visible").height(),g=b.isVideo||!b.options.autosizeProgress?parseInt(e*d/c,10):d;(isNaN(g)||0!==f&&g>f&&f>d)&&(g=f),b.container.parent().length>0&&"body"===b.container.parent()[0].tagName.toLowerCase()&&(e=a(window).width(),g=a(window).height()),g&&e&&(b.container.width(e).height(g),b.$media.add(b.container.find(".mejs-shim")).width("100%").height("100%"),b.isVideo&&b.media.setVideoSize&&b.media.setVideoSize(e,g),b.layers.children(".mejs-layer").width("100%").height("100%"))},setFillMode:function(){var a=this,b=a.outerContainer;b.width()||b.height(a.$media.width()),b.height()||b.height(a.$media.height());var c=b.width(),d=b.height();a.setDimensions("100%","100%"),a.container.find(".mejs-poster img").css("display","block"),targetElement=a.container.find("object, embed, iframe, video");var e=a.height,f=a.width,g=c,h=e*c/f,i=f*d/e,j=d,k=!(i>c),l=k?Math.floor(g):Math.floor(i),m=k?Math.floor(h):Math.floor(j);k?(targetElement.height(m).width(c),a.media.setVideoSize&&a.media.setVideoSize(c,m)):(targetElement.height(d).width(l),a.media.setVideoSize&&a.media.setVideoSize(l,d)),targetElement.css({"margin-left":Math.floor((c-l)/2),"margin-top":0})},setDimensions:function(a,b){var c=this;c.container.width(a).height(b),c.layers.children(".mejs-layer").width(a).height(b)},setControlsSize:function(){var b=this,c=0,d=0,e=b.controls.find(".mejs-time-rail"),f=b.controls.find(".mejs-time-total"),g=e.siblings(),h=g.last(),i=null,j=b.options&&!b.options.autosizeProgress;if(b.container.is(":visible")&&e.length&&e.is(":visible")){j&&(d=parseInt(e.css("width"),10)),0!==d&&d||(g.each(function(){var b=a(this);"absolute"!=b.css("position")&&b.is(":visible")&&(c+=a(this).outerWidth(!0))}),d=b.controls.width()-c-(e.outerWidth(!0)-e.width()));do j||e.width(d),f.width(d-(f.outerWidth(!0)-f.width())),"absolute"!=h.css("position")&&(i=h.length?h.position():null,d--);while(null!==i&&i.top.toFixed(2)>0&&d>0);b.container.trigger("controlsresize")}},buildposter:function(b,c,d,e){var f=this,g=a('<div class="mejs-poster mejs-layer"></div>').appendTo(d),h=b.$media.attr("poster");""!==b.options.poster&&(h=b.options.poster),h?f.setPoster(h):g.hide(),e.addEventListener("play",function(){g.hide()},!1),b.options.showPosterWhenEnded&&b.options.autoRewind&&e.addEventListener("ended",function(){g.show()},!1)},setPoster:function(b){var c=this,d=c.container.find(".mejs-poster"),e=d.find("img");0===e.length&&(e=a('<img width="100%" height="100%" alt="" />').appendTo(d)),e.attr("src",b),d.css({"background-image":"url("+b+")"})},buildoverlays:function(b,c,d,e){var f=this;if(b.isVideo){var g=a('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(d),h=a('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(d),i=a('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button" role="button" aria-label="'+mejs.i18n.t("mejs.play")+'" aria-pressed="false"></div></div>').appendTo(d).bind("click",function(){if(f.options.clickToPlayPause){e.paused&&e.play();var b=a(this).find(".mejs-overlay-button"),c=b.attr("aria-pressed");b.attr("aria-pressed",!!c)}});e.addEventListener("play",function(){i.hide(),g.hide(),c.find(".mejs-time-buffering").hide(),h.hide()},!1),e.addEventListener("playing",function(){i.hide(),g.hide(),c.find(".mejs-time-buffering").hide(),h.hide()},!1),e.addEventListener("seeking",function(){g.show(),c.find(".mejs-time-buffering").show()},!1),e.addEventListener("seeked",function(){g.hide(),c.find(".mejs-time-buffering").hide()},!1),e.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||i.show()},!1),e.addEventListener("waiting",function(){g.show(),c.find(".mejs-time-buffering").show()},!1),e.addEventListener("loadeddata",function(){g.show(),c.find(".mejs-time-buffering").show(),mejs.MediaFeatures.isAndroid&&(e.canplayTimeout=window.setTimeout(function(){if(document.createEvent){var a=document.createEvent("HTMLEvents");return a.initEvent("canplay",!0,!0),e.dispatchEvent(a)}},300))},!1),e.addEventListener("canplay",function(){g.hide(),c.find(".mejs-time-buffering").hide(),clearTimeout(e.canplayTimeout)},!1),e.addEventListener("error",function(a){f.handleError(a),g.hide(),i.hide(),h.show(),h.find(".mejs-overlay-error").html("Error loading this resource")},!1),e.addEventListener("keydown",function(a){f.onkeydown(b,e,a)},!1)}},buildkeyboard:function(b,c,d,e){var f=this;f.container.keydown(function(){f.keyboardAction=!0}),f.globalBind("keydown",function(c){return b.hasFocus=0!==a(c.target).closest(".mejs-container").length&&a(c.target).closest(".mejs-container").attr("id")===b.$media.closest(".mejs-container").attr("id"),f.onkeydown(b,e,c)}),f.globalBind("click",function(c){b.hasFocus=0!==a(c.target).closest(".mejs-container").length})},onkeydown:function(a,b,c){if(a.hasFocus&&a.options.enableKeyboard)for(var d=0,e=a.options.keyActions.length;e>d;d++)for(var f=a.options.keyActions[d],g=0,h=f.keys.length;h>g;g++)if(c.keyCode==f.keys[g])return"function"==typeof c.preventDefault&&c.preventDefault(),f.action(a,b,c.keyCode,c),!1;return!0},findTracks:function(){var b=this,c=b.$media.find("track");b.tracks=[],c.each(function(c,d){d=a(d),b.tracks.push({srclang:d.attr("srclang")?d.attr("srclang").toLowerCase():"",src:d.attr("src"),kind:d.attr("kind"),label:d.attr("label")||"",entries:[],isLoaded:!1})})},changeSkin:function(a){this.container[0].className="mejs-container "+a,this.setPlayerSize(this.width,this.height),this.setControlsSize()},play:function(){this.load(),this.media.play()},pause:function(){try{this.media.pause()}catch(a){}},load:function(){this.isLoaded||this.media.load(),this.isLoaded=!0},setMuted:function(a){this.media.setMuted(a)},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){var b=this;if("youtube"===b.media.pluginType){var c;if("string"!=typeof a){var d,e;for(d=0;d<a.length;d++)if(e=a[d],this.canPlayType(e.type)){a=e.src;break}}if(-1!==a.lastIndexOf("youtu.be"))c=a.substr(a.lastIndexOf("/")+1),-1!==c.indexOf("?")&&(c=c.substr(0,c.indexOf("?")));else{var f=a.match(/[?&]v=([^&#]+)|&|#|$/);f&&(c=f[1])}null!==b.media.getAttribute("autoplay")?b.media.pluginApi.loadVideoById(c):b.media.pluginApi.cueVideoById(c)}else b.media.setSrc(a)},remove:function(){var a,b,c=this;c.container.prev(".mejs-offscreen").remove();for(a in c.options.features)if(b=c.options.features[a],c["clean"+b])try{c["clean"+b](c)}catch(d){}c.isDynamic?c.$node.insertBefore(c.container):(c.$media.prop("controls",!0),c.$node.clone().insertBefore(c.container).show(),c.$node.remove()),"native"!==c.media.pluginType&&c.media.remove(),delete mejs.players[c.id],"object"==typeof c.container&&c.container.remove(),c.globalUnbind(),delete c.node.player},rebuildtracks:function(){var a=this;a.findTracks(),a.buildtracks(a,a.controls,a.layers,a.media)},resetSize:function(){var a=this;setTimeout(function(){a.setPlayerSize(a.width,a.height),a.setControlsSize()},50)}},function(){function b(b,d){var e={d:[],w:[]};return a.each((b||"").split(" "),function(a,b){var f=b+"."+d;0===f.indexOf(".")?(e.d.push(f),e.w.push(f)):e[c.test(b)?"w":"d"].push(f)}),e.d=e.d.join(" "),e.w=e.w.join(" "),e}var c=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;mejs.MediaElementPlayer.prototype.globalBind=function(c,d,e){var f=this,g=f.node?f.node.ownerDocument:document;c=b(c,f.id),c.d&&a(g).bind(c.d,d,e),c.w&&a(window).bind(c.w,d,e)},mejs.MediaElementPlayer.prototype.globalUnbind=function(c,d){var e=this,f=e.node?e.node.ownerDocument:document;c=b(c,e.id),c.d&&a(f).unbind(c.d,d),c.w&&a(window).unbind(c.w,d)}}(),"undefined"!=typeof a&&(a.fn.mediaelementplayer=function(b){return b===!1?this.each(function(){var b=a(this).data("mediaelementplayer");b&&b.remove(),a(this).removeData("mediaelementplayer")}):this.each(function(){a(this).data("mediaelementplayer",new mejs.MediaElementPlayer(this,b))}),this},a(document).ready(function(){a(".mejs-player").mediaelementplayer()})),window.MediaElementPlayer=mejs.MediaElementPlayer}(mejs.$),function(a){a.extend(mejs.MepDefaults,{playText:"",pauseText:""}),a.extend(MediaElementPlayer.prototype,{buildplaypause:function(b,c,d,e){function f(a){"play"===a?(k.removeClass("mejs-play").addClass("mejs-pause"),l.attr({title:j,"aria-label":j})):(k.removeClass("mejs-pause").addClass("mejs-play"),l.attr({title:i,"aria-label":i}))}var g=this,h=g.options,i=h.playText?h.playText:mejs.i18n.t("mejs.play"),j=h.pauseText?h.pauseText:mejs.i18n.t("mejs.pause"),k=a('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+g.id+'" title="'+i+'" aria-label="'+j+'"></button></div>').appendTo(c).click(function(a){return a.preventDefault(),e.paused?e.play():e.pause(),!1}),l=k.find("button");f("pse"),e.addEventListener("play",function(){f("play")},!1),e.addEventListener("playing",function(){f("play")},!1),e.addEventListener("pause",function(){f("pse")},!1),e.addEventListener("paused",function(){f("pse")},!1)}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{stopText:"Stop"}),a.extend(MediaElementPlayer.prototype,{buildstop:function(b,c,d,e){var f=this;a('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+f.id+'" title="'+f.options.stopText+'" aria-label="'+f.options.stopText+'"></button></div>').appendTo(c).click(function(){e.paused||e.pause(),e.currentTime>0&&(e.setCurrentTime(0),e.pause(),c.find(".mejs-time-current").width("0px"),c.find(".mejs-time-handle").css("left","0px"),c.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0,b.options)),c.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0,b.options)),d.find(".mejs-poster").show())})}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{enableProgressTooltip:!0,progressHelpText:""}),a.extend(MediaElementPlayer.prototype,{buildprogress:function(b,c,d,e){var f=this,g=!1,h=!1,i=0,j=!1,k=b.options.autoRewind,l=(f.options.progressHelpText?f.options.progressHelpText:mejs.i18n.t("mejs.time-help-text"),b.options.enableProgressTooltip?'<span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span>':"");a('<div class="mejs-time-rail"><span class="mejs-time-total mejs-time-slider"><span class="mejs-time-buffering"></span><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span>'+l+"</span></div>").appendTo(c),c.find(".mejs-time-buffering").hide(),f.total=c.find(".mejs-time-total"),f.loaded=c.find(".mejs-time-loaded"),f.current=c.find(".mejs-time-current"),f.handle=c.find(".mejs-time-handle"),f.timefloat=c.find(".mejs-time-float"),f.timefloatcurrent=c.find(".mejs-time-float-current"),f.slider=c.find(".mejs-time-slider");var m=function(a){var c,d=f.total.offset(),h=f.total.width(),i=0,j=0,k=0;c=a.originalEvent&&a.originalEvent.changedTouches?a.originalEvent.changedTouches[0].pageX:a.changedTouches?a.changedTouches[0].pageX:a.pageX,e.duration&&(c<d.left?c=d.left:c>h+d.left&&(c=h+d.left),k=c-d.left,i=k/h,j=.02>=i?0:i*e.duration,g&&j!==e.currentTime&&e.setCurrentTime(j),mejs.MediaFeatures.hasTouch||(f.timefloat.css("left",k),f.timefloatcurrent.html(mejs.Utility.secondsToTimeCode(j,b.options)),f.timefloat.show()))},n=function(a){var c=e.currentTime,d=mejs.i18n.t("mejs.time-slider"),g=mejs.Utility.secondsToTimeCode(c,b.options),h=e.duration;f.slider.attr({"aria-label":d,"aria-valuemin":0,"aria-valuemax":h,"aria-valuenow":c,"aria-valuetext":g,role:"slider",tabindex:0})},o=function(){var a=new Date;a-i>=1e3&&e.play()};f.slider.bind("focus",function(a){b.options.autoRewind=!1}),f.slider.bind("blur",function(a){b.options.autoRewind=k}),f.slider.bind("keydown",function(a){new Date-i>=1e3&&(j=e.paused);var c=a.keyCode,d=e.duration,f=e.currentTime,g=b.options.defaultSeekForwardInterval(e),h=b.options.defaultSeekBackwardInterval(e);switch(c){case 37:case 40:f-=h;break;case 39:case 38:f+=g;break;case 36:f=0;break;case 35:f=d;break;case 32:case 13:return void(e.paused?e.play():e.pause());default:return}return f=0>f?0:f>=d?d:Math.floor(f),i=new Date,j||e.pause(),f<e.duration&&!j&&setTimeout(o,1100),e.setCurrentTime(f),a.preventDefault(),a.stopPropagation(),!1}),f.total.bind("mousedown touchstart",function(a){(1===a.which||0===a.which)&&(g=!0,m(a),f.globalBind("mousemove.dur touchmove.dur",function(a){m(a)}),f.globalBind("mouseup.dur touchend.dur",function(a){g=!1,"undefined"!=typeof f.timefloat&&f.timefloat.hide(),f.globalUnbind(".dur")}))}).bind("mouseenter",function(a){h=!0,f.globalBind("mousemove.dur",function(a){m(a)}),"undefined"==typeof f.timefloat||mejs.MediaFeatures.hasTouch||f.timefloat.show()}).bind("mouseleave",function(a){h=!1,g||(f.globalUnbind(".dur"),"undefined"!=typeof f.timefloat&&f.timefloat.hide())}),e.addEventListener("progress",function(a){b.setProgressRail(a),b.setCurrentRail(a)},!1),e.addEventListener("timeupdate",function(a){b.setProgressRail(a),b.setCurrentRail(a),n(a)},!1),f.container.on("controlsresize",function(a){b.setProgressRail(a),b.setCurrentRail(a)})},setProgressRail:function(a){var b=this,c=void 0!==a?a.target:b.media,d=null;c&&c.buffered&&c.buffered.length>0&&c.buffered.end&&c.duration?d=c.buffered.end(c.buffered.length-1)/c.duration:c&&void 0!==c.bytesTotal&&c.bytesTotal>0&&void 0!==c.bufferedBytes?d=c.bufferedBytes/c.bytesTotal:a&&a.lengthComputable&&0!==a.total&&(d=a.loaded/a.total),null!==d&&(d=Math.min(1,Math.max(0,d)),b.loaded&&b.total&&b.loaded.width(b.total.width()*d))},setCurrentRail:function(){var a=this;if(void 0!==a.media.currentTime&&a.media.duration&&a.total&&a.handle){var b=Math.round(a.total.width()*a.media.currentTime/a.media.duration),c=b-Math.round(a.handle.outerWidth(!0)/2);a.current.width(b),a.handle.css("left",c)}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:"<span> | </span>"}),a.extend(MediaElementPlayer.prototype,{buildcurrent:function(b,c,d,e){var f=this;a('<div class="mejs-time" role="timer" aria-live="off"><span class="mejs-currenttime">'+mejs.Utility.secondsToTimeCode(0,b.options)+"</span></div>").appendTo(c),f.currenttime=f.controls.find(".mejs-currenttime"),e.addEventListener("timeupdate",function(){f.controlsAreVisible&&b.updateCurrent()},!1)},buildduration:function(b,c,d,e){var f=this;c.children().last().find(".mejs-currenttime").length>0?a(f.options.timeAndDurationSeparator+'<span class="mejs-duration">'+mejs.Utility.secondsToTimeCode(f.options.duration,f.options)+"</span>").appendTo(c.find(".mejs-time")):(c.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container"),a('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+mejs.Utility.secondsToTimeCode(f.options.duration,f.options)+"</span></div>").appendTo(c)),f.durationD=f.controls.find(".mejs-duration"),e.addEventListener("timeupdate",function(){f.controlsAreVisible&&b.updateDuration()},!1)},updateCurrent:function(){var a=this,b=a.media.currentTime;isNaN(b)&&(b=0),a.currenttime&&a.currenttime.html(mejs.Utility.secondsToTimeCode(b,a.options))},updateDuration:function(){var a=this,b=a.media.duration;a.options.duration>0&&(b=a.options.duration),isNaN(b)&&(b=0),a.container.toggleClass("mejs-long-video",b>3600),a.durationD&&b>0&&a.durationD.html(mejs.Utility.secondsToTimeCode(b,a.options))}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{muteText:mejs.i18n.t("mejs.mute-toggle"),allyVolumeControlText:mejs.i18n.t("mejs.volume-help-text"),hideVolumeOnTouchDevices:!0,audioVolume:"horizontal",videoVolume:"vertical"}),a.extend(MediaElementPlayer.prototype,{buildvolume:function(b,c,d,e){if(!mejs.MediaFeatures.isAndroid&&!mejs.MediaFeatures.isiOS||!this.options.hideVolumeOnTouchDevices){var f=this,g=f.isVideo?f.options.videoVolume:f.options.audioVolume,h="horizontal"==g?a('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+f.id+'" title="'+f.options.muteText+'" aria-label="'+f.options.muteText+'"></button></div><a href="javascript:void(0);" class="mejs-horizontal-volume-slider"><span class="mejs-offscreen">'+f.options.allyVolumeControlText+'</span><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></a>').appendTo(c):a('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+f.id+'" title="'+f.options.muteText+'" aria-label="'+f.options.muteText+'"></button><a href="javascript:void(0);" class="mejs-volume-slider"><span class="mejs-offscreen">'+f.options.allyVolumeControlText+'</span><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></a></div>').appendTo(c),i=f.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),j=f.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),k=f.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),l=f.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),m=function(a,b){if(!i.is(":visible")&&"undefined"==typeof b)return i.show(),m(a,!0),void i.hide();a=Math.max(0,a),a=Math.min(a,1),0===a?(h.removeClass("mejs-mute").addClass("mejs-unmute"),h.children("button").attr("title",mejs.i18n.t("mejs.unmute")).attr("aria-label",mejs.i18n.t("mejs.unmute"))):(h.removeClass("mejs-unmute").addClass("mejs-mute"),h.children("button").attr("title",mejs.i18n.t("mejs.mute")).attr("aria-label",mejs.i18n.t("mejs.mute")));var c=j.position();if("vertical"==g){var d=j.height(),e=d-d*a;l.css("top",Math.round(c.top+e-l.height()/2)),k.height(d-e),k.css("top",c.top+e)}else{var f=j.width(),n=f*a;l.css("left",Math.round(c.left+n-l.width()/2)),k.width(Math.round(n))}},n=function(a){var b=null,c=j.offset();if("vertical"===g){var d=j.height(),f=a.pageY-c.top;if(b=(d-f)/d,0===c.top||0===c.left)return}else{var h=j.width(),i=a.pageX-c.left;b=i/h;
|
14 |
+
}b=Math.max(0,b),b=Math.min(b,1),m(b),0===b?e.setMuted(!0):e.setMuted(!1),e.setVolume(b)},o=!1,p=!1;h.hover(function(){i.show(),p=!0},function(){p=!1,o||"vertical"!=g||i.hide()});var q=function(a){var b=Math.floor(100*e.volume);i.attr({"aria-label":mejs.i18n.t("mejs.volume-slider"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":b,"aria-valuetext":b+"%",role:"slider",tabindex:0})};i.bind("mouseover",function(){p=!0}).bind("mousedown",function(a){return n(a),f.globalBind("mousemove.vol",function(a){n(a)}),f.globalBind("mouseup.vol",function(){o=!1,f.globalUnbind(".vol"),p||"vertical"!=g||i.hide()}),o=!0,!1}).bind("keydown",function(a){var b=a.keyCode,c=e.volume;switch(b){case 38:c=Math.min(c+.1,1);break;case 40:c=Math.max(0,c-.1);break;default:return!0}return o=!1,m(c),e.setVolume(c),!1}),h.find("button").click(function(){e.setMuted(!e.muted)}),h.find("button").bind("focus",function(){i.show()}),e.addEventListener("volumechange",function(a){o||(e.muted?(m(0),h.removeClass("mejs-mute").addClass("mejs-unmute")):(m(e.volume),h.removeClass("mejs-unmute").addClass("mejs-mute"))),q(a)},!1),0===b.options.startVolume&&e.setMuted(!0),"native"===e.pluginType&&e.setVolume(b.options.startVolume),f.container.on("controlsresize",function(){e.muted?(m(0),h.removeClass("mejs-mute").addClass("mejs-unmute")):(m(e.volume),h.removeClass("mejs-unmute").addClass("mejs-mute"))})}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{usePluginFullScreen:!0,newWindowCallback:function(){return""},fullscreenText:""}),a.extend(MediaElementPlayer.prototype,{isFullScreen:!1,isNativeFullScreen:!1,isInIframe:!1,fullscreenMode:"",buildfullscreen:function(b,c,d,e){if(b.isVideo){b.isInIframe=window.location!=window.parent.location,e.addEventListener("loadstart",function(){b.detectFullscreenMode()});var f=this,g=null,h=f.options.fullscreenText?f.options.fullscreenText:mejs.i18n.t("mejs.fullscreen"),i=a('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+f.id+'" title="'+h+'" aria-label="'+h+'"></button></div>').appendTo(c).on("click",function(){var a=mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||b.isFullScreen;a?b.exitFullScreen():b.enterFullScreen()}).on("mouseover",function(){if("plugin-hover"==f.fullscreenMode){null!==g&&(clearTimeout(g),delete g);var a=i.offset(),c=b.container.offset();e.positionFullscreenButton(a.left-c.left,a.top-c.top,!0)}}).on("mouseout",function(){"plugin-hover"==f.fullscreenMode&&(null!==g&&(clearTimeout(g),delete g),g=setTimeout(function(){e.hideFullscreenButton()},1500))});if(b.fullscreenBtn=i,f.globalBind("keydown",function(a){27==a.keyCode&&(mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||f.isFullScreen)&&b.exitFullScreen()}),f.normalHeight=0,f.normalWidth=0,mejs.MediaFeatures.hasTrueNativeFullScreen){var j=function(a){b.isFullScreen&&(mejs.MediaFeatures.isFullScreen()?(b.isNativeFullScreen=!0,b.setControlsSize()):(b.isNativeFullScreen=!1,b.exitFullScreen()))};b.globalBind(mejs.MediaFeatures.fullScreenEventName,j)}}},detectFullscreenMode:function(){var a=this,b="",c=mejs.MediaFeatures;return c.hasTrueNativeFullScreen&&"native"===a.media.pluginType?b="native-native":c.hasTrueNativeFullScreen&&"native"!==a.media.pluginType&&!c.hasFirefoxPluginMovingProblem?b="plugin-native":a.usePluginFullScreen?mejs.MediaFeatures.supportsPointerEvents?(b="plugin-click",a.createPluginClickThrough()):b="plugin-hover":b="fullwindow",a.fullscreenMode=b,b},isPluginClickThroughCreated:!1,createPluginClickThrough:function(){var b=this;if(!b.isPluginClickThroughCreated){var c,d,e=!1,f=function(){if(e){for(var a in g)g[a].hide();b.fullscreenBtn.css("pointer-events",""),b.controls.css("pointer-events",""),b.media.removeEventListener("click",b.clickToPlayPauseCallback),e=!1}},g={},h=["top","left","right","bottom"],i=function(){var a=fullscreenBtn.offset().left-b.container.offset().left,d=fullscreenBtn.offset().top-b.container.offset().top,e=fullscreenBtn.outerWidth(!0),f=fullscreenBtn.outerHeight(!0),h=b.container.width(),i=b.container.height();for(c in g)g[c].css({position:"absolute",top:0,left:0});g.top.width(h).height(d),g.left.width(a).height(f).css({top:d}),g.right.width(h-a-e).height(f).css({top:d,left:a+e}),g.bottom.width(h).height(i-f-d).css({top:d+f})};for(b.globalBind("resize",function(){i()}),c=0,d=h.length;d>c;c++)g[h[c]]=a('<div class="mejs-fullscreen-hover" />').appendTo(b.container).mouseover(f).hide();fullscreenBtn.on("mouseover",function(){if(!b.isFullScreen){var a=fullscreenBtn.offset(),d=player.container.offset();media.positionFullscreenButton(a.left-d.left,a.top-d.top,!1),b.fullscreenBtn.css("pointer-events","none"),b.controls.css("pointer-events","none"),b.media.addEventListener("click",b.clickToPlayPauseCallback);for(c in g)g[c].show();i(),e=!0}}),media.addEventListener("fullscreenchange",function(a){b.isFullScreen=!b.isFullScreen,b.isFullScreen?b.media.removeEventListener("click",b.clickToPlayPauseCallback):b.media.addEventListener("click",b.clickToPlayPauseCallback),f()}),b.globalBind("mousemove",function(a){if(e){var c=fullscreenBtn.offset();(a.pageY<c.top||a.pageY>c.top+fullscreenBtn.outerHeight(!0)||a.pageX<c.left||a.pageX>c.left+fullscreenBtn.outerWidth(!0))&&(fullscreenBtn.css("pointer-events",""),b.controls.css("pointer-events",""),e=!1)}}),b.isPluginClickThroughCreated=!0}},cleanfullscreen:function(a){a.exitFullScreen()},containerSizeTimeout:null,enterFullScreen:function(){var b=this;if(mejs.MediaFeatures.isiOS&&mejs.MediaFeatures.hasiOSFullScreen&&"function"==typeof b.media.webkitEnterFullscreen)return void b.media.webkitEnterFullscreen();a(document.documentElement).addClass("mejs-fullscreen"),b.normalHeight=b.container.height(),b.normalWidth=b.container.width(),"native-native"===b.fullscreenMode||"plugin-native"===b.fullscreenMode?(mejs.MediaFeatures.requestFullScreen(b.container[0]),b.isInIframe&&setTimeout(function d(){if(b.isNativeFullScreen){var c=.002,e=a(window).width(),f=screen.width,g=Math.abs(f-e),h=f*c;g>h?b.exitFullScreen():setTimeout(d,500)}},1e3)):"fullwindow"==b.fullscreeMode,b.container.addClass("mejs-container-fullscreen").width("100%").height("100%"),b.containerSizeTimeout=setTimeout(function(){b.container.css({width:"100%",height:"100%"}),b.setControlsSize()},500),"native"===b.media.pluginType?b.$media.width("100%").height("100%"):(b.container.find(".mejs-shim").width("100%").height("100%"),setTimeout(function(){var c=a(window),d=c.width(),e=c.height();b.media.setVideoSize(d,e)},500)),b.layers.children("div").width("100%").height("100%"),b.fullscreenBtn&&b.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen"),b.setControlsSize(),b.isFullScreen=!0;var c=Math.min(screen.width/b.width,screen.height/b.height);b.container.find(".mejs-captions-text").css("font-size",100*c+"%"),b.container.find(".mejs-captions-text").css("line-height","normal"),b.container.find(".mejs-captions-position").css("bottom","45px"),b.container.trigger("enteredfullscreen")},exitFullScreen:function(){var b=this;clearTimeout(b.containerSizeTimeout),mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||b.isFullScreen)&&mejs.MediaFeatures.cancelFullScreen(),a(document.documentElement).removeClass("mejs-fullscreen"),b.container.removeClass("mejs-container-fullscreen").width(b.normalWidth).height(b.normalHeight),"native"===b.media.pluginType?b.$media.width(b.normalWidth).height(b.normalHeight):(b.container.find(".mejs-shim").width(b.normalWidth).height(b.normalHeight),b.media.setVideoSize(b.normalWidth,b.normalHeight)),b.layers.children("div").width(b.normalWidth).height(b.normalHeight),b.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen"),b.setControlsSize(),b.isFullScreen=!1,b.container.find(".mejs-captions-text").css("font-size",""),b.container.find(".mejs-captions-text").css("line-height",""),b.container.find(".mejs-captions-position").css("bottom",""),b.container.trigger("exitedfullscreen")}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x"}),a.extend(MediaElementPlayer.prototype,{buildspeed:function(b,c,d,e){var f=this;if("native"==f.media.pluginType){for(var g=null,h=null,i=null,j=null,k=[],l=!1,m=0,n=f.options.speeds.length;n>m;m++){var o=f.options.speeds[m];"string"==typeof o?(k.push({name:o+f.options.speedChar,value:o}),o===f.options.defaultSpeed&&(l=!0)):(k.push(o),o.value===f.options.defaultSpeed&&(l=!0))}l||k.push({name:f.options.defaultSpeed+f.options.speedChar,value:f.options.defaultSpeed}),k.sort(function(a,b){return parseFloat(b.value)-parseFloat(a.value)});var p=function(a){for(m=0,n=k.length;n>m;m++)if(k[m].value===a)return k[m].name},q='<div class="mejs-button mejs-speed-button"><button type="button">'+p(f.options.defaultSpeed)+'</button><div class="mejs-speed-selector"><ul>';for(m=0,il=k.length;m<il;m++)j=f.id+"-speed-"+k[m].value,q+='<li><input type="radio" name="speed" value="'+k[m].value+'" id="'+j+'" '+(k[m].value===f.options.defaultSpeed?" checked":"")+' /><label for="'+j+'" '+(k[m].value===f.options.defaultSpeed?' class="mejs-speed-selected"':"")+">"+k[m].name+"</label></li>";q+="</ul></div></div>",g=a(q).appendTo(c),h=g.find(".mejs-speed-selector"),i=f.options.defaultSpeed,e.addEventListener("loadedmetadata",function(a){i&&(e.playbackRate=parseFloat(i))},!0),h.on("click",'input[type="radio"]',function(){var b=a(this).attr("value");i=b,e.playbackRate=parseFloat(b),g.find("button").html(p(b)),g.find(".mejs-speed-selected").removeClass("mejs-speed-selected"),g.find('input[type="radio"]:checked').next().addClass("mejs-speed-selected")}),g.one("mouseenter focusin",function(){h.height(g.find(".mejs-speed-selector ul").outerHeight(!0)+g.find(".mejs-speed-translations").outerHeight(!0)).css("top",-1*h.height()+"px")})}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{startLanguage:"",tracksText:"",tracksAriaLive:!1,hideCaptionsButtonWhenEmpty:!0,toggleCaptionsButtonWhenOnlyOne:!1,slidesSelector:""}),a.extend(MediaElementPlayer.prototype,{hasChapters:!1,cleartracks:function(a,b,c,d){a&&(a.captions&&a.captions.remove(),a.chapters&&a.chapters.remove(),a.captionsText&&a.captionsText.remove(),a.captionsButton&&a.captionsButton.remove())},buildtracks:function(b,c,d,e){if(0!==b.tracks.length){var f,g,h=this,i=h.options.tracksAriaLive?'role="log" aria-live="assertive" aria-atomic="false"':"",j=h.options.tracksText?h.options.tracksText:mejs.i18n.t("mejs.captions-subtitles");if(h.domNode.textTracks)for(f=h.domNode.textTracks.length-1;f>=0;f--)h.domNode.textTracks[f].mode="hidden";h.cleartracks(b,c,d,e),b.chapters=a('<div class="mejs-chapters mejs-layer"></div>').prependTo(d).hide(),b.captions=a('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover" '+i+'><span class="mejs-captions-text"></span></div></div>').prependTo(d).hide(),b.captionsText=b.captions.find(".mejs-captions-text"),b.captionsButton=a('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+h.id+'" title="'+j+'" aria-label="'+j+'"></button><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+b.id+'_captions" id="'+b.id+'_captions_none" value="none" checked="checked" /><label for="'+b.id+'_captions_none">'+mejs.i18n.t("mejs.none")+"</label></li></ul></div></div>").appendTo(c);var k=0;for(f=0;f<b.tracks.length;f++)g=b.tracks[f].kind,("subtitles"===g||"captions"===g)&&k++;for(h.options.toggleCaptionsButtonWhenOnlyOne&&1==k?b.captionsButton.on("click",function(){null===b.selectedTrack?lang=b.tracks[0].srclang:lang="none",b.setTrack(lang)}):(b.captionsButton.on("mouseenter focusin",function(){a(this).find(".mejs-captions-selector").removeClass("mejs-offscreen")}).on("click","input[type=radio]",function(){lang=this.value,b.setTrack(lang)}),b.captionsButton.on("mouseleave focusout",function(){a(this).find(".mejs-captions-selector").addClass("mejs-offscreen")})),b.options.alwaysShowControls?b.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):b.container.bind("controlsshown",function(){b.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("controlshidden",function(){e.paused||b.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")}),b.trackToLoad=-1,b.selectedTrack=null,b.isLoadingTrack=!1,f=0;f<b.tracks.length;f++)g=b.tracks[f].kind,("subtitles"===g||"captions"===g)&&b.addTrackButton(b.tracks[f].srclang,b.tracks[f].label);b.loadNextTrack(),e.addEventListener("timeupdate",function(){b.displayCaptions()},!1),""!==b.options.slidesSelector&&(b.slidesContainer=a(b.options.slidesSelector),e.addEventListener("timeupdate",function(){b.displaySlides()},!1)),e.addEventListener("loadedmetadata",function(){b.displayChapters()},!1),b.container.hover(function(){b.hasChapters&&(b.chapters.removeClass("mejs-offscreen"),b.chapters.fadeIn(200).height(b.chapters.find(".mejs-chapter").outerHeight()))},function(){b.hasChapters&&!e.paused&&b.chapters.fadeOut(200,function(){a(this).addClass("mejs-offscreen"),a(this).css("display","block")})}),h.container.on("controlsresize",function(){h.adjustLanguageBox()}),null!==b.node.getAttribute("autoplay")&&b.chapters.addClass("mejs-offscreen")}},setTrack:function(a){var b,c=this;if("none"==a)c.selectedTrack=null,c.captionsButton.removeClass("mejs-captions-enabled");else for(b=0;b<c.tracks.length;b++)if(c.tracks[b].srclang==a){null===c.selectedTrack&&c.captionsButton.addClass("mejs-captions-enabled"),c.selectedTrack=c.tracks[b],c.captions.attr("lang",c.selectedTrack.srclang),c.displayCaptions();break}},loadNextTrack:function(){var a=this;a.trackToLoad++,a.trackToLoad<a.tracks.length?(a.isLoadingTrack=!0,a.loadTrack(a.trackToLoad)):(a.isLoadingTrack=!1,a.checkForTracks())},loadTrack:function(b){var c=this,d=c.tracks[b],e=function(){d.isLoaded=!0,c.enableTrackButton(d.srclang,d.label),c.loadNextTrack()};(void 0!==d.src||""!==d.src)&&a.ajax({url:d.src,dataType:"text",success:function(a){"string"==typeof a&&/<tt\s+xml/gi.exec(a)?d.entries=mejs.TrackFormatParser.dfxp.parse(a):d.entries=mejs.TrackFormatParser.webvtt.parse(a),e(),"chapters"==d.kind&&c.media.addEventListener("play",function(){c.media.duration>0&&c.displayChapters(d)},!1),"slides"==d.kind&&c.setupSlides(d)},error:function(){c.removeTrackButton(d.srclang),c.loadNextTrack()}})},enableTrackButton:function(b,c){var d=this;""===c&&(c=mejs.language.codes[b]||b),d.captionsButton.find("input[value="+b+"]").prop("disabled",!1).siblings("label").html(c),d.options.startLanguage==b&&a("#"+d.id+"_captions_"+b).prop("checked",!0).trigger("click"),d.adjustLanguageBox()},removeTrackButton:function(a){var b=this;b.captionsButton.find("input[value="+a+"]").closest("li").remove(),b.adjustLanguageBox()},addTrackButton:function(b,c){var d=this;""===c&&(c=mejs.language.codes[b]||b),d.captionsButton.find("ul").append(a('<li><input type="radio" name="'+d.id+'_captions" id="'+d.id+"_captions_"+b+'" value="'+b+'" disabled="disabled" /><label for="'+d.id+"_captions_"+b+'">'+c+" (loading)</label></li>")),d.adjustLanguageBox(),d.container.find(".mejs-captions-translations option[value="+b+"]").remove()},adjustLanguageBox:function(){var a=this;a.captionsButton.find(".mejs-captions-selector").height(a.captionsButton.find(".mejs-captions-selector ul").outerHeight(!0)+a.captionsButton.find(".mejs-captions-translations").outerHeight(!0))},checkForTracks:function(){var a=this,b=!1;if(a.options.hideCaptionsButtonWhenEmpty){for(var c=0;c<a.tracks.length;c++){var d=a.tracks[c].kind;if(("subtitles"===d||"captions"===d)&&a.tracks[c].isLoaded){b=!0;break}}b||(a.captionsButton.hide(),a.setControlsSize())}},displayCaptions:function(){if("undefined"!=typeof this.tracks){var a,b=this,c=b.selectedTrack;if(null!==c&&c.isLoaded){for(a=0;a<c.entries.times.length;a++)if(b.media.currentTime>=c.entries.times[a].start&&b.media.currentTime<=c.entries.times[a].stop)return b.captionsText.html(c.entries.text[a]).attr("class","mejs-captions-text "+(c.entries.times[a].identifier||"")),void b.captions.show().height(0);b.captions.hide()}else b.captions.hide()}},setupSlides:function(a){var b=this;b.slides=a,b.slides.entries.imgs=[b.slides.entries.text.length],b.showSlide(0)},showSlide:function(b){if("undefined"!=typeof this.tracks&&"undefined"!=typeof this.slidesContainer){var c=this,d=c.slides.entries.text[b],e=c.slides.entries.imgs[b];"undefined"==typeof e||"undefined"==typeof e.fadeIn?c.slides.entries.imgs[b]=e=a('<img src="'+d+'">').on("load",function(){e.appendTo(c.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()}):e.is(":visible")||e.is(":animated")||e.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if("undefined"!=typeof this.slides){var a,b=this,c=b.slides;for(a=0;a<c.entries.times.length;a++)if(b.media.currentTime>=c.entries.times[a].start&&b.media.currentTime<=c.entries.times[a].stop)return void b.showSlide(a)}},displayChapters:function(){var a,b=this;for(a=0;a<b.tracks.length;a++)if("chapters"==b.tracks[a].kind&&b.tracks[a].isLoaded){b.drawChapters(b.tracks[a]),b.hasChapters=!0;break}},drawChapters:function(b){var c,d,e=this,f=0,g=0;for(e.chapters.empty(),c=0;c<b.entries.times.length;c++)d=b.entries.times[c].stop-b.entries.times[c].start,f=Math.floor(d/e.media.duration*100),(f+g>100||c==b.entries.times.length-1&&100>f+g)&&(f=100-g),e.chapters.append(a('<div class="mejs-chapter" rel="'+b.entries.times[c].start+'" style="left: '+g.toString()+"%;width: "+f.toString()+'%;"><div class="mejs-chapter-block'+(c==b.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+b.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(b.entries.times[c].start,e.options)+"–"+mejs.Utility.secondsToTimeCode(b.entries.times[c].stop,e.options)+"</span></div></div>")),g+=f;e.chapters.find("div.mejs-chapter").click(function(){e.media.setCurrentTime(parseFloat(a(this).attr("rel"))),e.media.paused&&e.media.play()}),e.chapters.show()}}),mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",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",fl:"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",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.TrackFormatParser={webvtt:{pattern_timecode:/^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(b){for(var c,d,e,f=0,g=mejs.TrackFormatParser.split2(b,/\r?\n/),h={text:[],times:[]};f<g.length;f++){if(c=this.pattern_timecode.exec(g[f]),c&&f<g.length){for(f-1>=0&&""!==g[f-1]&&(e=g[f-1]),f++,d=g[f],f++;""!==g[f]&&f<g.length;)d=d+"\n"+g[f],f++;d=a.trim(d).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>"),h.text.push(d),h.times.push({identifier:e,start:0===mejs.Utility.convertSMPTEtoSeconds(c[1])?.2:mejs.Utility.convertSMPTEtoSeconds(c[1]),stop:mejs.Utility.convertSMPTEtoSeconds(c[3]),settings:c[5]})}e=""}return h}},dfxp:{parse:function(b){b=a(b).filter("tt");var c,d,e=0,f=b.children("div").eq(0),g=f.find("p"),h=b.find("#"+f.attr("style")),i={text:[],times:[]};if(h.length){var j=h.removeAttr("id").get(0).attributes;if(j.length)for(c={},e=0;e<j.length;e++)c[j[e].name.split(":")[1]]=j[e].value}for(e=0;e<g.length;e++){var k,l={start:null,stop:null,style:null};if(g.eq(e).attr("begin")&&(l.start=mejs.Utility.convertSMPTEtoSeconds(g.eq(e).attr("begin"))),!l.start&&g.eq(e-1).attr("end")&&(l.start=mejs.Utility.convertSMPTEtoSeconds(g.eq(e-1).attr("end"))),g.eq(e).attr("end")&&(l.stop=mejs.Utility.convertSMPTEtoSeconds(g.eq(e).attr("end"))),!l.stop&&g.eq(e+1).attr("begin")&&(l.stop=mejs.Utility.convertSMPTEtoSeconds(g.eq(e+1).attr("begin"))),c){k="";for(var m in c)k+=m+":"+c[m]+";"}k&&(l.style=k),0===l.start&&(l.start=.2),i.times.push(l),d=a.trim(g.eq(e).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>"),i.text.push(d)}return i}},split2:function(a,b){return a.split(b)}},3!="x\n\ny".split(/\n/gi).length&&(mejs.TrackFormatParser.split2=function(a,b){var c,d=[],e="";for(c=0;c<a.length;c++)e+=a.substring(c,c+1),b.test(e)&&(d.push(e.replace(b,"")),e="");return d.push(e),d})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{sourcechooserText:""}),a.extend(MediaElementPlayer.prototype,{buildsourcechooser:function(b,c,d,e){var f,g=this,h=g.options.sourcechooserText?g.options.sourcechooserText:mejs.i18n.t("mejs.source-chooser");b.sourcechooserButton=a('<div class="mejs-button mejs-sourcechooser-button"><button type="button" role="button" aria-haspopup="true" aria-owns="'+g.id+'" title="'+h+'" aria-label="'+h+'"></button><div class="mejs-sourcechooser-selector mejs-offscreen" role="menu" aria-expanded="false" aria-hidden="true"><ul></ul></div></div>').appendTo(c).hover(function(){clearTimeout(f),b.showSourcechooserSelector()},function(){a(this);f=setTimeout(function(){b.hideSourcechooserSelector()},500)}).on("keydown",function(c){var d=c.keyCode;switch(d){case 32:mejs.MediaFeatures.isFirefox||b.showSourcechooserSelector(),a(this).find(".mejs-sourcechooser-selector").find("input[type=radio]:checked").first().focus();break;case 13:b.showSourcechooserSelector(),a(this).find(".mejs-sourcechooser-selector").find("input[type=radio]:checked").first().focus();break;case 27:b.hideSourcechooserSelector(),a(this).find("button").focus();break;default:return!0}}).on("focusout",mejs.Utility.debounce(function(c){setTimeout(function(){var c=a(document.activeElement).closest(".mejs-sourcechooser-selector");c.length||b.hideSourcechooserSelector()},0)},100)).delegate("input[type=radio]","click",function(){a(this).attr("aria-selected",!0).attr("checked","checked"),a(this).closest(".mejs-sourcechooser-selector").find("input[type=radio]").not(this).attr("aria-selected","false").removeAttr("checked");var b=this.value;if(e.currentSrc!=b){var c=e.currentTime,d=e.paused;e.pause(),e.setSrc(b),e.addEventListener("loadedmetadata",function(a){e.currentTime=c},!0);var f=function(a){d||e.play(),e.removeEventListener("canplay",f,!0)};e.addEventListener("canplay",f,!0),e.load()}}).delegate("button","click",function(c){a(this).siblings(".mejs-sourcechooser-selector").hasClass("mejs-offscreen")?(b.showSourcechooserSelector(),a(this).siblings(".mejs-sourcechooser-selector").find("input[type=radio]:checked").first().focus()):b.hideSourcechooserSelector()});for(var i in this.node.children){var j=this.node.children[i];"SOURCE"!==j.nodeName||"probably"!=e.canPlayType(j.type)&&"maybe"!=e.canPlayType(j.type)||b.addSourceButton(j.src,j.title,j.type,e.src==j.src)}},addSourceButton:function(b,c,d,e){var f=this;(""===c||void 0==c)&&(c=b),d=d.split("/")[1],f.sourcechooserButton.find("ul").append(a('<li><input type="radio" name="'+f.id+'_sourcechooser" id="'+f.id+"_sourcechooser_"+c+d+'" role="menuitemradio" value="'+b+'" '+(e?'checked="checked"':"")+'aria-selected="'+e+'" /><label for="'+f.id+"_sourcechooser_"+c+d+'" aria-hidden="true">'+c+" ("+d+")</label></li>")),f.adjustSourcechooserBox()},adjustSourcechooserBox:function(){var a=this;a.sourcechooserButton.find(".mejs-sourcechooser-selector").height(a.sourcechooserButton.find(".mejs-sourcechooser-selector ul").outerHeight(!0))},hideSourcechooserSelector:function(){this.sourcechooserButton.find(".mejs-sourcechooser-selector").addClass("mejs-offscreen").attr("aria-expanded","false").attr("aria-hidden","true").find("input[type=radio]").attr("tabindex","-1")},showSourcechooserSelector:function(){this.sourcechooserButton.find(".mejs-sourcechooser-selector").removeClass("mejs-offscreen").attr("aria-expanded","true").attr("aria-hidden","false").find("input[type=radio]").attr("tabindex","0")}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){return"undefined"==typeof a.enterFullScreen?null:a.isFullScreen?mejs.i18n.t("mejs.fullscreen-off"):mejs.i18n.t("mejs.fullscreen-on")},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?mejs.i18n.t("mejs.unmute"):mejs.i18n.t("mejs.mute")},click:function(a){a.media.muted?a.setMuted(!1):a.setMuted(!0)}},{isSeparator:!0},{render:function(a){return mejs.i18n.t("mejs.download-video")},click:function(a){window.location.href=a.media.currentSrc}}]}),a.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(b,c,d,e){b.contextMenu=a('<div class="mejs-contextmenu"></div>').appendTo(a("body")).hide(),b.container.bind("contextmenu",function(a){return b.isContextMenuEnabled?(a.preventDefault(),b.renderContextMenu(a.clientX-1,a.clientY-1),!1):void 0}),b.container.bind("click",function(){b.contextMenu.hide()}),b.contextMenu.bind("mouseleave",function(){b.startContextMenuTimer()})},cleancontextmenu:function(a){a.contextMenu.remove()},isContextMenuEnabled:!0,enableContextMenu:function(){this.isContextMenuEnabled=!0},disableContextMenu:function(){this.isContextMenuEnabled=!1},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer(),a.contextMenuTimer=setTimeout(function(){a.hideContextMenu(),a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;null!=a&&(clearTimeout(a),delete a,a=null)},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(b,c){for(var d=this,e="",f=d.options.contextMenuItems,g=0,h=f.length;h>g;g++)if(f[g].isSeparator)e+='<div class="mejs-contextmenu-separator"></div>';else{var i=f[g].render(d);null!=i&&(e+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+1e6*Math.random()+'">'+i+"</div>")}d.contextMenu.empty().append(a(e)).css({top:c,left:b}).show(),d.contextMenu.find(".mejs-contextmenu-item").each(function(){var b=a(this),c=parseInt(b.data("itemindex"),10),e=d.options.contextMenuItems[c];"undefined"!=typeof e.show&&e.show(b,d),b.click(function(){"undefined"!=typeof e.click&&e.click(d),d.contextMenu.hide()})}),setTimeout(function(){d.killControlsTimer("rev3")},100)}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{skipBackInterval:30,skipBackText:""}),a.extend(MediaElementPlayer.prototype,{buildskipback:function(b,c,d,e){var f=this,g=mejs.i18n.t("mejs.time-skip-back",f.options.skipBackInterval),h=f.options.skipBackText?f.options.skipBackText:g;a('<div class="mejs-button mejs-skip-back-button"><button type="button" aria-controls="'+f.id+'" title="'+h+'" aria-label="'+h+'">'+f.options.skipBackInterval+"</button></div>").appendTo(c).click(function(){e.setCurrentTime(Math.max(e.currentTime-f.options.skipBackInterval,0)),a(this).find("button").blur()})}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{postrollCloseText:""}),a.extend(MediaElementPlayer.prototype,{buildpostroll:function(b,c,d,e){var f=this,g=f.options.postrollCloseText?f.options.postrollCloseText:mejs.i18n.t("mejs.close"),h=f.container.find('link[rel="postroll"]').attr("href");"undefined"!=typeof h&&(b.postroll=a('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">'+g+'</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(d).hide(),f.media.addEventListener("ended",function(c){a.ajax({dataType:"html",url:h,success:function(a,b){d.find(".mejs-postroll-layer-content").html(a)}}),b.postroll.show()},!1))}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{markerColor:"#E9BC3D",markers:[],markerCallback:function(){}}),a.extend(MediaElementPlayer.prototype,{buildmarkers:function(a,b,c,d){var e=0,f=-1,g=-1,h=-1,i=-1;for(e=0;e<a.options.markers.length;++e)b.find(".mejs-time-total").append('<span class="mejs-time-marker"></span>');d.addEventListener("durationchange",function(c){a.setmarkers(b)}),d.addEventListener("timeupdate",function(b){for(f=Math.floor(d.currentTime),h>f?i>f&&(i=-1):h=f,e=0;e<a.options.markers.length;++e)g=Math.floor(a.options.markers[e]),f===g&&g!==i&&(a.options.markerCallback(d,d.currentTime),i=g)},!1)},setmarkers:function(b){var c,d=this,e=0;for(e=0;e<d.options.markers.length;++e)Math.floor(d.options.markers[e])<=d.media.duration&&Math.floor(d.options.markers[e])>=0&&(c=100*Math.floor(d.options.markers[e])/d.media.duration,a(b.find(".mejs-time-marker")[e]).css({width:"1px",left:c+"%",background:d.options.markerColor}))}})}(mejs.$);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mediaelement/mejs-skins.css
CHANGED
@@ -17,6 +17,9 @@
|
|
17 |
background: url(controls-ted.png) repeat-x 0 -52px;
|
18 |
height: 6px;
|
19 |
}
|
|
|
|
|
|
|
20 |
.mejs-ted .mejs-controls .mejs-time-rail .mejs-time-loaded {
|
21 |
background-color: none;
|
22 |
background: url(controls-ted.png) repeat-x 0 -52px;
|
@@ -177,6 +180,9 @@
|
|
177 |
border: solid 1px #ccc;
|
178 |
height: 3px;
|
179 |
}
|
|
|
|
|
|
|
180 |
.mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-loaded {
|
181 |
background-color: rgba(255,255,255,0.3);
|
182 |
width: 0;
|
17 |
background: url(controls-ted.png) repeat-x 0 -52px;
|
18 |
height: 6px;
|
19 |
}
|
20 |
+
.mejs-ted .mejs-controls .mejs-time-rail .mejs-time-buffering {
|
21 |
+
height: 6px;
|
22 |
+
}
|
23 |
.mejs-ted .mejs-controls .mejs-time-rail .mejs-time-loaded {
|
24 |
background-color: none;
|
25 |
background: url(controls-ted.png) repeat-x 0 -52px;
|
180 |
border: solid 1px #ccc;
|
181 |
height: 3px;
|
182 |
}
|
183 |
+
.mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-buffering {
|
184 |
+
height: 3px;
|
185 |
+
}
|
186 |
.mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-loaded {
|
187 |
background-color: rgba(255,255,255,0.3);
|
188 |
width: 0;
|
mediaelement/silverlightmediaelement.xap
CHANGED
Binary file
|
readme.txt
CHANGED
@@ -1,243 +1,247 @@
|
|
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:
|
7 |
-
Stable tag: 2.
|
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 |
-
Video and audio plugin for WordPress built on the MediaElement.js HTML5 media player library. Provides Flash or Silverlight fallback players for non-HTML5 browsers. 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 |
-
= Alternatives =
|
29 |
-
If you have a plugin that conflicts with MediaElement.js, you can also use the short codes
|
30 |
-
|
31 |
-
[mejsvideo src="http://mysite.com/mymedia.mp4" width="640" height="360"]
|
32 |
-
[mejsaudio src="http://mysite.com/mymedia.mp3"]
|
33 |
-
|
34 |
-
= src =
|
35 |
-
This location of any audio or video file
|
36 |
-
|
37 |
-
[video src="http://mysite.com/mymedia.mp4"]
|
38 |
-
|
39 |
-
You can also leave off the extention and MediaElement.js will look for all media files matching the filename (mymedia.mp4, mymedia.webm, etc.)
|
40 |
-
|
41 |
-
[video src="http://mysite.com/mymedia"]
|
42 |
-
|
43 |
-
= type =
|
44 |
-
The media type of the resource
|
45 |
-
|
46 |
-
[video src="http://mysite.com/mymedia?xyz" type="video/mp4"]
|
47 |
-
|
48 |
-
= mp4 =
|
49 |
-
The location of the h.264/MP4 source for the video.
|
50 |
-
|
51 |
-
[video mp4="http://mysite.com/mymedia.mp4"]
|
52 |
-
|
53 |
-
= mp3 =
|
54 |
-
The location of an MP3 file for video
|
55 |
-
|
56 |
-
[audio mp3="http://mysite.com/mymedia.mp3"]
|
57 |
-
|
58 |
-
= ogg =
|
59 |
-
The location of the Theora/Ogg source for the video.
|
60 |
-
|
61 |
-
[video ogg="http://mysite.com/mymedia.ogg"]
|
62 |
-
|
63 |
-
= webm =
|
64 |
-
The location of the VP8/WebM source for the video.
|
65 |
-
|
66 |
-
[video webm="http://mysite.com/mymedia.webm"]
|
67 |
-
|
68 |
-
= poster =
|
69 |
-
The location of the poster frame for the video.
|
70 |
-
|
71 |
-
[video poster="http://mysite.com/mymedia.png"]
|
72 |
-
|
73 |
-
= width =
|
74 |
-
The width of the video
|
75 |
-
|
76 |
-
[video width="640"]
|
77 |
-
|
78 |
-
= height =
|
79 |
-
The height of the video
|
80 |
-
|
81 |
-
[video height="264"]
|
82 |
-
|
83 |
-
= loop =
|
84 |
-
Loops the video or audio when it ends
|
85 |
-
|
86 |
-
[video src="http://mysite.com/mymedia.mp4" loop="true"]
|
87 |
-
|
88 |
-
= preload =
|
89 |
-
Start loading the video as soon as possible, before the user clicks play.
|
90 |
-
|
91 |
-
[video preload="true"]
|
92 |
-
|
93 |
-
= autoplay =
|
94 |
-
Start playing the video as soon as it's ready.
|
95 |
-
|
96 |
-
[video autoplay="true"]
|
97 |
-
|
98 |
-
= fullscreen =
|
99 |
-
Disables the fullscreen button
|
100 |
-
|
101 |
-
[video src="http://mysite.com/mymedia.mp4" fullscreen="false"]
|
102 |
-
|
103 |
-
= duration =
|
104 |
-
Disables the duration output
|
105 |
-
|
106 |
-
[video src="http://mysite.com/mymedia.mp4" duration="false"]
|
107 |
-
|
108 |
-
= volume =
|
109 |
-
Disables the volume slider
|
110 |
-
|
111 |
-
[video src="http://mysite.com/mymedia.mp4" volume="false"]
|
112 |
-
|
113 |
-
= progress =
|
114 |
-
Disables the progress bar
|
115 |
-
|
116 |
-
[video src="http://mysite.com/mymedia.mp4" progress="false"]
|
117 |
-
|
118 |
-
= captions =
|
119 |
-
URL to a WebSRT captions file
|
120 |
-
|
121 |
-
[video src="http://mysite.com/mymedia.mp4" captions="http://mysite.com/mymedia.srt"]
|
122 |
-
|
123 |
-
= Simple Video =
|
124 |
-
Basic playback options
|
125 |
-
|
126 |
-
[video src="http://mysite.com/mymedia.mp4" width="640" height="360"]
|
127 |
-
|
128 |
-
= All Attributes Video =
|
129 |
-
All options enabled
|
130 |
-
|
131 |
-
[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"]
|
132 |
-
|
133 |
-
= Simple Audio =
|
134 |
-
Basic playback options
|
135 |
-
|
136 |
-
[audio src="http://mysite.com/mymedia.mp3"]
|
137 |
-
|
138 |
-
= All Attributes Audio =
|
139 |
-
All options enabled
|
140 |
-
|
141 |
-
[audio mp3="http://mysite.com/mymedia.mp3" ogg="http://mysite.com/mymedia.ogg" preload="true" autoplay="true"]
|
142 |
-
|
143 |
-
### Use in a template
|
144 |
-
You can use Wordpress shortcodes in your templates using the do_shortcode function.
|
145 |
-
|
146 |
-
<?php echo do_shortcode('[video src="myvfile.mp4"]'); ?>
|
147 |
-
|
148 |
-
|
149 |
-
== Installation ==
|
150 |
-
|
151 |
-
View <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more information.
|
152 |
-
|
153 |
-
1. Upload the `media-element-html5-video-and-audio-player` folder to the `/wp-content/plugins/` directory
|
154 |
-
2. Activate the plugin through the `Plugins` menu in WordPress
|
155 |
-
3. Use the `[video]` or `[audio]` shortcode in your post or page with the options on the front page.
|
156 |
-
|
157 |
-
== Changelog ==
|
158 |
-
|
159 |
-
= 2.
|
160 |
-
*
|
161 |
-
*
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
*
|
166 |
-
*
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
*
|
171 |
-
*
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
*
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
*
|
184 |
-
|
185 |
-
= 2.0.
|
186 |
-
*
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
*
|
197 |
-
|
198 |
-
= 2.0.1.
|
199 |
-
*
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
*
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
*
|
211 |
-
*
|
212 |
-
|
213 |
-
= 1.1.
|
214 |
-
* Updated to 1.1
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
*
|
219 |
-
|
220 |
-
= 1.0 =
|
221 |
-
*
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
==
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
=
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
|
|
|
|
|
|
243 |
1. Video player
|
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: 4.8
|
7 |
+
Stable tag: 2.23.5
|
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 |
+
Video and audio plugin for WordPress built on the MediaElement.js HTML5 media player library. Provides Flash or Silverlight fallback players for non-HTML5 browsers. 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 |
+
= Alternatives =
|
29 |
+
If you have a plugin that conflicts with MediaElement.js, you can also use the short codes
|
30 |
+
|
31 |
+
[mejsvideo src="http://mysite.com/mymedia.mp4" width="640" height="360"]
|
32 |
+
[mejsaudio src="http://mysite.com/mymedia.mp3"]
|
33 |
+
|
34 |
+
= src =
|
35 |
+
This location of any audio or video file
|
36 |
+
|
37 |
+
[video src="http://mysite.com/mymedia.mp4"]
|
38 |
+
|
39 |
+
You can also leave off the extention and MediaElement.js will look for all media files matching the filename (mymedia.mp4, mymedia.webm, etc.)
|
40 |
+
|
41 |
+
[video src="http://mysite.com/mymedia"]
|
42 |
+
|
43 |
+
= type =
|
44 |
+
The media type of the resource
|
45 |
+
|
46 |
+
[video src="http://mysite.com/mymedia?xyz" type="video/mp4"]
|
47 |
+
|
48 |
+
= mp4 =
|
49 |
+
The location of the h.264/MP4 source for the video.
|
50 |
+
|
51 |
+
[video mp4="http://mysite.com/mymedia.mp4"]
|
52 |
+
|
53 |
+
= mp3 =
|
54 |
+
The location of an MP3 file for video
|
55 |
+
|
56 |
+
[audio mp3="http://mysite.com/mymedia.mp3"]
|
57 |
+
|
58 |
+
= ogg =
|
59 |
+
The location of the Theora/Ogg source for the video.
|
60 |
+
|
61 |
+
[video ogg="http://mysite.com/mymedia.ogg"]
|
62 |
+
|
63 |
+
= webm =
|
64 |
+
The location of the VP8/WebM source for the video.
|
65 |
+
|
66 |
+
[video webm="http://mysite.com/mymedia.webm"]
|
67 |
+
|
68 |
+
= poster =
|
69 |
+
The location of the poster frame for the video.
|
70 |
+
|
71 |
+
[video poster="http://mysite.com/mymedia.png"]
|
72 |
+
|
73 |
+
= width =
|
74 |
+
The width of the video
|
75 |
+
|
76 |
+
[video width="640"]
|
77 |
+
|
78 |
+
= height =
|
79 |
+
The height of the video
|
80 |
+
|
81 |
+
[video height="264"]
|
82 |
+
|
83 |
+
= loop =
|
84 |
+
Loops the video or audio when it ends
|
85 |
+
|
86 |
+
[video src="http://mysite.com/mymedia.mp4" loop="true"]
|
87 |
+
|
88 |
+
= preload =
|
89 |
+
Start loading the video as soon as possible, before the user clicks play.
|
90 |
+
|
91 |
+
[video preload="true"]
|
92 |
+
|
93 |
+
= autoplay =
|
94 |
+
Start playing the video as soon as it's ready.
|
95 |
+
|
96 |
+
[video autoplay="true"]
|
97 |
+
|
98 |
+
= fullscreen =
|
99 |
+
Disables the fullscreen button
|
100 |
+
|
101 |
+
[video src="http://mysite.com/mymedia.mp4" fullscreen="false"]
|
102 |
+
|
103 |
+
= duration =
|
104 |
+
Disables the duration output
|
105 |
+
|
106 |
+
[video src="http://mysite.com/mymedia.mp4" duration="false"]
|
107 |
+
|
108 |
+
= volume =
|
109 |
+
Disables the volume slider
|
110 |
+
|
111 |
+
[video src="http://mysite.com/mymedia.mp4" volume="false"]
|
112 |
+
|
113 |
+
= progress =
|
114 |
+
Disables the progress bar
|
115 |
+
|
116 |
+
[video src="http://mysite.com/mymedia.mp4" progress="false"]
|
117 |
+
|
118 |
+
= captions =
|
119 |
+
URL to a WebSRT captions file
|
120 |
+
|
121 |
+
[video src="http://mysite.com/mymedia.mp4" captions="http://mysite.com/mymedia.srt"]
|
122 |
+
|
123 |
+
= Simple Video =
|
124 |
+
Basic playback options
|
125 |
+
|
126 |
+
[video src="http://mysite.com/mymedia.mp4" width="640" height="360"]
|
127 |
+
|
128 |
+
= All Attributes Video =
|
129 |
+
All options enabled
|
130 |
+
|
131 |
+
[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"]
|
132 |
+
|
133 |
+
= Simple Audio =
|
134 |
+
Basic playback options
|
135 |
+
|
136 |
+
[audio src="http://mysite.com/mymedia.mp3"]
|
137 |
+
|
138 |
+
= All Attributes Audio =
|
139 |
+
All options enabled
|
140 |
+
|
141 |
+
[audio mp3="http://mysite.com/mymedia.mp3" ogg="http://mysite.com/mymedia.ogg" preload="true" autoplay="true"]
|
142 |
+
|
143 |
+
### Use in a template
|
144 |
+
You can use Wordpress shortcodes in your templates using the do_shortcode function.
|
145 |
+
|
146 |
+
<?php echo do_shortcode('[video src="myvfile.mp4"]'); ?>
|
147 |
+
|
148 |
+
|
149 |
+
== Installation ==
|
150 |
+
|
151 |
+
View <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more information.
|
152 |
+
|
153 |
+
1. Upload the `media-element-html5-video-and-audio-player` folder to the `/wp-content/plugins/` directory
|
154 |
+
2. Activate the plugin through the `Plugins` menu in WordPress
|
155 |
+
3. Use the `[video]` or `[audio]` shortcode in your post or page with the options on the front page.
|
156 |
+
|
157 |
+
== Changelog ==
|
158 |
+
|
159 |
+
= 2.23.5 =
|
160 |
+
* Updating to final version of 2.x line (Wordpress 4.9 will have the 4.x branch)
|
161 |
+
* Updated screenshot
|
162 |
+
|
163 |
+
= 2.2.5 =
|
164 |
+
* Update to 2.2.5 codebase
|
165 |
+
* Support for true fullscreen in Chrome and Firefox (in addition to Safari)
|
166 |
+
* Support for 100% sizing
|
167 |
+
|
168 |
+
= 2.1.7 =
|
169 |
+
* Skin selector (default, WMP, TED)
|
170 |
+
* Audio height and width
|
171 |
+
* Leave off the extension on the src attribute and files will be automatically detected
|
172 |
+
|
173 |
+
= 2.1.4 =
|
174 |
+
* Updated to latest MediaElement.js code
|
175 |
+
* Changed scripts to use wp_enqueue_script("mediaelementjs-scripts")
|
176 |
+
* Changed styles to use wp_enqueue_style("mediaelementjs-styles")
|
177 |
+
* Added [mejsaudio] and [mejsvideo] as valid short codes. Wordpress's Jetpack will now take over [audio]
|
178 |
+
|
179 |
+
= 2.0.6.2 =
|
180 |
+
* Fixed a problem with Wordpress SVN
|
181 |
+
|
182 |
+
= 2.0.6 =
|
183 |
+
* Updated to 2.0.6 codebase
|
184 |
+
|
185 |
+
= 2.0.5 =
|
186 |
+
* Lots of minor changes to JS code
|
187 |
+
* better IE6 support
|
188 |
+
|
189 |
+
= 2.0.4 =
|
190 |
+
* Plugin fix
|
191 |
+
|
192 |
+
= 2.0.3 =
|
193 |
+
* Silverlight fix
|
194 |
+
|
195 |
+
= 2.0.2 =
|
196 |
+
* Updated to 2.0.2 MEjs code
|
197 |
+
|
198 |
+
= 2.0.1.2 =
|
199 |
+
* Loop fix
|
200 |
+
* Video for Everybody Syntax (Works even when JavaScript is turned off)
|
201 |
+
|
202 |
+
= 2.0.1.1 =
|
203 |
+
* Autoplay fix
|
204 |
+
|
205 |
+
= 2.0.1 =
|
206 |
+
* Updated to 2.0.1 version
|
207 |
+
|
208 |
+
= 1.1.5 =
|
209 |
+
* Updated to 1.1.5 version
|
210 |
+
* Added options to turn controls on/off
|
211 |
+
* Added loop option
|
212 |
+
|
213 |
+
= 1.1.2 =
|
214 |
+
* Updated to 1.1.2 version
|
215 |
+
* adds captions support and new style
|
216 |
+
|
217 |
+
= 1.1.0 =
|
218 |
+
* Updated to 1.1 of player
|
219 |
+
|
220 |
+
= 1.0.1 =
|
221 |
+
* Fixed URL bug
|
222 |
+
* Fixed non-src bugs
|
223 |
+
|
224 |
+
= 1.0 =
|
225 |
+
* First release.
|
226 |
+
|
227 |
+
== Upgrade Notice ==
|
228 |
+
|
229 |
+
None
|
230 |
+
|
231 |
+
== Frequently Asked Questions ==
|
232 |
+
|
233 |
+
= Where can I find out more? =
|
234 |
+
|
235 |
+
Check out <a href="http://mediaelementjs.com/">mediaElementjs.com</a> for more examples
|
236 |
+
|
237 |
+
= What does this get me over other HTML5 players? =
|
238 |
+
|
239 |
+
Most HTML5 players offer one player to modern browsers and then a competely separate Flash player to older browser. This creates an inconsistent look and functionality.
|
240 |
+
|
241 |
+
Instead, MediaElement.js upgrades older browsers, using Flash to mimic the entire HTML5 Media API. Then once all the browsers have something that looks like HTML5 Media, we build a consistent player on top using just HTML and CSS.
|
242 |
+
|
243 |
+
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
|
244 |
+
|
245 |
+
== Screenshots ==
|
246 |
+
|
247 |
1. Video player
|
screenshot-1.jpg
CHANGED
Binary file
|