Version Description
None
Download this release
Release Info
Developer | johndyer |
Plugin | MediaElement.js – HTML5 Video & Audio Player |
Version | 2.10.3 |
Comparing to | |
See all releases |
Code changes from version 2.9.1 to 2.10.3
- mediaelement-js-wp.php +114 -96
- mediaelement/controls.png +0 -0
- mediaelement/controls.svg +1 -0
- mediaelement/flashmediaelement.swf +0 -0
- mediaelement/mediaelement-and-player.js +2568 -2151
- mediaelement/mediaelement-and-player.min.js +97 -86
- mediaelement/mediaelement.js +445 -156
- mediaelement/mediaelement.min.js +35 -30
- mediaelement/mediaelementplayer.css +77 -28
- mediaelement/mediaelementplayer.js +2004 -1876
- mediaelement/mediaelementplayer.min.css +1 -1
- mediaelement/mediaelementplayer.min.js +62 -56
- readme.txt +3 -7
mediaelement-js-wp.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package MediaElementJS
|
4 |
-
* @version 2.
|
5 |
*/
|
6 |
|
7 |
/*
|
@@ -9,9 +9,9 @@ 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:
|
15 |
*/
|
16 |
|
17 |
/*
|
@@ -19,14 +19,12 @@ Adapted from: http://videojs.com/ plugin
|
|
19 |
*/
|
20 |
|
21 |
$mediaElementPlayerIndex = 1;
|
22 |
-
define('MEDIAELEMENTJS_DIR', plugin_dir_url(__FILE__).'mediaelement/');
|
23 |
|
24 |
/* Runs when plugin is activated */
|
25 |
register_activation_hook(__FILE__,'mejs_install');
|
26 |
|
27 |
function mejs_install() {
|
28 |
add_option('mep_video_skin', '');
|
29 |
-
add_option('mep_script_on_demand', false);
|
30 |
|
31 |
add_option('mep_default_video_height', 270);
|
32 |
add_option('mep_default_video_width', 480);
|
@@ -41,7 +39,6 @@ function mejs_install() {
|
|
41 |
register_deactivation_hook( __FILE__, 'mejs_remove' );
|
42 |
function mejs_remove() {
|
43 |
delete_option('mep_video_skin');
|
44 |
-
delete_option('mep_script_on_demand');
|
45 |
|
46 |
delete_option('mep_default_video_height');
|
47 |
delete_option('mep_default_video_width');
|
@@ -68,7 +65,6 @@ function mejs_create_menu() {
|
|
68 |
function mejs_register_settings() {
|
69 |
//register our settings
|
70 |
register_setting( 'mep_settings', 'mep_video_skin' );
|
71 |
-
register_setting( 'mep_settings', 'mep_script_on_demand' );
|
72 |
|
73 |
register_setting( 'mep_settings', 'mep_default_video_height' );
|
74 |
register_setting( 'mep_settings', 'mep_default_video_width' );
|
@@ -90,18 +86,6 @@ function mejs_settings_page() {
|
|
90 |
<form method="post" action="options.php">
|
91 |
<?php wp_nonce_field('update-options'); ?>
|
92 |
|
93 |
-
<h3 class="title"><span>General Settings</span></h3>
|
94 |
-
|
95 |
-
<table class="form-table">
|
96 |
-
<tr valign="top">
|
97 |
-
<th scope="row">
|
98 |
-
<label for="mep_script_on_demand">Load Script on Demand (requires WP 3.3)</label>
|
99 |
-
</th>
|
100 |
-
<td >
|
101 |
-
<input name="mep_script_on_demand" type="checkbox" id="mep_script_on_demand" <?php echo (get_option('mep_script_on_demand') == true ? "checked" : "") ?> />
|
102 |
-
</td>
|
103 |
-
</tr>
|
104 |
-
</table>
|
105 |
|
106 |
<h3 class="title"><span>Video Settings</span></h3>
|
107 |
|
@@ -175,7 +159,7 @@ function mejs_settings_page() {
|
|
175 |
</table>
|
176 |
|
177 |
<input type="hidden" name="action" value="update" />
|
178 |
-
<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
|
179 |
|
180 |
<p>
|
181 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
@@ -191,21 +175,17 @@ function mejs_settings_page() {
|
|
191 |
}
|
192 |
|
193 |
|
194 |
-
|
195 |
-
|
196 |
-
// This is now handled by calling wp_enqueue_script inside the mejs_media_shortcode function by default. This means that MediaElement.js's JavaScript will only be called as needed
|
197 |
-
if (!get_option('mep_script_on_demand')) {
|
198 |
function mejs_add_scripts(){
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
}
|
204 |
add_action('wp_print_scripts', 'mejs_add_scripts');
|
205 |
-
}
|
206 |
|
207 |
-
//
|
208 |
-
// still always enqueued so it happens in the <head> tag
|
209 |
function mejs_add_styles(){
|
210 |
if (!is_admin()){
|
211 |
// the style
|
@@ -218,20 +198,42 @@ function mejs_add_styles(){
|
|
218 |
}
|
219 |
add_action('wp_print_styles', 'mejs_add_styles');
|
220 |
|
221 |
-
function
|
|
|
222 |
|
|
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
global $mediaElementPlayerIndex;
|
230 |
-
$dir =
|
231 |
-
$attributes = array();
|
232 |
-
$sources = array();
|
233 |
-
$options = array();
|
234 |
-
$flash_src = '';
|
235 |
|
236 |
extract(shortcode_atts(array(
|
237 |
'src' => '',
|
@@ -262,12 +264,12 @@ function mejs_media_shortcode($tagName, $atts){
|
|
262 |
), $atts));
|
263 |
|
264 |
if ($type) {
|
265 |
-
$
|
266 |
}
|
267 |
|
268 |
/*
|
269 |
if ($src) {
|
270 |
-
$
|
271 |
$flash_src = htmlspecialchars($src);
|
272 |
}
|
273 |
*/
|
@@ -276,7 +278,7 @@ function mejs_media_shortcode($tagName, $atts){
|
|
276 |
|
277 |
// does it have an extension?
|
278 |
if (substr($src, strlen($src)-4, 1)=='.') {
|
279 |
-
$
|
280 |
$flash_src = htmlspecialchars($src);
|
281 |
} else {
|
282 |
|
@@ -340,97 +342,113 @@ function mejs_media_shortcode($tagName, $atts){
|
|
340 |
}
|
341 |
}
|
342 |
|
343 |
-
|
|
|
344 |
if ($mp4) {
|
345 |
-
$
|
346 |
$flash_src = htmlspecialchars($mp4);
|
347 |
}
|
|
|
348 |
if ($mp3) {
|
349 |
-
$
|
350 |
$flash_src = htmlspecialchars($mp3);
|
351 |
-
}
|
|
|
352 |
if ($webm) {
|
353 |
-
$
|
354 |
}
|
|
|
355 |
if ($ogg) {
|
356 |
-
$
|
357 |
}
|
|
|
358 |
if ($flv) {
|
359 |
-
$
|
360 |
-
}
|
|
|
361 |
if ($wmv) {
|
362 |
-
$
|
363 |
}
|
|
|
|
|
364 |
if ($captions) {
|
365 |
-
$
|
366 |
}
|
367 |
|
368 |
-
// <audio|video> attributes
|
369 |
if ($width && $tagName == 'video') {
|
370 |
-
$
|
371 |
}
|
|
|
372 |
if ($height && $tagName == 'video') {
|
373 |
-
$
|
374 |
}
|
|
|
375 |
if ($poster) {
|
376 |
-
$
|
377 |
}
|
|
|
378 |
if ($preload) {
|
379 |
-
$
|
380 |
}
|
|
|
381 |
if ($autoplay) {
|
382 |
-
$
|
383 |
}
|
384 |
|
385 |
-
// MEJS JavaScript options
|
386 |
if ($loop) {
|
387 |
-
$
|
388 |
}
|
389 |
|
390 |
-
// CONTROLS
|
391 |
-
$controls_option
|
392 |
-
if ($progress == 'true')
|
393 |
-
$controls_option
|
394 |
-
|
395 |
-
|
396 |
-
if ($
|
397 |
-
$controls_option
|
398 |
-
|
399 |
-
if ($
|
400 |
-
$controls_option
|
401 |
-
|
402 |
-
$controls_option[] = '"tracks"';
|
403 |
-
if ($fullscreen == 'true') {
|
404 |
-
$controls_option[] = '"fullscreen"';
|
405 |
-
}
|
406 |
-
$options[] = '"features":[' . implode(',', $controls_option) . ']';
|
407 |
|
408 |
-
//
|
|
|
409 |
if ($tagName == 'audio') {
|
410 |
-
$
|
411 |
-
$options[] = '"audioHeight":'.$height;
|
412 |
}
|
413 |
|
414 |
-
//
|
415 |
-
$
|
416 |
-
if ($skin != '') {
|
417 |
-
$
|
418 |
}
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
{$
|
429 |
<object width="{$width}" height="{$height}" type="application/x-shockwave-flash" data="{$dir}flashmediaelement.swf">
|
430 |
<param name="movie" value="{$dir}flashmediaelement.swf" />
|
431 |
<param name="flashvars" value="controls=true&file={$flash_src}" />
|
432 |
</object>
|
433 |
</{$tagName}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
434 |
_end_;
|
435 |
|
436 |
$mediaElementPlayerIndex++;
|
1 |
<?php
|
2 |
/**
|
3 |
* @package MediaElementJS
|
4 |
+
* @version 2.10.3
|
5 |
*/
|
6 |
|
7 |
/*
|
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.10.3
|
13 |
Author URI: http://j.hn/
|
14 |
+
License: MIT
|
15 |
*/
|
16 |
|
17 |
/*
|
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);
|
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');
|
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' );
|
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 |
|
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') ?>" />
|
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
|
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' => '',
|
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 |
*/
|
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 |
|
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++;
|
mediaelement/controls.png
CHANGED
Binary file
|
mediaelement/controls.svg
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
mediaelement/flashmediaelement.swf
CHANGED
Binary file
|
mediaelement/mediaelement-and-player.js
CHANGED
@@ -8,150 +8,173 @@
|
|
8 |
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
*
|
10 |
* Copyright 2010-2012, John Dyer (http://j.hn)
|
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;
|
22 |
-
|
23 |
-
// media types accepted by plugins
|
24 |
-
mejs.plugins = {
|
25 |
-
silverlight: [
|
26 |
-
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','audio/mpeg']}
|
27 |
-
],
|
28 |
-
flash: [
|
29 |
-
{version: [9,0,124], types: ['video/mp4','video/m4v','video/mov','video/flv','video/x-flv','audio/flv','audio/x-flv','audio/mp3','audio/m4a','audio/mpeg', 'video/youtube', 'video/x-youtube']}
|
30 |
-
//,{version: [12,0], types: ['video/webm']} // for future reference (hopefully!)
|
31 |
-
],
|
32 |
-
youtube: [
|
33 |
-
{version: null, types: ['video/youtube', 'video/x-youtube']}
|
34 |
-
],
|
35 |
-
vimeo: [
|
36 |
-
{version: null, types: ['video/vimeo']}
|
37 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
};
|
39 |
-
|
40 |
-
/*
|
41 |
-
Utility methods
|
42 |
-
*/
|
43 |
-
mejs.Utility = {
|
44 |
-
encodeUrl: function(url) {
|
45 |
-
return encodeURIComponent(url); //.replace(/\?/gi,'%3F').replace(/=/gi,'%3D').replace(/&/gi,'%26');
|
46 |
-
},
|
47 |
-
escapeHTML: function(s) {
|
48 |
-
return s.toString().split('&').join('&').split('<').join('<').split('"').join('"');
|
49 |
-
},
|
50 |
-
absolutizeUrl: function(url) {
|
51 |
-
var el = document.createElement('div');
|
52 |
-
el.innerHTML = '<a href="' + this.escapeHTML(url) + '">x</a>';
|
53 |
-
return el.firstChild.href;
|
54 |
-
},
|
55 |
-
getScriptPath: function(scriptNames) {
|
56 |
-
var
|
57 |
-
i = 0,
|
58 |
-
j,
|
59 |
-
path = '',
|
60 |
-
name = '',
|
61 |
-
script,
|
62 |
-
scripts = document.getElementsByTagName('script'),
|
63 |
-
il = scripts.length,
|
64 |
-
jl = scriptNames.length;
|
65 |
-
|
66 |
-
for (; i < il; i++) {
|
67 |
-
script = scripts[i].src;
|
68 |
-
for (j = 0; j < jl; j++) {
|
69 |
-
name = scriptNames[j];
|
70 |
-
if (script.indexOf(name) > -1) {
|
71 |
-
path = script.substring(0, script.indexOf(name));
|
72 |
-
break;
|
73 |
-
}
|
74 |
-
}
|
75 |
-
if (path !== '') {
|
76 |
-
break;
|
77 |
-
}
|
78 |
-
}
|
79 |
-
return path;
|
80 |
-
},
|
81 |
-
secondsToTimeCode: function(time, forceHours, showFrameCount, fps) {
|
82 |
-
//add framecount
|
83 |
-
if (typeof showFrameCount == 'undefined') {
|
84 |
-
showFrameCount=false;
|
85 |
-
} else if(typeof fps == 'undefined') {
|
86 |
-
fps = 25;
|
87 |
-
}
|
88 |
-
|
89 |
-
var hours = Math.floor(time / 3600) % 24,
|
90 |
-
minutes = Math.floor(time / 60) % 60,
|
91 |
-
seconds = Math.floor(time % 60),
|
92 |
-
frames = Math.floor(((time % 1)*fps).toFixed(3)),
|
93 |
-
result =
|
94 |
-
( (forceHours || hours > 0) ? (hours < 10 ? '0' + hours : hours) + ':' : '')
|
95 |
-
+ (minutes < 10 ? '0' + minutes : minutes) + ':'
|
96 |
-
+ (seconds < 10 ? '0' + seconds : seconds)
|
97 |
-
+ ((showFrameCount) ? ':' + (frames < 10 ? '0' + frames : frames) : '');
|
98 |
-
|
99 |
-
return result;
|
100 |
-
},
|
101 |
-
|
102 |
-
timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
|
103 |
-
if (typeof showFrameCount == 'undefined') {
|
104 |
-
showFrameCount=false;
|
105 |
-
} else if(typeof fps == 'undefined') {
|
106 |
-
fps = 25;
|
107 |
-
}
|
108 |
-
|
109 |
-
var tc_array = hh_mm_ss_ff.split(":"),
|
110 |
-
tc_hh = parseInt(tc_array[0], 10),
|
111 |
-
tc_mm = parseInt(tc_array[1], 10),
|
112 |
-
tc_ss = parseInt(tc_array[2], 10),
|
113 |
-
tc_ff = 0,
|
114 |
-
tc_in_seconds = 0;
|
115 |
-
|
116 |
-
if (showFrameCount) {
|
117 |
-
tc_ff = parseInt(tc_array[3])/fps;
|
118 |
-
}
|
119 |
-
|
120 |
-
tc_in_seconds = ( tc_hh * 3600 ) + ( tc_mm * 60 ) + tc_ss + tc_ff;
|
121 |
-
|
122 |
-
return tc_in_seconds;
|
123 |
-
},
|
124 |
-
|
125 |
-
/* borrowed from SWFObject: http://code.google.com/p/swfobject/source/browse/trunk/swfobject/src/swfobject.js#474 */
|
126 |
-
removeSwf: function(id) {
|
127 |
-
var obj = document.getElementById(id);
|
128 |
-
if (obj && obj.nodeName == "OBJECT") {
|
129 |
-
if (mejs.MediaFeatures.isIE) {
|
130 |
-
obj.style.display = "none";
|
131 |
-
(function(){
|
132 |
-
if (obj.readyState == 4) {
|
133 |
-
mejs.Utility.removeObjectInIE(id);
|
134 |
-
} else {
|
135 |
-
setTimeout(arguments.callee, 10);
|
136 |
-
}
|
137 |
-
})();
|
138 |
-
} else {
|
139 |
-
obj.parentNode.removeChild(obj);
|
140 |
-
}
|
141 |
-
}
|
142 |
-
},
|
143 |
-
removeObjectInIE: function(id) {
|
144 |
-
var obj = document.getElementById(id);
|
145 |
-
if (obj) {
|
146 |
-
for (var i in obj) {
|
147 |
-
if (typeof obj[i] == "function") {
|
148 |
-
obj[i] = null;
|
149 |
-
}
|
150 |
-
}
|
151 |
-
obj.parentNode.removeChild(obj);
|
152 |
-
}
|
153 |
-
}
|
154 |
-
};
|
155 |
|
156 |
|
157 |
// Core detector, plugins are added below
|
@@ -280,6 +303,10 @@ mejs.MediaFeatures = {
|
|
280 |
t.isGecko = (ua.match(/gecko/gi) !== null) && !t.isWebkit;
|
281 |
t.isOpera = (ua.match(/opera/gi) !== null);
|
282 |
t.hasTouch = ('ontouchstart' in window);
|
|
|
|
|
|
|
|
|
283 |
|
284 |
// create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
|
285 |
for (i=0; i<html5Elements.length; i++) {
|
@@ -350,7 +377,6 @@ mejs.MediaFeatures = {
|
|
350 |
};
|
351 |
mejs.MediaFeatures.init();
|
352 |
|
353 |
-
|
354 |
/*
|
355 |
extension methods to <video> or <audio> object to bring it into parity with PluginMediaElement (see below)
|
356 |
*/
|
@@ -395,6 +421,7 @@ mejs.HtmlMediaElement = {
|
|
395 |
media = url[i];
|
396 |
if (this.canPlayType(media.type)) {
|
397 |
this.src = media.src;
|
|
|
398 |
}
|
399 |
}
|
400 |
}
|
@@ -414,6 +441,7 @@ mejs.PluginMediaElement = function (pluginid, pluginType, mediaUrl) {
|
|
414 |
this.pluginType = pluginType;
|
415 |
this.src = mediaUrl;
|
416 |
this.events = {};
|
|
|
417 |
};
|
418 |
|
419 |
// JavaScript values and ExternalInterface methods that match HTML5 video properties methods
|
@@ -542,6 +570,7 @@ mejs.PluginMediaElement.prototype = {
|
|
542 |
if (this.canPlayType(media.type)) {
|
543 |
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
|
544 |
this.src = mejs.Utility.absolutizeUrl(url);
|
|
|
545 |
}
|
546 |
}
|
547 |
}
|
@@ -654,7 +683,6 @@ mejs.PluginMediaElement.prototype = {
|
|
654 |
// end: fake events
|
655 |
|
656 |
// fake DOM attribute methods
|
657 |
-
attributes: {},
|
658 |
hasAttribute: function(name){
|
659 |
return (name in this.attributes);
|
660 |
},
|
@@ -721,9 +749,6 @@ mejs.MediaPluginBridge = {
|
|
721 |
bufferedTime,
|
722 |
pluginMediaElement = this.pluginMediaElements[id];
|
723 |
|
724 |
-
pluginMediaElement.ended = false;
|
725 |
-
pluginMediaElement.paused = true;
|
726 |
-
|
727 |
// fake event object to mimic real HTML media event.
|
728 |
e = {
|
729 |
type: eventName,
|
@@ -759,6 +784,7 @@ Default options
|
|
759 |
mejs.MediaElementDefaults = {
|
760 |
// allows testing on HTML5, flash, silverlight
|
761 |
// auto: attempts to detect what the browser can do
|
|
|
762 |
// native: forces HTML5 playback
|
763 |
// shim: disallows HTML5, will attempt either Flash or Silverlight
|
764 |
// none: forces fallback view
|
@@ -773,6 +799,8 @@ mejs.MediaElementDefaults = {
|
|
773 |
pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
|
774 |
// name of flash file
|
775 |
flashName: 'flashmediaelement.swf',
|
|
|
|
|
776 |
// turns on the smoothing filter in Flash
|
777 |
enablePluginSmoothing: false,
|
778 |
// name of silverlight file
|
@@ -873,7 +901,8 @@ mejs.HtmlMediaElementShim = {
|
|
873 |
pluginName,
|
874 |
pluginVersions,
|
875 |
pluginInfo,
|
876 |
-
dummy
|
|
|
877 |
|
878 |
// STEP 1: Get URL and type from <video src> or <source src>
|
879 |
|
@@ -903,7 +932,11 @@ mejs.HtmlMediaElementShim = {
|
|
903 |
if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
|
904 |
src = n.getAttribute('src');
|
905 |
type = this.formatType(src, n.getAttribute('type'));
|
906 |
-
|
|
|
|
|
|
|
|
|
907 |
}
|
908 |
}
|
909 |
}
|
@@ -926,7 +959,7 @@ mejs.HtmlMediaElementShim = {
|
|
926 |
|
927 |
|
928 |
// test for native playback first
|
929 |
-
if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'native')) {
|
930 |
|
931 |
if (!isMediaTag) {
|
932 |
|
@@ -955,12 +988,15 @@ mejs.HtmlMediaElementShim = {
|
|
955 |
htmlMediaElement.src = result.url;
|
956 |
}
|
957 |
|
958 |
-
|
|
|
|
|
|
|
959 |
}
|
960 |
}
|
961 |
|
962 |
// if native playback didn't work, then test plugins
|
963 |
-
if (options.mode === 'auto' || options.mode === 'shim') {
|
964 |
for (i=0; i<mediaFiles.length; i++) {
|
965 |
type = mediaFiles[i].type;
|
966 |
|
@@ -997,6 +1033,12 @@ mejs.HtmlMediaElementShim = {
|
|
997 |
}
|
998 |
}
|
999 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1000 |
// what if there's nothing to play? just grab the first available
|
1001 |
if (result.method === '' && mediaFiles.length > 0) {
|
1002 |
result.url = mediaFiles[0].url;
|
@@ -1025,8 +1067,28 @@ mejs.HtmlMediaElementShim = {
|
|
1025 |
},
|
1026 |
|
1027 |
getTypeFromFile: function(url) {
|
|
|
1028 |
var ext = url.substring(url.lastIndexOf('.') + 1);
|
1029 |
-
return (/(mp4|m4v|ogg|ogv|webm|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video' : 'audio') + '/' + ext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1030 |
},
|
1031 |
|
1032 |
createErrorMessage: function(playback, options, poster) {
|
@@ -1043,7 +1105,7 @@ mejs.HtmlMediaElementShim = {
|
|
1043 |
|
1044 |
errorContainer.innerHTML = (poster !== '') ?
|
1045 |
'<a href="' + playback.url + '"><img src="' + poster + '" width="100%" height="100%" /></a>' :
|
1046 |
-
'<a href="' + playback.url + '"><span>Download File</span></a>';
|
1047 |
|
1048 |
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
|
1049 |
htmlMediaElement.style.display = 'none';
|
@@ -1122,6 +1184,7 @@ mejs.HtmlMediaElementShim = {
|
|
1122 |
'width=' + width,
|
1123 |
'startvolume=' + options.startVolume,
|
1124 |
'timerrate=' + options.timerRate,
|
|
|
1125 |
'height=' + height];
|
1126 |
|
1127 |
if (playback.url !== null) {
|
@@ -1218,10 +1281,13 @@ mejs.HtmlMediaElementShim = {
|
|
1218 |
|
1219 |
// DEMO Code. Does NOT work.
|
1220 |
case 'vimeo':
|
1221 |
-
console.log('vimeoid');
|
1222 |
|
1223 |
pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1224 |
|
|
|
|
|
|
|
1225 |
container.innerHTML =
|
1226 |
'<object width="' + width + '" height="' + height + '">' +
|
1227 |
'<param name="allowfullscreen" value="true" />' +
|
@@ -1230,7 +1296,8 @@ mejs.HtmlMediaElementShim = {
|
|
1230 |
'<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=' + pluginMediaElement.vimeoid + '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" />' +
|
1231 |
'<embed src="//vimeo.com/moogaloop.swf?api=1&clip_id=' + pluginMediaElement.vimeoid + '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="' + width + '" height="' + height + '"></embed>' +
|
1232 |
'</object>';
|
1233 |
-
|
|
|
1234 |
break;
|
1235 |
}
|
1236 |
// hide original element
|
@@ -1456,7 +1523,7 @@ mejs.YouTubeApi = {
|
|
1456 |
// load the youtube video
|
1457 |
player.cueVideoById(settings.videoId);
|
1458 |
|
1459 |
-
var callbackName = settings.containerId + '_callback'
|
1460 |
|
1461 |
window[callbackName] = function(e) {
|
1462 |
mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
|
@@ -1516,6 +1583,228 @@ function onYouTubePlayerReady(id) {
|
|
1516 |
window.mejs = mejs;
|
1517 |
window.MediaElement = mejs.MediaElement;
|
1518 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1519 |
/*!
|
1520 |
* MediaElementPlayer
|
1521 |
* http://mediaelementjs.com/
|
@@ -1524,7 +1813,7 @@ window.MediaElement = mejs.MediaElement;
|
|
1524 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
1525 |
*
|
1526 |
* Copyright 2010-2012, John Dyer (http://j.hn/)
|
1527 |
-
*
|
1528 |
*
|
1529 |
*/
|
1530 |
if (typeof jQuery != 'undefined') {
|
@@ -1532,1204 +1821,1244 @@ if (typeof jQuery != 'undefined') {
|
|
1532 |
} else if (typeof ender != 'undefined') {
|
1533 |
mejs.$ = ender;
|
1534 |
}
|
1535 |
-
(function ($) {
|
1536 |
-
|
1537 |
-
// default player values
|
1538 |
-
mejs.MepDefaults = {
|
1539 |
-
// url to poster (to fix iOS 3.x)
|
1540 |
-
poster: '',
|
1541 |
-
// default if the <video width> is not specified
|
1542 |
-
defaultVideoWidth: 480,
|
1543 |
-
// default if the <video height> is not specified
|
1544 |
-
defaultVideoHeight: 270,
|
1545 |
-
// if set, overrides <video width>
|
1546 |
-
videoWidth: -1,
|
1547 |
-
// if set, overrides <video height>
|
1548 |
-
videoHeight: -1,
|
1549 |
-
// default if the user doesn't specify
|
1550 |
-
defaultAudioWidth: 400,
|
1551 |
-
// default if the user doesn't specify
|
1552 |
-
defaultAudioHeight: 30,
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
//
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
//
|
1572 |
-
|
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 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
}
|
1620 |
-
},
|
1621 |
-
{
|
1622 |
-
keys: [
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
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 |
-
player.
|
1663 |
-
}
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
// these will be reset after the MediaElement.success fires
|
1686 |
-
t.$media = t.$node = $(node);
|
1687 |
-
t.node = t.media = t.$media[0];
|
1688 |
-
|
1689 |
-
// check for existing player
|
1690 |
-
if (typeof t.node.player != 'undefined') {
|
1691 |
-
return t.node.player;
|
1692 |
-
} else {
|
1693 |
-
// attach player to DOM node for reference
|
1694 |
-
t.node.player = t;
|
1695 |
-
}
|
1696 |
-
|
1697 |
-
|
1698 |
-
// try to get options from data-mejsoptions
|
1699 |
-
if (typeof o == 'undefined') {
|
1700 |
-
o = t.$node.data('mejsoptions');
|
1701 |
-
}
|
1702 |
-
|
1703 |
-
// extend default options
|
1704 |
-
t.options = $.extend({},mejs.MepDefaults,o);
|
1705 |
-
|
1706 |
-
// add to player array (for focus events)
|
1707 |
-
mejs.players.push(t);
|
1708 |
-
|
1709 |
-
// start up
|
1710 |
-
t.init();
|
1711 |
-
|
1712 |
-
return t;
|
1713 |
-
};
|
1714 |
-
|
1715 |
-
// actual player
|
1716 |
-
mejs.MediaElementPlayer.prototype = {
|
1717 |
-
|
1718 |
-
hasFocus: false,
|
1719 |
-
|
1720 |
-
controlsAreVisible: true,
|
1721 |
-
|
1722 |
-
init: function() {
|
1723 |
-
|
1724 |
-
var
|
1725 |
-
t = this,
|
1726 |
-
mf = mejs.MediaFeatures,
|
1727 |
-
// options for MediaElement (shim)
|
1728 |
-
meOptions = $.extend(true, {}, t.options, {
|
1729 |
-
success: function(media, domNode) { t.meReady(media, domNode); },
|
1730 |
-
error: function(e) { t.handleError(e);}
|
1731 |
-
}),
|
1732 |
-
tagName = t.media.tagName.toLowerCase();
|
1733 |
-
|
1734 |
-
t.isDynamic = (tagName !== 'audio' && tagName !== 'video');
|
1735 |
-
|
1736 |
-
if (t.isDynamic) {
|
1737 |
-
// get video from src or href?
|
1738 |
-
t.isVideo = t.options.isVideo;
|
1739 |
-
} else {
|
1740 |
-
t.isVideo = (tagName !== 'audio' && t.options.isVideo);
|
1741 |
-
}
|
1742 |
-
|
1743 |
-
// use native controls in iPad, iPhone, and Android
|
1744 |
-
if ((mf.isiPad && t.options.iPadUseNativeControls) || (mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
1745 |
-
|
1746 |
-
// add controls and stop
|
1747 |
-
t.$media.attr('controls', 'controls');
|
1748 |
-
|
1749 |
-
// attempt to fix iOS 3 bug
|
1750 |
-
//t.$media.removeAttr('poster');
|
1751 |
-
// no Issue found on iOS3 -ttroxell
|
1752 |
-
|
1753 |
-
// override Apple's autoplay override for iPads
|
1754 |
-
if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
|
1755 |
-
t.media.load();
|
1756 |
-
t.media.play();
|
1757 |
-
}
|
1758 |
-
|
1759 |
-
} else if (mf.isAndroid && t.AndroidUseNativeControls) {
|
1760 |
-
|
1761 |
-
// leave default player
|
1762 |
-
|
1763 |
-
} else {
|
1764 |
-
|
1765 |
-
// DESKTOP: use MediaElementPlayer controls
|
1766 |
-
|
1767 |
-
// remove native controls
|
1768 |
-
t.$media.removeAttr('controls');
|
1769 |
-
|
1770 |
-
// unique ID
|
1771 |
-
t.id = 'mep_' + mejs.mepIndex++;
|
1772 |
-
|
1773 |
-
// build container
|
1774 |
-
t.container =
|
1775 |
-
$('<div id="' + t.id + '" class="mejs-container">'+
|
1776 |
-
'<div class="mejs-inner">'+
|
1777 |
-
'<div class="mejs-mediaelement"></div>'+
|
1778 |
-
'<div class="mejs-layers"></div>'+
|
1779 |
-
'<div class="mejs-controls"></div>'+
|
1780 |
-
'<div class="mejs-clear"></div>'+
|
1781 |
-
'</div>' +
|
1782 |
-
'</div>')
|
1783 |
-
.addClass(t.$media[0].className)
|
1784 |
-
.insertBefore(t.$media);
|
1785 |
-
|
1786 |
-
// add classes for user and content
|
1787 |
-
t.container.addClass(
|
1788 |
-
(mf.isAndroid ? 'mejs-android ' : '') +
|
1789 |
-
(mf.isiOS ? 'mejs-ios ' : '') +
|
1790 |
-
(mf.isiPad ? 'mejs-ipad ' : '') +
|
1791 |
-
(mf.isiPhone ? 'mejs-iphone ' : '') +
|
1792 |
-
(t.isVideo ? 'mejs-video ' : 'mejs-audio ')
|
1793 |
-
);
|
1794 |
-
|
1795 |
-
|
1796 |
-
// move the <video/video> tag into the right spot
|
1797 |
-
if (mf.isiOS) {
|
1798 |
-
|
1799 |
-
// sadly, you can't move nodes in iOS, so we have to destroy and recreate it!
|
1800 |
-
var $newMedia = t.$media.clone();
|
1801 |
-
|
1802 |
-
t.container.find('.mejs-mediaelement').append($newMedia);
|
1803 |
-
|
1804 |
-
t.$media.remove();
|
1805 |
-
t.$node = t.$media = $newMedia;
|
1806 |
-
t.node = t.media = $newMedia[0]
|
1807 |
-
|
1808 |
-
} else {
|
1809 |
-
|
1810 |
-
// normal way of moving it into place (doesn't work on iOS)
|
1811 |
-
t.container.find('.mejs-mediaelement').append(t.$media);
|
1812 |
-
}
|
1813 |
-
|
1814 |
-
// find parts
|
1815 |
-
t.controls = t.container.find('.mejs-controls');
|
1816 |
-
t.layers = t.container.find('.mejs-layers');
|
1817 |
-
|
1818 |
-
// determine the size
|
1819 |
-
|
1820 |
-
/* size priority:
|
1821 |
-
(1) videoWidth (forced),
|
1822 |
-
(2) style="width;height;"
|
1823 |
-
(3) width attribute,
|
1824 |
-
(4) defaultVideoWidth (for unspecified cases)
|
1825 |
-
*/
|
1826 |
-
|
1827 |
-
var capsTagName = tagName.substring(0,1).toUpperCase() + tagName.substring(1);
|
1828 |
-
|
1829 |
-
if (t.options[tagName + 'Width'] > 0 || t.options[tagName + 'Width'].toString().indexOf('%') > -1) {
|
1830 |
-
t.width = t.options[tagName + 'Width'];
|
1831 |
-
} else if (t.media.style.width !== '' && t.media.style.width !== null) {
|
1832 |
-
t.width = t.media.style.width;
|
1833 |
-
} else if (t.media.getAttribute('width') !== null) {
|
1834 |
-
t.width = t.$media.attr('width');
|
1835 |
-
} else {
|
1836 |
-
t.width = t.options['default' + capsTagName + 'Width'];
|
1837 |
-
}
|
1838 |
-
|
1839 |
-
if (t.options[tagName + 'Height'] > 0 || t.options[tagName + 'Height'].toString().indexOf('%') > -1) {
|
1840 |
-
t.height = t.options[tagName + 'Height'];
|
1841 |
-
} else if (t.media.style.height !== '' && t.media.style.height !== null) {
|
1842 |
-
t.height = t.media.style.height;
|
1843 |
-
} else if (t.$media[0].getAttribute('height') !== null) {
|
1844 |
-
t.height = t.$media.attr('height');
|
1845 |
-
} else {
|
1846 |
-
t.height = t.options['default' + capsTagName + 'Height'];
|
1847 |
-
}
|
1848 |
-
|
1849 |
-
// set the size, while we wait for the plugins to load below
|
1850 |
-
t.setPlayerSize(t.width, t.height);
|
1851 |
-
|
1852 |
-
// create MediaElementShim
|
1853 |
-
meOptions.pluginWidth = t.height;
|
1854 |
-
meOptions.pluginHeight = t.width;
|
1855 |
-
}
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
// create MediaElement shim
|
1860 |
-
mejs.MediaElement(t.$media[0], meOptions);
|
1861 |
-
},
|
1862 |
-
|
1863 |
-
showControls: function(doAnimation) {
|
1864 |
-
var t = this;
|
1865 |
-
|
1866 |
-
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
1867 |
-
|
1868 |
-
if (t.controlsAreVisible)
|
1869 |
-
return;
|
1870 |
-
|
1871 |
-
if (doAnimation) {
|
1872 |
-
t.controls
|
1873 |
-
.css('visibility','visible')
|
1874 |
-
.stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
|
1875 |
-
|
1876 |
-
// any additional controls people might add and want to hide
|
1877 |
-
t.container.find('.mejs-control')
|
1878 |
-
.css('visibility','visible')
|
1879 |
-
.stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
|
1880 |
-
|
1881 |
-
} else {
|
1882 |
-
t.controls
|
1883 |
-
.css('visibility','visible')
|
1884 |
-
.css('display','block');
|
1885 |
-
|
1886 |
-
// any additional controls people might add and want to hide
|
1887 |
-
t.container.find('.mejs-control')
|
1888 |
-
.css('visibility','visible')
|
1889 |
-
.css('display','block');
|
1890 |
-
|
1891 |
-
t.controlsAreVisible = true;
|
1892 |
-
}
|
1893 |
-
|
1894 |
-
t.setControlsSize();
|
1895 |
-
|
1896 |
-
},
|
1897 |
-
|
1898 |
-
hideControls: function(doAnimation) {
|
1899 |
-
var t = this;
|
1900 |
-
|
1901 |
-
doAnimation = typeof doAnimation == 'undefined' || doAnimation;
|
1902 |
-
|
1903 |
-
if (!t.controlsAreVisible)
|
1904 |
-
return;
|
1905 |
-
|
1906 |
-
if (doAnimation) {
|
1907 |
-
// fade out main controls
|
1908 |
-
t.controls.stop(true, true).fadeOut(200, function() {
|
1909 |
-
$(this)
|
1910 |
-
.css('visibility','hidden')
|
1911 |
-
.css('display','block');
|
1912 |
-
|
1913 |
-
t.controlsAreVisible = false;
|
1914 |
-
});
|
1915 |
-
|
1916 |
-
// any additional controls people might add and want to hide
|
1917 |
-
t.container.find('.mejs-control').stop(true, true).fadeOut(200, function() {
|
1918 |
-
$(this)
|
1919 |
-
.css('visibility','hidden')
|
1920 |
-
.css('display','block');
|
1921 |
-
});
|
1922 |
-
} else {
|
1923 |
-
|
1924 |
-
// hide main controls
|
1925 |
-
t.controls
|
1926 |
-
.css('visibility','hidden')
|
1927 |
-
.css('display','block');
|
1928 |
-
|
1929 |
-
// hide others
|
1930 |
-
t.container.find('.mejs-control')
|
1931 |
-
.css('visibility','hidden')
|
1932 |
-
.css('display','block');
|
1933 |
-
|
1934 |
-
t.controlsAreVisible = false;
|
1935 |
-
}
|
1936 |
-
},
|
1937 |
-
|
1938 |
-
controlsTimer: null,
|
1939 |
-
|
1940 |
-
startControlsTimer: function(timeout) {
|
1941 |
-
|
1942 |
-
var t = this;
|
1943 |
-
|
1944 |
-
timeout = typeof timeout != 'undefined' ? timeout : 1500;
|
1945 |
-
|
1946 |
-
t.killControlsTimer('start');
|
1947 |
-
|
1948 |
-
t.controlsTimer = setTimeout(function() {
|
1949 |
-
//console.log('timer fired');
|
1950 |
-
t.hideControls();
|
1951 |
-
t.killControlsTimer('hide');
|
1952 |
-
}, timeout);
|
1953 |
-
},
|
1954 |
-
|
1955 |
-
killControlsTimer: function(src) {
|
1956 |
-
|
1957 |
-
var t = this;
|
1958 |
-
|
1959 |
-
if (t.controlsTimer !== null) {
|
1960 |
-
clearTimeout(t.controlsTimer);
|
1961 |
-
delete t.controlsTimer;
|
1962 |
-
t.controlsTimer = null;
|
1963 |
-
}
|
1964 |
-
},
|
1965 |
-
|
1966 |
-
controlsEnabled: true,
|
1967 |
-
|
1968 |
-
disableControls: function() {
|
1969 |
-
var t= this;
|
1970 |
-
|
1971 |
-
t.killControlsTimer();
|
1972 |
-
t.hideControls(false);
|
1973 |
-
this.controlsEnabled = false;
|
1974 |
-
},
|
1975 |
-
|
1976 |
-
enableControls: function() {
|
1977 |
-
var t= this;
|
1978 |
-
|
1979 |
-
t.showControls(false);
|
1980 |
-
|
1981 |
-
t.controlsEnabled = true;
|
1982 |
-
},
|
1983 |
-
|
1984 |
-
|
1985 |
-
// Sets up all controls and events
|
1986 |
-
meReady: function(media, domNode) {
|
1987 |
-
|
1988 |
-
|
1989 |
-
var t = this,
|
1990 |
-
mf = mejs.MediaFeatures,
|
1991 |
-
autoplayAttr = domNode.getAttribute('autoplay'),
|
1992 |
-
autoplay = !(typeof autoplayAttr == 'undefined' || autoplayAttr === null || autoplayAttr === 'false'),
|
1993 |
-
featureIndex,
|
1994 |
-
feature;
|
1995 |
-
|
1996 |
-
// make sure it can't create itself again if a plugin reloads
|
1997 |
-
if (t.created)
|
1998 |
-
return;
|
1999 |
-
else
|
2000 |
-
t.created = true;
|
2001 |
-
|
2002 |
-
t.media = media;
|
2003 |
-
t.domNode = domNode;
|
2004 |
-
|
2005 |
-
if (!(mf.isAndroid && t.options.AndroidUseNativeControls) && !(mf.isiPad && t.options.iPadUseNativeControls) && !(mf.isiPhone && t.options.iPhoneUseNativeControls)) {
|
2006 |
-
|
2007 |
-
// two built in features
|
2008 |
-
t.buildposter(t, t.controls, t.layers, t.media);
|
2009 |
-
t.buildkeyboard(t, t.controls, t.layers, t.media);
|
2010 |
-
t.buildoverlays(t, t.controls, t.layers, t.media);
|
2011 |
-
|
2012 |
-
// grab for use by features
|
2013 |
-
t.findTracks();
|
2014 |
-
|
2015 |
-
// add user-defined features/controls
|
2016 |
-
for (featureIndex in t.options.features) {
|
2017 |
-
feature = t.options.features[featureIndex];
|
2018 |
-
if (t['build' + feature]) {
|
2019 |
-
try {
|
2020 |
-
t['build' + feature](t, t.controls, t.layers, t.media);
|
2021 |
-
} catch (e) {
|
2022 |
-
// TODO: report control error
|
2023 |
-
//throw e;
|
2024 |
-
//console.log('error building ' + feature);
|
2025 |
-
//console.log(e);
|
2026 |
-
}
|
2027 |
-
}
|
2028 |
-
}
|
2029 |
-
|
2030 |
-
t.container.trigger('controlsready');
|
2031 |
-
|
2032 |
-
// reset all layers and controls
|
2033 |
-
t.setPlayerSize(t.width, t.height);
|
2034 |
-
t.setControlsSize();
|
2035 |
-
|
2036 |
-
|
2037 |
-
// controls fade
|
2038 |
-
if (t.isVideo) {
|
2039 |
-
|
2040 |
-
if (mejs.MediaFeatures.hasTouch) {
|
2041 |
-
|
2042 |
-
// for touch devices (iOS, Android)
|
2043 |
-
// show/hide without animation on touch
|
2044 |
-
|
2045 |
-
t.$media.bind('touchstart', function() {
|
2046 |
-
|
2047 |
-
|
2048 |
-
// toggle controls
|
2049 |
-
if (t.controlsAreVisible) {
|
2050 |
-
t.hideControls(false);
|
2051 |
-
} else {
|
2052 |
-
if (t.controlsEnabled) {
|
2053 |
-
t.showControls(false);
|
2054 |
-
}
|
2055 |
-
}
|
2056 |
-
});
|
2057 |
-
|
2058 |
-
} else {
|
2059 |
-
// click controls
|
2060 |
-
var clickElement = (t.media.pluginType == 'native') ? t.$media : $(t.media.pluginElement);
|
2061 |
-
|
2062 |
-
// click to play/pause
|
2063 |
-
clickElement.click(function() {
|
2064 |
-
if (media.paused) {
|
2065 |
-
media.play();
|
2066 |
-
} else {
|
2067 |
-
media.pause();
|
2068 |
-
}
|
2069 |
-
});
|
2070 |
-
|
2071 |
-
|
2072 |
-
// show/hide controls
|
2073 |
-
t.container
|
2074 |
-
.bind('mouseenter mouseover', function () {
|
2075 |
-
if (t.controlsEnabled) {
|
2076 |
-
if (!t.options.alwaysShowControls) {
|
2077 |
-
t.killControlsTimer('enter');
|
2078 |
-
t.showControls();
|
2079 |
-
t.startControlsTimer(2500);
|
2080 |
-
}
|
2081 |
-
}
|
2082 |
-
})
|
2083 |
-
.bind('mousemove', function() {
|
2084 |
-
if (t.controlsEnabled) {
|
2085 |
-
if (!t.controlsAreVisible) {
|
2086 |
-
t.showControls();
|
2087 |
-
}
|
2088 |
-
//t.killControlsTimer('move');
|
2089 |
-
if (!t.options.alwaysShowControls) {
|
2090 |
-
t.startControlsTimer(2500);
|
2091 |
-
}
|
2092 |
-
}
|
2093 |
-
})
|
2094 |
-
.bind('mouseleave', function () {
|
2095 |
-
if (t.controlsEnabled) {
|
2096 |
-
if (!t.media.paused && !t.options.alwaysShowControls) {
|
2097 |
-
t.startControlsTimer(1000);
|
2098 |
-
}
|
2099 |
-
}
|
2100 |
-
});
|
2101 |
-
}
|
2102 |
-
|
2103 |
-
// check for autoplay
|
2104 |
-
if (autoplay && !t.options.alwaysShowControls) {
|
2105 |
-
t.hideControls();
|
2106 |
-
}
|
2107 |
-
|
2108 |
-
// resizer
|
2109 |
-
if (t.options.enableAutosize) {
|
2110 |
-
t.media.addEventListener('loadedmetadata', function(e) {
|
2111 |
-
// if the <video height> was not set and the options.videoHeight was not set
|
2112 |
-
// then resize to the real dimensions
|
2113 |
-
if (t.options.videoHeight <= 0 && t.domNode.getAttribute('height') === null && !isNaN(e.target.videoHeight)) {
|
2114 |
-
t.setPlayerSize(e.target.videoWidth, e.target.videoHeight);
|
2115 |
-
t.setControlsSize();
|
2116 |
-
t.media.setVideoSize(e.target.videoWidth, e.target.videoHeight);
|
2117 |
-
}
|
2118 |
-
}, false);
|
2119 |
-
}
|
2120 |
-
}
|
2121 |
-
|
2122 |
-
// EVENTS
|
2123 |
-
|
2124 |
-
// FOCUS: when a video starts playing, it takes focus from other players (possibily pausing them)
|
2125 |
-
media.addEventListener('play', function() {
|
2126 |
-
|
2127 |
-
// go through all other players
|
2128 |
-
for (var i=0, il=mejs.players.length; i<il; i++) {
|
2129 |
-
var p = mejs.players[i];
|
2130 |
-
if (p.id != t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended) {
|
2131 |
-
p.pause();
|
2132 |
-
}
|
2133 |
-
p.hasFocus = false;
|
2134 |
-
}
|
2135 |
-
|
2136 |
-
t.hasFocus = true;
|
2137 |
-
},false);
|
2138 |
-
|
2139 |
-
|
2140 |
-
// ended for all
|
2141 |
-
t.media.addEventListener('ended', function (e) {
|
2142 |
-
try{
|
2143 |
-
t.media.setCurrentTime(0);
|
2144 |
-
} catch (exp) {
|
2145 |
-
|
2146 |
-
}
|
2147 |
-
t.media.pause();
|
2148 |
-
|
2149 |
-
if (t.setProgressRail)
|
2150 |
-
t.setProgressRail();
|
2151 |
-
if (t.setCurrentRail)
|
2152 |
-
t.setCurrentRail();
|
2153 |
-
|
2154 |
-
if (t.options.loop) {
|
2155 |
-
t.media.play();
|
2156 |
-
} else if (!t.options.alwaysShowControls && t.controlsEnabled) {
|
2157 |
-
t.showControls();
|
2158 |
-
}
|
2159 |
-
}, false);
|
2160 |
-
|
2161 |
-
// resize on the first play
|
2162 |
-
t.media.addEventListener('loadedmetadata', function(e) {
|
2163 |
-
if (t.updateDuration) {
|
2164 |
-
t.updateDuration();
|
2165 |
-
}
|
2166 |
-
if (t.updateCurrent) {
|
2167 |
-
t.updateCurrent();
|
2168 |
-
}
|
2169 |
-
|
2170 |
-
if (!t.isFullScreen) {
|
2171 |
-
t.setPlayerSize(t.width, t.height);
|
2172 |
-
t.setControlsSize();
|
2173 |
-
}
|
2174 |
-
}, false);
|
2175 |
-
|
2176 |
-
|
2177 |
-
// webkit has trouble doing this without a delay
|
2178 |
-
setTimeout(function () {
|
2179 |
-
t.setPlayerSize(t.width, t.height);
|
2180 |
-
t.setControlsSize();
|
2181 |
-
}, 50);
|
2182 |
-
|
2183 |
-
// adjust controls whenever window sizes (used to be in fullscreen only)
|
2184 |
-
$(window).resize(function() {
|
2185 |
-
|
2186 |
-
// don't resize for fullscreen mode
|
2187 |
-
if ( !(t.isFullScreen || (mejs.MediaFeatures.hasTrueNativeFullScreen && document.webkitIsFullScreen)) ) {
|
2188 |
-
t.setPlayerSize(t.width, t.height);
|
2189 |
-
}
|
2190 |
-
|
2191 |
-
// always adjust controls
|
2192 |
-
t.setControlsSize();
|
2193 |
-
});
|
2194 |
-
|
2195 |
-
// TEMP: needs to be moved somewhere else
|
2196 |
-
if (t.media.pluginType == 'youtube') {
|
2197 |
-
t.container.find('.mejs-overlay-play').hide();
|
2198 |
-
}
|
2199 |
-
}
|
2200 |
-
|
2201 |
-
// force autoplay for HTML5
|
2202 |
-
if (autoplay && media.pluginType == 'native') {
|
2203 |
-
media.load();
|
2204 |
-
media.play();
|
2205 |
-
}
|
2206 |
-
|
2207 |
-
|
2208 |
-
if (t.options.success) {
|
2209 |
-
|
2210 |
-
if (typeof t.options.success == 'string') {
|
2211 |
-
window[t.options.success](t.media, t.domNode, t);
|
2212 |
-
} else {
|
2213 |
-
t.options.success(t.media, t.domNode, t);
|
2214 |
-
}
|
2215 |
-
}
|
2216 |
-
},
|
2217 |
-
|
2218 |
-
handleError: function(e) {
|
2219 |
-
var t = this;
|
2220 |
-
|
2221 |
-
t.controls.hide();
|
2222 |
-
|
2223 |
-
// Tell user that the file cannot be played
|
2224 |
-
if (t.options.error) {
|
2225 |
-
t.options.error(e);
|
2226 |
-
}
|
2227 |
-
},
|
2228 |
-
|
2229 |
-
setPlayerSize: function(width,height) {
|
2230 |
-
var t = this;
|
2231 |
-
|
2232 |
-
if (typeof width != 'undefined')
|
2233 |
-
t.width = width;
|
2234 |
-
|
2235 |
-
if (typeof height != 'undefined')
|
2236 |
-
t.height = height;
|
2237 |
-
|
2238 |
-
// detect 100% mode
|
2239 |
-
if (t.height.toString().indexOf('%') > 0) {
|
2240 |
-
|
2241 |
-
// do we have the native dimensions yet?
|
2242 |
-
var
|
2243 |
-
nativeWidth = (t.media.videoWidth && t.media.videoWidth > 0) ? t.media.videoWidth : t.options.defaultVideoWidth,
|
2244 |
-
nativeHeight = (t.media.videoHeight && t.media.videoHeight > 0) ? t.media.videoHeight : t.options.defaultVideoHeight,
|
2245 |
-
parentWidth = t.container.parent().width(),
|
2246 |
-
newHeight = parseInt(parentWidth * nativeHeight/nativeWidth, 10);
|
2247 |
-
|
2248 |
-
if (t.container.parent()[0].tagName.toLowerCase() === 'body') { // && t.container.siblings().count == 0) {
|
2249 |
-
parentWidth = $(window).width();
|
2250 |
-
newHeight = $(window).height();
|
2251 |
-
}
|
2252 |
-
|
2253 |
-
|
2254 |
-
// set outer container size
|
2255 |
-
t.container
|
2256 |
-
.width(parentWidth)
|
2257 |
-
.height(newHeight);
|
2258 |
-
|
2259 |
-
// set native <video>
|
2260 |
-
t.$media
|
2261 |
-
.width('100%')
|
2262 |
-
.height('100%');
|
2263 |
-
|
2264 |
-
// set shims
|
2265 |
-
t.container.find('object, embed, iframe')
|
2266 |
-
.width('100%')
|
2267 |
-
.height('100%');
|
2268 |
-
|
2269 |
-
// if shim is ready, send the size to the embeded plugin
|
2270 |
-
if (t.media.setVideoSize)
|
2271 |
-
t.media.setVideoSize(parentWidth, newHeight);
|
2272 |
-
|
2273 |
-
// set the layers
|
2274 |
-
t.layers.children('.mejs-layer')
|
2275 |
-
.width('100%')
|
2276 |
-
.height('100%');
|
2277 |
-
|
2278 |
-
|
2279 |
-
} else {
|
2280 |
-
|
2281 |
-
t.container
|
2282 |
-
.width(t.width)
|
2283 |
-
.height(t.height);
|
2284 |
-
|
2285 |
-
t.layers.children('.mejs-layer')
|
2286 |
-
.width(t.width)
|
2287 |
-
.height(t.height);
|
2288 |
-
|
2289 |
-
}
|
2290 |
-
},
|
2291 |
-
|
2292 |
-
setControlsSize: function() {
|
2293 |
-
var t = this,
|
2294 |
-
usedWidth = 0,
|
2295 |
-
railWidth = 0,
|
2296 |
-
rail = t.controls.find('.mejs-time-rail'),
|
2297 |
-
total = t.controls.find('.mejs-time-total'),
|
2298 |
-
current = t.controls.find('.mejs-time-current'),
|
2299 |
-
loaded = t.controls.find('.mejs-time-loaded'),
|
2300 |
-
others = rail.siblings();
|
2301 |
-
|
2302 |
-
|
2303 |
-
// allow the size to come from custom CSS
|
2304 |
-
if (t.options && !t.options.autosizeProgress) {
|
2305 |
-
// Also, frontends devs can be more flexible
|
2306 |
-
// due the opportunity of absolute positioning.
|
2307 |
-
railWidth = parseInt(rail.css('width'));
|
2308 |
-
}
|
2309 |
-
|
2310 |
-
// attempt to autosize
|
2311 |
-
if (railWidth === 0 || !railWidth) {
|
2312 |
-
|
2313 |
-
// find the size of all the other controls besides the rail
|
2314 |
-
others.each(function() {
|
2315 |
-
if ($(this).css('position') != 'absolute') {
|
2316 |
-
usedWidth += $(this).outerWidth(true);
|
2317 |
-
}
|
2318 |
-
});
|
2319 |
-
|
2320 |
-
// fit the rail into the remaining space
|
2321 |
-
railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.width());
|
2322 |
-
}
|
2323 |
-
|
2324 |
-
// outer area
|
2325 |
-
rail.width(railWidth);
|
2326 |
-
// dark space
|
2327 |
-
total.width(railWidth - (total.outerWidth(true) - total.width()));
|
2328 |
-
|
2329 |
-
if (t.setProgressRail)
|
2330 |
-
t.setProgressRail();
|
2331 |
-
if (t.setCurrentRail)
|
2332 |
-
t.setCurrentRail();
|
2333 |
-
},
|
2334 |
-
|
2335 |
-
|
2336 |
-
buildposter: function(player, controls, layers, media) {
|
2337 |
-
var t = this,
|
2338 |
-
poster =
|
2339 |
-
$('<div class="mejs-poster mejs-layer">' +
|
2340 |
-
'</div>')
|
2341 |
-
.appendTo(layers),
|
2342 |
-
posterUrl = player.$media.attr('poster');
|
2343 |
-
|
2344 |
-
// prioriy goes to option (this is useful if you need to support iOS 3.x (iOS completely fails with poster)
|
2345 |
-
if (player.options.poster !== '') {
|
2346 |
-
posterUrl = player.options.poster;
|
2347 |
-
}
|
2348 |
-
|
2349 |
-
// second, try the real poster
|
2350 |
-
if (posterUrl !== '' && posterUrl != null) {
|
2351 |
-
t.setPoster(posterUrl);
|
2352 |
-
} else {
|
2353 |
-
poster.hide();
|
2354 |
-
}
|
2355 |
-
|
2356 |
-
media.addEventListener('play',function() {
|
2357 |
-
poster.hide();
|
2358 |
-
}, false);
|
2359 |
-
},
|
2360 |
-
|
2361 |
-
setPoster: function(url) {
|
2362 |
-
var t = this,
|
2363 |
-
posterDiv = t.container.find('.mejs-poster'),
|
2364 |
-
posterImg = posterDiv.find('img');
|
2365 |
-
|
2366 |
-
if (posterImg.length == 0) {
|
2367 |
-
posterImg = $('<img width="100%" height="100%" />').appendTo(posterDiv);
|
2368 |
-
}
|
2369 |
-
|
2370 |
-
posterImg.attr('src', url);
|
2371 |
-
},
|
2372 |
-
|
2373 |
-
buildoverlays: function(player, controls, layers, media) {
|
2374 |
-
if (!player.isVideo)
|
2375 |
-
return;
|
2376 |
-
|
2377 |
-
var
|
2378 |
-
loading =
|
2379 |
-
$('<div class="mejs-overlay mejs-layer">'+
|
2380 |
-
'<div class="mejs-overlay-loading"><span></span></div>'+
|
2381 |
-
'</div>')
|
2382 |
-
.hide() // start out hidden
|
2383 |
-
.appendTo(layers),
|
2384 |
-
error =
|
2385 |
-
$('<div class="mejs-overlay mejs-layer">'+
|
2386 |
-
'<div class="mejs-overlay-error"></div>'+
|
2387 |
-
'</div>')
|
2388 |
-
.hide() // start out hidden
|
2389 |
-
.appendTo(layers),
|
2390 |
-
// this needs to come last so it's on top
|
2391 |
-
bigPlay =
|
2392 |
-
$('<div class="mejs-overlay mejs-layer mejs-overlay-play">'+
|
2393 |
-
'<div class="mejs-overlay-button"></div>'+
|
2394 |
-
'</div>')
|
2395 |
-
.appendTo(layers)
|
2396 |
-
.click(function() {
|
2397 |
-
if (media.paused) {
|
2398 |
-
media.play();
|
2399 |
-
} else {
|
2400 |
-
media.pause();
|
2401 |
-
}
|
2402 |
-
});
|
2403 |
-
|
2404 |
-
/*
|
2405 |
-
if (mejs.MediaFeatures.isiOS || mejs.MediaFeatures.isAndroid) {
|
2406 |
-
bigPlay.remove();
|
2407 |
-
loading.remove();
|
2408 |
-
}
|
2409 |
-
*/
|
2410 |
-
|
2411 |
-
|
2412 |
-
// show/hide big play button
|
2413 |
-
media.addEventListener('play',function() {
|
2414 |
-
bigPlay.hide();
|
2415 |
-
loading.hide();
|
2416 |
-
controls.find('.mejs-time-buffering').hide();
|
2417 |
-
error.hide();
|
2418 |
-
}, false);
|
2419 |
-
|
2420 |
-
media.addEventListener('playing', function() {
|
2421 |
-
bigPlay.hide();
|
2422 |
-
loading.hide();
|
2423 |
-
controls.find('.mejs-time-buffering').hide();
|
2424 |
-
error.hide();
|
2425 |
-
}, false);
|
2426 |
-
|
2427 |
-
media.addEventListener('seeking', function() {
|
2428 |
-
loading.show();
|
2429 |
-
controls.find('.mejs-time-buffering').show();
|
2430 |
-
}, false);
|
2431 |
-
|
2432 |
-
media.addEventListener('seeked', function() {
|
2433 |
-
loading.hide();
|
2434 |
-
controls.find('.mejs-time-buffering').hide();
|
2435 |
-
}, false);
|
2436 |
-
|
2437 |
-
media.addEventListener('pause',function() {
|
2438 |
-
if (!mejs.MediaFeatures.isiPhone) {
|
2439 |
-
bigPlay.show();
|
2440 |
-
}
|
2441 |
-
}, false);
|
2442 |
-
|
2443 |
-
media.addEventListener('waiting', function() {
|
2444 |
-
loading.show();
|
2445 |
-
controls.find('.mejs-time-buffering').show();
|
2446 |
-
}, false);
|
2447 |
-
|
2448 |
-
|
2449 |
-
// show/hide loading
|
2450 |
-
media.addEventListener('loadeddata',function() {
|
2451 |
-
// for some reason Chrome is firing this event
|
2452 |
-
//if (mejs.MediaFeatures.isChrome && media.getAttribute && media.getAttribute('preload') === 'none')
|
2453 |
-
// return;
|
2454 |
-
|
2455 |
-
loading.show();
|
2456 |
-
controls.find('.mejs-time-buffering').show();
|
2457 |
-
}, false);
|
2458 |
-
media.addEventListener('canplay',function() {
|
2459 |
-
loading.hide();
|
2460 |
-
controls.find('.mejs-time-buffering').hide();
|
2461 |
-
}, false);
|
2462 |
-
|
2463 |
-
// error handling
|
2464 |
-
media.addEventListener('error',function() {
|
2465 |
-
loading.hide();
|
2466 |
-
controls.find('.mejs-time-buffering').hide();
|
2467 |
-
error.show();
|
2468 |
-
error.find('mejs-overlay-error').html("Error loading this resource");
|
2469 |
-
}, false);
|
2470 |
-
},
|
2471 |
-
|
2472 |
-
buildkeyboard: function(player, controls, layers, media) {
|
2473 |
-
|
2474 |
-
var t = this;
|
2475 |
-
|
2476 |
-
// listen for key presses
|
2477 |
-
$(document).keydown(function(e) {
|
2478 |
-
|
2479 |
-
if (player.hasFocus && player.options.enableKeyboard) {
|
2480 |
-
|
2481 |
-
// find a matching key
|
2482 |
-
for (var i=0, il=player.options.keyActions.length; i<il; i++) {
|
2483 |
-
var keyAction = player.options.keyActions[i];
|
2484 |
-
|
2485 |
-
for (var j=0, jl=keyAction.keys.length; j<jl; j++) {
|
2486 |
-
if (e.keyCode == keyAction.keys[j]) {
|
2487 |
-
e.preventDefault();
|
2488 |
-
keyAction.action(player, media);
|
2489 |
-
return false;
|
2490 |
-
}
|
2491 |
-
}
|
2492 |
-
}
|
2493 |
-
}
|
2494 |
-
|
2495 |
-
return true;
|
2496 |
-
});
|
2497 |
-
|
2498 |
-
// check if someone clicked outside a player region, then kill its focus
|
2499 |
-
$(document).click(function(event) {
|
2500 |
-
if ($(event.target).closest('.mejs-container').length == 0) {
|
2501 |
-
player.hasFocus = false;
|
2502 |
-
}
|
2503 |
-
});
|
2504 |
-
|
2505 |
-
},
|
2506 |
-
|
2507 |
-
findTracks: function() {
|
2508 |
-
var t = this,
|
2509 |
-
tracktags = t.$media.find('track');
|
2510 |
-
|
2511 |
-
// store for use by plugins
|
2512 |
-
t.tracks = [];
|
2513 |
-
tracktags.each(function(index, track) {
|
2514 |
-
|
2515 |
-
track = $(track);
|
2516 |
-
|
2517 |
-
t.tracks.push({
|
2518 |
-
srclang: track.attr('srclang').toLowerCase(),
|
2519 |
-
src: track.attr('src'),
|
2520 |
-
kind: track.attr('kind'),
|
2521 |
-
label: track.attr('label') || '',
|
2522 |
-
entries: [],
|
2523 |
-
isLoaded: false
|
2524 |
-
});
|
2525 |
-
});
|
2526 |
-
},
|
2527 |
-
changeSkin: function(className) {
|
2528 |
-
this.container[0].className = 'mejs-container ' + className;
|
2529 |
-
this.setPlayerSize(this.width, this.height);
|
2530 |
-
this.setControlsSize();
|
2531 |
-
},
|
2532 |
-
play: function() {
|
2533 |
-
this.media.play();
|
2534 |
-
},
|
2535 |
-
pause: function() {
|
2536 |
-
this.media.pause();
|
2537 |
-
},
|
2538 |
-
load: function() {
|
2539 |
-
this.media.load();
|
2540 |
-
},
|
2541 |
-
setMuted: function(muted) {
|
2542 |
-
this.media.setMuted(muted);
|
2543 |
-
},
|
2544 |
-
setCurrentTime: function(time) {
|
2545 |
-
this.media.setCurrentTime(time);
|
2546 |
-
},
|
2547 |
-
getCurrentTime: function() {
|
2548 |
-
return this.media.currentTime;
|
2549 |
-
},
|
2550 |
-
setVolume: function(volume) {
|
2551 |
-
this.media.setVolume(volume);
|
2552 |
-
},
|
2553 |
-
getVolume: function() {
|
2554 |
-
return this.media.volume;
|
2555 |
-
},
|
2556 |
-
setSrc: function(src) {
|
2557 |
-
this.media.setSrc(src);
|
2558 |
-
},
|
2559 |
-
remove: function() {
|
2560 |
-
var t = this;
|
2561 |
-
|
2562 |
-
if (t.media.pluginType == 'flash') {
|
2563 |
-
t.media.remove();
|
2564 |
-
} else if (t.media.pluginType == 'native') {
|
2565 |
-
t.media.prop('controls', true);
|
2566 |
-
}
|
2567 |
-
|
2568 |
-
// grab video and put it back in place
|
2569 |
-
if (!t.isDynamic) {
|
2570 |
-
t.$node.insertBefore(t.container)
|
2571 |
-
}
|
2572 |
-
|
2573 |
-
t.container.remove();
|
2574 |
-
}
|
2575 |
-
};
|
2576 |
-
|
2577 |
-
// turn into jQuery plugin
|
2578 |
-
if (typeof jQuery != 'undefined') {
|
2579 |
-
jQuery.fn.mediaelementplayer = function (options) {
|
2580 |
-
return this.each(function () {
|
2581 |
-
new mejs.MediaElementPlayer(this, options);
|
2582 |
-
});
|
2583 |
-
};
|
2584 |
-
}
|
2585 |
-
|
2586 |
-
$(document).ready(function() {
|
2587 |
-
// auto enable using JSON attribute
|
2588 |
-
$('.mejs-player').mediaelementplayer();
|
2589 |
-
});
|
2590 |
-
|
2591 |
-
// push out to window
|
2592 |
-
window.MediaElementPlayer = mejs.MediaElementPlayer;
|
2593 |
-
|
2594 |
-
})(mejs.$);
|
2595 |
|
2596 |
-
|
|
|
|
|
2597 |
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
|
|
|
|
|
|
2601 |
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
|
|
2614 |
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
}
|
2620 |
-
|
2621 |
-
return false;
|
2622 |
-
});
|
2623 |
-
|
2624 |
-
media.addEventListener('play',function() {
|
2625 |
-
play.removeClass('mejs-play').addClass('mejs-pause');
|
2626 |
-
}, false);
|
2627 |
-
media.addEventListener('playing',function() {
|
2628 |
-
play.removeClass('mejs-play').addClass('mejs-pause');
|
2629 |
-
}, false);
|
2630 |
-
|
2631 |
-
|
2632 |
-
media.addEventListener('pause',function() {
|
2633 |
-
play.removeClass('mejs-pause').addClass('mejs-play');
|
2634 |
-
}, false);
|
2635 |
-
media.addEventListener('paused',function() {
|
2636 |
-
play.removeClass('mejs-pause').addClass('mejs-play');
|
2637 |
-
}, false);
|
2638 |
}
|
2639 |
-
|
2640 |
-
|
2641 |
-
}
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
-
|
2646 |
-
|
|
|
2647 |
|
2648 |
-
|
2649 |
-
|
2650 |
-
buildstop: function(player, controls, layers, media) {
|
2651 |
-
var t = this,
|
2652 |
-
stop =
|
2653 |
-
$('<div class="mejs-button mejs-stop-button mejs-stop">' +
|
2654 |
-
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.stopText + '"></button>' +
|
2655 |
-
'</div>')
|
2656 |
-
.appendTo(controls)
|
2657 |
-
.click(function() {
|
2658 |
-
if (!media.paused) {
|
2659 |
-
media.pause();
|
2660 |
-
}
|
2661 |
-
if (media.currentTime > 0) {
|
2662 |
-
media.setCurrentTime(0);
|
2663 |
-
controls.find('.mejs-time-current').width('0px');
|
2664 |
-
controls.find('.mejs-time-handle').css('left', '0px');
|
2665 |
-
controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0) );
|
2666 |
-
controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0) );
|
2667 |
-
layers.find('.mejs-poster').show();
|
2668 |
-
}
|
2669 |
-
});
|
2670 |
-
}
|
2671 |
-
});
|
2672 |
-
|
2673 |
-
})(mejs.$);
|
2674 |
-
(function($) {
|
2675 |
-
// progress/loaded bar
|
2676 |
-
$.extend(MediaElementPlayer.prototype, {
|
2677 |
-
buildprogress: function(player, controls, layers, media) {
|
2678 |
|
2679 |
-
|
2680 |
-
|
2681 |
-
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
-
|
2686 |
-
|
2687 |
-
'<span class="mejs-time-float-corner"></span>' +
|
2688 |
-
'</span>'+
|
2689 |
-
'</span>'+
|
2690 |
-
'</div>')
|
2691 |
-
.appendTo(controls);
|
2692 |
-
controls.find('.mejs-time-buffering').hide();
|
2693 |
|
2694 |
-
var
|
2695 |
t = this,
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
-
|
2700 |
-
|
2701 |
-
|
2702 |
-
|
2703 |
-
|
2704 |
-
|
2705 |
-
|
2706 |
-
|
2707 |
-
|
2708 |
-
|
2709 |
-
|
2710 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2711 |
|
2712 |
-
|
2713 |
-
|
2714 |
-
|
2715 |
|
2716 |
-
|
2717 |
-
|
2718 |
-
|
2719 |
-
|
|
|
|
|
|
|
|
|
|
|
2720 |
|
2721 |
-
|
2722 |
-
if (!mejs.MediaFeatures.hasTouch) {
|
2723 |
-
timefloat.css('left', pos);
|
2724 |
-
timefloatcurrent.html( mejs.Utility.secondsToTimeCode(newTime) );
|
2725 |
-
timefloat.show();
|
2726 |
-
}
|
2727 |
-
}
|
2728 |
-
},
|
2729 |
-
mouseIsDown = false,
|
2730 |
-
mouseIsOver = false;
|
2731 |
|
2732 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2733 |
//controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
|
2734 |
total
|
2735 |
.bind('mousedown', function (e) {
|
@@ -2838,86 +3167,90 @@ if (typeof jQuery != 'undefined') {
|
|
2838 |
}
|
2839 |
});
|
2840 |
})(mejs.$);
|
2841 |
-
|
2842 |
-
|
2843 |
-
|
2844 |
-
|
2845 |
-
|
2846 |
-
|
2847 |
-
|
2848 |
-
|
2849 |
-
|
2850 |
-
|
2851 |
-
|
2852 |
-
|
2853 |
-
|
2854 |
-
|
2855 |
-
|
2856 |
-
|
2857 |
-
+ (player.options.
|
2858 |
-
'</
|
2859 |
-
|
2860 |
-
|
2861 |
-
|
2862 |
-
|
2863 |
-
|
2864 |
-
|
2865 |
-
|
2866 |
-
|
2867 |
-
|
2868 |
-
|
2869 |
-
|
2870 |
-
|
2871 |
-
|
2872 |
-
|
2873 |
-
|
2874 |
-
|
2875 |
-
|
2876 |
-
|
2877 |
-
|
2878 |
-
|
2879 |
-
|
2880 |
-
|
2881 |
-
|
2882 |
-
|
2883 |
-
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
|
2888 |
-
|
2889 |
-
|
2890 |
-
|
2891 |
-
|
2892 |
-
|
2893 |
-
|
2894 |
-
|
2895 |
-
|
2896 |
-
|
2897 |
-
|
2898 |
-
|
2899 |
-
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
|
2904 |
-
|
2905 |
-
|
2906 |
-
|
2907 |
-
|
2908 |
-
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
-
|
2913 |
-
|
2914 |
-
|
2915 |
-
|
2916 |
-
|
2917 |
-
|
2918 |
-
|
2919 |
-
|
2920 |
-
|
|
|
|
|
|
|
|
|
2921 |
})(mejs.$);
|
2922 |
(function($) {
|
2923 |
|
@@ -2969,7 +3302,7 @@ if (typeof jQuery != 'undefined') {
|
|
2969 |
|
2970 |
positionVolumeHandle = function(volume, secondTry) {
|
2971 |
|
2972 |
-
if (!volumeSlider.is(':visible') && typeof secondTry
|
2973 |
volumeSlider.show();
|
2974 |
positionVolumeHandle(volume, true);
|
2975 |
volumeSlider.hide()
|
@@ -3002,7 +3335,7 @@ if (typeof jQuery != 'undefined') {
|
|
3002 |
newTop = totalHeight - (totalHeight * volume);
|
3003 |
|
3004 |
// handle
|
3005 |
-
volumeHandle.css('top', totalPosition.top + newTop - (volumeHandle.height() / 2));
|
3006 |
|
3007 |
// show the current visibility
|
3008 |
volumeCurrent.height(totalHeight - newTop );
|
@@ -3020,10 +3353,10 @@ if (typeof jQuery != 'undefined') {
|
|
3020 |
newLeft = totalWidth * volume;
|
3021 |
|
3022 |
// handle
|
3023 |
-
volumeHandle.css('left', totalPosition.left + newLeft - (volumeHandle.width() / 2));
|
3024 |
|
3025 |
// rezize the current part of the volume bar
|
3026 |
-
volumeCurrent.width( newLeft );
|
3027 |
}
|
3028 |
},
|
3029 |
handleVolumeMove = function(e) {
|
@@ -3099,487 +3432,485 @@ if (typeof jQuery != 'undefined') {
|
|
3099 |
mouseIsDown = false;
|
3100 |
$(document).unbind('.vol');
|
3101 |
|
3102 |
-
if (!mouseIsOver && mode == 'vertical') {
|
3103 |
-
volumeSlider.hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3104 |
}
|
3105 |
});
|
3106 |
-
|
3107 |
-
|
3108 |
-
return false;
|
3109 |
-
});
|
3110 |
|
3111 |
|
3112 |
-
|
3113 |
-
|
3114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3115 |
});
|
3116 |
|
3117 |
-
|
3118 |
-
|
3119 |
-
|
3120 |
-
|
3121 |
-
|
3122 |
-
|
3123 |
-
|
3124 |
-
|
3125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3126 |
}
|
|
|
|
|
|
|
|
|
3127 |
}
|
3128 |
-
}
|
3129 |
|
3130 |
-
|
3131 |
-
|
3132 |
-
|
3133 |
-
|
3134 |
-
|
3135 |
-
if (
|
3136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3137 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3139 |
}
|
3140 |
});
|
3141 |
-
|
3142 |
-
})(mejs.$);
|
3143 |
|
3144 |
-
(
|
3145 |
-
|
3146 |
-
$.extend(mejs.MepDefaults, {
|
3147 |
-
usePluginFullScreen: true,
|
3148 |
-
newWindowCallback: function() { return '';},
|
3149 |
-
fullscreenText: 'Fullscreen'
|
3150 |
-
});
|
3151 |
-
|
3152 |
-
$.extend(MediaElementPlayer.prototype, {
|
3153 |
-
|
3154 |
-
isFullScreen: false,
|
3155 |
-
|
3156 |
-
isNativeFullScreen: false,
|
3157 |
-
|
3158 |
-
docStyleOverflow: null,
|
3159 |
-
|
3160 |
-
isInIframe: false,
|
3161 |
-
|
3162 |
-
buildfullscreen: function(player, controls, layers, media) {
|
3163 |
-
|
3164 |
-
if (!player.isVideo)
|
3165 |
-
return;
|
3166 |
-
|
3167 |
-
player.isInIframe = (window.location != window.parent.location);
|
3168 |
-
|
3169 |
-
// native events
|
3170 |
-
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3171 |
-
|
3172 |
-
// chrome doesn't alays fire this in an iframe
|
3173 |
-
var target = null;
|
3174 |
-
|
3175 |
-
if (mejs.MediaFeatures.hasMozNativeFullScreen) {
|
3176 |
-
target = $(document);
|
3177 |
-
} else {
|
3178 |
-
target = player.container;
|
3179 |
-
}
|
3180 |
-
|
3181 |
-
target.bind(mejs.MediaFeatures.fullScreenEventName, function(e) {
|
3182 |
-
//player.container.bind('webkitfullscreenchange', function(e) {
|
3183 |
-
|
3184 |
-
|
3185 |
-
if (mejs.MediaFeatures.isFullScreen()) {
|
3186 |
-
player.isNativeFullScreen = true;
|
3187 |
-
// reset the controls once we are fully in full screen
|
3188 |
-
player.setControlsSize();
|
3189 |
-
} else {
|
3190 |
-
player.isNativeFullScreen = false;
|
3191 |
-
// when a user presses ESC
|
3192 |
-
// make sure to put the player back into place
|
3193 |
-
player.exitFullScreen();
|
3194 |
-
}
|
3195 |
-
});
|
3196 |
-
}
|
3197 |
-
|
3198 |
-
var t = this,
|
3199 |
-
normalHeight = 0,
|
3200 |
-
normalWidth = 0,
|
3201 |
-
container = player.container,
|
3202 |
-
fullscreenBtn =
|
3203 |
-
$('<div class="mejs-button mejs-fullscreen-button">' +
|
3204 |
-
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.fullscreenText + '"></button>' +
|
3205 |
-
'</div>')
|
3206 |
-
.appendTo(controls);
|
3207 |
-
|
3208 |
-
if (t.media.pluginType === 'native' || (!t.options.usePluginFullScreen && !mejs.MediaFeatures.isFirefox)) {
|
3209 |
-
|
3210 |
-
fullscreenBtn.click(function() {
|
3211 |
-
var isFullScreen = (mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || player.isFullScreen;
|
3212 |
-
|
3213 |
-
if (isFullScreen) {
|
3214 |
-
player.exitFullScreen();
|
3215 |
-
} else {
|
3216 |
-
player.enterFullScreen();
|
3217 |
-
}
|
3218 |
-
});
|
3219 |
-
|
3220 |
-
} else {
|
3221 |
-
|
3222 |
-
var hideTimeout = null,
|
3223 |
-
supportsPointerEvents = (function() {
|
3224 |
-
// TAKEN FROM MODERNIZR
|
3225 |
-
var element = document.createElement('x'),
|
3226 |
-
documentElement = document.documentElement,
|
3227 |
-
getComputedStyle = window.getComputedStyle,
|
3228 |
-
supports;
|
3229 |
-
if(!('pointerEvents' in element.style)){
|
3230 |
-
return false;
|
3231 |
-
}
|
3232 |
-
element.style.pointerEvents = 'auto';
|
3233 |
-
element.style.pointerEvents = 'x';
|
3234 |
-
documentElement.appendChild(element);
|
3235 |
-
supports = getComputedStyle &&
|
3236 |
-
getComputedStyle(element, '').pointerEvents === 'auto';
|
3237 |
-
documentElement.removeChild(element);
|
3238 |
-
return !!supports;
|
3239 |
-
})();
|
3240 |
-
|
3241 |
-
console.log('supportsPointerEvents', supportsPointerEvents);
|
3242 |
-
|
3243 |
-
if (supportsPointerEvents && !mejs.MediaFeatures.isOpera) { // opera doesn't allow this :(
|
3244 |
-
|
3245 |
-
// allows clicking through the fullscreen button and controls down directly to Flash
|
3246 |
-
|
3247 |
-
/*
|
3248 |
-
When a user puts his mouse over the fullscreen button, the controls are disabled
|
3249 |
-
So we put a div over the video and another one on iether side of the fullscreen button
|
3250 |
-
that caputre mouse movement
|
3251 |
-
and restore the controls once the mouse moves outside of the fullscreen button
|
3252 |
-
*/
|
3253 |
-
|
3254 |
-
var fullscreenIsDisabled = false,
|
3255 |
-
restoreControls = function() {
|
3256 |
-
if (fullscreenIsDisabled) {
|
3257 |
-
// hide the hovers
|
3258 |
-
videoHoverDiv.hide();
|
3259 |
-
controlsLeftHoverDiv.hide();
|
3260 |
-
controlsRightHoverDiv.hide();
|
3261 |
-
|
3262 |
-
// restore the control bar
|
3263 |
-
fullscreenBtn.css('pointer-events', '');
|
3264 |
-
t.controls.css('pointer-events', '');
|
3265 |
-
|
3266 |
-
// store for later
|
3267 |
-
fullscreenIsDisabled = false;
|
3268 |
-
}
|
3269 |
-
},
|
3270 |
-
videoHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
3271 |
-
controlsLeftHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
3272 |
-
controlsRightHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
3273 |
-
positionHoverDivs = function() {
|
3274 |
-
var style = {position: 'absolute', top: 0, left: 0}; //, backgroundColor: '#f00'};
|
3275 |
-
videoHoverDiv.css(style);
|
3276 |
-
controlsLeftHoverDiv.css(style);
|
3277 |
-
controlsRightHoverDiv.css(style);
|
3278 |
-
|
3279 |
-
// over video, but not controls
|
3280 |
-
videoHoverDiv
|
3281 |
-
.width( t.container.width() )
|
3282 |
-
.height( t.container.height() - t.controls.height() );
|
3283 |
-
|
3284 |
-
// over controls, but not the fullscreen button
|
3285 |
-
var fullScreenBtnOffset = fullscreenBtn.offset().left - t.container.offset().left;
|
3286 |
-
fullScreenBtnWidth = fullscreenBtn.outerWidth(true);
|
3287 |
-
|
3288 |
-
controlsLeftHoverDiv
|
3289 |
-
.width( fullScreenBtnOffset )
|
3290 |
-
.height( t.controls.height() )
|
3291 |
-
.css({top: t.container.height() - t.controls.height()});
|
3292 |
-
|
3293 |
-
// after the fullscreen button
|
3294 |
-
controlsRightHoverDiv
|
3295 |
-
.width( t.container.width() - fullScreenBtnOffset - fullScreenBtnWidth )
|
3296 |
-
.height( t.controls.height() )
|
3297 |
-
.css({top: t.container.height() - t.controls.height(),
|
3298 |
-
left: fullScreenBtnOffset + fullScreenBtnWidth});
|
3299 |
-
};
|
3300 |
-
|
3301 |
-
$(document).resize(function() {
|
3302 |
-
positionHoverDivs();
|
3303 |
-
});
|
3304 |
-
|
3305 |
-
// on hover, kill the fullscreen button's HTML handling, allowing clicks down to Flash
|
3306 |
-
fullscreenBtn
|
3307 |
-
.mouseover(function() {
|
3308 |
-
|
3309 |
-
if (!t.isFullScreen) {
|
3310 |
-
|
3311 |
-
var buttonPos = fullscreenBtn.offset(),
|
3312 |
-
containerPos = player.container.offset();
|
3313 |
-
|
3314 |
-
// move the button in Flash into place
|
3315 |
-
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, false);
|
3316 |
-
|
3317 |
-
// allows click through
|
3318 |
-
fullscreenBtn.css('pointer-events', 'none');
|
3319 |
-
t.controls.css('pointer-events', 'none');
|
3320 |
-
|
3321 |
-
// show the divs that will restore things
|
3322 |
-
videoHoverDiv.show();
|
3323 |
-
controlsRightHoverDiv.show();
|
3324 |
-
controlsLeftHoverDiv.show();
|
3325 |
-
positionHoverDivs();
|
3326 |
-
|
3327 |
-
fullscreenIsDisabled = true;
|
3328 |
-
}
|
3329 |
-
|
3330 |
-
});
|
3331 |
-
|
3332 |
-
// restore controls anytime the user enters or leaves fullscreen
|
3333 |
-
media.addEventListener('fullscreenchange', function(e) {
|
3334 |
-
restoreControls();
|
3335 |
-
});
|
3336 |
-
|
3337 |
-
|
3338 |
-
// the mouseout event doesn't work on the fullscren button, because we already killed the pointer-events
|
3339 |
-
// so we use the document.mousemove event to restore controls when the mouse moves outside the fullscreen button
|
3340 |
-
/*
|
3341 |
-
$(document).mousemove(function(e) {
|
3342 |
-
|
3343 |
-
// if the mouse is anywhere but the fullsceen button, then restore it all
|
3344 |
-
if (fullscreenIsDisabled) {
|
3345 |
-
|
3346 |
-
var fullscreenBtnPos = fullscreenBtn.offset();
|
3347 |
-
|
3348 |
-
|
3349 |
-
if (e.pageY < fullscreenBtnPos.top || e.pageY > fullscreenBtnPos.top + fullscreenBtn.outerHeight(true) ||
|
3350 |
-
e.pageX < fullscreenBtnPos.left || e.pageX > fullscreenBtnPos.left + fullscreenBtn.outerWidth(true)
|
3351 |
-
) {
|
3352 |
-
|
3353 |
-
fullscreenBtn.css('pointer-events', '');
|
3354 |
-
t.controls.css('pointer-events', '');
|
3355 |
-
|
3356 |
-
fullscreenIsDisabled = false;
|
3357 |
-
}
|
3358 |
-
}
|
3359 |
-
});
|
3360 |
-
*/
|
3361 |
-
|
3362 |
-
|
3363 |
-
} else {
|
3364 |
-
|
3365 |
-
// the hover state will show the fullscreen button in Flash to hover up and click
|
3366 |
-
|
3367 |
-
fullscreenBtn
|
3368 |
-
.mouseover(function() {
|
3369 |
-
|
3370 |
-
if (hideTimeout !== null) {
|
3371 |
-
clearTimeout(hideTimeout);
|
3372 |
-
delete hideTimeout;
|
3373 |
-
}
|
3374 |
-
|
3375 |
-
var buttonPos = fullscreenBtn.offset(),
|
3376 |
-
containerPos = player.container.offset();
|
3377 |
-
|
3378 |
-
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, true);
|
3379 |
-
|
3380 |
-
})
|
3381 |
-
.mouseout(function() {
|
3382 |
-
|
3383 |
-
if (hideTimeout !== null) {
|
3384 |
-
clearTimeout(hideTimeout);
|
3385 |
-
delete hideTimeout;
|
3386 |
-
}
|
3387 |
-
|
3388 |
-
hideTimeout = setTimeout(function() {
|
3389 |
-
media.hideFullscreenButton();
|
3390 |
-
}, 1500);
|
3391 |
-
|
3392 |
-
|
3393 |
-
});
|
3394 |
-
}
|
3395 |
-
}
|
3396 |
-
|
3397 |
-
player.fullscreenBtn = fullscreenBtn;
|
3398 |
-
|
3399 |
-
$(document).bind('keydown',function (e) {
|
3400 |
-
if (((mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || t.isFullScreen) && e.keyCode == 27) {
|
3401 |
-
player.exitFullScreen();
|
3402 |
-
}
|
3403 |
-
});
|
3404 |
-
|
3405 |
-
},
|
3406 |
-
enterFullScreen: function() {
|
3407 |
-
|
3408 |
-
var t = this;
|
3409 |
-
|
3410 |
-
// firefox+flash can't adjust plugin sizes without resetting :(
|
3411 |
-
if (t.media.pluginType !== 'native' && (mejs.MediaFeatures.isFirefox || t.options.usePluginFullScreen)) {
|
3412 |
-
//t.media.setFullscreen(true);
|
3413 |
-
//player.isFullScreen = true;
|
3414 |
-
return;
|
3415 |
-
}
|
3416 |
-
|
3417 |
-
// store overflow
|
3418 |
-
docStyleOverflow = document.documentElement.style.overflow;
|
3419 |
-
// set it to not show scroll bars so 100% will work
|
3420 |
-
document.documentElement.style.overflow = 'hidden';
|
3421 |
-
|
3422 |
-
// store sizing
|
3423 |
-
normalHeight = t.container.height();
|
3424 |
-
normalWidth = t.container.width();
|
3425 |
-
|
3426 |
-
// attempt to do true fullscreen (Safari 5.1 and Firefox Nightly only for now)
|
3427 |
-
if (t.media.pluginType === 'native') {
|
3428 |
-
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3429 |
-
|
3430 |
-
mejs.MediaFeatures.requestFullScreen(t.container[0]);
|
3431 |
-
//return;
|
3432 |
-
|
3433 |
-
if (t.isInIframe) {
|
3434 |
-
// sometimes exiting from fullscreen doesn't work
|
3435 |
-
// notably in Chrome <iframe>. Fixed in version 17
|
3436 |
-
setTimeout(function checkFullscreen() {
|
3437 |
-
|
3438 |
-
if (t.isNativeFullScreen) {
|
3439 |
-
|
3440 |
-
// check if the video is suddenly not really fullscreen
|
3441 |
-
if ($(window).width() !== screen.width) {
|
3442 |
-
// manually exit
|
3443 |
-
t.exitFullScreen();
|
3444 |
-
} else {
|
3445 |
-
// test again
|
3446 |
-
setTimeout(checkFullscreen, 500);
|
3447 |
-
}
|
3448 |
-
}
|
3449 |
-
|
3450 |
-
|
3451 |
-
}, 500);
|
3452 |
-
}
|
3453 |
-
|
3454 |
-
} else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
|
3455 |
-
t.media.webkitEnterFullscreen();
|
3456 |
-
return;
|
3457 |
-
}
|
3458 |
-
}
|
3459 |
-
|
3460 |
-
// check for iframe launch
|
3461 |
-
if (t.isInIframe) {
|
3462 |
-
var url = t.options.newWindowCallback(this);
|
3463 |
-
|
3464 |
-
|
3465 |
-
if (url !== '') {
|
3466 |
-
|
3467 |
-
// launch immediately
|
3468 |
-
if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3469 |
-
t.pause();
|
3470 |
-
window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
|
3471 |
-
return;
|
3472 |
-
} else {
|
3473 |
-
setTimeout(function() {
|
3474 |
-
if (!t.isNativeFullScreen) {
|
3475 |
-
t.pause();
|
3476 |
-
window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
|
3477 |
-
}
|
3478 |
-
}, 250);
|
3479 |
-
}
|
3480 |
-
}
|
3481 |
-
|
3482 |
-
}
|
3483 |
-
|
3484 |
-
// full window code
|
3485 |
-
|
3486 |
-
|
3487 |
-
|
3488 |
-
// make full size
|
3489 |
-
t.container
|
3490 |
-
.addClass('mejs-container-fullscreen')
|
3491 |
-
.width('100%')
|
3492 |
-
.height('100%');
|
3493 |
-
//.css({position: 'fixed', left: 0, top: 0, right: 0, bottom: 0, overflow: 'hidden', width: '100%', height: '100%', 'z-index': 1000});
|
3494 |
-
|
3495 |
-
// Only needed for safari 5.1 native full screen, can cause display issues elsewhere
|
3496 |
-
// Actually, it seems to be needed for IE8, too
|
3497 |
-
//if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3498 |
-
setTimeout(function() {
|
3499 |
-
t.container.css({width: '100%', height: '100%'});
|
3500 |
-
t.setControlsSize();
|
3501 |
-
}, 500);
|
3502 |
-
//}
|
3503 |
-
|
3504 |
-
if (t.pluginType === 'native') {
|
3505 |
-
t.$media
|
3506 |
-
.width('100%')
|
3507 |
-
.height('100%');
|
3508 |
-
} else {
|
3509 |
-
t.container.find('object, embed, iframe')
|
3510 |
-
.width('100%')
|
3511 |
-
.height('100%');
|
3512 |
-
|
3513 |
-
//if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3514 |
-
t.media.setVideoSize($(window).width(),$(window).height());
|
3515 |
-
//}
|
3516 |
-
}
|
3517 |
-
|
3518 |
-
t.layers.children('div')
|
3519 |
-
.width('100%')
|
3520 |
-
.height('100%');
|
3521 |
-
|
3522 |
-
if (t.fullscreenBtn) {
|
3523 |
-
t.fullscreenBtn
|
3524 |
-
.removeClass('mejs-fullscreen')
|
3525 |
-
.addClass('mejs-unfullscreen');
|
3526 |
-
}
|
3527 |
-
|
3528 |
-
t.setControlsSize();
|
3529 |
-
t.isFullScreen = true;
|
3530 |
-
},
|
3531 |
-
|
3532 |
-
exitFullScreen: function() {
|
3533 |
-
|
3534 |
-
var t = this;
|
3535 |
-
|
3536 |
-
// firefox can't adjust plugins
|
3537 |
-
if (t.media.pluginType !== 'native' && mejs.MediaFeatures.isFirefox) {
|
3538 |
-
t.media.setFullscreen(false);
|
3539 |
-
//player.isFullScreen = false;
|
3540 |
-
return;
|
3541 |
-
}
|
3542 |
-
|
3543 |
-
// come outo of native fullscreen
|
3544 |
-
if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || t.isFullScreen)) {
|
3545 |
-
mejs.MediaFeatures.cancelFullScreen();
|
3546 |
-
}
|
3547 |
-
|
3548 |
-
// restore scroll bars to document
|
3549 |
-
document.documentElement.style.overflow = docStyleOverflow;
|
3550 |
-
|
3551 |
-
t.container
|
3552 |
-
.removeClass('mejs-container-fullscreen')
|
3553 |
-
.width(normalWidth)
|
3554 |
-
.height(normalHeight);
|
3555 |
-
//.css({position: '', left: '', top: '', right: '', bottom: '', overflow: 'inherit', width: normalWidth + 'px', height: normalHeight + 'px', 'z-index': 1});
|
3556 |
-
|
3557 |
-
if (t.pluginType === 'native') {
|
3558 |
-
t.$media
|
3559 |
-
.width(normalWidth)
|
3560 |
-
.height(normalHeight);
|
3561 |
-
} else {
|
3562 |
-
t.container.find('object embed')
|
3563 |
-
.width(normalWidth)
|
3564 |
-
.height(normalHeight);
|
3565 |
-
|
3566 |
-
t.media.setVideoSize(normalWidth, normalHeight);
|
3567 |
-
}
|
3568 |
-
|
3569 |
-
t.layers.children('div')
|
3570 |
-
.width(normalWidth)
|
3571 |
-
.height(normalHeight);
|
3572 |
-
|
3573 |
-
t.fullscreenBtn
|
3574 |
-
.removeClass('mejs-unfullscreen')
|
3575 |
-
.addClass('mejs-fullscreen');
|
3576 |
-
|
3577 |
-
t.setControlsSize();
|
3578 |
-
t.isFullScreen = false;
|
3579 |
-
}
|
3580 |
-
});
|
3581 |
-
|
3582 |
-
})(mejs.$);
|
3583 |
|
3584 |
(function($) {
|
3585 |
|
@@ -3656,12 +3987,12 @@ if (typeof jQuery != 'undefined') {
|
|
3656 |
if (!player.options.alwaysShowControls) {
|
3657 |
// move with controls
|
3658 |
player.container
|
3659 |
-
.bind('
|
3660 |
// push captions above controls
|
3661 |
player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
|
3662 |
|
3663 |
})
|
3664 |
-
.bind('
|
3665 |
if (!media.paused) {
|
3666 |
// move back to normal place
|
3667 |
player.container.find('.mejs-captions-position').removeClass('mejs-captions-position-hover');
|
@@ -3747,35 +4078,33 @@ if (typeof jQuery != 'undefined') {
|
|
3747 |
|
3748 |
};
|
3749 |
|
3750 |
-
if (track.isTranslation) {
|
3751 |
|
3752 |
-
|
3753 |
-
|
3754 |
-
|
3755 |
-
|
3756 |
-
track.entries = newOne;
|
3757 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3758 |
after();
|
3759 |
-
});
|
3760 |
-
|
3761 |
-
} else {
|
3762 |
-
$.ajax({
|
3763 |
-
url: track.src,
|
3764 |
-
success: function(d) {
|
3765 |
|
3766 |
-
|
3767 |
-
|
3768 |
-
|
3769 |
-
|
3770 |
-
|
3771 |
-
|
3772 |
-
}
|
3773 |
-
},
|
3774 |
-
error: function() {
|
3775 |
-
t.loadNextTrack();
|
3776 |
}
|
3777 |
-
}
|
3778 |
-
|
|
|
|
|
|
|
3779 |
},
|
3780 |
|
3781 |
enableTrackButton: function(lang, label) {
|
@@ -3993,53 +4322,106 @@ if (typeof jQuery != 'undefined') {
|
|
3993 |
Adapted from: http://www.delphiki.com/html5/playr
|
3994 |
*/
|
3995 |
mejs.TrackFormatParser = {
|
3996 |
-
|
3997 |
-
|
3998 |
-
|
3999 |
-
|
4000 |
-
|
4001 |
-
|
4002 |
-
|
4003 |
-
|
4004 |
-
|
4005 |
-
|
4006 |
-
|
4007 |
-
|
4008 |
-
lines
|
4009 |
-
|
4010 |
-
|
4011 |
-
|
4012 |
-
|
4013 |
-
for(; i<lines.length; i++) {
|
4014 |
-
// check for the line number
|
4015 |
-
if (this.pattern_identifier.exec(lines[i])){
|
4016 |
-
// skip to the next line where the start --> end time code should be
|
4017 |
-
i++;
|
4018 |
-
timecode = this.pattern_timecode.exec(lines[i]);
|
4019 |
-
|
4020 |
-
if (timecode && i<lines.length){
|
4021 |
-
i++;
|
4022 |
-
// grab all the (possibly multi-line) text that follows
|
4023 |
-
text = lines[i];
|
4024 |
i++;
|
4025 |
-
|
4026 |
-
|
|
|
|
|
|
|
|
|
4027 |
i++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4028 |
}
|
4029 |
-
|
4030 |
-
// Text is in a different array so I can use .join
|
4031 |
-
entries.text.push(text);
|
4032 |
-
entries.times.push(
|
4033 |
-
{
|
4034 |
-
start: mejs.Utility.timeCodeToSeconds(timecode[1]),
|
4035 |
-
stop: mejs.Utility.timeCodeToSeconds(timecode[3]),
|
4036 |
-
settings: timecode[5]
|
4037 |
-
});
|
4038 |
}
|
4039 |
}
|
|
|
4040 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4041 |
|
4042 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4043 |
}
|
4044 |
};
|
4045 |
|
@@ -4066,197 +4448,232 @@ if (typeof jQuery != 'undefined') {
|
|
4066 |
|
4067 |
})(mejs.$);
|
4068 |
|
4069 |
-
/*
|
4070 |
-
* ContextMenu Plugin
|
4071 |
-
*
|
4072 |
-
*
|
4073 |
-
*/
|
4074 |
-
|
4075 |
-
(function($) {
|
4076 |
-
|
4077 |
-
$.extend(mejs.MepDefaults,
|
4078 |
-
{ 'contextMenuItems': [
|
4079 |
-
// demo of a fullscreen option
|
4080 |
-
{
|
4081 |
-
render: function(player) {
|
4082 |
-
|
4083 |
-
// check for fullscreen plugin
|
4084 |
-
if (typeof player.enterFullScreen == 'undefined')
|
4085 |
-
return null;
|
4086 |
-
|
4087 |
-
if (player.isFullScreen) {
|
4088 |
-
return "Turn off Fullscreen";
|
4089 |
-
} else {
|
4090 |
-
return "Go Fullscreen";
|
4091 |
-
}
|
4092 |
-
},
|
4093 |
-
click: function(player) {
|
4094 |
-
if (player.isFullScreen) {
|
4095 |
-
player.exitFullScreen();
|
4096 |
-
} else {
|
4097 |
-
player.enterFullScreen();
|
4098 |
-
}
|
4099 |
-
}
|
4100 |
-
}
|
4101 |
-
,
|
4102 |
-
// demo of a mute/unmute button
|
4103 |
-
{
|
4104 |
-
render: function(player) {
|
4105 |
-
if (player.media.muted) {
|
4106 |
-
return "Unmute";
|
4107 |
-
} else {
|
4108 |
-
return "Mute";
|
4109 |
-
}
|
4110 |
-
},
|
4111 |
-
click: function(player) {
|
4112 |
-
if (player.media.muted) {
|
4113 |
-
player.setMuted(false);
|
4114 |
-
} else {
|
4115 |
-
player.setMuted(true);
|
4116 |
-
}
|
4117 |
-
}
|
4118 |
-
},
|
4119 |
-
// separator
|
4120 |
-
{
|
4121 |
-
isSeparator: true
|
4122 |
-
}
|
4123 |
-
,
|
4124 |
-
// demo of simple download video
|
4125 |
-
{
|
4126 |
-
render: function(player) {
|
4127 |
-
return "Download Video";
|
4128 |
-
},
|
4129 |
-
click: function(player) {
|
4130 |
-
window.location.href = player.media.currentSrc;
|
4131 |
-
}
|
4132 |
-
}
|
4133 |
-
]}
|
4134 |
-
);
|
4135 |
-
|
4136 |
-
|
4137 |
-
$.extend(MediaElementPlayer.prototype, {
|
4138 |
-
buildcontextmenu: function(player, controls, layers, media) {
|
4139 |
-
|
4140 |
-
// create context menu
|
4141 |
-
player.contextMenu = $('<div class="mejs-contextmenu"></div>')
|
4142 |
-
.appendTo($('body'))
|
4143 |
-
.hide();
|
4144 |
-
|
4145 |
-
// create events for showing context menu
|
4146 |
-
player.container.bind('contextmenu', function(e) {
|
4147 |
-
if (player.isContextMenuEnabled) {
|
4148 |
-
e.preventDefault();
|
4149 |
-
player.renderContextMenu(e.clientX-1, e.clientY-1);
|
4150 |
-
return false;
|
4151 |
-
}
|
4152 |
-
});
|
4153 |
-
player.container.bind('click', function() {
|
4154 |
-
player.contextMenu.hide();
|
4155 |
-
});
|
4156 |
-
player.contextMenu.bind('mouseleave', function() {
|
4157 |
-
|
4158 |
-
//console.log('context hover out');
|
4159 |
-
player.startContextMenuTimer();
|
4160 |
-
|
4161 |
-
});
|
4162 |
-
},
|
4163 |
-
|
4164 |
-
isContextMenuEnabled: true,
|
4165 |
-
enableContextMenu: function() {
|
4166 |
-
this.isContextMenuEnabled = true;
|
4167 |
-
},
|
4168 |
-
disableContextMenu: function() {
|
4169 |
-
this.isContextMenuEnabled = false;
|
4170 |
-
},
|
4171 |
-
|
4172 |
-
contextMenuTimeout: null,
|
4173 |
-
startContextMenuTimer: function() {
|
4174 |
-
//console.log('startContextMenuTimer');
|
4175 |
-
|
4176 |
-
var t = this;
|
4177 |
-
|
4178 |
-
t.killContextMenuTimer();
|
4179 |
-
|
4180 |
-
t.contextMenuTimer = setTimeout(function() {
|
4181 |
-
t.hideContextMenu();
|
4182 |
-
t.killContextMenuTimer();
|
4183 |
-
}, 750);
|
4184 |
-
},
|
4185 |
-
killContextMenuTimer: function() {
|
4186 |
-
var timer = this.contextMenuTimer;
|
4187 |
-
|
4188 |
-
//console.log('killContextMenuTimer', timer);
|
4189 |
-
|
4190 |
-
if (timer != null) {
|
4191 |
-
clearTimeout(timer);
|
4192 |
-
delete timer;
|
4193 |
-
timer = null;
|
4194 |
-
}
|
4195 |
-
},
|
4196 |
-
|
4197 |
-
hideContextMenu: function() {
|
4198 |
-
this.contextMenu.hide();
|
4199 |
-
},
|
4200 |
-
|
4201 |
-
renderContextMenu: function(x,y) {
|
4202 |
-
|
4203 |
-
// alway re-render the items so that things like "turn fullscreen on" and "turn fullscreen off" are always written correctly
|
4204 |
-
var t = this,
|
4205 |
-
html = '',
|
4206 |
-
items = t.options.contextMenuItems;
|
4207 |
-
|
4208 |
-
for (var i=0, il=items.length; i<il; i++) {
|
4209 |
-
|
4210 |
-
if (items[i].isSeparator) {
|
4211 |
-
html += '<div class="mejs-contextmenu-separator"></div>';
|
4212 |
-
} else {
|
4213 |
-
|
4214 |
-
var rendered = items[i].render(t);
|
4215 |
-
|
4216 |
-
// render can return null if the item doesn't need to be used at the moment
|
4217 |
-
if (rendered != null) {
|
4218 |
-
html += '<div class="mejs-contextmenu-item" data-itemindex="' + i + '" id="element-' + (Math.random()*1000000) + '">' + rendered + '</div>';
|
4219 |
-
}
|
4220 |
-
}
|
4221 |
-
}
|
4222 |
-
|
4223 |
-
// position and show the context menu
|
4224 |
-
t.contextMenu
|
4225 |
-
.empty()
|
4226 |
-
.append($(html))
|
4227 |
-
.css({top:y, left:x})
|
4228 |
-
.show();
|
4229 |
-
|
4230 |
-
// bind events
|
4231 |
-
t.contextMenu.find('.mejs-contextmenu-item').each(function() {
|
4232 |
-
|
4233 |
-
// which one is this?
|
4234 |
-
var $dom = $(this),
|
4235 |
-
itemIndex = parseInt( $dom.data('itemindex'), 10 ),
|
4236 |
-
item = t.options.contextMenuItems[itemIndex];
|
4237 |
-
|
4238 |
-
// bind extra functionality?
|
4239 |
-
if (typeof item.show != 'undefined')
|
4240 |
-
item.show( $dom , t);
|
4241 |
-
|
4242 |
-
// bind click action
|
4243 |
-
$dom.click(function() {
|
4244 |
-
// perform click action
|
4245 |
-
if (typeof item.click != 'undefined')
|
4246 |
-
item.click(t);
|
4247 |
-
|
4248 |
-
// close
|
4249 |
-
t.contextMenu.hide();
|
4250 |
-
});
|
4251 |
-
});
|
4252 |
-
|
4253 |
-
// stop the controls from hiding
|
4254 |
-
setTimeout(function() {
|
4255 |
-
t.killControlsTimer('rev3');
|
4256 |
-
}, 100);
|
4257 |
-
|
4258 |
-
}
|
4259 |
-
});
|
4260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4261 |
})(mejs.$);
|
4262 |
|
8 |
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
*
|
10 |
* Copyright 2010-2012, John Dyer (http://j.hn)
|
11 |
+
* License: MIT
|
12 |
*
|
13 |
*/
|
14 |
+
// Namespace
|
15 |
+
var mejs = mejs || {};
|
16 |
+
|
17 |
+
// version number
|
18 |
+
mejs.version = '2.10.3';
|
19 |
+
|
20 |
+
// player number (for missing, same id attr)
|
21 |
+
mejs.meIndex = 0;
|
22 |
+
|
23 |
+
// media types accepted by plugins
|
24 |
+
mejs.plugins = {
|
25 |
+
silverlight: [
|
26 |
+
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','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/youtube', 'video/x-youtube']}
|
30 |
+
//,{version: [12,0], types: ['video/webm']} // for future reference (hopefully!)
|
31 |
+
],
|
32 |
+
youtube: [
|
33 |
+
{version: null, types: ['video/youtube', 'video/x-youtube']}
|
34 |
+
],
|
35 |
+
vimeo: [
|
36 |
+
{version: null, types: ['video/vimeo', 'video/x-vimeo']}
|
37 |
+
]
|
38 |
+
};
|
39 |
+
|
40 |
+
/*
|
41 |
+
Utility methods
|
42 |
+
*/
|
43 |
+
mejs.Utility = {
|
44 |
+
encodeUrl: function(url) {
|
45 |
+
return encodeURIComponent(url); //.replace(/\?/gi,'%3F').replace(/=/gi,'%3D').replace(/&/gi,'%26');
|
46 |
+
},
|
47 |
+
escapeHTML: function(s) {
|
48 |
+
return s.toString().split('&').join('&').split('<').join('<').split('"').join('"');
|
49 |
+
},
|
50 |
+
absolutizeUrl: function(url) {
|
51 |
+
var el = document.createElement('div');
|
52 |
+
el.innerHTML = '<a href="' + this.escapeHTML(url) + '">x</a>';
|
53 |
+
return el.firstChild.href;
|
54 |
+
},
|
55 |
+
getScriptPath: function(scriptNames) {
|
56 |
+
var
|
57 |
+
i = 0,
|
58 |
+
j,
|
59 |
+
path = '',
|
60 |
+
name = '',
|
61 |
+
script,
|
62 |
+
scripts = document.getElementsByTagName('script'),
|
63 |
+
il = scripts.length,
|
64 |
+
jl = scriptNames.length;
|
65 |
+
|
66 |
+
for (; i < il; i++) {
|
67 |
+
script = scripts[i].src;
|
68 |
+
for (j = 0; j < jl; j++) {
|
69 |
+
name = scriptNames[j];
|
70 |
+
if (script.indexOf(name) > -1) {
|
71 |
+
path = script.substring(0, script.indexOf(name));
|
72 |
+
break;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
if (path !== '') {
|
76 |
+
break;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
return path;
|
80 |
+
},
|
81 |
+
secondsToTimeCode: function(time, forceHours, showFrameCount, fps) {
|
82 |
+
//add framecount
|
83 |
+
if (typeof showFrameCount == 'undefined') {
|
84 |
+
showFrameCount=false;
|
85 |
+
} else if(typeof fps == 'undefined') {
|
86 |
+
fps = 25;
|
87 |
+
}
|
88 |
+
|
89 |
+
var hours = Math.floor(time / 3600) % 24,
|
90 |
+
minutes = Math.floor(time / 60) % 60,
|
91 |
+
seconds = Math.floor(time % 60),
|
92 |
+
frames = Math.floor(((time % 1)*fps).toFixed(3)),
|
93 |
+
result =
|
94 |
+
( (forceHours || hours > 0) ? (hours < 10 ? '0' + hours : hours) + ':' : '')
|
95 |
+
+ (minutes < 10 ? '0' + minutes : minutes) + ':'
|
96 |
+
+ (seconds < 10 ? '0' + seconds : seconds)
|
97 |
+
+ ((showFrameCount) ? ':' + (frames < 10 ? '0' + frames : frames) : '');
|
98 |
+
|
99 |
+
return result;
|
100 |
+
},
|
101 |
+
|
102 |
+
timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
|
103 |
+
if (typeof showFrameCount == 'undefined') {
|
104 |
+
showFrameCount=false;
|
105 |
+
} else if(typeof fps == 'undefined') {
|
106 |
+
fps = 25;
|
107 |
+
}
|
108 |
+
|
109 |
+
var tc_array = hh_mm_ss_ff.split(":"),
|
110 |
+
tc_hh = parseInt(tc_array[0], 10),
|
111 |
+
tc_mm = parseInt(tc_array[1], 10),
|
112 |
+
tc_ss = parseInt(tc_array[2], 10),
|
113 |
+
tc_ff = 0,
|
114 |
+
tc_in_seconds = 0;
|
115 |
+
|
116 |
+
if (showFrameCount) {
|
117 |
+
tc_ff = parseInt(tc_array[3])/fps;
|
118 |
+
}
|
119 |
+
|
120 |
+
tc_in_seconds = ( tc_hh * 3600 ) + ( tc_mm * 60 ) + tc_ss + tc_ff;
|
121 |
+
|
122 |
+
return tc_in_seconds;
|
123 |
+
},
|
124 |
+
|
125 |
+
|
126 |
+
convertSMPTEtoSeconds: function (SMPTE) {
|
127 |
+
if (typeof SMPTE != 'string')
|
128 |
+
return false;
|
129 |
+
|
130 |
+
SMPTE = SMPTE.replace(',', '.');
|
131 |
+
|
132 |
+
var secs = 0,
|
133 |
+
decimalLen = (SMPTE.indexOf('.') != -1) ? SMPTE.split('.')[1].length : 0,
|
134 |
+
multiplier = 1;
|
135 |
+
|
136 |
+
SMPTE = SMPTE.split(':').reverse();
|
137 |
+
|
138 |
+
for (var i = 0; i < SMPTE.length; i++) {
|
139 |
+
multiplier = 1;
|
140 |
+
if (i > 0) {
|
141 |
+
multiplier = Math.pow(60, i);
|
142 |
+
}
|
143 |
+
secs += Number(SMPTE[i]) * multiplier;
|
144 |
+
}
|
145 |
+
return Number(secs.toFixed(decimalLen));
|
146 |
+
},
|
147 |
+
|
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 == "OBJECT") {
|
152 |
+
if (mejs.MediaFeatures.isIE) {
|
153 |
+
obj.style.display = "none";
|
154 |
+
(function(){
|
155 |
+
if (obj.readyState == 4) {
|
156 |
+
mejs.Utility.removeObjectInIE(id);
|
157 |
+
} else {
|
158 |
+
setTimeout(arguments.callee, 10);
|
159 |
+
}
|
160 |
+
})();
|
161 |
+
} else {
|
162 |
+
obj.parentNode.removeChild(obj);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
},
|
166 |
+
removeObjectInIE: function(id) {
|
167 |
+
var obj = document.getElementById(id);
|
168 |
+
if (obj) {
|
169 |
+
for (var i in obj) {
|
170 |
+
if (typeof obj[i] == "function") {
|
171 |
+
obj[i] = null;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
obj.parentNode.removeChild(obj);
|
175 |
+
}
|
176 |
+
}
|
177 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
|
180 |
// Core detector, plugins are added below
|
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 |
+
// borrowed from Modernizr
|
308 |
+
t.svg = !! document.createElementNS &&
|
309 |
+
!! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect;
|
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++) {
|
377 |
};
|
378 |
mejs.MediaFeatures.init();
|
379 |
|
|
|
380 |
/*
|
381 |
extension methods to <video> or <audio> object to bring it into parity with PluginMediaElement (see below)
|
382 |
*/
|
421 |
media = url[i];
|
422 |
if (this.canPlayType(media.type)) {
|
423 |
this.src = media.src;
|
424 |
+
break;
|
425 |
}
|
426 |
}
|
427 |
}
|
441 |
this.pluginType = pluginType;
|
442 |
this.src = mediaUrl;
|
443 |
this.events = {};
|
444 |
+
this.attributes = {};
|
445 |
};
|
446 |
|
447 |
// JavaScript values and ExternalInterface methods that match HTML5 video properties methods
|
570 |
if (this.canPlayType(media.type)) {
|
571 |
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
|
572 |
this.src = mejs.Utility.absolutizeUrl(url);
|
573 |
+
break;
|
574 |
}
|
575 |
}
|
576 |
}
|
683 |
// end: fake events
|
684 |
|
685 |
// fake DOM attribute methods
|
|
|
686 |
hasAttribute: function(name){
|
687 |
return (name in this.attributes);
|
688 |
},
|
749 |
bufferedTime,
|
750 |
pluginMediaElement = this.pluginMediaElements[id];
|
751 |
|
|
|
|
|
|
|
752 |
// fake event object to mimic real HTML media event.
|
753 |
e = {
|
754 |
type: eventName,
|
784 |
mejs.MediaElementDefaults = {
|
785 |
// allows testing on HTML5, flash, silverlight
|
786 |
// auto: attempts to detect what the browser can do
|
787 |
+
// auto_plugin: prefer plugins and then attempt native HTML5
|
788 |
// native: forces HTML5 playback
|
789 |
// shim: disallows HTML5, will attempt either Flash or Silverlight
|
790 |
// none: forces fallback view
|
799 |
pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
|
800 |
// name of flash file
|
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
|
901 |
pluginName,
|
902 |
pluginVersions,
|
903 |
pluginInfo,
|
904 |
+
dummy,
|
905 |
+
media;
|
906 |
|
907 |
// STEP 1: Get URL and type from <video src> or <source src>
|
908 |
|
932 |
if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
|
933 |
src = n.getAttribute('src');
|
934 |
type = this.formatType(src, n.getAttribute('type'));
|
935 |
+
media = n.getAttribute('media');
|
936 |
+
|
937 |
+
if (!media || !window.matchMedia || (window.matchMedia && window.matchMedia(media).matches)) {
|
938 |
+
mediaFiles.push({type:type, url:src});
|
939 |
+
}
|
940 |
}
|
941 |
}
|
942 |
}
|
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 |
|
988 |
htmlMediaElement.src = result.url;
|
989 |
}
|
990 |
|
991 |
+
// if `auto_plugin` mode, then cache the native result but try plugins.
|
992 |
+
if (options.mode !== 'auto_plugin') {
|
993 |
+
return result;
|
994 |
+
}
|
995 |
}
|
996 |
}
|
997 |
|
998 |
// if native playback didn't work, then test plugins
|
999 |
+
if (options.mode === 'auto' || options.mode === 'auto_plugin' || options.mode === 'shim') {
|
1000 |
for (i=0; i<mediaFiles.length; i++) {
|
1001 |
type = mediaFiles[i].type;
|
1002 |
|
1033 |
}
|
1034 |
}
|
1035 |
|
1036 |
+
// at this point, being in 'auto_plugin' mode implies that we tried plugins but failed.
|
1037 |
+
// if we have native support then return that.
|
1038 |
+
if (options.mode === 'auto_plugin' && result.method === 'native') {
|
1039 |
+
return result;
|
1040 |
+
}
|
1041 |
+
|
1042 |
// what if there's nothing to play? just grab the first available
|
1043 |
if (result.method === '' && mediaFiles.length > 0) {
|
1044 |
result.url = mediaFiles[0].url;
|
1067 |
},
|
1068 |
|
1069 |
getTypeFromFile: function(url) {
|
1070 |
+
url = url.split('?')[0];
|
1071 |
var ext = url.substring(url.lastIndexOf('.') + 1);
|
1072 |
+
return (/(mp4|m4v|ogg|ogv|webm|webmv|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video' : 'audio') + '/' + this.getTypeFromExtension(ext);
|
1073 |
+
},
|
1074 |
+
|
1075 |
+
getTypeFromExtension: function(ext) {
|
1076 |
+
|
1077 |
+
switch (ext) {
|
1078 |
+
case 'mp4':
|
1079 |
+
case 'm4v':
|
1080 |
+
return 'mp4';
|
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) {
|
1105 |
|
1106 |
errorContainer.innerHTML = (poster !== '') ?
|
1107 |
'<a href="' + playback.url + '"><img src="' + poster + '" width="100%" height="100%" /></a>' :
|
1108 |
+
'<a href="' + playback.url + '"><span>' + mejs.i18n.t('Download File') + '</span></a>';
|
1109 |
|
1110 |
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
|
1111 |
htmlMediaElement.style.display = 'none';
|
1184 |
'width=' + width,
|
1185 |
'startvolume=' + options.startVolume,
|
1186 |
'timerrate=' + options.timerRate,
|
1187 |
+
'flashstreamer=' + options.flashStreamer,
|
1188 |
'height=' + height];
|
1189 |
|
1190 |
if (playback.url !== null) {
|
1281 |
|
1282 |
// DEMO Code. Does NOT work.
|
1283 |
case 'vimeo':
|
1284 |
+
//console.log('vimeoid');
|
1285 |
|
1286 |
pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1287 |
|
1288 |
+
container.innerHTML ='<iframe src="http://player.vimeo.com/video/' + pluginMediaElement.vimeoid + '?portrait=0&byline=0&title=0" width="' + width +'" height="' + height +'" frameborder="0"></iframe>';
|
1289 |
+
|
1290 |
+
/*
|
1291 |
container.innerHTML =
|
1292 |
'<object width="' + width + '" height="' + height + '">' +
|
1293 |
'<param name="allowfullscreen" value="true" />' +
|
1296 |
'<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=' + pluginMediaElement.vimeoid + '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" />' +
|
1297 |
'<embed src="//vimeo.com/moogaloop.swf?api=1&clip_id=' + pluginMediaElement.vimeoid + '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="' + width + '" height="' + height + '"></embed>' +
|
1298 |
'</object>';
|
1299 |
+
*/
|
1300 |
+
|
1301 |
break;
|
1302 |
}
|
1303 |
// hide original element
|
1523 |
// load the youtube video
|
1524 |
player.cueVideoById(settings.videoId);
|
1525 |
|
1526 |
+
var callbackName = settings.containerId + '_callback';
|
1527 |
|
1528 |
window[callbackName] = function(e) {
|
1529 |
mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
|
1583 |
window.mejs = mejs;
|
1584 |
window.MediaElement = mejs.MediaElement;
|
1585 |
|
1586 |
+
/*!
|
1587 |
+
* Adds Internationalization and localization to objects.
|
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 |
+
* @params
|
1625 |
+
* - $ - zepto || jQuery ..
|
1626 |
+
* - context - document, iframe ..
|
1627 |
+
* - exports - CommonJS, window ..
|
1628 |
+
*
|
1629 |
+
*/
|
1630 |
+
;(function($, context, exports, undefined) {
|
1631 |
+
"use strict";
|
1632 |
+
var i18n = {
|
1633 |
+
"locale": {
|
1634 |
+
"strings" : {}
|
1635 |
+
},
|
1636 |
+
"methods" : {}
|
1637 |
+
};
|
1638 |
+
// start i18n
|
1639 |
+
|
1640 |
+
|
1641 |
+
/**
|
1642 |
+
* Get the current browser's language
|
1643 |
+
*
|
1644 |
+
* @see: i18n.methods.t()
|
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 |
+
if (args) {
|
1744 |
+
str = i18n.methods.formatString(str, args);
|
1745 |
+
}
|
1746 |
+
return str;
|
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 |
+
if (typeof str === 'string' && str.length > 0) {
|
1759 |
+
|
1760 |
+
// check every time due languge can change for
|
1761 |
+
// different reasons (translation, lang switcher ..)
|
1762 |
+
var lang = i18n.locale.getLanguage();
|
1763 |
+
|
1764 |
+
options = options || {
|
1765 |
+
"context" : lang.language
|
1766 |
+
};
|
1767 |
+
|
1768 |
+
return i18n.methods.t(str, args, options);
|
1769 |
+
}
|
1770 |
+
else {
|
1771 |
+
throw {
|
1772 |
+
"name" : 'InvalidArgumentException',
|
1773 |
+
"message" : 'First argument is either not a string or empty.'
|
1774 |
+
}
|
1775 |
+
}
|
1776 |
+
};
|
1777 |
+
|
1778 |
+
// end i18n
|
1779 |
+
exports.i18n = i18n;
|
1780 |
+
}(jQuery, document, mejs));
|
1781 |
+
/*!
|
1782 |
+
* This is a i18n.locale language object.
|
1783 |
+
*
|
1784 |
+
*<de> German translation by Tim Latz, latz.tim@gmail.com
|
1785 |
+
*
|
1786 |
+
* @author
|
1787 |
+
* Tim Latz (latz.tim@gmail.com)
|
1788 |
+
*
|
1789 |
+
* @see
|
1790 |
+
* me-i18n.js
|
1791 |
+
*
|
1792 |
+
* @params
|
1793 |
+
* - exports - CommonJS, window ..
|
1794 |
+
*/
|
1795 |
+
;(function(exports, undefined) {
|
1796 |
+
|
1797 |
+
"use strict";
|
1798 |
+
|
1799 |
+
exports.de = {
|
1800 |
+
"Fullscreen" : "Vollbild",
|
1801 |
+
"Go Fullscreen" : "Vollbild an",
|
1802 |
+
"Turn off Fullscreen" : "Vollbild aus",
|
1803 |
+
"Close" : "Schließen"
|
1804 |
+
};
|
1805 |
+
|
1806 |
+
}(mejs.i18n.locale.strings));
|
1807 |
+
|
1808 |
/*!
|
1809 |
* MediaElementPlayer
|
1810 |
* http://mediaelementjs.com/
|
1813 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
1814 |
*
|
1815 |
* Copyright 2010-2012, John Dyer (http://j.hn/)
|
1816 |
+
* License: MIT
|
1817 |
*
|
1818 |
*/
|
1819 |
if (typeof jQuery != 'undefined') {
|
1821 |
} else if (typeof ender != 'undefined') {
|
1822 |
mejs.$ = ender;
|
1823 |
}
|
1824 |
+
(function ($) {
|
1825 |
+
|
1826 |
+
// default player values
|
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
|
1833 |
+
defaultVideoHeight: 270,
|
1834 |
+
// if set, overrides <video width>
|
1835 |
+
videoWidth: -1,
|
1836 |
+
// if set, overrides <video height>
|
1837 |
+
videoHeight: -1,
|
1838 |
+
// default if the user doesn't specify
|
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 |
+
autoRewind: true,
|
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 |
+
// Enable click video element to toggle play/pause
|
1877 |
+
clickToPlayPause: true,
|
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 |
+
media.play();
|
1905 |
+
} else {
|
1906 |
+
media.pause();
|
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 |
+
}
|
1923 |
+
},
|
1924 |
+
{
|
1925 |
+
keys: [
|
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);
|
1939 |
+
}
|
1940 |
+
}
|
1941 |
+
},
|
1942 |
+
{
|
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], // f
|
1962 |
+
action: function(player, media) {
|
1963 |
+
if (typeof player.enterFullScreen != 'undefined') {
|
1964 |
+
if (player.isFullScreen) {
|
1965 |
+
player.exitFullScreen();
|
1966 |
+
} else {
|
1967 |
+
player.enterFullScreen();
|
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.push(t);
|
2011 |
+
|
2012 |
+
// start up
|
2013 |
+
t.init();
|
2014 |
|
2015 |
+
return t;
|
2016 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017 |
|
2018 |
+
// actual player
|
2019 |
+
mejs.MediaElementPlayer.prototype = {
|
2020 |
+
|
2021 |
+
hasFocus: false,
|
2022 |
+
|
2023 |
+
controlsAreVisible: true,
|
2024 |
+
|
2025 |
+
init: function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
2026 |
|
2027 |
+
var
|
2028 |
t = this,
|
2029 |
+
mf = mejs.MediaFeatures,
|
2030 |
+
// options for MediaElement (shim)
|
2031 |
+
meOptions = $.extend(true, {}, t.options, {
|
2032 |
+
success: function(media, domNode) { t.meReady(media, domNode); },
|
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 |
+
// no Issue found on iOS3 -ttroxell
|
2055 |
|
2056 |
+
// override Apple's autoplay override for iPads
|
2057 |
+
if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
|
2058 |
+
t.media.load();
|
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.svg ? 'svg' : 'no-svg') + '">'+
|
2079 |
+
'<div class="mejs-inner">'+
|
2080 |
+
'<div class="mejs-mediaelement"></div>'+
|
2081 |
+
'<div class="mejs-layers"></div>'+
|
2082 |
+
'<div class="mejs-controls"></div>'+
|
2083 |
+
'<div class="mejs-clear"></div>'+
|
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 ' : '') +
|
2092 |
+
(mf.isiOS ? 'mejs-ios ' : '') +
|
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 |
+
if (mf.isiOS) {
|
2101 |
+
|
2102 |
+
// sadly, you can't move nodes in iOS, so we have to destroy and recreate it!
|
2103 |
+
var $newMedia = t.$media.clone();
|
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.height;
|
2159 |
+
meOptions.pluginHeight = t.width;
|
2160 |
+
}
|
2161 |
+
|
2162 |
+
|
2163 |
+
|
2164 |
+
// create MediaElement shim
|
2165 |
+
mejs.MediaElement(t.$media[0], meOptions);
|
2166 |
+
|
2167 |
+
// controls are shown when loaded
|
2168 |
+
t.container.trigger('controlsshown');
|
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 |
+
.css('visibility','visible')
|
2182 |
+
.stop(true, true).fadeIn(200, function() {
|
2183 |
+
t.controlsAreVisible = true;
|
2184 |
+
t.container.trigger('controlsshown');
|
2185 |
+
});
|
2186 |
+
|
2187 |
+
// any additional controls people might add and want to hide
|
2188 |
+
t.container.find('.mejs-control')
|
2189 |
+
.css('visibility','visible')
|
2190 |
+
.stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
|
2191 |
+
|
2192 |
+
} else {
|
2193 |
+
t.controls
|
2194 |
+
.css('visibility','visible')
|
2195 |
+
.css('display','block');
|
2196 |
+
|
2197 |
+
// any additional controls people might add and want to hide
|
2198 |
+
t.container.find('.mejs-control')
|
2199 |
+
.css('visibility','visible')
|
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 |
+
.css('visibility','hidden')
|
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 |
+
.css('visibility','hidden')
|
2233 |
+
.css('display','block');
|
2234 |
+
});
|
2235 |
+
} else {
|
2236 |
+
|
2237 |
+
// hide main controls
|
2238 |
+
t.controls
|
2239 |
+
.css('visibility','hidden')
|
2240 |
+
.css('display','block');
|
2241 |
+
|
2242 |
+
// hide others
|
2243 |
+
t.container.find('.mejs-control')
|
2244 |
+
.css('visibility','hidden')
|
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 : 1500;
|
2259 |
+
|
2260 |
+
t.killControlsTimer('start');
|
2261 |
+
|
2262 |
+
t.controlsTimer = setTimeout(function() {
|
2263 |
+
//console.log('timer fired');
|
2264 |
+
t.hideControls();
|
2265 |
+
t.killControlsTimer('hide');
|
2266 |
+
}, timeout);
|
2267 |
+
},
|
2268 |
+
|
2269 |
+
killControlsTimer: function(src) {
|
2270 |
+
|
2271 |
+
var t = this;
|
2272 |
+
|
2273 |
+
if (t.controlsTimer !== null) {
|
2274 |
+
clearTimeout(t.controlsTimer);
|
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 |
+
var t = this,
|
2304 |
+
mf = mejs.MediaFeatures,
|
2305 |
+
autoplayAttr = domNode.getAttribute('autoplay'),
|
2306 |
+
autoplay = !(typeof autoplayAttr == 'undefined' || autoplayAttr === null || autoplayAttr === 'false'),
|
2307 |
+
featureIndex,
|
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);
|
2324 |
+
t.buildoverlays(t, t.controls, t.layers, t.media);
|
2325 |
+
|
2326 |
+
// grab for use by features
|
2327 |
+
t.findTracks();
|
2328 |
+
|
2329 |
+
// add user-defined features/controls
|
2330 |
+
for (featureIndex in t.options.features) {
|
2331 |
+
feature = t.options.features[featureIndex];
|
2332 |
+
if (t['build' + feature]) {
|
2333 |
+
try {
|
2334 |
+
t['build' + feature](t, t.controls, t.layers, t.media);
|
2335 |
+
} catch (e) {
|
2336 |
+
// TODO: report control error
|
2337 |
+
//throw e;
|
2338 |
+
//console.log('error building ' + feature);
|
2339 |
+
//console.log(e);
|
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);
|
2365 |
+
} else {
|
2366 |
+
if (t.controlsEnabled) {
|
2367 |
+
t.showControls(false);
|
2368 |
+
}
|
2369 |
+
}
|
2370 |
+
});
|
2371 |
+
|
2372 |
+
} else {
|
2373 |
+
// click to play/pause
|
2374 |
+
t.media.addEventListener('click', function() {
|
2375 |
+
if (t.options.clickToPlayPause) {
|
2376 |
+
if (t.media.paused) {
|
2377 |
+
t.media.play();
|
2378 |
+
} else {
|
2379 |
+
t.media.pause();
|
2380 |
+
}
|
2381 |
+
}
|
2382 |
+
});
|
2383 |
+
|
2384 |
+
// show/hide controls
|
2385 |
+
t.container
|
2386 |
+
.bind('mouseenter mouseover', function () {
|
2387 |
+
if (t.controlsEnabled) {
|
2388 |
+
if (!t.options.alwaysShowControls) {
|
2389 |
+
t.killControlsTimer('enter');
|
2390 |
+
t.showControls();
|
2391 |
+
t.startControlsTimer(2500);
|
2392 |
+
}
|
2393 |
+
}
|
2394 |
+
})
|
2395 |
+
.bind('mousemove', function() {
|
2396 |
+
if (t.controlsEnabled) {
|
2397 |
+
if (!t.controlsAreVisible) {
|
2398 |
+
t.showControls();
|
2399 |
+
}
|
2400 |
+
//t.killControlsTimer('move');
|
2401 |
+
if (!t.options.alwaysShowControls) {
|
2402 |
+
t.startControlsTimer(2500);
|
2403 |
+
}
|
2404 |
+
}
|
2405 |
+
})
|
2406 |
+
.bind('mouseleave', function () {
|
2407 |
+
if (t.controlsEnabled) {
|
2408 |
+
if (!t.media.paused && !t.options.alwaysShowControls) {
|
2409 |
+
t.startControlsTimer(1000);
|
2410 |
+
}
|
2411 |
+
}
|
2412 |
+
});
|
2413 |
+
}
|
2414 |
+
|
2415 |
+
// check for autoplay
|
2416 |
+
if (autoplay && !t.options.alwaysShowControls) {
|
2417 |
+
t.hideControls();
|
2418 |
+
}
|
2419 |
+
|
2420 |
+
// resizer
|
2421 |
+
if (t.options.enableAutosize) {
|
2422 |
+
t.media.addEventListener('loadedmetadata', function(e) {
|
2423 |
+
// if the <video height> was not set and the options.videoHeight was not set
|
2424 |
+
// then resize to the real dimensions
|
2425 |
+
if (t.options.videoHeight <= 0 && t.domNode.getAttribute('height') === null && !isNaN(e.target.videoHeight)) {
|
2426 |
+
t.setPlayerSize(e.target.videoWidth, e.target.videoHeight);
|
2427 |
+
t.setControlsSize();
|
2428 |
+
t.media.setVideoSize(e.target.videoWidth, e.target.videoHeight);
|
2429 |
+
}
|
2430 |
+
}, false);
|
2431 |
+
}
|
2432 |
+
}
|
2433 |
+
|
2434 |
+
// EVENTS
|
2435 |
+
|
2436 |
+
// FOCUS: when a video starts playing, it takes focus from other players (possibily pausing them)
|
2437 |
+
media.addEventListener('play', function() {
|
2438 |
+
|
2439 |
+
// go through all other players
|
2440 |
+
for (var i=0, il=mejs.players.length; i<il; i++) {
|
2441 |
+
var p = mejs.players[i];
|
2442 |
+
if (p.id != t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended) {
|
2443 |
+
p.pause();
|
2444 |
+
}
|
2445 |
+
p.hasFocus = false;
|
2446 |
+
}
|
2447 |
+
|
2448 |
+
t.hasFocus = true;
|
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.pause();
|
2462 |
+
|
2463 |
+
if (t.setProgressRail)
|
2464 |
+
t.setProgressRail();
|
2465 |
+
if (t.setCurrentRail)
|
2466 |
+
t.setCurrentRail();
|
2467 |
+
|
2468 |
+
if (t.options.loop) {
|
2469 |
+
t.media.play();
|
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(e) {
|
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 |
+
$(window).resize(function() {
|
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 |
+
// TEMP: needs to be moved somewhere else
|
2510 |
+
if (t.media.pluginType == 'youtube') {
|
2511 |
+
t.container.find('.mejs-overlay-play').hide();
|
2512 |
+
}
|
2513 |
+
}
|
2514 |
+
|
2515 |
+
// force autoplay for HTML5
|
2516 |
+
if (autoplay && media.pluginType == 'native') {
|
2517 |
+
media.load();
|
2518 |
+
media.play();
|
2519 |
+
}
|
2520 |
+
|
2521 |
+
|
2522 |
+
if (t.options.success) {
|
2523 |
+
|
2524 |
+
if (typeof t.options.success == 'string') {
|
2525 |
+
window[t.options.success](t.media, t.domNode, t);
|
2526 |
+
} else {
|
2527 |
+
t.options.success(t.media, t.domNode, t);
|
2528 |
+
}
|
2529 |
+
}
|
2530 |
+
},
|
2531 |
+
|
2532 |
+
handleError: function(e) {
|
2533 |
+
var t = this;
|
2534 |
+
|
2535 |
+
t.controls.hide();
|
2536 |
+
|
2537 |
+
// Tell user that the file cannot be played
|
2538 |
+
if (t.options.error) {
|
2539 |
+
t.options.error(e);
|
2540 |
+
}
|
2541 |
+
},
|
2542 |
+
|
2543 |
+
setPlayerSize: function(width,height) {
|
2544 |
+
var t = this;
|
2545 |
+
|
2546 |
+
if (typeof width != 'undefined')
|
2547 |
+
t.width = width;
|
2548 |
+
|
2549 |
+
if (typeof height != 'undefined')
|
2550 |
+
t.height = height;
|
2551 |
+
|
2552 |
+
// detect 100% mode - use currentStyle for IE since css() doesn't return percentages
|
2553 |
+
if (t.height.toString().indexOf('%') > 0 || t.$node.css('max-width') === '100%' || (t.$node[0].currentStyle && t.$node[0].currentStyle.maxWidth === '100%')) {
|
2554 |
+
|
2555 |
+
// do we have the native dimensions yet?
|
2556 |
+
var
|
2557 |
+
nativeWidth = t.isVideo ? ((t.media.videoWidth && t.media.videoWidth > 0) ? t.media.videoWidth : t.options.defaultVideoWidth) : t.options.defaultAudioWidth,
|
2558 |
+
nativeHeight = t.isVideo ? ((t.media.videoHeight && t.media.videoHeight > 0) ? t.media.videoHeight : t.options.defaultVideoHeight) : t.options.defaultAudioHeight,
|
2559 |
+
parentWidth = t.container.parent().closest(':visible').width(),
|
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 |
+
if (t.media.setVideoSize) {
|
2586 |
+
t.media.setVideoSize(parentWidth, newHeight);
|
2587 |
+
}
|
2588 |
+
}
|
2589 |
+
|
2590 |
+
// set the layers
|
2591 |
+
t.layers.children('.mejs-layer')
|
2592 |
+
.width('100%')
|
2593 |
+
.height('100%');
|
2594 |
+
}
|
2595 |
+
|
2596 |
+
|
2597 |
+
} else {
|
2598 |
+
|
2599 |
+
t.container
|
2600 |
+
.width(t.width)
|
2601 |
+
.height(t.height);
|
2602 |
+
|
2603 |
+
t.layers.children('.mejs-layer')
|
2604 |
+
.width(t.width)
|
2605 |
+
.height(t.height);
|
2606 |
+
|
2607 |
+
}
|
2608 |
+
},
|
2609 |
+
|
2610 |
+
setControlsSize: function() {
|
2611 |
+
var t = this,
|
2612 |
+
usedWidth = 0,
|
2613 |
+
railWidth = 0,
|
2614 |
+
rail = t.controls.find('.mejs-time-rail'),
|
2615 |
+
total = t.controls.find('.mejs-time-total'),
|
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 |
+
// attempt to autosize
|
2629 |
+
if (railWidth === 0 || !railWidth) {
|
2630 |
+
|
2631 |
+
// find the size of all the other controls besides the rail
|
2632 |
+
others.each(function() {
|
2633 |
+
if ($(this).css('position') != 'absolute') {
|
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 |
+
// outer area
|
2643 |
+
rail.width(railWidth);
|
2644 |
+
// dark space
|
2645 |
+
total.width(railWidth - (total.outerWidth(true) - total.width()));
|
2646 |
+
|
2647 |
+
if (t.setProgressRail)
|
2648 |
+
t.setProgressRail();
|
2649 |
+
if (t.setCurrentRail)
|
2650 |
+
t.setCurrentRail();
|
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),
|
2660 |
+
posterUrl = player.$media.attr('poster');
|
2661 |
+
|
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 (posterUrl !== '' && posterUrl != null) {
|
2669 |
+
t.setPoster(posterUrl);
|
2670 |
+
} else {
|
2671 |
+
poster.hide();
|
2672 |
+
}
|
2673 |
+
|
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 == 0) {
|
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 |
+
var t = this;
|
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(function() {
|
2716 |
+
if (t.options.clickToPlayPause) {
|
2717 |
+
if (media.paused) {
|
2718 |
+
media.play();
|
2719 |
+
} else {
|
2720 |
+
media.pause();
|
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() {
|
2735 |
+
bigPlay.hide();
|
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() {
|
2749 |
+
loading.show();
|
2750 |
+
controls.find('.mejs-time-buffering').show();
|
2751 |
+
}, false);
|
2752 |
+
|
2753 |
+
media.addEventListener('seeked', function() {
|
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 |
+
}, false);
|
2779 |
+
media.addEventListener('canplay',function() {
|
2780 |
+
loading.hide();
|
2781 |
+
controls.find('.mejs-time-buffering').hide();
|
2782 |
+
}, false);
|
2783 |
+
|
2784 |
+
// error handling
|
2785 |
+
media.addEventListener('error',function() {
|
2786 |
+
loading.hide();
|
2787 |
+
controls.find('.mejs-time-buffering').hide();
|
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 |
+
$(document).keydown(function(e) {
|
2799 |
+
|
2800 |
+
if (player.hasFocus && player.options.enableKeyboard) {
|
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 |
+
$(document).click(function(event) {
|
2821 |
+
if ($(event.target).closest('.mejs-container').length == 0) {
|
2822 |
+
player.hasFocus = false;
|
2823 |
+
}
|
2824 |
+
});
|
2825 |
+
|
2826 |
+
},
|
2827 |
+
|
2828 |
+
findTracks: function() {
|
2829 |
+
var t = this,
|
2830 |
+
tracktags = t.$media.find('track');
|
2831 |
+
|
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') || '',
|
2843 |
+
entries: [],
|
2844 |
+
isLoaded: false
|
2845 |
+
});
|
2846 |
+
});
|
2847 |
+
},
|
2848 |
+
changeSkin: function(className) {
|
2849 |
+
this.container[0].className = 'mejs-container ' + className;
|
2850 |
+
this.setPlayerSize(this.width, this.height);
|
2851 |
+
this.setControlsSize();
|
2852 |
+
},
|
2853 |
+
play: function() {
|
2854 |
+
this.media.play();
|
2855 |
+
},
|
2856 |
+
pause: function() {
|
2857 |
+
this.media.pause();
|
2858 |
+
},
|
2859 |
+
load: function() {
|
2860 |
+
this.media.load();
|
2861 |
+
},
|
2862 |
+
setMuted: function(muted) {
|
2863 |
+
this.media.setMuted(muted);
|
2864 |
+
},
|
2865 |
+
setCurrentTime: function(time) {
|
2866 |
+
this.media.setCurrentTime(time);
|
2867 |
+
},
|
2868 |
+
getCurrentTime: function() {
|
2869 |
+
return this.media.currentTime;
|
2870 |
+
},
|
2871 |
+
setVolume: function(volume) {
|
2872 |
+
this.media.setVolume(volume);
|
2873 |
+
},
|
2874 |
+
getVolume: function() {
|
2875 |
+
return this.media.volume;
|
2876 |
+
},
|
2877 |
+
setSrc: function(src) {
|
2878 |
+
this.media.setSrc(src);
|
2879 |
+
},
|
2880 |
+
remove: function() {
|
2881 |
+
var t = this;
|
2882 |
+
|
2883 |
+
if (t.media.pluginType === 'flash') {
|
2884 |
+
t.media.remove();
|
2885 |
+
} else if (t.media.pluginType === 'native') {
|
2886 |
+
t.$media.prop('controls', true);
|
2887 |
+
}
|
2888 |
+
|
2889 |
+
// grab video and put it back in place
|
2890 |
+
if (!t.isDynamic) {
|
2891 |
+
t.$node.insertBefore(t.container)
|
2892 |
+
}
|
2893 |
+
|
2894 |
+
t.container.remove();
|
2895 |
+
}
|
2896 |
+
};
|
2897 |
+
|
2898 |
+
// turn into jQuery plugin
|
2899 |
+
if (typeof jQuery != 'undefined') {
|
2900 |
+
jQuery.fn.mediaelementplayer = function (options) {
|
2901 |
+
return this.each(function () {
|
2902 |
+
new mejs.MediaElementPlayer(this, options);
|
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 |
+
|
2915 |
+
})(mejs.$);
|
2916 |
+
|
2917 |
+
(function($) {
|
2918 |
+
|
2919 |
+
$.extend(mejs.MepDefaults, {
|
2920 |
+
playpauseText: 'Play/Pause'
|
2921 |
+
});
|
2922 |
+
|
2923 |
+
// PLAY/pause BUTTON
|
2924 |
+
$.extend(MediaElementPlayer.prototype, {
|
2925 |
+
buildplaypause: function(player, controls, layers, media) {
|
2926 |
+
var
|
2927 |
+
t = this,
|
2928 |
+
play =
|
2929 |
+
$('<div class="mejs-button mejs-playpause-button mejs-play" >' +
|
2930 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.playpauseText + '"></button>' +
|
2931 |
+
'</div>')
|
2932 |
+
.appendTo(controls)
|
2933 |
+
.click(function(e) {
|
2934 |
+
e.preventDefault();
|
2935 |
+
|
2936 |
+
if (media.paused) {
|
2937 |
+
media.play();
|
2938 |
+
} else {
|
2939 |
+
media.pause();
|
2940 |
+
}
|
2941 |
+
|
2942 |
+
return false;
|
2943 |
+
});
|
2944 |
+
|
2945 |
+
media.addEventListener('play',function() {
|
2946 |
+
play.removeClass('mejs-play').addClass('mejs-pause');
|
2947 |
+
}, false);
|
2948 |
+
media.addEventListener('playing',function() {
|
2949 |
+
play.removeClass('mejs-play').addClass('mejs-pause');
|
2950 |
+
}, false);
|
2951 |
+
|
2952 |
+
|
2953 |
+
media.addEventListener('pause',function() {
|
2954 |
+
play.removeClass('mejs-pause').addClass('mejs-play');
|
2955 |
+
}, false);
|
2956 |
+
media.addEventListener('paused',function() {
|
2957 |
+
play.removeClass('mejs-pause').addClass('mejs-play');
|
2958 |
+
}, false);
|
2959 |
+
}
|
2960 |
+
});
|
2961 |
+
|
2962 |
+
})(mejs.$);
|
2963 |
+
(function($) {
|
2964 |
+
|
2965 |
+
$.extend(mejs.MepDefaults, {
|
2966 |
+
stopText: 'Stop'
|
2967 |
+
});
|
2968 |
+
|
2969 |
+
// STOP BUTTON
|
2970 |
+
$.extend(MediaElementPlayer.prototype, {
|
2971 |
+
buildstop: function(player, controls, layers, media) {
|
2972 |
+
var t = this,
|
2973 |
+
stop =
|
2974 |
+
$('<div class="mejs-button mejs-stop-button mejs-stop">' +
|
2975 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.stopText + '"></button>' +
|
2976 |
+
'</div>')
|
2977 |
+
.appendTo(controls)
|
2978 |
+
.click(function() {
|
2979 |
+
if (!media.paused) {
|
2980 |
+
media.pause();
|
2981 |
+
}
|
2982 |
+
if (media.currentTime > 0) {
|
2983 |
+
media.setCurrentTime(0);
|
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 |
+
});
|
2992 |
+
}
|
2993 |
+
});
|
2994 |
+
|
2995 |
+
})(mejs.$);
|
2996 |
+
(function($) {
|
2997 |
+
// progress/loaded bar
|
2998 |
+
$.extend(MediaElementPlayer.prototype, {
|
2999 |
+
buildprogress: function(player, controls, layers, media) {
|
3000 |
+
|
3001 |
+
$('<div class="mejs-time-rail">'+
|
3002 |
+
'<span class="mejs-time-total">'+
|
3003 |
+
'<span class="mejs-time-buffering"></span>'+
|
3004 |
+
'<span class="mejs-time-loaded"></span>'+
|
3005 |
+
'<span class="mejs-time-current"></span>'+
|
3006 |
+
'<span class="mejs-time-handle"></span>'+
|
3007 |
+
'<span class="mejs-time-float">' +
|
3008 |
+
'<span class="mejs-time-float-current">00:00</span>' +
|
3009 |
+
'<span class="mejs-time-float-corner"></span>' +
|
3010 |
+
'</span>'+
|
3011 |
+
'</span>'+
|
3012 |
+
'</div>')
|
3013 |
+
.appendTo(controls);
|
3014 |
+
controls.find('.mejs-time-buffering').hide();
|
3015 |
+
|
3016 |
+
var
|
3017 |
+
t = this,
|
3018 |
+
total = controls.find('.mejs-time-total'),
|
3019 |
+
loaded = controls.find('.mejs-time-loaded'),
|
3020 |
+
current = controls.find('.mejs-time-current'),
|
3021 |
+
handle = controls.find('.mejs-time-handle'),
|
3022 |
+
timefloat = controls.find('.mejs-time-float'),
|
3023 |
+
timefloatcurrent = controls.find('.mejs-time-float-current'),
|
3024 |
+
handleMouseMove = function (e) {
|
3025 |
+
// mouse position relative to the object
|
3026 |
+
var x = e.pageX,
|
3027 |
+
offset = total.offset(),
|
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) {
|
3036 |
+
x = offset.left;
|
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;
|
3044 |
+
|
3045 |
+
// seek to where the mouse is
|
3046 |
+
if (mouseIsDown && newTime !== media.currentTime) {
|
3047 |
+
media.setCurrentTime(newTime);
|
3048 |
+
}
|
3049 |
+
|
3050 |
+
// position floating time box
|
3051 |
+
if (!mejs.MediaFeatures.hasTouch) {
|
3052 |
+
timefloat.css('left', pos);
|
3053 |
+
timefloatcurrent.html( mejs.Utility.secondsToTimeCode(newTime) );
|
3054 |
+
timefloat.show();
|
3055 |
+
}
|
3056 |
+
}
|
3057 |
+
},
|
3058 |
+
mouseIsDown = false,
|
3059 |
+
mouseIsOver = false;
|
3060 |
+
|
3061 |
+
// handle clicks
|
3062 |
//controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
|
3063 |
total
|
3064 |
.bind('mousedown', function (e) {
|
3167 |
}
|
3168 |
});
|
3169 |
})(mejs.$);
|
3170 |
+
|
3171 |
+
(function($) {
|
3172 |
+
|
3173 |
+
// options
|
3174 |
+
$.extend(mejs.MepDefaults, {
|
3175 |
+
duration: -1,
|
3176 |
+
timeAndDurationSeparator: ' <span> | </span> '
|
3177 |
+
});
|
3178 |
+
|
3179 |
+
|
3180 |
+
// current and duration 00:00 / 00:00
|
3181 |
+
$.extend(MediaElementPlayer.prototype, {
|
3182 |
+
buildcurrent: function(player, controls, layers, media) {
|
3183 |
+
var t = this;
|
3184 |
+
|
3185 |
+
$('<div class="mejs-time">'+
|
3186 |
+
'<span class="mejs-currenttime">' + (player.options.alwaysShowHours ? '00:' : '')
|
3187 |
+
+ (player.options.showTimecodeFrameCount? '00:00:00':'00:00')+ '</span>'+
|
3188 |
+
'</div>')
|
3189 |
+
.appendTo(controls);
|
3190 |
+
|
3191 |
+
t.currenttime = t.controls.find('.mejs-currenttime');
|
3192 |
+
|
3193 |
+
media.addEventListener('timeupdate',function() {
|
3194 |
+
player.updateCurrent();
|
3195 |
+
}, false);
|
3196 |
+
},
|
3197 |
+
|
3198 |
+
|
3199 |
+
buildduration: function(player, controls, layers, media) {
|
3200 |
+
var t = this;
|
3201 |
+
|
3202 |
+
if (controls.children().last().find('.mejs-currenttime').length > 0) {
|
3203 |
+
$(t.options.timeAndDurationSeparator +
|
3204 |
+
'<span class="mejs-duration">' +
|
3205 |
+
(t.options.duration > 0 ?
|
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 {
|
3212 |
+
|
3213 |
+
// add class to current time
|
3214 |
+
controls.find('.mejs-currenttime').parent().addClass('mejs-currenttime-container');
|
3215 |
+
|
3216 |
+
$('<div class="mejs-time mejs-duration-container">'+
|
3217 |
+
'<span class="mejs-duration">' +
|
3218 |
+
(t.options.duration > 0 ?
|
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);
|
3225 |
+
}
|
3226 |
+
|
3227 |
+
t.durationD = t.controls.find('.mejs-duration');
|
3228 |
+
|
3229 |
+
media.addEventListener('timeupdate',function() {
|
3230 |
+
player.updateDuration();
|
3231 |
+
}, false);
|
3232 |
+
},
|
3233 |
+
|
3234 |
+
updateCurrent: function() {
|
3235 |
+
var t = this;
|
3236 |
+
|
3237 |
+
if (t.currenttime) {
|
3238 |
+
t.currenttime.html(mejs.Utility.secondsToTimeCode(t.media.currentTime, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25));
|
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", t.media.duration > 3600);
|
3247 |
+
|
3248 |
+
if (t.media.duration && t.durationD) {
|
3249 |
+
t.durationD.html(mejs.Utility.secondsToTimeCode(t.media.duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25));
|
3250 |
+
}
|
3251 |
+
}
|
3252 |
+
});
|
3253 |
+
|
3254 |
})(mejs.$);
|
3255 |
(function($) {
|
3256 |
|
3302 |
|
3303 |
positionVolumeHandle = function(volume, secondTry) {
|
3304 |
|
3305 |
+
if (!volumeSlider.is(':visible') && typeof secondTry == 'undefined') {
|
3306 |
volumeSlider.show();
|
3307 |
positionVolumeHandle(volume, true);
|
3308 |
volumeSlider.hide()
|
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 );
|
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) {
|
3432 |
mouseIsDown = false;
|
3433 |
$(document).unbind('.vol');
|
3434 |
|
3435 |
+
if (!mouseIsOver && mode == 'vertical') {
|
3436 |
+
volumeSlider.hide();
|
3437 |
+
}
|
3438 |
+
});
|
3439 |
+
mouseIsDown = true;
|
3440 |
+
|
3441 |
+
return false;
|
3442 |
+
});
|
3443 |
+
|
3444 |
+
|
3445 |
+
// MUTE button
|
3446 |
+
mute.find('button').click(function() {
|
3447 |
+
media.setMuted( !media.muted );
|
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);
|
3455 |
+
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
3456 |
+
} else {
|
3457 |
+
positionVolumeHandle(media.volume);
|
3458 |
+
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
3459 |
+
}
|
3460 |
+
}
|
3461 |
+
}, false);
|
3462 |
+
|
3463 |
+
if (t.container.is(':visible')) {
|
3464 |
+
// set initial volume
|
3465 |
+
positionVolumeHandle(player.options.startVolume);
|
3466 |
+
|
3467 |
+
// shim gets the startvolume as a parameter, but we have to set it on the native <video> and <audio> elements
|
3468 |
+
if (media.pluginType === 'native') {
|
3469 |
+
media.setVolume(player.options.startVolume);
|
3470 |
+
}
|
3471 |
+
}
|
3472 |
+
}
|
3473 |
+
});
|
3474 |
+
|
3475 |
+
})(mejs.$);
|
3476 |
+
|
3477 |
+
(function($) {
|
3478 |
+
|
3479 |
+
$.extend(mejs.MepDefaults, {
|
3480 |
+
usePluginFullScreen: true,
|
3481 |
+
newWindowCallback: function() { return '';},
|
3482 |
+
fullscreenText: mejs.i18n.t('Fullscreen')
|
3483 |
+
});
|
3484 |
+
|
3485 |
+
$.extend(MediaElementPlayer.prototype, {
|
3486 |
+
|
3487 |
+
isFullScreen: false,
|
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 |
+
// native events
|
3503 |
+
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3504 |
+
|
3505 |
+
// chrome doesn't alays fire this in an iframe
|
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 |
+
normalHeight = 0,
|
3531 |
+
normalWidth = 0,
|
3532 |
+
container = player.container,
|
3533 |
+
fullscreenBtn =
|
3534 |
+
$('<div class="mejs-button mejs-fullscreen-button">' +
|
3535 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.fullscreenText + '"></button>' +
|
3536 |
+
'</div>')
|
3537 |
+
.appendTo(controls);
|
3538 |
+
|
3539 |
+
if (t.media.pluginType === 'native' || (!t.options.usePluginFullScreen && !mejs.MediaFeatures.isFirefox)) {
|
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 |
+
} else {
|
3552 |
+
|
3553 |
+
var hideTimeout = null,
|
3554 |
+
supportsPointerEvents = (function() {
|
3555 |
+
// TAKEN FROM MODERNIZR
|
3556 |
+
var element = document.createElement('x'),
|
3557 |
+
documentElement = document.documentElement,
|
3558 |
+
getComputedStyle = window.getComputedStyle,
|
3559 |
+
supports;
|
3560 |
+
if(!('pointerEvents' in element.style)){
|
3561 |
+
return false;
|
3562 |
+
}
|
3563 |
+
element.style.pointerEvents = 'auto';
|
3564 |
+
element.style.pointerEvents = 'x';
|
3565 |
+
documentElement.appendChild(element);
|
3566 |
+
supports = getComputedStyle &&
|
3567 |
+
getComputedStyle(element, '').pointerEvents === 'auto';
|
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 |
+
$(document).resize(function() {
|
3633 |
+
positionHoverDivs();
|
3634 |
+
});
|
3635 |
+
|
3636 |
+
// on hover, kill the fullscreen button's HTML handling, allowing clicks down to Flash
|
3637 |
+
fullscreenBtn
|
3638 |
+
.mouseover(function() {
|
3639 |
+
|
3640 |
+
if (!t.isFullScreen) {
|
3641 |
+
|
3642 |
+
var buttonPos = fullscreenBtn.offset(),
|
3643 |
+
containerPos = player.container.offset();
|
3644 |
+
|
3645 |
+
// move the button in Flash into place
|
3646 |
+
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, false);
|
3647 |
+
|
3648 |
+
// allows click through
|
3649 |
+
fullscreenBtn.css('pointer-events', 'none');
|
3650 |
+
t.controls.css('pointer-events', 'none');
|
3651 |
+
|
3652 |
+
// show the divs that will restore things
|
3653 |
+
videoHoverDiv.show();
|
3654 |
+
controlsRightHoverDiv.show();
|
3655 |
+
controlsLeftHoverDiv.show();
|
3656 |
+
positionHoverDivs();
|
3657 |
+
|
3658 |
+
fullscreenIsDisabled = true;
|
3659 |
+
}
|
3660 |
+
|
3661 |
+
});
|
3662 |
+
|
3663 |
+
// restore controls anytime the user enters or leaves fullscreen
|
3664 |
+
media.addEventListener('fullscreenchange', function(e) {
|
3665 |
+
restoreControls();
|
3666 |
+
});
|
3667 |
+
|
3668 |
+
|
3669 |
+
// the mouseout event doesn't work on the fullscren button, because we already killed the pointer-events
|
3670 |
+
// so we use the document.mousemove event to restore controls when the mouse moves outside the fullscreen button
|
3671 |
+
/*
|
3672 |
+
$(document).mousemove(function(e) {
|
3673 |
+
|
3674 |
+
// if the mouse is anywhere but the fullsceen button, then restore it all
|
3675 |
+
if (fullscreenIsDisabled) {
|
3676 |
+
|
3677 |
+
var fullscreenBtnPos = fullscreenBtn.offset();
|
3678 |
+
|
3679 |
+
|
3680 |
+
if (e.pageY < fullscreenBtnPos.top || e.pageY > fullscreenBtnPos.top + fullscreenBtn.outerHeight(true) ||
|
3681 |
+
e.pageX < fullscreenBtnPos.left || e.pageX > fullscreenBtnPos.left + fullscreenBtn.outerWidth(true)
|
3682 |
+
) {
|
3683 |
+
|
3684 |
+
fullscreenBtn.css('pointer-events', '');
|
3685 |
+
t.controls.css('pointer-events', '');
|
3686 |
+
|
3687 |
+
fullscreenIsDisabled = false;
|
3688 |
+
}
|
3689 |
}
|
3690 |
});
|
3691 |
+
*/
|
|
|
|
|
|
|
3692 |
|
3693 |
|
3694 |
+
} else {
|
3695 |
+
|
3696 |
+
// the hover state will show the fullscreen button in Flash to hover up and click
|
3697 |
+
|
3698 |
+
fullscreenBtn
|
3699 |
+
.mouseover(function() {
|
3700 |
+
|
3701 |
+
if (hideTimeout !== null) {
|
3702 |
+
clearTimeout(hideTimeout);
|
3703 |
+
delete hideTimeout;
|
3704 |
+
}
|
3705 |
+
|
3706 |
+
var buttonPos = fullscreenBtn.offset(),
|
3707 |
+
containerPos = player.container.offset();
|
3708 |
+
|
3709 |
+
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, true);
|
3710 |
+
|
3711 |
+
})
|
3712 |
+
.mouseout(function() {
|
3713 |
+
|
3714 |
+
if (hideTimeout !== null) {
|
3715 |
+
clearTimeout(hideTimeout);
|
3716 |
+
delete hideTimeout;
|
3717 |
+
}
|
3718 |
+
|
3719 |
+
hideTimeout = setTimeout(function() {
|
3720 |
+
media.hideFullscreenButton();
|
3721 |
+
}, 1500);
|
3722 |
+
|
3723 |
+
|
3724 |
+
});
|
3725 |
+
}
|
3726 |
+
}
|
3727 |
+
|
3728 |
+
player.fullscreenBtn = fullscreenBtn;
|
3729 |
+
|
3730 |
+
$(document).bind('keydown',function (e) {
|
3731 |
+
if (((mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || t.isFullScreen) && e.keyCode == 27) {
|
3732 |
+
player.exitFullScreen();
|
3733 |
+
}
|
3734 |
});
|
3735 |
|
3736 |
+
},
|
3737 |
+
enterFullScreen: function() {
|
3738 |
+
|
3739 |
+
var t = this;
|
3740 |
+
|
3741 |
+
// firefox+flash can't adjust plugin sizes without resetting :(
|
3742 |
+
if (t.media.pluginType !== 'native' && (mejs.MediaFeatures.isFirefox || t.options.usePluginFullScreen)) {
|
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 |
+
document.documentElement.style.overflow = 'hidden';
|
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 |
+
} else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
|
3786 |
+
t.media.webkitEnterFullscreen();
|
3787 |
+
return;
|
3788 |
}
|
3789 |
+
}
|
3790 |
|
3791 |
+
// check for iframe launch
|
3792 |
+
if (t.isInIframe) {
|
3793 |
+
var url = t.options.newWindowCallback(this);
|
3794 |
+
|
3795 |
+
|
3796 |
+
if (url !== '') {
|
3797 |
+
|
3798 |
+
// launch immediately
|
3799 |
+
if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3800 |
+
t.pause();
|
3801 |
+
window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
|
3802 |
+
return;
|
3803 |
+
} else {
|
3804 |
+
setTimeout(function() {
|
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 |
+
}, 250);
|
3810 |
+
}
|
3811 |
}
|
3812 |
+
|
3813 |
+
}
|
3814 |
+
|
3815 |
+
// full window code
|
3816 |
+
|
3817 |
+
|
3818 |
+
|
3819 |
+
// make full size
|
3820 |
+
t.container
|
3821 |
+
.addClass('mejs-container-fullscreen')
|
3822 |
+
.width('100%')
|
3823 |
+
.height('100%');
|
3824 |
+
//.css({position: 'fixed', left: 0, top: 0, right: 0, bottom: 0, overflow: 'hidden', width: '100%', height: '100%', 'z-index': 1000});
|
3825 |
+
|
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('object, embed, iframe')
|
3841 |
+
.width('100%')
|
3842 |
+
.height('100%');
|
3843 |
+
|
3844 |
+
//if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
3845 |
+
t.media.setVideoSize($(window).width(),$(window).height());
|
3846 |
+
//}
|
3847 |
+
}
|
3848 |
+
|
3849 |
+
t.layers.children('div')
|
3850 |
+
.width('100%')
|
3851 |
+
.height('100%');
|
3852 |
+
|
3853 |
+
if (t.fullscreenBtn) {
|
3854 |
+
t.fullscreenBtn
|
3855 |
+
.removeClass('mejs-fullscreen')
|
3856 |
+
.addClass('mejs-unfullscreen');
|
3857 |
+
}
|
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 outo of native fullscreen
|
3875 |
+
if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || t.isFullScreen)) {
|
3876 |
+
mejs.MediaFeatures.cancelFullScreen();
|
3877 |
+
}
|
3878 |
+
|
3879 |
+
// restore scroll bars to document
|
3880 |
+
document.documentElement.style.overflow = docStyleOverflow;
|
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('object embed')
|
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')
|
3906 |
+
.addClass('mejs-fullscreen');
|
3907 |
+
|
3908 |
+
t.setControlsSize();
|
3909 |
+
t.isFullScreen = false;
|
3910 |
}
|
3911 |
});
|
|
|
|
|
3912 |
|
3913 |
+
})(mejs.$);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3914 |
|
3915 |
(function($) {
|
3916 |
|
3987 |
if (!player.options.alwaysShowControls) {
|
3988 |
// move with controls
|
3989 |
player.container
|
3990 |
+
.bind('controlsshown', function () {
|
3991 |
// push captions above controls
|
3992 |
player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
|
3993 |
|
3994 |
})
|
3995 |
+
.bind('controlshidden', function () {
|
3996 |
if (!media.paused) {
|
3997 |
// move back to normal place
|
3998 |
player.container.find('.mejs-captions-position').removeClass('mejs-captions-position-hover');
|
4078 |
|
4079 |
};
|
4080 |
|
|
|
4081 |
|
4082 |
+
$.ajax({
|
4083 |
+
url: track.src,
|
4084 |
+
dataType: "text",
|
4085 |
+
success: function(d) {
|
|
|
4086 |
|
4087 |
+
// parse the loaded file
|
4088 |
+
if (typeof d == "string" && (/<tt\s+xml/ig).exec(d)) {
|
4089 |
+
track.entries = mejs.TrackFormatParser.dfxp.parse(d);
|
4090 |
+
} else {
|
4091 |
+
track.entries = mejs.TrackFormatParser.webvvt.parse(d);
|
4092 |
+
}
|
4093 |
+
|
4094 |
after();
|
|
|
|
|
|
|
|
|
|
|
|
|
4095 |
|
4096 |
+
if (track.kind == 'chapters') {
|
4097 |
+
t.media.addEventListener('play', function(e) {
|
4098 |
+
if (t.media.duration > 0) {
|
4099 |
+
t.displayChapters(track);
|
4100 |
+
}
|
4101 |
+
}, false);
|
|
|
|
|
|
|
|
|
4102 |
}
|
4103 |
+
},
|
4104 |
+
error: function() {
|
4105 |
+
t.loadNextTrack();
|
4106 |
+
}
|
4107 |
+
});
|
4108 |
},
|
4109 |
|
4110 |
enableTrackButton: function(lang, label) {
|
4322 |
Adapted from: http://www.delphiki.com/html5/playr
|
4323 |
*/
|
4324 |
mejs.TrackFormatParser = {
|
4325 |
+
webvvt: {
|
4326 |
+
// match start "chapter-" (or anythingelse)
|
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 |
+
// check for the line number
|
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 |
+
if (timecode && i<lines.length){
|
4345 |
+
i++;
|
4346 |
+
// grab all the (possibly multi-line) text that follows
|
4347 |
+
text = lines[i];
|
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 |
}
|
4367 |
+
},
|
4368 |
+
// Thanks to Justin Capella: https://github.com/johndyer/mediaelement/pull/420
|
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 |
+
|
4383 |
+
|
4384 |
+
if (styleNode.length) {
|
4385 |
+
var attributes = styleNode.removeAttr("id").get(0).attributes;
|
4386 |
+
if (attributes.length) {
|
4387 |
+
styles = {};
|
4388 |
+
for (i = 0; i < attributes.length; i++) {
|
4389 |
+
styles[attributes[i].name.split(":")[1]] = attributes[i].value;
|
4390 |
+
}
|
4391 |
+
}
|
4392 |
+
}
|
4393 |
|
4394 |
+
for(i = 0; i<lines.length; i++) {
|
4395 |
+
var style;
|
4396 |
+
var _temp_times = {
|
4397 |
+
start: null,
|
4398 |
+
stop: null,
|
4399 |
+
style: null
|
4400 |
+
};
|
4401 |
+
if (lines.eq(i).attr("begin")) _temp_times.start = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i).attr("begin"));
|
4402 |
+
if (!_temp_times.start && lines.eq(i-1).attr("end")) _temp_times.start = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i-1).attr("end"));
|
4403 |
+
if (lines.eq(i).attr("end")) _temp_times.stop = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i).attr("end"));
|
4404 |
+
if (!_temp_times.stop && lines.eq(i+1).attr("begin")) _temp_times.stop = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i+1).attr("begin"));
|
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 == 0) _temp_times.start = 0.200;
|
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 |
+
}
|
4420 |
+
},
|
4421 |
+
split2: function (text, regex) {
|
4422 |
+
// normal version for compliant browsers
|
4423 |
+
// see below for IE fix
|
4424 |
+
return text.split(regex);
|
4425 |
}
|
4426 |
};
|
4427 |
|
4448 |
|
4449 |
})(mejs.$);
|
4450 |
|
4451 |
+
/*
|
4452 |
+
* ContextMenu Plugin
|
4453 |
+
*
|
4454 |
+
*
|
4455 |
+
*/
|
4456 |
+
|
4457 |
+
(function($) {
|
4458 |
+
|
4459 |
+
$.extend(mejs.MepDefaults,
|
4460 |
+
{ 'contextMenuItems': [
|
4461 |
+
// demo of a fullscreen option
|
4462 |
+
{
|
4463 |
+
render: function(player) {
|
4464 |
+
|
4465 |
+
// check for fullscreen plugin
|
4466 |
+
if (typeof player.enterFullScreen == 'undefined')
|
4467 |
+
return null;
|
4468 |
+
|
4469 |
+
if (player.isFullScreen) {
|
4470 |
+
return "Turn off Fullscreen";
|
4471 |
+
} else {
|
4472 |
+
return "Go Fullscreen";
|
4473 |
+
}
|
4474 |
+
},
|
4475 |
+
click: function(player) {
|
4476 |
+
if (player.isFullScreen) {
|
4477 |
+
player.exitFullScreen();
|
4478 |
+
} else {
|
4479 |
+
player.enterFullScreen();
|
4480 |
+
}
|
4481 |
+
}
|
4482 |
+
}
|
4483 |
+
,
|
4484 |
+
// demo of a mute/unmute button
|
4485 |
+
{
|
4486 |
+
render: function(player) {
|
4487 |
+
if (player.media.muted) {
|
4488 |
+
return "Unmute";
|
4489 |
+
} else {
|
4490 |
+
return "Mute";
|
4491 |
+
}
|
4492 |
+
},
|
4493 |
+
click: function(player) {
|
4494 |
+
if (player.media.muted) {
|
4495 |
+
player.setMuted(false);
|
4496 |
+
} else {
|
4497 |
+
player.setMuted(true);
|
4498 |
+
}
|
4499 |
+
}
|
4500 |
+
},
|
4501 |
+
// separator
|
4502 |
+
{
|
4503 |
+
isSeparator: true
|
4504 |
+
}
|
4505 |
+
,
|
4506 |
+
// demo of simple download video
|
4507 |
+
{
|
4508 |
+
render: function(player) {
|
4509 |
+
return "Download Video";
|
4510 |
+
},
|
4511 |
+
click: function(player) {
|
4512 |
+
window.location.href = player.media.currentSrc;
|
4513 |
+
}
|
4514 |
+
}
|
4515 |
+
]}
|
4516 |
+
);
|
4517 |
+
|
4518 |
+
|
4519 |
+
$.extend(MediaElementPlayer.prototype, {
|
4520 |
+
buildcontextmenu: function(player, controls, layers, media) {
|
4521 |
+
|
4522 |
+
// create context menu
|
4523 |
+
player.contextMenu = $('<div class="mejs-contextmenu"></div>')
|
4524 |
+
.appendTo($('body'))
|
4525 |
+
.hide();
|
4526 |
+
|
4527 |
+
// create events for showing context menu
|
4528 |
+
player.container.bind('contextmenu', function(e) {
|
4529 |
+
if (player.isContextMenuEnabled) {
|
4530 |
+
e.preventDefault();
|
4531 |
+
player.renderContextMenu(e.clientX-1, e.clientY-1);
|
4532 |
+
return false;
|
4533 |
+
}
|
4534 |
+
});
|
4535 |
+
player.container.bind('click', function() {
|
4536 |
+
player.contextMenu.hide();
|
4537 |
+
});
|
4538 |
+
player.contextMenu.bind('mouseleave', function() {
|
4539 |
+
|
4540 |
+
//console.log('context hover out');
|
4541 |
+
player.startContextMenuTimer();
|
4542 |
+
|
4543 |
+
});
|
4544 |
+
},
|
4545 |
+
|
4546 |
+
isContextMenuEnabled: true,
|
4547 |
+
enableContextMenu: function() {
|
4548 |
+
this.isContextMenuEnabled = true;
|
4549 |
+
},
|
4550 |
+
disableContextMenu: function() {
|
4551 |
+
this.isContextMenuEnabled = false;
|
4552 |
+
},
|
4553 |
+
|
4554 |
+
contextMenuTimeout: null,
|
4555 |
+
startContextMenuTimer: function() {
|
4556 |
+
//console.log('startContextMenuTimer');
|
4557 |
+
|
4558 |
+
var t = this;
|
4559 |
+
|
4560 |
+
t.killContextMenuTimer();
|
4561 |
+
|
4562 |
+
t.contextMenuTimer = setTimeout(function() {
|
4563 |
+
t.hideContextMenu();
|
4564 |
+
t.killContextMenuTimer();
|
4565 |
+
}, 750);
|
4566 |
+
},
|
4567 |
+
killContextMenuTimer: function() {
|
4568 |
+
var timer = this.contextMenuTimer;
|
4569 |
+
|
4570 |
+
//console.log('killContextMenuTimer', timer);
|
4571 |
+
|
4572 |
+
if (timer != null) {
|
4573 |
+
clearTimeout(timer);
|
4574 |
+
delete timer;
|
4575 |
+
timer = null;
|
4576 |
+
}
|
4577 |
+
},
|
4578 |
+
|
4579 |
+
hideContextMenu: function() {
|
4580 |
+
this.contextMenu.hide();
|
4581 |
+
},
|
4582 |
+
|
4583 |
+
renderContextMenu: function(x,y) {
|
4584 |
+
|
4585 |
+
// alway re-render the items so that things like "turn fullscreen on" and "turn fullscreen off" are always written correctly
|
4586 |
+
var t = this,
|
4587 |
+
html = '',
|
4588 |
+
items = t.options.contextMenuItems;
|
4589 |
+
|
4590 |
+
for (var i=0, il=items.length; i<il; i++) {
|
4591 |
+
|
4592 |
+
if (items[i].isSeparator) {
|
4593 |
+
html += '<div class="mejs-contextmenu-separator"></div>';
|
4594 |
+
} else {
|
4595 |
+
|
4596 |
+
var rendered = items[i].render(t);
|
4597 |
+
|
4598 |
+
// render can return null if the item doesn't need to be used at the moment
|
4599 |
+
if (rendered != null) {
|
4600 |
+
html += '<div class="mejs-contextmenu-item" data-itemindex="' + i + '" id="element-' + (Math.random()*1000000) + '">' + rendered + '</div>';
|
4601 |
+
}
|
4602 |
+
}
|
4603 |
+
}
|
4604 |
+
|
4605 |
+
// position and show the context menu
|
4606 |
+
t.contextMenu
|
4607 |
+
.empty()
|
4608 |
+
.append($(html))
|
4609 |
+
.css({top:y, left:x})
|
4610 |
+
.show();
|
4611 |
+
|
4612 |
+
// bind events
|
4613 |
+
t.contextMenu.find('.mejs-contextmenu-item').each(function() {
|
4614 |
+
|
4615 |
+
// which one is this?
|
4616 |
+
var $dom = $(this),
|
4617 |
+
itemIndex = parseInt( $dom.data('itemindex'), 10 ),
|
4618 |
+
item = t.options.contextMenuItems[itemIndex];
|
4619 |
+
|
4620 |
+
// bind extra functionality?
|
4621 |
+
if (typeof item.show != 'undefined')
|
4622 |
+
item.show( $dom , t);
|
4623 |
+
|
4624 |
+
// bind click action
|
4625 |
+
$dom.click(function() {
|
4626 |
+
// perform click action
|
4627 |
+
if (typeof item.click != 'undefined')
|
4628 |
+
item.click(t);
|
4629 |
+
|
4630 |
+
// close
|
4631 |
+
t.contextMenu.hide();
|
4632 |
+
});
|
4633 |
+
});
|
4634 |
+
|
4635 |
+
// stop the controls from hiding
|
4636 |
+
setTimeout(function() {
|
4637 |
+
t.killControlsTimer('rev3');
|
4638 |
+
}, 100);
|
4639 |
+
|
4640 |
+
}
|
4641 |
+
});
|
4642 |
+
|
4643 |
+
})(mejs.$);
|
4644 |
+
/**
|
4645 |
+
* Postroll plugin
|
4646 |
+
*/
|
4647 |
+
(function($) {
|
4648 |
+
|
4649 |
+
$.extend(mejs.MepDefaults, {
|
4650 |
+
postrollCloseText: mejs.i18n.t('Close')
|
4651 |
+
});
|
4652 |
+
|
4653 |
+
// Postroll
|
4654 |
+
$.extend(MediaElementPlayer.prototype, {
|
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;">' + t.options.postrollCloseText + '</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(layers).hide();
|
4663 |
+
|
4664 |
+
t.media.addEventListener('ended', function (e) {
|
4665 |
+
$.ajax({
|
4666 |
+
dataType: 'html',
|
4667 |
+
url: postrollLink,
|
4668 |
+
success: function (data, textStatus) {
|
4669 |
+
layers.find('.mejs-postroll-layer-content').html(data);
|
4670 |
+
}
|
4671 |
+
});
|
4672 |
+
player.postroll.show();
|
4673 |
+
}, false);
|
4674 |
+
}
|
4675 |
+
}
|
4676 |
+
});
|
4677 |
+
|
4678 |
})(mejs.$);
|
4679 |
|
mediaelement/mediaelement-and-player.min.js
CHANGED
@@ -8,48 +8,50 @@
|
|
8 |
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
*
|
10 |
* Copyright 2010-2012, John Dyer (http://j.hn)
|
11 |
-
*
|
12 |
*
|
13 |
-
*/var mejs=mejs||{};mejs.version="2.
|
14 |
-
mejs.
|
|
|
15 |
-1){d=g.substring(0,g.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,g=Math.floor(a/60)%60,f=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(g<10?"0"+g:g)+":"+(f<10?"0"+f:f)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;a=a.split(":");b=parseInt(a[0],
|
16 |
-
10);var e=parseInt(a[1],10),g=parseInt(a[2],10),f=0,
|
|
|
17 |
mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],g;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
|
18 |
!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(g=new ActiveXObject(c))e=d(g)}catch(f){}return e}};
|
19 |
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
|
20 |
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,g,f){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[g]+=f;e[g]-=f};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
|
21 |
mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,g=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==
|
22 |
-
null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit;a.isOpera=d.match(/opera/gi)!==null;a.hasTouch="ontouchstart"in window;for(c=0;c<g.length;c++)e=document.createElement(g[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";
|
23 |
-
a.hasMozNativeFullScreen;a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=e.mozFullScreenEnabled;if(this.isChrome)a.hasSemiNativeFullScreen=false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;
|
24 |
-
else a.hasMozNativeFullScreen&&f.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
|
25 |
-
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:false,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(typeof a=="string")this.src=a;else{var c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type))this.src=c.src}}},setVideoSize:function(a,b){this.width=a;this.height=b}};
|
26 |
-
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={}};
|
27 |
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,tagName:"",muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=
|
28 |
false}},pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return true}return false},
|
29 |
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));
|
30 |
-
this.src=mejs.Utility.absolutizeUrl(a)}}}},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);
|
31 |
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&&
|
32 |
-
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)}},
|
33 |
-
|
34 |
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,
|
35 |
-
c)}},fireEvent:function(a,b,c){var d,e;a=this.pluginMediaElements[a];
|
36 |
-
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",enablePluginSmoothing:false,silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:0.8,
|
37 |
-
error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
|
38 |
-
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
|
39 |
-
"none":h
|
40 |
-
determinePlayback:function(a,b,c,d,e){var g=[],f,j
|
41 |
-
|
42 |
-
"")!==""||a.canPlayType(g[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){
|
43 |
-
""&&g.length>0)
|
44 |
-
""
|
45 |
-
c
|
46 |
-
|
47 |
-
b.
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
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,
|
54 |
{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;
|
55 |
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]=
|
@@ -57,6 +59,9 @@ a;var b,c="http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+a.pl
|
|
57 |
'<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,
|
58 |
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,
|
59 |
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;
|
|
|
|
|
|
|
60 |
|
61 |
/*!
|
62 |
* MediaElementPlayer
|
@@ -66,84 +71,90 @@ c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress")}}};function
|
|
66 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
67 |
*
|
68 |
* Copyright 2010-2012, John Dyer (http://j.hn/)
|
69 |
-
*
|
70 |
*
|
71 |
*/if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
|
72 |
-
(function(f){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,
|
73 |
-
"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)&&
|
74 |
-
228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}
|
75 |
-
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,
|
76 |
-
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();
|
77 |
-
a.
|
78 |
-
|
79 |
-
a.options["
|
80 |
-
"
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
function(){
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
90 |
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)-
|
91 |
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==
|
92 |
-
0)c=f('<img width="100%" height="100%" />').appendTo(b);c.attr("src",a)},buildoverlays:function(a,b,c,d){if(a.isVideo){var
|
93 |
-
d.pause()});d.addEventListener("play",function(){
|
94 |
-
false);d.addEventListener("waiting",function(){
|
95 |
-
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);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"),
|
96 |
-
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)},
|
97 |
-
getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){if(this.media.pluginType
|
98 |
window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
|
99 |
(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);
|
100 |
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.$);
|
101 |
-
(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);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));
|
102 |
b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-poster").show()}})}})})(mejs.$);
|
103 |
(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=
|
104 |
-
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(
|
105 |
-
1){p=true;n(
|
106 |
-
a.setCurrentRail(
|
107 |
-
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.$);
|
108 |
(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,
|
109 |
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");
|
110 |
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()},
|
111 |
-
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(){if(this.media.duration&&this.durationD)this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,
|
|
|
112 |
(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+
|
113 |
'"></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),
|
114 |
-
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,
|
115 |
-
if(e=="vertical"){var r=h.height(),s=h.position(),t=r-r*j;n.css("top",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",s.left+r-n.width()/2);o.width(r)}}},
|
116 |
-
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){
|
117 |
-
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.$);
|
118 |
-
(function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:true,newWindowCallback:function(){return""},fullscreenText:"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,
|
119 |
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()||
|
120 |
-
a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});else{var k=null;
|
121 |
-
"");
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
false}}})})(mejs.$);
|
130 |
(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");
|
131 |
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",
|
132 |
-
"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("
|
133 |
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",
|
134 |
"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=
|
135 |
-
this,c=b.tracks[a],
|
136 |
-
a
|
137 |
-
|
138 |
-
this.
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
settings:d[5]})}}return c}};
|
|
|
|
|
144 |
(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}}]});
|
145 |
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=
|
146 |
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<
|
147 |
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!=
|
148 |
"undefined"&&p.click(c);c.contextMenu.hide()})});setTimeout(function(){c.killControlsTimer("rev3")},100)}})})(mejs.$);
|
|
|
|
|
149 |
|
8 |
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
*
|
10 |
* Copyright 2010-2012, John Dyer (http://j.hn)
|
11 |
+
* License: MIT
|
12 |
*
|
13 |
+
*/var mejs=mejs||{};mejs.version="2.10.3";mejs.meIndex=0;
|
14 |
+
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/mpeg","video/youtube","video/x-youtube"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo","video/x-vimeo"]}]};
|
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 |
-1){d=g.substring(0,g.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,g=Math.floor(a/60)%60,f=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(g<10?"0"+g:g)+":"+(f<10?"0"+f:f)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;a=a.split(":");b=parseInt(a[0],
|
17 |
+
10);var e=parseInt(a[1],10),g=parseInt(a[2],10),f=0,h=0;if(c)f=parseInt(a[3])/d;return h=b*3600+e*60+g+f},convertSMPTEtoSeconds:function(a){if(typeof a!="string")return false;a=a.replace(",",".");var b=0,c=a.indexOf(".")!=-1?a.split(".")[1].length:0,d=1;a=a.split(":").reverse();for(var e=0;e<a.length;e++){d=1;if(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);if(b&&b.nodeName=="OBJECT")if(mejs.MediaFeatures.isIE){b.style.display=
|
18 |
+
"none";(function(){b.readyState==4?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)})()}else b.parentNode.removeChild(b)},removeObjectInIE:function(a){if(a=document.getElementById(a)){for(var b in a)if(typeof a[b]=="function")a[b]=null;a.parentNode.removeChild(a)}}};
|
19 |
mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],g;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
|
20 |
!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(g=new ActiveXObject(c))e=d(g)}catch(f){}return e}};
|
21 |
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
|
22 |
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,g,f){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[g]+=f;e[g]-=f};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
|
23 |
mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,g=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==
|
24 |
+
null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit;a.isOpera=d.match(/opera/gi)!==null;a.hasTouch="ontouchstart"in window;a.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;for(c=0;c<g.length;c++)e=document.createElement(g[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";
|
25 |
+
a.hasMozNativeFullScreen=typeof e.mozRequestFullScreen!=="undefined";a.hasTrueNativeFullScreen=a.hasWebkitNativeFullScreen||a.hasMozNativeFullScreen;a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=e.mozFullScreenEnabled;if(this.isChrome)a.hasSemiNativeFullScreen=false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;
|
26 |
+
else if(e.webkitRequestFullScreen)return b.webkitIsFullScreen};a.requestFullScreen=function(f){if(a.hasWebkitNativeFullScreen)f.webkitRequestFullScreen();else a.hasMozNativeFullScreen&&f.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
|
27 |
+
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:false,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(typeof a=="string")this.src=a;else{var c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.src=c.src;break}}}},setVideoSize:function(a,b){this.width=a;this.height=b}};
|
28 |
+
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={};this.attributes={}};
|
29 |
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,tagName:"",muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=
|
30 |
false}},pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return true}return false},
|
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]=
|
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
|
71 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
72 |
*
|
73 |
* Copyright 2010-2012, John Dyer (http://j.hn/)
|
74 |
+
* License: MIT
|
75 |
*
|
76 |
*/if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
|
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 |
|
mediaelement/mediaelement.js
CHANGED
@@ -8,150 +8,173 @@
|
|
8 |
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
*
|
10 |
* Copyright 2010-2012, John Dyer (http://j.hn)
|
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;
|
22 |
-
|
23 |
-
// media types accepted by plugins
|
24 |
-
mejs.plugins = {
|
25 |
-
silverlight: [
|
26 |
-
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','audio/mpeg']}
|
27 |
-
],
|
28 |
-
flash: [
|
29 |
-
{version: [9,0,124], types: ['video/mp4','video/m4v','video/mov','video/flv','video/x-flv','audio/flv','audio/x-flv','audio/mp3','audio/m4a','audio/mpeg', 'video/youtube', 'video/x-youtube']}
|
30 |
-
//,{version: [12,0], types: ['video/webm']} // for future reference (hopefully!)
|
31 |
-
],
|
32 |
-
youtube: [
|
33 |
-
{version: null, types: ['video/youtube', 'video/x-youtube']}
|
34 |
-
],
|
35 |
-
vimeo: [
|
36 |
-
{version: null, types: ['video/vimeo']}
|
37 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
};
|
39 |
-
|
40 |
-
/*
|
41 |
-
Utility methods
|
42 |
-
*/
|
43 |
-
mejs.Utility = {
|
44 |
-
encodeUrl: function(url) {
|
45 |
-
return encodeURIComponent(url); //.replace(/\?/gi,'%3F').replace(/=/gi,'%3D').replace(/&/gi,'%26');
|
46 |
-
},
|
47 |
-
escapeHTML: function(s) {
|
48 |
-
return s.toString().split('&').join('&').split('<').join('<').split('"').join('"');
|
49 |
-
},
|
50 |
-
absolutizeUrl: function(url) {
|
51 |
-
var el = document.createElement('div');
|
52 |
-
el.innerHTML = '<a href="' + this.escapeHTML(url) + '">x</a>';
|
53 |
-
return el.firstChild.href;
|
54 |
-
},
|
55 |
-
getScriptPath: function(scriptNames) {
|
56 |
-
var
|
57 |
-
i = 0,
|
58 |
-
j,
|
59 |
-
path = '',
|
60 |
-
name = '',
|
61 |
-
script,
|
62 |
-
scripts = document.getElementsByTagName('script'),
|
63 |
-
il = scripts.length,
|
64 |
-
jl = scriptNames.length;
|
65 |
-
|
66 |
-
for (; i < il; i++) {
|
67 |
-
script = scripts[i].src;
|
68 |
-
for (j = 0; j < jl; j++) {
|
69 |
-
name = scriptNames[j];
|
70 |
-
if (script.indexOf(name) > -1) {
|
71 |
-
path = script.substring(0, script.indexOf(name));
|
72 |
-
break;
|
73 |
-
}
|
74 |
-
}
|
75 |
-
if (path !== '') {
|
76 |
-
break;
|
77 |
-
}
|
78 |
-
}
|
79 |
-
return path;
|
80 |
-
},
|
81 |
-
secondsToTimeCode: function(time, forceHours, showFrameCount, fps) {
|
82 |
-
//add framecount
|
83 |
-
if (typeof showFrameCount == 'undefined') {
|
84 |
-
showFrameCount=false;
|
85 |
-
} else if(typeof fps == 'undefined') {
|
86 |
-
fps = 25;
|
87 |
-
}
|
88 |
-
|
89 |
-
var hours = Math.floor(time / 3600) % 24,
|
90 |
-
minutes = Math.floor(time / 60) % 60,
|
91 |
-
seconds = Math.floor(time % 60),
|
92 |
-
frames = Math.floor(((time % 1)*fps).toFixed(3)),
|
93 |
-
result =
|
94 |
-
( (forceHours || hours > 0) ? (hours < 10 ? '0' + hours : hours) + ':' : '')
|
95 |
-
+ (minutes < 10 ? '0' + minutes : minutes) + ':'
|
96 |
-
+ (seconds < 10 ? '0' + seconds : seconds)
|
97 |
-
+ ((showFrameCount) ? ':' + (frames < 10 ? '0' + frames : frames) : '');
|
98 |
-
|
99 |
-
return result;
|
100 |
-
},
|
101 |
-
|
102 |
-
timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
|
103 |
-
if (typeof showFrameCount == 'undefined') {
|
104 |
-
showFrameCount=false;
|
105 |
-
} else if(typeof fps == 'undefined') {
|
106 |
-
fps = 25;
|
107 |
-
}
|
108 |
-
|
109 |
-
var tc_array = hh_mm_ss_ff.split(":"),
|
110 |
-
tc_hh = parseInt(tc_array[0], 10),
|
111 |
-
tc_mm = parseInt(tc_array[1], 10),
|
112 |
-
tc_ss = parseInt(tc_array[2], 10),
|
113 |
-
tc_ff = 0,
|
114 |
-
tc_in_seconds = 0;
|
115 |
-
|
116 |
-
if (showFrameCount) {
|
117 |
-
tc_ff = parseInt(tc_array[3])/fps;
|
118 |
-
}
|
119 |
-
|
120 |
-
tc_in_seconds = ( tc_hh * 3600 ) + ( tc_mm * 60 ) + tc_ss + tc_ff;
|
121 |
-
|
122 |
-
return tc_in_seconds;
|
123 |
-
},
|
124 |
-
|
125 |
-
/* borrowed from SWFObject: http://code.google.com/p/swfobject/source/browse/trunk/swfobject/src/swfobject.js#474 */
|
126 |
-
removeSwf: function(id) {
|
127 |
-
var obj = document.getElementById(id);
|
128 |
-
if (obj && obj.nodeName == "OBJECT") {
|
129 |
-
if (mejs.MediaFeatures.isIE) {
|
130 |
-
obj.style.display = "none";
|
131 |
-
(function(){
|
132 |
-
if (obj.readyState == 4) {
|
133 |
-
mejs.Utility.removeObjectInIE(id);
|
134 |
-
} else {
|
135 |
-
setTimeout(arguments.callee, 10);
|
136 |
-
}
|
137 |
-
})();
|
138 |
-
} else {
|
139 |
-
obj.parentNode.removeChild(obj);
|
140 |
-
}
|
141 |
-
}
|
142 |
-
},
|
143 |
-
removeObjectInIE: function(id) {
|
144 |
-
var obj = document.getElementById(id);
|
145 |
-
if (obj) {
|
146 |
-
for (var i in obj) {
|
147 |
-
if (typeof obj[i] == "function") {
|
148 |
-
obj[i] = null;
|
149 |
-
}
|
150 |
-
}
|
151 |
-
obj.parentNode.removeChild(obj);
|
152 |
-
}
|
153 |
-
}
|
154 |
-
};
|
155 |
|
156 |
|
157 |
// Core detector, plugins are added below
|
@@ -280,6 +303,10 @@ mejs.MediaFeatures = {
|
|
280 |
t.isGecko = (ua.match(/gecko/gi) !== null) && !t.isWebkit;
|
281 |
t.isOpera = (ua.match(/opera/gi) !== null);
|
282 |
t.hasTouch = ('ontouchstart' in window);
|
|
|
|
|
|
|
|
|
283 |
|
284 |
// create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
|
285 |
for (i=0; i<html5Elements.length; i++) {
|
@@ -350,7 +377,6 @@ mejs.MediaFeatures = {
|
|
350 |
};
|
351 |
mejs.MediaFeatures.init();
|
352 |
|
353 |
-
|
354 |
/*
|
355 |
extension methods to <video> or <audio> object to bring it into parity with PluginMediaElement (see below)
|
356 |
*/
|
@@ -395,6 +421,7 @@ mejs.HtmlMediaElement = {
|
|
395 |
media = url[i];
|
396 |
if (this.canPlayType(media.type)) {
|
397 |
this.src = media.src;
|
|
|
398 |
}
|
399 |
}
|
400 |
}
|
@@ -414,6 +441,7 @@ mejs.PluginMediaElement = function (pluginid, pluginType, mediaUrl) {
|
|
414 |
this.pluginType = pluginType;
|
415 |
this.src = mediaUrl;
|
416 |
this.events = {};
|
|
|
417 |
};
|
418 |
|
419 |
// JavaScript values and ExternalInterface methods that match HTML5 video properties methods
|
@@ -542,6 +570,7 @@ mejs.PluginMediaElement.prototype = {
|
|
542 |
if (this.canPlayType(media.type)) {
|
543 |
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
|
544 |
this.src = mejs.Utility.absolutizeUrl(url);
|
|
|
545 |
}
|
546 |
}
|
547 |
}
|
@@ -654,7 +683,6 @@ mejs.PluginMediaElement.prototype = {
|
|
654 |
// end: fake events
|
655 |
|
656 |
// fake DOM attribute methods
|
657 |
-
attributes: {},
|
658 |
hasAttribute: function(name){
|
659 |
return (name in this.attributes);
|
660 |
},
|
@@ -721,9 +749,6 @@ mejs.MediaPluginBridge = {
|
|
721 |
bufferedTime,
|
722 |
pluginMediaElement = this.pluginMediaElements[id];
|
723 |
|
724 |
-
pluginMediaElement.ended = false;
|
725 |
-
pluginMediaElement.paused = true;
|
726 |
-
|
727 |
// fake event object to mimic real HTML media event.
|
728 |
e = {
|
729 |
type: eventName,
|
@@ -759,6 +784,7 @@ Default options
|
|
759 |
mejs.MediaElementDefaults = {
|
760 |
// allows testing on HTML5, flash, silverlight
|
761 |
// auto: attempts to detect what the browser can do
|
|
|
762 |
// native: forces HTML5 playback
|
763 |
// shim: disallows HTML5, will attempt either Flash or Silverlight
|
764 |
// none: forces fallback view
|
@@ -773,6 +799,8 @@ mejs.MediaElementDefaults = {
|
|
773 |
pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
|
774 |
// name of flash file
|
775 |
flashName: 'flashmediaelement.swf',
|
|
|
|
|
776 |
// turns on the smoothing filter in Flash
|
777 |
enablePluginSmoothing: false,
|
778 |
// name of silverlight file
|
@@ -873,7 +901,8 @@ mejs.HtmlMediaElementShim = {
|
|
873 |
pluginName,
|
874 |
pluginVersions,
|
875 |
pluginInfo,
|
876 |
-
dummy
|
|
|
877 |
|
878 |
// STEP 1: Get URL and type from <video src> or <source src>
|
879 |
|
@@ -903,7 +932,11 @@ mejs.HtmlMediaElementShim = {
|
|
903 |
if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
|
904 |
src = n.getAttribute('src');
|
905 |
type = this.formatType(src, n.getAttribute('type'));
|
906 |
-
|
|
|
|
|
|
|
|
|
907 |
}
|
908 |
}
|
909 |
}
|
@@ -926,7 +959,7 @@ mejs.HtmlMediaElementShim = {
|
|
926 |
|
927 |
|
928 |
// test for native playback first
|
929 |
-
if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'native')) {
|
930 |
|
931 |
if (!isMediaTag) {
|
932 |
|
@@ -955,12 +988,15 @@ mejs.HtmlMediaElementShim = {
|
|
955 |
htmlMediaElement.src = result.url;
|
956 |
}
|
957 |
|
958 |
-
|
|
|
|
|
|
|
959 |
}
|
960 |
}
|
961 |
|
962 |
// if native playback didn't work, then test plugins
|
963 |
-
if (options.mode === 'auto' || options.mode === 'shim') {
|
964 |
for (i=0; i<mediaFiles.length; i++) {
|
965 |
type = mediaFiles[i].type;
|
966 |
|
@@ -997,6 +1033,12 @@ mejs.HtmlMediaElementShim = {
|
|
997 |
}
|
998 |
}
|
999 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1000 |
// what if there's nothing to play? just grab the first available
|
1001 |
if (result.method === '' && mediaFiles.length > 0) {
|
1002 |
result.url = mediaFiles[0].url;
|
@@ -1025,8 +1067,28 @@ mejs.HtmlMediaElementShim = {
|
|
1025 |
},
|
1026 |
|
1027 |
getTypeFromFile: function(url) {
|
|
|
1028 |
var ext = url.substring(url.lastIndexOf('.') + 1);
|
1029 |
-
return (/(mp4|m4v|ogg|ogv|webm|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video' : 'audio') + '/' + ext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1030 |
},
|
1031 |
|
1032 |
createErrorMessage: function(playback, options, poster) {
|
@@ -1043,7 +1105,7 @@ mejs.HtmlMediaElementShim = {
|
|
1043 |
|
1044 |
errorContainer.innerHTML = (poster !== '') ?
|
1045 |
'<a href="' + playback.url + '"><img src="' + poster + '" width="100%" height="100%" /></a>' :
|
1046 |
-
'<a href="' + playback.url + '"><span>Download File</span></a>';
|
1047 |
|
1048 |
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
|
1049 |
htmlMediaElement.style.display = 'none';
|
@@ -1122,6 +1184,7 @@ mejs.HtmlMediaElementShim = {
|
|
1122 |
'width=' + width,
|
1123 |
'startvolume=' + options.startVolume,
|
1124 |
'timerrate=' + options.timerRate,
|
|
|
1125 |
'height=' + height];
|
1126 |
|
1127 |
if (playback.url !== null) {
|
@@ -1218,10 +1281,13 @@ mejs.HtmlMediaElementShim = {
|
|
1218 |
|
1219 |
// DEMO Code. Does NOT work.
|
1220 |
case 'vimeo':
|
1221 |
-
console.log('vimeoid');
|
1222 |
|
1223 |
pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1224 |
|
|
|
|
|
|
|
1225 |
container.innerHTML =
|
1226 |
'<object width="' + width + '" height="' + height + '">' +
|
1227 |
'<param name="allowfullscreen" value="true" />' +
|
@@ -1230,7 +1296,8 @@ mejs.HtmlMediaElementShim = {
|
|
1230 |
'<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=' + pluginMediaElement.vimeoid + '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" />' +
|
1231 |
'<embed src="//vimeo.com/moogaloop.swf?api=1&clip_id=' + pluginMediaElement.vimeoid + '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="' + width + '" height="' + height + '"></embed>' +
|
1232 |
'</object>';
|
1233 |
-
|
|
|
1234 |
break;
|
1235 |
}
|
1236 |
// hide original element
|
@@ -1456,7 +1523,7 @@ mejs.YouTubeApi = {
|
|
1456 |
// load the youtube video
|
1457 |
player.cueVideoById(settings.videoId);
|
1458 |
|
1459 |
-
var callbackName = settings.containerId + '_callback'
|
1460 |
|
1461 |
window[callbackName] = function(e) {
|
1462 |
mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
|
@@ -1515,3 +1582,225 @@ function onYouTubePlayerReady(id) {
|
|
1515 |
|
1516 |
window.mejs = mejs;
|
1517 |
window.MediaElement = mejs.MediaElement;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
*
|
10 |
* Copyright 2010-2012, John Dyer (http://j.hn)
|
11 |
+
* License: MIT
|
12 |
*
|
13 |
*/
|
14 |
+
// Namespace
|
15 |
+
var mejs = mejs || {};
|
16 |
+
|
17 |
+
// version number
|
18 |
+
mejs.version = '2.10.3';
|
19 |
+
|
20 |
+
// player number (for missing, same id attr)
|
21 |
+
mejs.meIndex = 0;
|
22 |
+
|
23 |
+
// media types accepted by plugins
|
24 |
+
mejs.plugins = {
|
25 |
+
silverlight: [
|
26 |
+
{version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','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/youtube', 'video/x-youtube']}
|
30 |
+
//,{version: [12,0], types: ['video/webm']} // for future reference (hopefully!)
|
31 |
+
],
|
32 |
+
youtube: [
|
33 |
+
{version: null, types: ['video/youtube', 'video/x-youtube']}
|
34 |
+
],
|
35 |
+
vimeo: [
|
36 |
+
{version: null, types: ['video/vimeo', 'video/x-vimeo']}
|
37 |
+
]
|
38 |
+
};
|
39 |
+
|
40 |
+
/*
|
41 |
+
Utility methods
|
42 |
+
*/
|
43 |
+
mejs.Utility = {
|
44 |
+
encodeUrl: function(url) {
|
45 |
+
return encodeURIComponent(url); //.replace(/\?/gi,'%3F').replace(/=/gi,'%3D').replace(/&/gi,'%26');
|
46 |
+
},
|
47 |
+
escapeHTML: function(s) {
|
48 |
+
return s.toString().split('&').join('&').split('<').join('<').split('"').join('"');
|
49 |
+
},
|
50 |
+
absolutizeUrl: function(url) {
|
51 |
+
var el = document.createElement('div');
|
52 |
+
el.innerHTML = '<a href="' + this.escapeHTML(url) + '">x</a>';
|
53 |
+
return el.firstChild.href;
|
54 |
+
},
|
55 |
+
getScriptPath: function(scriptNames) {
|
56 |
+
var
|
57 |
+
i = 0,
|
58 |
+
j,
|
59 |
+
path = '',
|
60 |
+
name = '',
|
61 |
+
script,
|
62 |
+
scripts = document.getElementsByTagName('script'),
|
63 |
+
il = scripts.length,
|
64 |
+
jl = scriptNames.length;
|
65 |
+
|
66 |
+
for (; i < il; i++) {
|
67 |
+
script = scripts[i].src;
|
68 |
+
for (j = 0; j < jl; j++) {
|
69 |
+
name = scriptNames[j];
|
70 |
+
if (script.indexOf(name) > -1) {
|
71 |
+
path = script.substring(0, script.indexOf(name));
|
72 |
+
break;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
if (path !== '') {
|
76 |
+
break;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
return path;
|
80 |
+
},
|
81 |
+
secondsToTimeCode: function(time, forceHours, showFrameCount, fps) {
|
82 |
+
//add framecount
|
83 |
+
if (typeof showFrameCount == 'undefined') {
|
84 |
+
showFrameCount=false;
|
85 |
+
} else if(typeof fps == 'undefined') {
|
86 |
+
fps = 25;
|
87 |
+
}
|
88 |
+
|
89 |
+
var hours = Math.floor(time / 3600) % 24,
|
90 |
+
minutes = Math.floor(time / 60) % 60,
|
91 |
+
seconds = Math.floor(time % 60),
|
92 |
+
frames = Math.floor(((time % 1)*fps).toFixed(3)),
|
93 |
+
result =
|
94 |
+
( (forceHours || hours > 0) ? (hours < 10 ? '0' + hours : hours) + ':' : '')
|
95 |
+
+ (minutes < 10 ? '0' + minutes : minutes) + ':'
|
96 |
+
+ (seconds < 10 ? '0' + seconds : seconds)
|
97 |
+
+ ((showFrameCount) ? ':' + (frames < 10 ? '0' + frames : frames) : '');
|
98 |
+
|
99 |
+
return result;
|
100 |
+
},
|
101 |
+
|
102 |
+
timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
|
103 |
+
if (typeof showFrameCount == 'undefined') {
|
104 |
+
showFrameCount=false;
|
105 |
+
} else if(typeof fps == 'undefined') {
|
106 |
+
fps = 25;
|
107 |
+
}
|
108 |
+
|
109 |
+
var tc_array = hh_mm_ss_ff.split(":"),
|
110 |
+
tc_hh = parseInt(tc_array[0], 10),
|
111 |
+
tc_mm = parseInt(tc_array[1], 10),
|
112 |
+
tc_ss = parseInt(tc_array[2], 10),
|
113 |
+
tc_ff = 0,
|
114 |
+
tc_in_seconds = 0;
|
115 |
+
|
116 |
+
if (showFrameCount) {
|
117 |
+
tc_ff = parseInt(tc_array[3])/fps;
|
118 |
+
}
|
119 |
+
|
120 |
+
tc_in_seconds = ( tc_hh * 3600 ) + ( tc_mm * 60 ) + tc_ss + tc_ff;
|
121 |
+
|
122 |
+
return tc_in_seconds;
|
123 |
+
},
|
124 |
+
|
125 |
+
|
126 |
+
convertSMPTEtoSeconds: function (SMPTE) {
|
127 |
+
if (typeof SMPTE != 'string')
|
128 |
+
return false;
|
129 |
+
|
130 |
+
SMPTE = SMPTE.replace(',', '.');
|
131 |
+
|
132 |
+
var secs = 0,
|
133 |
+
decimalLen = (SMPTE.indexOf('.') != -1) ? SMPTE.split('.')[1].length : 0,
|
134 |
+
multiplier = 1;
|
135 |
+
|
136 |
+
SMPTE = SMPTE.split(':').reverse();
|
137 |
+
|
138 |
+
for (var i = 0; i < SMPTE.length; i++) {
|
139 |
+
multiplier = 1;
|
140 |
+
if (i > 0) {
|
141 |
+
multiplier = Math.pow(60, i);
|
142 |
+
}
|
143 |
+
secs += Number(SMPTE[i]) * multiplier;
|
144 |
+
}
|
145 |
+
return Number(secs.toFixed(decimalLen));
|
146 |
+
},
|
147 |
+
|
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 == "OBJECT") {
|
152 |
+
if (mejs.MediaFeatures.isIE) {
|
153 |
+
obj.style.display = "none";
|
154 |
+
(function(){
|
155 |
+
if (obj.readyState == 4) {
|
156 |
+
mejs.Utility.removeObjectInIE(id);
|
157 |
+
} else {
|
158 |
+
setTimeout(arguments.callee, 10);
|
159 |
+
}
|
160 |
+
})();
|
161 |
+
} else {
|
162 |
+
obj.parentNode.removeChild(obj);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
},
|
166 |
+
removeObjectInIE: function(id) {
|
167 |
+
var obj = document.getElementById(id);
|
168 |
+
if (obj) {
|
169 |
+
for (var i in obj) {
|
170 |
+
if (typeof obj[i] == "function") {
|
171 |
+
obj[i] = null;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
obj.parentNode.removeChild(obj);
|
175 |
+
}
|
176 |
+
}
|
177 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
|
180 |
// Core detector, plugins are added below
|
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 |
+
// borrowed from Modernizr
|
308 |
+
t.svg = !! document.createElementNS &&
|
309 |
+
!! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect;
|
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++) {
|
377 |
};
|
378 |
mejs.MediaFeatures.init();
|
379 |
|
|
|
380 |
/*
|
381 |
extension methods to <video> or <audio> object to bring it into parity with PluginMediaElement (see below)
|
382 |
*/
|
421 |
media = url[i];
|
422 |
if (this.canPlayType(media.type)) {
|
423 |
this.src = media.src;
|
424 |
+
break;
|
425 |
}
|
426 |
}
|
427 |
}
|
441 |
this.pluginType = pluginType;
|
442 |
this.src = mediaUrl;
|
443 |
this.events = {};
|
444 |
+
this.attributes = {};
|
445 |
};
|
446 |
|
447 |
// JavaScript values and ExternalInterface methods that match HTML5 video properties methods
|
570 |
if (this.canPlayType(media.type)) {
|
571 |
this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
|
572 |
this.src = mejs.Utility.absolutizeUrl(url);
|
573 |
+
break;
|
574 |
}
|
575 |
}
|
576 |
}
|
683 |
// end: fake events
|
684 |
|
685 |
// fake DOM attribute methods
|
|
|
686 |
hasAttribute: function(name){
|
687 |
return (name in this.attributes);
|
688 |
},
|
749 |
bufferedTime,
|
750 |
pluginMediaElement = this.pluginMediaElements[id];
|
751 |
|
|
|
|
|
|
|
752 |
// fake event object to mimic real HTML media event.
|
753 |
e = {
|
754 |
type: eventName,
|
784 |
mejs.MediaElementDefaults = {
|
785 |
// allows testing on HTML5, flash, silverlight
|
786 |
// auto: attempts to detect what the browser can do
|
787 |
+
// auto_plugin: prefer plugins and then attempt native HTML5
|
788 |
// native: forces HTML5 playback
|
789 |
// shim: disallows HTML5, will attempt either Flash or Silverlight
|
790 |
// none: forces fallback view
|
799 |
pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
|
800 |
// name of flash file
|
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
|
901 |
pluginName,
|
902 |
pluginVersions,
|
903 |
pluginInfo,
|
904 |
+
dummy,
|
905 |
+
media;
|
906 |
|
907 |
// STEP 1: Get URL and type from <video src> or <source src>
|
908 |
|
932 |
if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
|
933 |
src = n.getAttribute('src');
|
934 |
type = this.formatType(src, n.getAttribute('type'));
|
935 |
+
media = n.getAttribute('media');
|
936 |
+
|
937 |
+
if (!media || !window.matchMedia || (window.matchMedia && window.matchMedia(media).matches)) {
|
938 |
+
mediaFiles.push({type:type, url:src});
|
939 |
+
}
|
940 |
}
|
941 |
}
|
942 |
}
|
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 |
|
988 |
htmlMediaElement.src = result.url;
|
989 |
}
|
990 |
|
991 |
+
// if `auto_plugin` mode, then cache the native result but try plugins.
|
992 |
+
if (options.mode !== 'auto_plugin') {
|
993 |
+
return result;
|
994 |
+
}
|
995 |
}
|
996 |
}
|
997 |
|
998 |
// if native playback didn't work, then test plugins
|
999 |
+
if (options.mode === 'auto' || options.mode === 'auto_plugin' || options.mode === 'shim') {
|
1000 |
for (i=0; i<mediaFiles.length; i++) {
|
1001 |
type = mediaFiles[i].type;
|
1002 |
|
1033 |
}
|
1034 |
}
|
1035 |
|
1036 |
+
// at this point, being in 'auto_plugin' mode implies that we tried plugins but failed.
|
1037 |
+
// if we have native support then return that.
|
1038 |
+
if (options.mode === 'auto_plugin' && result.method === 'native') {
|
1039 |
+
return result;
|
1040 |
+
}
|
1041 |
+
|
1042 |
// what if there's nothing to play? just grab the first available
|
1043 |
if (result.method === '' && mediaFiles.length > 0) {
|
1044 |
result.url = mediaFiles[0].url;
|
1067 |
},
|
1068 |
|
1069 |
getTypeFromFile: function(url) {
|
1070 |
+
url = url.split('?')[0];
|
1071 |
var ext = url.substring(url.lastIndexOf('.') + 1);
|
1072 |
+
return (/(mp4|m4v|ogg|ogv|webm|webmv|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video' : 'audio') + '/' + this.getTypeFromExtension(ext);
|
1073 |
+
},
|
1074 |
+
|
1075 |
+
getTypeFromExtension: function(ext) {
|
1076 |
+
|
1077 |
+
switch (ext) {
|
1078 |
+
case 'mp4':
|
1079 |
+
case 'm4v':
|
1080 |
+
return 'mp4';
|
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) {
|
1105 |
|
1106 |
errorContainer.innerHTML = (poster !== '') ?
|
1107 |
'<a href="' + playback.url + '"><img src="' + poster + '" width="100%" height="100%" /></a>' :
|
1108 |
+
'<a href="' + playback.url + '"><span>' + mejs.i18n.t('Download File') + '</span></a>';
|
1109 |
|
1110 |
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
|
1111 |
htmlMediaElement.style.display = 'none';
|
1184 |
'width=' + width,
|
1185 |
'startvolume=' + options.startVolume,
|
1186 |
'timerrate=' + options.timerRate,
|
1187 |
+
'flashstreamer=' + options.flashStreamer,
|
1188 |
'height=' + height];
|
1189 |
|
1190 |
if (playback.url !== null) {
|
1281 |
|
1282 |
// DEMO Code. Does NOT work.
|
1283 |
case 'vimeo':
|
1284 |
+
//console.log('vimeoid');
|
1285 |
|
1286 |
pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
|
1287 |
|
1288 |
+
container.innerHTML ='<iframe src="http://player.vimeo.com/video/' + pluginMediaElement.vimeoid + '?portrait=0&byline=0&title=0" width="' + width +'" height="' + height +'" frameborder="0"></iframe>';
|
1289 |
+
|
1290 |
+
/*
|
1291 |
container.innerHTML =
|
1292 |
'<object width="' + width + '" height="' + height + '">' +
|
1293 |
'<param name="allowfullscreen" value="true" />' +
|
1296 |
'<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=' + pluginMediaElement.vimeoid + '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" />' +
|
1297 |
'<embed src="//vimeo.com/moogaloop.swf?api=1&clip_id=' + pluginMediaElement.vimeoid + '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="' + width + '" height="' + height + '"></embed>' +
|
1298 |
'</object>';
|
1299 |
+
*/
|
1300 |
+
|
1301 |
break;
|
1302 |
}
|
1303 |
// hide original element
|
1523 |
// load the youtube video
|
1524 |
player.cueVideoById(settings.videoId);
|
1525 |
|
1526 |
+
var callbackName = settings.containerId + '_callback';
|
1527 |
|
1528 |
window[callbackName] = function(e) {
|
1529 |
mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
|
1582 |
|
1583 |
window.mejs = mejs;
|
1584 |
window.MediaElement = mejs.MediaElement;
|
1585 |
+
|
1586 |
+
/*!
|
1587 |
+
* Adds Internationalization and localization to objects.
|
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 |
+
* @params
|
1625 |
+
* - $ - zepto || jQuery ..
|
1626 |
+
* - context - document, iframe ..
|
1627 |
+
* - exports - CommonJS, window ..
|
1628 |
+
*
|
1629 |
+
*/
|
1630 |
+
;(function($, context, exports, undefined) {
|
1631 |
+
"use strict";
|
1632 |
+
var i18n = {
|
1633 |
+
"locale": {
|
1634 |
+
"strings" : {}
|
1635 |
+
},
|
1636 |
+
"methods" : {}
|
1637 |
+
};
|
1638 |
+
// start i18n
|
1639 |
+
|
1640 |
+
|
1641 |
+
/**
|
1642 |
+
* Get the current browser's language
|
1643 |
+
*
|
1644 |
+
* @see: i18n.methods.t()
|
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 |
+
if (args) {
|
1744 |
+
str = i18n.methods.formatString(str, args);
|
1745 |
+
}
|
1746 |
+
return str;
|
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 |
+
if (typeof str === 'string' && str.length > 0) {
|
1759 |
+
|
1760 |
+
// check every time due languge can change for
|
1761 |
+
// different reasons (translation, lang switcher ..)
|
1762 |
+
var lang = i18n.locale.getLanguage();
|
1763 |
+
|
1764 |
+
options = options || {
|
1765 |
+
"context" : lang.language
|
1766 |
+
};
|
1767 |
+
|
1768 |
+
return i18n.methods.t(str, args, options);
|
1769 |
+
}
|
1770 |
+
else {
|
1771 |
+
throw {
|
1772 |
+
"name" : 'InvalidArgumentException',
|
1773 |
+
"message" : 'First argument is either not a string or empty.'
|
1774 |
+
}
|
1775 |
+
}
|
1776 |
+
};
|
1777 |
+
|
1778 |
+
// end i18n
|
1779 |
+
exports.i18n = i18n;
|
1780 |
+
}(jQuery, document, mejs));
|
1781 |
+
/*!
|
1782 |
+
* This is a i18n.locale language object.
|
1783 |
+
*
|
1784 |
+
*<de> German translation by Tim Latz, latz.tim@gmail.com
|
1785 |
+
*
|
1786 |
+
* @author
|
1787 |
+
* Tim Latz (latz.tim@gmail.com)
|
1788 |
+
*
|
1789 |
+
* @see
|
1790 |
+
* me-i18n.js
|
1791 |
+
*
|
1792 |
+
* @params
|
1793 |
+
* - exports - CommonJS, window ..
|
1794 |
+
*/
|
1795 |
+
;(function(exports, undefined) {
|
1796 |
+
|
1797 |
+
"use strict";
|
1798 |
+
|
1799 |
+
exports.de = {
|
1800 |
+
"Fullscreen" : "Vollbild",
|
1801 |
+
"Go Fullscreen" : "Vollbild an",
|
1802 |
+
"Turn off Fullscreen" : "Vollbild aus",
|
1803 |
+
"Close" : "Schließen"
|
1804 |
+
};
|
1805 |
+
|
1806 |
+
}(mejs.i18n.locale.strings));
|
mediaelement/mediaelement.min.js
CHANGED
@@ -8,48 +8,50 @@
|
|
8 |
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
*
|
10 |
* Copyright 2010-2012, John Dyer (http://j.hn)
|
11 |
-
*
|
12 |
*
|
13 |
-
*/var mejs=mejs||{};mejs.version="2.
|
14 |
-
mejs.
|
|
|
15 |
-1){d=g.substring(0,g.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,g=Math.floor(a/60)%60,f=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(g<10?"0"+g:g)+":"+(f<10?"0"+f:f)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;a=a.split(":");b=parseInt(a[0],
|
16 |
-
10);var e=parseInt(a[1],10),g=parseInt(a[2],10),f=0,
|
|
|
17 |
mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],g;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
|
18 |
!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(g=new ActiveXObject(c))e=d(g)}catch(f){}return e}};
|
19 |
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
|
20 |
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,g,f){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[g]+=f;e[g]-=f};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
|
21 |
mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,g=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==
|
22 |
-
null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit;a.isOpera=d.match(/opera/gi)!==null;a.hasTouch="ontouchstart"in window;for(c=0;c<g.length;c++)e=document.createElement(g[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";
|
23 |
-
a.hasMozNativeFullScreen;a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=e.mozFullScreenEnabled;if(this.isChrome)a.hasSemiNativeFullScreen=false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;
|
24 |
-
else a.hasMozNativeFullScreen&&f.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
|
25 |
-
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:false,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(typeof a=="string")this.src=a;else{var c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type))this.src=c.src}}},setVideoSize:function(a,b){this.width=a;this.height=b}};
|
26 |
-
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={}};
|
27 |
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,tagName:"",muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=
|
28 |
false}},pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return true}return false},
|
29 |
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));
|
30 |
-
this.src=mejs.Utility.absolutizeUrl(a)}}}},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);
|
31 |
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&&
|
32 |
-
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)}},
|
33 |
-
|
34 |
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,
|
35 |
-
c)}},fireEvent:function(a,b,c){var d,e;a=this.pluginMediaElements[a];
|
36 |
-
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",enablePluginSmoothing:false,silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:0.8,
|
37 |
-
error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
|
38 |
-
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
|
39 |
-
"none":h
|
40 |
-
determinePlayback:function(a,b,c,d,e){var g=[],f,j
|
41 |
-
|
42 |
-
"")!==""||a.canPlayType(g[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){
|
43 |
-
""&&g.length>0)
|
44 |
-
""
|
45 |
-
c
|
46 |
-
|
47 |
-
b.
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
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,
|
54 |
{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;
|
55 |
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]=
|
@@ -57,3 +59,6 @@ a;var b,c="http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+a.pl
|
|
57 |
'<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,
|
58 |
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,
|
59 |
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;
|
|
|
|
|
|
8 |
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
|
9 |
*
|
10 |
* Copyright 2010-2012, John Dyer (http://j.hn)
|
11 |
+
* License: MIT
|
12 |
*
|
13 |
+
*/var mejs=mejs||{};mejs.version="2.10.3";mejs.meIndex=0;
|
14 |
+
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/mpeg","video/youtube","video/x-youtube"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo","video/x-vimeo"]}]};
|
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 |
-1){d=g.substring(0,g.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,g=Math.floor(a/60)%60,f=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(g<10?"0"+g:g)+":"+(f<10?"0"+f:f)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;a=a.split(":");b=parseInt(a[0],
|
17 |
+
10);var e=parseInt(a[1],10),g=parseInt(a[2],10),f=0,h=0;if(c)f=parseInt(a[3])/d;return h=b*3600+e*60+g+f},convertSMPTEtoSeconds:function(a){if(typeof a!="string")return false;a=a.replace(",",".");var b=0,c=a.indexOf(".")!=-1?a.split(".")[1].length:0,d=1;a=a.split(":").reverse();for(var e=0;e<a.length;e++){d=1;if(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);if(b&&b.nodeName=="OBJECT")if(mejs.MediaFeatures.isIE){b.style.display=
|
18 |
+
"none";(function(){b.readyState==4?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)})()}else b.parentNode.removeChild(b)},removeObjectInIE:function(a){if(a=document.getElementById(a)){for(var b in a)if(typeof a[b]=="function")a[b]=null;a.parentNode.removeChild(a)}}};
|
19 |
mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],g;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
|
20 |
!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(g=new ActiveXObject(c))e=d(g)}catch(f){}return e}};
|
21 |
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
|
22 |
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,g,f){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[g]+=f;e[g]-=f};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
|
23 |
mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,g=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==
|
24 |
+
null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit;a.isOpera=d.match(/opera/gi)!==null;a.hasTouch="ontouchstart"in window;a.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;for(c=0;c<g.length;c++)e=document.createElement(g[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";
|
25 |
+
a.hasMozNativeFullScreen=typeof e.mozRequestFullScreen!=="undefined";a.hasTrueNativeFullScreen=a.hasWebkitNativeFullScreen||a.hasMozNativeFullScreen;a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=e.mozFullScreenEnabled;if(this.isChrome)a.hasSemiNativeFullScreen=false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;
|
26 |
+
else if(e.webkitRequestFullScreen)return b.webkitIsFullScreen};a.requestFullScreen=function(f){if(a.hasWebkitNativeFullScreen)f.webkitRequestFullScreen();else a.hasMozNativeFullScreen&&f.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
|
27 |
+
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:false,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(typeof a=="string")this.src=a;else{var c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.src=c.src;break}}}},setVideoSize:function(a,b){this.width=a;this.height=b}};
|
28 |
+
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={};this.attributes={}};
|
29 |
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,tagName:"",muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=
|
30 |
false}},pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return true}return false},
|
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]=
|
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);
|
mediaelement/mediaelementplayer.css
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
font-family: Helvetica, Arial;
|
5 |
text-align: left;
|
6 |
vertical-align: top;
|
|
|
7 |
}
|
8 |
|
9 |
.me-plugin {
|
@@ -73,9 +74,12 @@
|
|
73 |
width: 100px;
|
74 |
height: 100px;
|
75 |
margin: -50px 0 0 -50px;
|
76 |
-
background: url(bigplay.
|
77 |
}
|
78 |
-
.
|
|
|
|
|
|
|
79 |
background-position: 0 -100px ;
|
80 |
}
|
81 |
.mejs-overlay-loading {
|
@@ -96,7 +100,7 @@
|
|
96 |
background: linear-gradient(rgba(50,50,50,0.9), rgba(0,0,0,0.9));
|
97 |
}
|
98 |
.mejs-overlay-loading span {
|
99 |
-
display:block;
|
100 |
width: 80px;
|
101 |
height: 80px;
|
102 |
background: transparent url(loading.gif) 50% 50% no-repeat;
|
@@ -152,7 +156,11 @@
|
|
152 |
height: 16px;
|
153 |
width: 16px;
|
154 |
border: 0;
|
155 |
-
background: transparent url(controls.
|
|
|
|
|
|
|
|
|
156 |
}
|
157 |
|
158 |
/* :focus for accessibility */
|
@@ -172,9 +180,9 @@
|
|
172 |
overflow: hidden;
|
173 |
text-align: center;
|
174 |
padding: auto 4px;
|
175 |
-
box-sizing: content-box;
|
176 |
-moz-box-sizing: content-box;
|
177 |
-webkit-box-sizing: content-box;
|
|
|
178 |
}
|
179 |
.mejs-container .mejs-controls .mejs-time span {
|
180 |
font-size: 11px;
|
@@ -190,10 +198,10 @@
|
|
190 |
|
191 |
/* Start: Play/pause */
|
192 |
.mejs-controls .mejs-play button {
|
193 |
-
background-position:0 0;
|
194 |
}
|
195 |
.mejs-controls .mejs-pause button {
|
196 |
-
background-position:0 -16px;
|
197 |
}
|
198 |
/* End: Play/pause */
|
199 |
|
@@ -231,7 +239,7 @@
|
|
231 |
background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
|
232 |
}
|
233 |
.mejs-controls .mejs-time-rail .mejs-time-buffering {
|
234 |
-
width:100%;
|
235 |
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);
|
236 |
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));
|
237 |
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);
|
@@ -313,6 +321,7 @@
|
|
313 |
text-align: center;
|
314 |
left: 0;
|
315 |
}
|
|
|
316 |
.mejs-controls .mejs-time-rail .mejs-time-float-corner {
|
317 |
position: absolute;
|
318 |
display: block;
|
@@ -326,9 +335,19 @@
|
|
326 |
border-radius: 0;
|
327 |
top: 15px;
|
328 |
left: 13px;
|
|
|
329 |
|
|
|
|
|
330 |
}
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
|
333 |
|
334 |
|
@@ -341,10 +360,10 @@
|
|
341 |
|
342 |
/* Start: Fullscreen */
|
343 |
.mejs-controls .mejs-fullscreen-button button {
|
344 |
-
background-position
|
345 |
}
|
346 |
.mejs-controls .mejs-unfullscreen button {
|
347 |
-
background-position
|
348 |
}
|
349 |
/* End: Fullscreen */
|
350 |
|
@@ -354,11 +373,11 @@
|
|
354 |
}
|
355 |
|
356 |
.mejs-controls .mejs-mute button {
|
357 |
-
background-position
|
358 |
}
|
359 |
|
360 |
.mejs-controls .mejs-unmute button {
|
361 |
-
background-position
|
362 |
}
|
363 |
|
364 |
.mejs-controls .mejs-volume-button {
|
@@ -503,7 +522,7 @@
|
|
503 |
}
|
504 |
|
505 |
.mejs-controls .mejs-captions-button button {
|
506 |
-
background-position
|
507 |
}
|
508 |
.mejs-controls .mejs-captions-button .mejs-captions-selector {
|
509 |
visibility: hidden;
|
@@ -534,20 +553,20 @@
|
|
534 |
list-style-type: none !important;
|
535 |
overflow: hidden;
|
536 |
}
|
537 |
-
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li{
|
538 |
margin: 0 0 6px 0;
|
539 |
padding: 0;
|
540 |
list-style-type: none !important;
|
541 |
-
display:block;
|
542 |
color: #fff;
|
543 |
overflow: hidden;
|
544 |
}
|
545 |
-
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li input{
|
546 |
clear: both;
|
547 |
float: left;
|
548 |
margin: 3px 3px 0 5px;
|
549 |
}
|
550 |
-
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li label{
|
551 |
width: 100px;
|
552 |
float: left;
|
553 |
padding: 4px 0 0 0;
|
@@ -610,21 +629,21 @@
|
|
610 |
background: linear-gradient(rgba(102,102,102,0.7), rgba(50,50,50,0.6));
|
611 |
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#666666,endColorstr=#323232);
|
612 |
}
|
613 |
-
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{
|
614 |
font-size: 12px;
|
615 |
font-weight: bold;
|
616 |
display: block;
|
617 |
-
white-space:nowrap;
|
618 |
text-overflow: ellipsis;
|
619 |
margin: 0 0 3px 0;
|
620 |
line-height: 12px;
|
621 |
}
|
622 |
-
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{
|
623 |
font-size: 12px;
|
624 |
line-height: 12px;
|
625 |
margin: 3px 0 4px 0;
|
626 |
display: block;
|
627 |
-
white-space:nowrap;
|
628 |
text-overflow: ellipsis;
|
629 |
}
|
630 |
|
@@ -688,7 +707,7 @@
|
|
688 |
|
689 |
|
690 |
/* Start: Loop */
|
691 |
-
.mejs-controls .mejs-loop-off button{
|
692 |
background-position: -64px -16px;
|
693 |
}
|
694 |
.mejs-controls .mejs-loop-on button {
|
@@ -697,7 +716,7 @@
|
|
697 |
/* End: Loop */
|
698 |
|
699 |
/* Start: backlight */
|
700 |
-
.mejs-controls .mejs-backlight-off button{
|
701 |
background-position: -80px -16px;
|
702 |
}
|
703 |
.mejs-controls .mejs-backlight-on button {
|
@@ -707,7 +726,7 @@
|
|
707 |
|
708 |
|
709 |
/* Start: picture controls */
|
710 |
-
.mejs-controls .mejs-picturecontrols-button{
|
711 |
background-position: -96px 0;
|
712 |
}
|
713 |
/* End: picture controls */
|
@@ -777,20 +796,20 @@
|
|
777 |
list-style-type: none !important;
|
778 |
overflow: hidden;
|
779 |
}
|
780 |
-
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li{
|
781 |
margin: 0 0 6px 0;
|
782 |
padding: 0;
|
783 |
list-style-type: none !important;
|
784 |
-
display:block;
|
785 |
color: #fff;
|
786 |
overflow: hidden;
|
787 |
}
|
788 |
-
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input{
|
789 |
clear: both;
|
790 |
float: left;
|
791 |
margin: 3px 3px 0 5px;
|
792 |
}
|
793 |
-
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label{
|
794 |
width: 100px;
|
795 |
float: left;
|
796 |
padding: 4px 0 0 0;
|
@@ -799,3 +818,33 @@
|
|
799 |
font-size: 10px;
|
800 |
}
|
801 |
/* End: SourceChooser */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
font-family: Helvetica, Arial;
|
5 |
text-align: left;
|
6 |
vertical-align: top;
|
7 |
+
text-indent: 0;
|
8 |
}
|
9 |
|
10 |
.me-plugin {
|
74 |
width: 100px;
|
75 |
height: 100px;
|
76 |
margin: -50px 0 0 -50px;
|
77 |
+
background: url(bigplay.svg) no-repeat;
|
78 |
}
|
79 |
+
.no-svg .mejs-overlay-button {
|
80 |
+
background-image: url(bigplay.png);
|
81 |
+
}
|
82 |
+
.mejs-overlay:hover .mejs-overlay-button {
|
83 |
background-position: 0 -100px ;
|
84 |
}
|
85 |
.mejs-overlay-loading {
|
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;
|
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 */
|
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 |
.mejs-container .mejs-controls .mejs-time span {
|
188 |
font-size: 11px;
|
198 |
|
199 |
/* Start: Play/pause */
|
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 |
|
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);
|
244 |
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));
|
245 |
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);
|
321 |
text-align: center;
|
322 |
left: 0;
|
323 |
}
|
324 |
+
|
325 |
.mejs-controls .mejs-time-rail .mejs-time-float-corner {
|
326 |
position: absolute;
|
327 |
display: block;
|
335 |
border-radius: 0;
|
336 |
top: 15px;
|
337 |
left: 13px;
|
338 |
+
}
|
339 |
|
340 |
+
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float {
|
341 |
+
width: 48px;
|
342 |
}
|
343 |
|
344 |
+
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-current {
|
345 |
+
width: 44px;
|
346 |
+
}
|
347 |
+
|
348 |
+
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-corner {
|
349 |
+
left: 18px;
|
350 |
+
}
|
351 |
|
352 |
|
353 |
|
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 |
}
|
368 |
/* End: Fullscreen */
|
369 |
|
373 |
}
|
374 |
|
375 |
.mejs-controls .mejs-mute button {
|
376 |
+
background-position: -16px -16px;
|
377 |
}
|
378 |
|
379 |
.mejs-controls .mejs-unmute button {
|
380 |
+
background-position: -16px 0;
|
381 |
}
|
382 |
|
383 |
.mejs-controls .mejs-volume-button {
|
522 |
}
|
523 |
|
524 |
.mejs-controls .mejs-captions-button button {
|
525 |
+
background-position: -48px 0;
|
526 |
}
|
527 |
.mejs-controls .mejs-captions-button .mejs-captions-selector {
|
528 |
visibility: hidden;
|
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;
|
559 |
list-style-type: none !important;
|
560 |
+
display: block;
|
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: 100px;
|
571 |
float: left;
|
572 |
padding: 4px 0 0 0;
|
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;
|
635 |
display: block;
|
636 |
+
white-space: nowrap;
|
637 |
text-overflow: ellipsis;
|
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;
|
644 |
margin: 3px 0 4px 0;
|
645 |
display: block;
|
646 |
+
white-space: nowrap;
|
647 |
text-overflow: ellipsis;
|
648 |
}
|
649 |
|
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 {
|
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 {
|
726 |
|
727 |
|
728 |
/* Start: picture controls */
|
729 |
+
.mejs-controls .mejs-picturecontrols-button {
|
730 |
background-position: -96px 0;
|
731 |
}
|
732 |
/* End: picture controls */
|
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;
|
802 |
list-style-type: none !important;
|
803 |
+
display: block;
|
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;
|
818 |
font-size: 10px;
|
819 |
}
|
820 |
/* End: SourceChooser */
|
821 |
+
|
822 |
+
|
823 |
+
/* Start: Postroll */
|
824 |
+
.mejs-postroll-layer {
|
825 |
+
position: absolute;
|
826 |
+
bottom: 0;
|
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;
|
834 |
+
}
|
835 |
+
.mejs-postroll-layer-content {
|
836 |
+
width: 100%;
|
837 |
+
height: 100%;
|
838 |
+
}
|
839 |
+
.mejs-postroll-close {
|
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;
|
847 |
+
z-index: 100;
|
848 |
+
cursor: pointer;
|
849 |
+
}
|
850 |
+
/* End: Postroll */
|
mediaelement/mediaelementplayer.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
7 |
*
|
8 |
* Copyright 2010-2012, John Dyer (http://j.hn/)
|
9 |
-
*
|
10 |
*
|
11 |
*/
|
12 |
if (typeof jQuery != 'undefined') {
|
@@ -14,1066 +14,1098 @@ if (typeof jQuery != 'undefined') {
|
|
14 |
} else if (typeof ender != 'undefined') {
|
15 |
mejs.$ = ender;
|
16 |
}
|
17 |
-
(function ($) {
|
18 |
-
|
19 |
-
// default player values
|
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
|
26 |
-
defaultVideoHeight: 270,
|
27 |
-
// if set, overrides <video width>
|
28 |
-
videoWidth: -1,
|
29 |
-
// if set, overrides <video height>
|
30 |
-
videoHeight: -1,
|
31 |
-
// default if the user doesn't specify
|
32 |
-
defaultAudioWidth: 400,
|
33 |
-
// default if the user doesn't specify
|
34 |
-
defaultAudioHeight: 30,
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
//
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
//
|
54 |
-
|
55 |
-
//
|
56 |
-
|
57 |
-
//
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
//
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
//
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
}
|
102 |
-
},
|
103 |
-
{
|
104 |
-
keys: [
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
player.
|
145 |
-
}
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
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 |
-
//
|
186 |
-
t.
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
//
|
250 |
-
t
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
(
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
t.
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
t.
|
329 |
-
}
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
t.
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
t.killControlsTimer();
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
t
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
//
|
515 |
-
t.
|
516 |
-
t.
|
517 |
-
|
518 |
-
|
519 |
-
//
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
//
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
t.
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
t.
|
754 |
-
|
755 |
-
//
|
756 |
-
|
757 |
-
.
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
}
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
if (
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
.hide()
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
.
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
}, false);
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
media.addEventListener('
|
947 |
-
loading.hide();
|
948 |
-
controls.find('.mejs-time-buffering').hide();
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
},
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
},
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
return this.
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1077 |
|
1078 |
(function($) {
|
1079 |
|
@@ -1141,7 +1173,8 @@ if (typeof jQuery != 'undefined') {
|
|
1141 |
media.pause();
|
1142 |
}
|
1143 |
if (media.currentTime > 0) {
|
1144 |
-
media.setCurrentTime(0);
|
|
|
1145 |
controls.find('.mejs-time-current').width('0px');
|
1146 |
controls.find('.mejs-time-handle').css('left', '0px');
|
1147 |
controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0) );
|
@@ -1185,18 +1218,25 @@ if (typeof jQuery != 'undefined') {
|
|
1185 |
// mouse position relative to the object
|
1186 |
var x = e.pageX,
|
1187 |
offset = total.offset(),
|
1188 |
-
width = total.outerWidth(),
|
1189 |
percentage = 0,
|
1190 |
newTime = 0,
|
1191 |
-
pos =
|
1192 |
|
1193 |
|
1194 |
-
if (
|
1195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1196 |
newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
|
1197 |
|
1198 |
// seek to where the mouse is
|
1199 |
-
if (mouseIsDown) {
|
1200 |
media.setCurrentTime(newTime);
|
1201 |
}
|
1202 |
|
@@ -1320,86 +1360,90 @@ if (typeof jQuery != 'undefined') {
|
|
1320 |
}
|
1321 |
});
|
1322 |
})(mejs.$);
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
+ (player.options.
|
1340 |
-
'</
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
|
|
|
|
|
|
|
|
1403 |
})(mejs.$);
|
1404 |
(function($) {
|
1405 |
|
@@ -1451,7 +1495,7 @@ if (typeof jQuery != 'undefined') {
|
|
1451 |
|
1452 |
positionVolumeHandle = function(volume, secondTry) {
|
1453 |
|
1454 |
-
if (!volumeSlider.is(':visible') && typeof secondTry
|
1455 |
volumeSlider.show();
|
1456 |
positionVolumeHandle(volume, true);
|
1457 |
volumeSlider.hide()
|
@@ -1484,7 +1528,7 @@ if (typeof jQuery != 'undefined') {
|
|
1484 |
newTop = totalHeight - (totalHeight * volume);
|
1485 |
|
1486 |
// handle
|
1487 |
-
volumeHandle.css('top', totalPosition.top + newTop - (volumeHandle.height() / 2));
|
1488 |
|
1489 |
// show the current visibility
|
1490 |
volumeCurrent.height(totalHeight - newTop );
|
@@ -1502,10 +1546,10 @@ if (typeof jQuery != 'undefined') {
|
|
1502 |
newLeft = totalWidth * volume;
|
1503 |
|
1504 |
// handle
|
1505 |
-
volumeHandle.css('left', totalPosition.left + newLeft - (volumeHandle.width() / 2));
|
1506 |
|
1507 |
// rezize the current part of the volume bar
|
1508 |
-
volumeCurrent.width( newLeft );
|
1509 |
}
|
1510 |
},
|
1511 |
handleVolumeMove = function(e) {
|
@@ -1581,487 +1625,485 @@ if (typeof jQuery != 'undefined') {
|
|
1581 |
mouseIsDown = false;
|
1582 |
$(document).unbind('.vol');
|
1583 |
|
1584 |
-
if (!mouseIsOver && mode == 'vertical') {
|
1585 |
-
volumeSlider.hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1586 |
}
|
1587 |
});
|
1588 |
-
|
1589 |
-
|
1590 |
-
return false;
|
1591 |
-
});
|
1592 |
|
1593 |
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1597 |
});
|
1598 |
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1608 |
}
|
|
|
|
|
|
|
|
|
1609 |
}
|
1610 |
-
}
|
1611 |
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
if (
|
1618 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1619 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1620 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1621 |
}
|
1622 |
});
|
1623 |
-
|
1624 |
-
})(mejs.$);
|
1625 |
|
1626 |
-
(
|
1627 |
-
|
1628 |
-
$.extend(mejs.MepDefaults, {
|
1629 |
-
usePluginFullScreen: true,
|
1630 |
-
newWindowCallback: function() { return '';},
|
1631 |
-
fullscreenText: 'Fullscreen'
|
1632 |
-
});
|
1633 |
-
|
1634 |
-
$.extend(MediaElementPlayer.prototype, {
|
1635 |
-
|
1636 |
-
isFullScreen: false,
|
1637 |
-
|
1638 |
-
isNativeFullScreen: false,
|
1639 |
-
|
1640 |
-
docStyleOverflow: null,
|
1641 |
-
|
1642 |
-
isInIframe: false,
|
1643 |
-
|
1644 |
-
buildfullscreen: function(player, controls, layers, media) {
|
1645 |
-
|
1646 |
-
if (!player.isVideo)
|
1647 |
-
return;
|
1648 |
-
|
1649 |
-
player.isInIframe = (window.location != window.parent.location);
|
1650 |
-
|
1651 |
-
// native events
|
1652 |
-
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
1653 |
-
|
1654 |
-
// chrome doesn't alays fire this in an iframe
|
1655 |
-
var target = null;
|
1656 |
-
|
1657 |
-
if (mejs.MediaFeatures.hasMozNativeFullScreen) {
|
1658 |
-
target = $(document);
|
1659 |
-
} else {
|
1660 |
-
target = player.container;
|
1661 |
-
}
|
1662 |
-
|
1663 |
-
target.bind(mejs.MediaFeatures.fullScreenEventName, function(e) {
|
1664 |
-
//player.container.bind('webkitfullscreenchange', function(e) {
|
1665 |
-
|
1666 |
-
|
1667 |
-
if (mejs.MediaFeatures.isFullScreen()) {
|
1668 |
-
player.isNativeFullScreen = true;
|
1669 |
-
// reset the controls once we are fully in full screen
|
1670 |
-
player.setControlsSize();
|
1671 |
-
} else {
|
1672 |
-
player.isNativeFullScreen = false;
|
1673 |
-
// when a user presses ESC
|
1674 |
-
// make sure to put the player back into place
|
1675 |
-
player.exitFullScreen();
|
1676 |
-
}
|
1677 |
-
});
|
1678 |
-
}
|
1679 |
-
|
1680 |
-
var t = this,
|
1681 |
-
normalHeight = 0,
|
1682 |
-
normalWidth = 0,
|
1683 |
-
container = player.container,
|
1684 |
-
fullscreenBtn =
|
1685 |
-
$('<div class="mejs-button mejs-fullscreen-button">' +
|
1686 |
-
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.fullscreenText + '"></button>' +
|
1687 |
-
'</div>')
|
1688 |
-
.appendTo(controls);
|
1689 |
-
|
1690 |
-
if (t.media.pluginType === 'native' || (!t.options.usePluginFullScreen && !mejs.MediaFeatures.isFirefox)) {
|
1691 |
-
|
1692 |
-
fullscreenBtn.click(function() {
|
1693 |
-
var isFullScreen = (mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || player.isFullScreen;
|
1694 |
-
|
1695 |
-
if (isFullScreen) {
|
1696 |
-
player.exitFullScreen();
|
1697 |
-
} else {
|
1698 |
-
player.enterFullScreen();
|
1699 |
-
}
|
1700 |
-
});
|
1701 |
-
|
1702 |
-
} else {
|
1703 |
-
|
1704 |
-
var hideTimeout = null,
|
1705 |
-
supportsPointerEvents = (function() {
|
1706 |
-
// TAKEN FROM MODERNIZR
|
1707 |
-
var element = document.createElement('x'),
|
1708 |
-
documentElement = document.documentElement,
|
1709 |
-
getComputedStyle = window.getComputedStyle,
|
1710 |
-
supports;
|
1711 |
-
if(!('pointerEvents' in element.style)){
|
1712 |
-
return false;
|
1713 |
-
}
|
1714 |
-
element.style.pointerEvents = 'auto';
|
1715 |
-
element.style.pointerEvents = 'x';
|
1716 |
-
documentElement.appendChild(element);
|
1717 |
-
supports = getComputedStyle &&
|
1718 |
-
getComputedStyle(element, '').pointerEvents === 'auto';
|
1719 |
-
documentElement.removeChild(element);
|
1720 |
-
return !!supports;
|
1721 |
-
})();
|
1722 |
-
|
1723 |
-
console.log('supportsPointerEvents', supportsPointerEvents);
|
1724 |
-
|
1725 |
-
if (supportsPointerEvents && !mejs.MediaFeatures.isOpera) { // opera doesn't allow this :(
|
1726 |
-
|
1727 |
-
// allows clicking through the fullscreen button and controls down directly to Flash
|
1728 |
-
|
1729 |
-
/*
|
1730 |
-
When a user puts his mouse over the fullscreen button, the controls are disabled
|
1731 |
-
So we put a div over the video and another one on iether side of the fullscreen button
|
1732 |
-
that caputre mouse movement
|
1733 |
-
and restore the controls once the mouse moves outside of the fullscreen button
|
1734 |
-
*/
|
1735 |
-
|
1736 |
-
var fullscreenIsDisabled = false,
|
1737 |
-
restoreControls = function() {
|
1738 |
-
if (fullscreenIsDisabled) {
|
1739 |
-
// hide the hovers
|
1740 |
-
videoHoverDiv.hide();
|
1741 |
-
controlsLeftHoverDiv.hide();
|
1742 |
-
controlsRightHoverDiv.hide();
|
1743 |
-
|
1744 |
-
// restore the control bar
|
1745 |
-
fullscreenBtn.css('pointer-events', '');
|
1746 |
-
t.controls.css('pointer-events', '');
|
1747 |
-
|
1748 |
-
// store for later
|
1749 |
-
fullscreenIsDisabled = false;
|
1750 |
-
}
|
1751 |
-
},
|
1752 |
-
videoHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
1753 |
-
controlsLeftHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
1754 |
-
controlsRightHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
|
1755 |
-
positionHoverDivs = function() {
|
1756 |
-
var style = {position: 'absolute', top: 0, left: 0}; //, backgroundColor: '#f00'};
|
1757 |
-
videoHoverDiv.css(style);
|
1758 |
-
controlsLeftHoverDiv.css(style);
|
1759 |
-
controlsRightHoverDiv.css(style);
|
1760 |
-
|
1761 |
-
// over video, but not controls
|
1762 |
-
videoHoverDiv
|
1763 |
-
.width( t.container.width() )
|
1764 |
-
.height( t.container.height() - t.controls.height() );
|
1765 |
-
|
1766 |
-
// over controls, but not the fullscreen button
|
1767 |
-
var fullScreenBtnOffset = fullscreenBtn.offset().left - t.container.offset().left;
|
1768 |
-
fullScreenBtnWidth = fullscreenBtn.outerWidth(true);
|
1769 |
-
|
1770 |
-
controlsLeftHoverDiv
|
1771 |
-
.width( fullScreenBtnOffset )
|
1772 |
-
.height( t.controls.height() )
|
1773 |
-
.css({top: t.container.height() - t.controls.height()});
|
1774 |
-
|
1775 |
-
// after the fullscreen button
|
1776 |
-
controlsRightHoverDiv
|
1777 |
-
.width( t.container.width() - fullScreenBtnOffset - fullScreenBtnWidth )
|
1778 |
-
.height( t.controls.height() )
|
1779 |
-
.css({top: t.container.height() - t.controls.height(),
|
1780 |
-
left: fullScreenBtnOffset + fullScreenBtnWidth});
|
1781 |
-
};
|
1782 |
-
|
1783 |
-
$(document).resize(function() {
|
1784 |
-
positionHoverDivs();
|
1785 |
-
});
|
1786 |
-
|
1787 |
-
// on hover, kill the fullscreen button's HTML handling, allowing clicks down to Flash
|
1788 |
-
fullscreenBtn
|
1789 |
-
.mouseover(function() {
|
1790 |
-
|
1791 |
-
if (!t.isFullScreen) {
|
1792 |
-
|
1793 |
-
var buttonPos = fullscreenBtn.offset(),
|
1794 |
-
containerPos = player.container.offset();
|
1795 |
-
|
1796 |
-
// move the button in Flash into place
|
1797 |
-
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, false);
|
1798 |
-
|
1799 |
-
// allows click through
|
1800 |
-
fullscreenBtn.css('pointer-events', 'none');
|
1801 |
-
t.controls.css('pointer-events', 'none');
|
1802 |
-
|
1803 |
-
// show the divs that will restore things
|
1804 |
-
videoHoverDiv.show();
|
1805 |
-
controlsRightHoverDiv.show();
|
1806 |
-
controlsLeftHoverDiv.show();
|
1807 |
-
positionHoverDivs();
|
1808 |
-
|
1809 |
-
fullscreenIsDisabled = true;
|
1810 |
-
}
|
1811 |
-
|
1812 |
-
});
|
1813 |
-
|
1814 |
-
// restore controls anytime the user enters or leaves fullscreen
|
1815 |
-
media.addEventListener('fullscreenchange', function(e) {
|
1816 |
-
restoreControls();
|
1817 |
-
});
|
1818 |
-
|
1819 |
-
|
1820 |
-
// the mouseout event doesn't work on the fullscren button, because we already killed the pointer-events
|
1821 |
-
// so we use the document.mousemove event to restore controls when the mouse moves outside the fullscreen button
|
1822 |
-
/*
|
1823 |
-
$(document).mousemove(function(e) {
|
1824 |
-
|
1825 |
-
// if the mouse is anywhere but the fullsceen button, then restore it all
|
1826 |
-
if (fullscreenIsDisabled) {
|
1827 |
-
|
1828 |
-
var fullscreenBtnPos = fullscreenBtn.offset();
|
1829 |
-
|
1830 |
-
|
1831 |
-
if (e.pageY < fullscreenBtnPos.top || e.pageY > fullscreenBtnPos.top + fullscreenBtn.outerHeight(true) ||
|
1832 |
-
e.pageX < fullscreenBtnPos.left || e.pageX > fullscreenBtnPos.left + fullscreenBtn.outerWidth(true)
|
1833 |
-
) {
|
1834 |
-
|
1835 |
-
fullscreenBtn.css('pointer-events', '');
|
1836 |
-
t.controls.css('pointer-events', '');
|
1837 |
-
|
1838 |
-
fullscreenIsDisabled = false;
|
1839 |
-
}
|
1840 |
-
}
|
1841 |
-
});
|
1842 |
-
*/
|
1843 |
-
|
1844 |
-
|
1845 |
-
} else {
|
1846 |
-
|
1847 |
-
// the hover state will show the fullscreen button in Flash to hover up and click
|
1848 |
-
|
1849 |
-
fullscreenBtn
|
1850 |
-
.mouseover(function() {
|
1851 |
-
|
1852 |
-
if (hideTimeout !== null) {
|
1853 |
-
clearTimeout(hideTimeout);
|
1854 |
-
delete hideTimeout;
|
1855 |
-
}
|
1856 |
-
|
1857 |
-
var buttonPos = fullscreenBtn.offset(),
|
1858 |
-
containerPos = player.container.offset();
|
1859 |
-
|
1860 |
-
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, true);
|
1861 |
-
|
1862 |
-
})
|
1863 |
-
.mouseout(function() {
|
1864 |
-
|
1865 |
-
if (hideTimeout !== null) {
|
1866 |
-
clearTimeout(hideTimeout);
|
1867 |
-
delete hideTimeout;
|
1868 |
-
}
|
1869 |
-
|
1870 |
-
hideTimeout = setTimeout(function() {
|
1871 |
-
media.hideFullscreenButton();
|
1872 |
-
}, 1500);
|
1873 |
-
|
1874 |
-
|
1875 |
-
});
|
1876 |
-
}
|
1877 |
-
}
|
1878 |
-
|
1879 |
-
player.fullscreenBtn = fullscreenBtn;
|
1880 |
-
|
1881 |
-
$(document).bind('keydown',function (e) {
|
1882 |
-
if (((mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || t.isFullScreen) && e.keyCode == 27) {
|
1883 |
-
player.exitFullScreen();
|
1884 |
-
}
|
1885 |
-
});
|
1886 |
-
|
1887 |
-
},
|
1888 |
-
enterFullScreen: function() {
|
1889 |
-
|
1890 |
-
var t = this;
|
1891 |
-
|
1892 |
-
// firefox+flash can't adjust plugin sizes without resetting :(
|
1893 |
-
if (t.media.pluginType !== 'native' && (mejs.MediaFeatures.isFirefox || t.options.usePluginFullScreen)) {
|
1894 |
-
//t.media.setFullscreen(true);
|
1895 |
-
//player.isFullScreen = true;
|
1896 |
-
return;
|
1897 |
-
}
|
1898 |
-
|
1899 |
-
// store overflow
|
1900 |
-
docStyleOverflow = document.documentElement.style.overflow;
|
1901 |
-
// set it to not show scroll bars so 100% will work
|
1902 |
-
document.documentElement.style.overflow = 'hidden';
|
1903 |
-
|
1904 |
-
// store sizing
|
1905 |
-
normalHeight = t.container.height();
|
1906 |
-
normalWidth = t.container.width();
|
1907 |
-
|
1908 |
-
// attempt to do true fullscreen (Safari 5.1 and Firefox Nightly only for now)
|
1909 |
-
if (t.media.pluginType === 'native') {
|
1910 |
-
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
1911 |
-
|
1912 |
-
mejs.MediaFeatures.requestFullScreen(t.container[0]);
|
1913 |
-
//return;
|
1914 |
-
|
1915 |
-
if (t.isInIframe) {
|
1916 |
-
// sometimes exiting from fullscreen doesn't work
|
1917 |
-
// notably in Chrome <iframe>. Fixed in version 17
|
1918 |
-
setTimeout(function checkFullscreen() {
|
1919 |
-
|
1920 |
-
if (t.isNativeFullScreen) {
|
1921 |
-
|
1922 |
-
// check if the video is suddenly not really fullscreen
|
1923 |
-
if ($(window).width() !== screen.width) {
|
1924 |
-
// manually exit
|
1925 |
-
t.exitFullScreen();
|
1926 |
-
} else {
|
1927 |
-
// test again
|
1928 |
-
setTimeout(checkFullscreen, 500);
|
1929 |
-
}
|
1930 |
-
}
|
1931 |
-
|
1932 |
-
|
1933 |
-
}, 500);
|
1934 |
-
}
|
1935 |
-
|
1936 |
-
} else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
|
1937 |
-
t.media.webkitEnterFullscreen();
|
1938 |
-
return;
|
1939 |
-
}
|
1940 |
-
}
|
1941 |
-
|
1942 |
-
// check for iframe launch
|
1943 |
-
if (t.isInIframe) {
|
1944 |
-
var url = t.options.newWindowCallback(this);
|
1945 |
-
|
1946 |
-
|
1947 |
-
if (url !== '') {
|
1948 |
-
|
1949 |
-
// launch immediately
|
1950 |
-
if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
1951 |
-
t.pause();
|
1952 |
-
window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
|
1953 |
-
return;
|
1954 |
-
} else {
|
1955 |
-
setTimeout(function() {
|
1956 |
-
if (!t.isNativeFullScreen) {
|
1957 |
-
t.pause();
|
1958 |
-
window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
|
1959 |
-
}
|
1960 |
-
}, 250);
|
1961 |
-
}
|
1962 |
-
}
|
1963 |
-
|
1964 |
-
}
|
1965 |
-
|
1966 |
-
// full window code
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
// make full size
|
1971 |
-
t.container
|
1972 |
-
.addClass('mejs-container-fullscreen')
|
1973 |
-
.width('100%')
|
1974 |
-
.height('100%');
|
1975 |
-
//.css({position: 'fixed', left: 0, top: 0, right: 0, bottom: 0, overflow: 'hidden', width: '100%', height: '100%', 'z-index': 1000});
|
1976 |
-
|
1977 |
-
// Only needed for safari 5.1 native full screen, can cause display issues elsewhere
|
1978 |
-
// Actually, it seems to be needed for IE8, too
|
1979 |
-
//if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
1980 |
-
setTimeout(function() {
|
1981 |
-
t.container.css({width: '100%', height: '100%'});
|
1982 |
-
t.setControlsSize();
|
1983 |
-
}, 500);
|
1984 |
-
//}
|
1985 |
-
|
1986 |
-
if (t.pluginType === 'native') {
|
1987 |
-
t.$media
|
1988 |
-
.width('100%')
|
1989 |
-
.height('100%');
|
1990 |
-
} else {
|
1991 |
-
t.container.find('object, embed, iframe')
|
1992 |
-
.width('100%')
|
1993 |
-
.height('100%');
|
1994 |
-
|
1995 |
-
//if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
1996 |
-
t.media.setVideoSize($(window).width(),$(window).height());
|
1997 |
-
//}
|
1998 |
-
}
|
1999 |
-
|
2000 |
-
t.layers.children('div')
|
2001 |
-
.width('100%')
|
2002 |
-
.height('100%');
|
2003 |
-
|
2004 |
-
if (t.fullscreenBtn) {
|
2005 |
-
t.fullscreenBtn
|
2006 |
-
.removeClass('mejs-fullscreen')
|
2007 |
-
.addClass('mejs-unfullscreen');
|
2008 |
-
}
|
2009 |
-
|
2010 |
-
t.setControlsSize();
|
2011 |
-
t.isFullScreen = true;
|
2012 |
-
},
|
2013 |
-
|
2014 |
-
exitFullScreen: function() {
|
2015 |
-
|
2016 |
-
var t = this;
|
2017 |
-
|
2018 |
-
// firefox can't adjust plugins
|
2019 |
-
if (t.media.pluginType !== 'native' && mejs.MediaFeatures.isFirefox) {
|
2020 |
-
t.media.setFullscreen(false);
|
2021 |
-
//player.isFullScreen = false;
|
2022 |
-
return;
|
2023 |
-
}
|
2024 |
-
|
2025 |
-
// come outo of native fullscreen
|
2026 |
-
if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || t.isFullScreen)) {
|
2027 |
-
mejs.MediaFeatures.cancelFullScreen();
|
2028 |
-
}
|
2029 |
-
|
2030 |
-
// restore scroll bars to document
|
2031 |
-
document.documentElement.style.overflow = docStyleOverflow;
|
2032 |
-
|
2033 |
-
t.container
|
2034 |
-
.removeClass('mejs-container-fullscreen')
|
2035 |
-
.width(normalWidth)
|
2036 |
-
.height(normalHeight);
|
2037 |
-
//.css({position: '', left: '', top: '', right: '', bottom: '', overflow: 'inherit', width: normalWidth + 'px', height: normalHeight + 'px', 'z-index': 1});
|
2038 |
-
|
2039 |
-
if (t.pluginType === 'native') {
|
2040 |
-
t.$media
|
2041 |
-
.width(normalWidth)
|
2042 |
-
.height(normalHeight);
|
2043 |
-
} else {
|
2044 |
-
t.container.find('object embed')
|
2045 |
-
.width(normalWidth)
|
2046 |
-
.height(normalHeight);
|
2047 |
-
|
2048 |
-
t.media.setVideoSize(normalWidth, normalHeight);
|
2049 |
-
}
|
2050 |
-
|
2051 |
-
t.layers.children('div')
|
2052 |
-
.width(normalWidth)
|
2053 |
-
.height(normalHeight);
|
2054 |
-
|
2055 |
-
t.fullscreenBtn
|
2056 |
-
.removeClass('mejs-unfullscreen')
|
2057 |
-
.addClass('mejs-fullscreen');
|
2058 |
-
|
2059 |
-
t.setControlsSize();
|
2060 |
-
t.isFullScreen = false;
|
2061 |
-
}
|
2062 |
-
});
|
2063 |
-
|
2064 |
-
})(mejs.$);
|
2065 |
|
2066 |
(function($) {
|
2067 |
|
@@ -2138,12 +2180,12 @@ if (typeof jQuery != 'undefined') {
|
|
2138 |
if (!player.options.alwaysShowControls) {
|
2139 |
// move with controls
|
2140 |
player.container
|
2141 |
-
.bind('
|
2142 |
// push captions above controls
|
2143 |
player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
|
2144 |
|
2145 |
})
|
2146 |
-
.bind('
|
2147 |
if (!media.paused) {
|
2148 |
// move back to normal place
|
2149 |
player.container.find('.mejs-captions-position').removeClass('mejs-captions-position-hover');
|
@@ -2229,35 +2271,33 @@ if (typeof jQuery != 'undefined') {
|
|
2229 |
|
2230 |
};
|
2231 |
|
2232 |
-
if (track.isTranslation) {
|
2233 |
-
|
2234 |
-
// translate the first track
|
2235 |
-
mejs.TrackFormatParser.translateTrackText(t.tracks[0].entries, t.tracks[0].srclang, track.srclang, t.options.googleApiKey, function(newOne) {
|
2236 |
|
2237 |
-
|
2238 |
-
|
|
|
|
|
2239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2240 |
after();
|
2241 |
-
});
|
2242 |
-
|
2243 |
-
} else {
|
2244 |
-
$.ajax({
|
2245 |
-
url: track.src,
|
2246 |
-
success: function(d) {
|
2247 |
-
|
2248 |
-
// parse the loaded file
|
2249 |
-
track.entries = mejs.TrackFormatParser.parse(d);
|
2250 |
-
after();
|
2251 |
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
2258 |
}
|
2259 |
-
}
|
2260 |
-
|
|
|
|
|
|
|
2261 |
},
|
2262 |
|
2263 |
enableTrackButton: function(lang, label) {
|
@@ -2475,53 +2515,106 @@ if (typeof jQuery != 'undefined') {
|
|
2475 |
Adapted from: http://www.delphiki.com/html5/playr
|
2476 |
*/
|
2477 |
mejs.TrackFormatParser = {
|
2478 |
-
|
2479 |
-
|
2480 |
-
|
2481 |
-
|
2482 |
-
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
|
2490 |
-
lines
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
for(; i<lines.length; i++) {
|
2496 |
-
// check for the line number
|
2497 |
-
if (this.pattern_identifier.exec(lines[i])){
|
2498 |
-
// skip to the next line where the start --> end time code should be
|
2499 |
-
i++;
|
2500 |
-
timecode = this.pattern_timecode.exec(lines[i]);
|
2501 |
-
|
2502 |
-
if (timecode && i<lines.length){
|
2503 |
i++;
|
2504 |
-
|
2505 |
-
|
2506 |
-
i
|
2507 |
-
while(lines[i] !== '' && i<lines.length){
|
2508 |
-
text = text + '\n' + lines[i];
|
2509 |
i++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2510 |
}
|
2511 |
-
|
2512 |
-
// Text is in a different array so I can use .join
|
2513 |
-
entries.text.push(text);
|
2514 |
-
entries.times.push(
|
2515 |
-
{
|
2516 |
-
start: mejs.Utility.timeCodeToSeconds(timecode[1]),
|
2517 |
-
stop: mejs.Utility.timeCodeToSeconds(timecode[3]),
|
2518 |
-
settings: timecode[5]
|
2519 |
-
});
|
2520 |
}
|
2521 |
}
|
|
|
2522 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2523 |
|
2524 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2525 |
}
|
2526 |
};
|
2527 |
|
@@ -2548,196 +2641,231 @@ if (typeof jQuery != 'undefined') {
|
|
2548 |
|
2549 |
})(mejs.$);
|
2550 |
|
2551 |
-
/*
|
2552 |
-
* ContextMenu Plugin
|
2553 |
-
*
|
2554 |
-
*
|
2555 |
-
*/
|
2556 |
-
|
2557 |
-
(function($) {
|
2558 |
-
|
2559 |
-
$.extend(mejs.MepDefaults,
|
2560 |
-
{ 'contextMenuItems': [
|
2561 |
-
// demo of a fullscreen option
|
2562 |
-
{
|
2563 |
-
render: function(player) {
|
2564 |
-
|
2565 |
-
// check for fullscreen plugin
|
2566 |
-
if (typeof player.enterFullScreen == 'undefined')
|
2567 |
-
return null;
|
2568 |
-
|
2569 |
-
if (player.isFullScreen) {
|
2570 |
-
return "Turn off Fullscreen";
|
2571 |
-
} else {
|
2572 |
-
return "Go Fullscreen";
|
2573 |
-
}
|
2574 |
-
},
|
2575 |
-
click: function(player) {
|
2576 |
-
if (player.isFullScreen) {
|
2577 |
-
player.exitFullScreen();
|
2578 |
-
} else {
|
2579 |
-
player.enterFullScreen();
|
2580 |
-
}
|
2581 |
-
}
|
2582 |
-
}
|
2583 |
-
,
|
2584 |
-
// demo of a mute/unmute button
|
2585 |
-
{
|
2586 |
-
render: function(player) {
|
2587 |
-
if (player.media.muted) {
|
2588 |
-
return "Unmute";
|
2589 |
-
} else {
|
2590 |
-
return "Mute";
|
2591 |
-
}
|
2592 |
-
},
|
2593 |
-
click: function(player) {
|
2594 |
-
if (player.media.muted) {
|
2595 |
-
player.setMuted(false);
|
2596 |
-
} else {
|
2597 |
-
player.setMuted(true);
|
2598 |
-
}
|
2599 |
-
}
|
2600 |
-
},
|
2601 |
-
// separator
|
2602 |
-
{
|
2603 |
-
isSeparator: true
|
2604 |
-
}
|
2605 |
-
,
|
2606 |
-
// demo of simple download video
|
2607 |
-
{
|
2608 |
-
render: function(player) {
|
2609 |
-
return "Download Video";
|
2610 |
-
},
|
2611 |
-
click: function(player) {
|
2612 |
-
window.location.href = player.media.currentSrc;
|
2613 |
-
}
|
2614 |
-
}
|
2615 |
-
]}
|
2616 |
-
);
|
2617 |
-
|
2618 |
-
|
2619 |
-
$.extend(MediaElementPlayer.prototype, {
|
2620 |
-
buildcontextmenu: function(player, controls, layers, media) {
|
2621 |
-
|
2622 |
-
// create context menu
|
2623 |
-
player.contextMenu = $('<div class="mejs-contextmenu"></div>')
|
2624 |
-
.appendTo($('body'))
|
2625 |
-
.hide();
|
2626 |
-
|
2627 |
-
// create events for showing context menu
|
2628 |
-
player.container.bind('contextmenu', function(e) {
|
2629 |
-
if (player.isContextMenuEnabled) {
|
2630 |
-
e.preventDefault();
|
2631 |
-
player.renderContextMenu(e.clientX-1, e.clientY-1);
|
2632 |
-
return false;
|
2633 |
-
}
|
2634 |
-
});
|
2635 |
-
player.container.bind('click', function() {
|
2636 |
-
player.contextMenu.hide();
|
2637 |
-
});
|
2638 |
-
player.contextMenu.bind('mouseleave', function() {
|
2639 |
-
|
2640 |
-
//console.log('context hover out');
|
2641 |
-
player.startContextMenuTimer();
|
2642 |
-
|
2643 |
-
});
|
2644 |
-
},
|
2645 |
-
|
2646 |
-
isContextMenuEnabled: true,
|
2647 |
-
enableContextMenu: function() {
|
2648 |
-
this.isContextMenuEnabled = true;
|
2649 |
-
},
|
2650 |
-
disableContextMenu: function() {
|
2651 |
-
this.isContextMenuEnabled = false;
|
2652 |
-
},
|
2653 |
-
|
2654 |
-
contextMenuTimeout: null,
|
2655 |
-
startContextMenuTimer: function() {
|
2656 |
-
//console.log('startContextMenuTimer');
|
2657 |
-
|
2658 |
-
var t = this;
|
2659 |
-
|
2660 |
-
t.killContextMenuTimer();
|
2661 |
-
|
2662 |
-
t.contextMenuTimer = setTimeout(function() {
|
2663 |
-
t.hideContextMenu();
|
2664 |
-
t.killContextMenuTimer();
|
2665 |
-
}, 750);
|
2666 |
-
},
|
2667 |
-
killContextMenuTimer: function() {
|
2668 |
-
var timer = this.contextMenuTimer;
|
2669 |
-
|
2670 |
-
//console.log('killContextMenuTimer', timer);
|
2671 |
-
|
2672 |
-
if (timer != null) {
|
2673 |
-
clearTimeout(timer);
|
2674 |
-
delete timer;
|
2675 |
-
timer = null;
|
2676 |
-
}
|
2677 |
-
},
|
2678 |
-
|
2679 |
-
hideContextMenu: function() {
|
2680 |
-
this.contextMenu.hide();
|
2681 |
-
},
|
2682 |
-
|
2683 |
-
renderContextMenu: function(x,y) {
|
2684 |
-
|
2685 |
-
// alway re-render the items so that things like "turn fullscreen on" and "turn fullscreen off" are always written correctly
|
2686 |
-
var t = this,
|
2687 |
-
html = '',
|
2688 |
-
items = t.options.contextMenuItems;
|
2689 |
-
|
2690 |
-
for (var i=0, il=items.length; i<il; i++) {
|
2691 |
-
|
2692 |
-
if (items[i].isSeparator) {
|
2693 |
-
html += '<div class="mejs-contextmenu-separator"></div>';
|
2694 |
-
} else {
|
2695 |
-
|
2696 |
-
var rendered = items[i].render(t);
|
2697 |
-
|
2698 |
-
// render can return null if the item doesn't need to be used at the moment
|
2699 |
-
if (rendered != null) {
|
2700 |
-
html += '<div class="mejs-contextmenu-item" data-itemindex="' + i + '" id="element-' + (Math.random()*1000000) + '">' + rendered + '</div>';
|
2701 |
-
}
|
2702 |
-
}
|
2703 |
-
}
|
2704 |
-
|
2705 |
-
// position and show the context menu
|
2706 |
-
t.contextMenu
|
2707 |
-
.empty()
|
2708 |
-
.append($(html))
|
2709 |
-
.css({top:y, left:x})
|
2710 |
-
.show();
|
2711 |
-
|
2712 |
-
// bind events
|
2713 |
-
t.contextMenu.find('.mejs-contextmenu-item').each(function() {
|
2714 |
-
|
2715 |
-
// which one is this?
|
2716 |
-
var $dom = $(this),
|
2717 |
-
itemIndex = parseInt( $dom.data('itemindex'), 10 ),
|
2718 |
-
item = t.options.contextMenuItems[itemIndex];
|
2719 |
-
|
2720 |
-
// bind extra functionality?
|
2721 |
-
if (typeof item.show != 'undefined')
|
2722 |
-
item.show( $dom , t);
|
2723 |
-
|
2724 |
-
// bind click action
|
2725 |
-
$dom.click(function() {
|
2726 |
-
// perform click action
|
2727 |
-
if (typeof item.click != 'undefined')
|
2728 |
-
item.click(t);
|
2729 |
-
|
2730 |
-
// close
|
2731 |
-
t.contextMenu.hide();
|
2732 |
-
});
|
2733 |
-
});
|
2734 |
-
|
2735 |
-
// stop the controls from hiding
|
2736 |
-
setTimeout(function() {
|
2737 |
-
t.killControlsTimer('rev3');
|
2738 |
-
}, 100);
|
2739 |
-
|
2740 |
-
}
|
2741 |
-
});
|
2742 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2743 |
})(mejs.$);
|
6 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
7 |
*
|
8 |
* Copyright 2010-2012, John Dyer (http://j.hn/)
|
9 |
+
* License: MIT
|
10 |
*
|
11 |
*/
|
12 |
if (typeof jQuery != 'undefined') {
|
14 |
} else if (typeof ender != 'undefined') {
|
15 |
mejs.$ = ender;
|
16 |
}
|
17 |
+
(function ($) {
|
18 |
+
|
19 |
+
// default player values
|
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
|
26 |
+
defaultVideoHeight: 270,
|
27 |
+
// if set, overrides <video width>
|
28 |
+
videoWidth: -1,
|
29 |
+
// if set, overrides <video height>
|
30 |
+
videoHeight: -1,
|
31 |
+
// default if the user doesn't specify
|
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 |
+
autoRewind: true,
|
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 |
+
// Enable click video element to toggle play/pause
|
70 |
+
clickToPlayPause: true,
|
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 |
+
media.play();
|
98 |
+
} else {
|
99 |
+
media.pause();
|
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 |
+
}
|
116 |
+
},
|
117 |
+
{
|
118 |
+
keys: [
|
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);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
},
|
135 |
+
{
|
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], // f
|
155 |
+
action: function(player, media) {
|
156 |
+
if (typeof player.enterFullScreen != 'undefined') {
|
157 |
+
if (player.isFullScreen) {
|
158 |
+
player.exitFullScreen();
|
159 |
+
} else {
|
160 |
+
player.enterFullScreen();
|
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.push(t);
|
204 |
+
|
205 |
+
// start up
|
206 |
+
t.init();
|
207 |
+
|
208 |
+
return t;
|
209 |
+
};
|
210 |
+
|
211 |
+
// actual player
|
212 |
+
mejs.MediaElementPlayer.prototype = {
|
213 |
+
|
214 |
+
hasFocus: false,
|
215 |
+
|
216 |
+
controlsAreVisible: true,
|
217 |
+
|
218 |
+
init: function() {
|
219 |
+
|
220 |
+
var
|
221 |
+
t = this,
|
222 |
+
mf = mejs.MediaFeatures,
|
223 |
+
// options for MediaElement (shim)
|
224 |
+
meOptions = $.extend(true, {}, t.options, {
|
225 |
+
success: function(media, domNode) { t.meReady(media, domNode); },
|
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 |
+
// no Issue found on iOS3 -ttroxell
|
248 |
+
|
249 |
+
// override Apple's autoplay override for iPads
|
250 |
+
if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
|
251 |
+
t.media.load();
|
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.svg ? 'svg' : 'no-svg') + '">'+
|
272 |
+
'<div class="mejs-inner">'+
|
273 |
+
'<div class="mejs-mediaelement"></div>'+
|
274 |
+
'<div class="mejs-layers"></div>'+
|
275 |
+
'<div class="mejs-controls"></div>'+
|
276 |
+
'<div class="mejs-clear"></div>'+
|
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 ' : '') +
|
285 |
+
(mf.isiOS ? 'mejs-ios ' : '') +
|
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 |
+
if (mf.isiOS) {
|
294 |
+
|
295 |
+
// sadly, you can't move nodes in iOS, so we have to destroy and recreate it!
|
296 |
+
var $newMedia = t.$media.clone();
|
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.height;
|
352 |
+
meOptions.pluginHeight = t.width;
|
353 |
+
}
|
354 |
+
|
355 |
+
|
356 |
+
|
357 |
+
// create MediaElement shim
|
358 |
+
mejs.MediaElement(t.$media[0], meOptions);
|
359 |
+
|
360 |
+
// controls are shown when loaded
|
361 |
+
t.container.trigger('controlsshown');
|
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 |
+
.css('visibility','visible')
|
375 |
+
.stop(true, true).fadeIn(200, function() {
|
376 |
+
t.controlsAreVisible = true;
|
377 |
+
t.container.trigger('controlsshown');
|
378 |
+
});
|
379 |
+
|
380 |
+
// any additional controls people might add and want to hide
|
381 |
+
t.container.find('.mejs-control')
|
382 |
+
.css('visibility','visible')
|
383 |
+
.stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
|
384 |
+
|
385 |
+
} else {
|
386 |
+
t.controls
|
387 |
+
.css('visibility','visible')
|
388 |
+
.css('display','block');
|
389 |
+
|
390 |
+
// any additional controls people might add and want to hide
|
391 |
+
t.container.find('.mejs-control')
|
392 |
+
.css('visibility','visible')
|
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 |
+
.css('visibility','hidden')
|
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 |
+
.css('visibility','hidden')
|
426 |
+
.css('display','block');
|
427 |
+
});
|
428 |
+
} else {
|
429 |
+
|
430 |
+
// hide main controls
|
431 |
+
t.controls
|
432 |
+
.css('visibility','hidden')
|
433 |
+
.css('display','block');
|
434 |
+
|
435 |
+
// hide others
|
436 |
+
t.container.find('.mejs-control')
|
437 |
+
.css('visibility','hidden')
|
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 : 1500;
|
452 |
+
|
453 |
+
t.killControlsTimer('start');
|
454 |
+
|
455 |
+
t.controlsTimer = setTimeout(function() {
|
456 |
+
//console.log('timer fired');
|
457 |
+
t.hideControls();
|
458 |
+
t.killControlsTimer('hide');
|
459 |
+
}, timeout);
|
460 |
+
},
|
461 |
+
|
462 |
+
killControlsTimer: function(src) {
|
463 |
+
|
464 |
+
var t = this;
|
465 |
+
|
466 |
+
if (t.controlsTimer !== null) {
|
467 |
+
clearTimeout(t.controlsTimer);
|
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 |
+
var t = this,
|
497 |
+
mf = mejs.MediaFeatures,
|
498 |
+
autoplayAttr = domNode.getAttribute('autoplay'),
|
499 |
+
autoplay = !(typeof autoplayAttr == 'undefined' || autoplayAttr === null || autoplayAttr === 'false'),
|
500 |
+
featureIndex,
|
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);
|
517 |
+
t.buildoverlays(t, t.controls, t.layers, t.media);
|
518 |
+
|
519 |
+
// grab for use by features
|
520 |
+
t.findTracks();
|
521 |
+
|
522 |
+
// add user-defined features/controls
|
523 |
+
for (featureIndex in t.options.features) {
|
524 |
+
feature = t.options.features[featureIndex];
|
525 |
+
if (t['build' + feature]) {
|
526 |
+
try {
|
527 |
+
t['build' + feature](t, t.controls, t.layers, t.media);
|
528 |
+
} catch (e) {
|
529 |
+
// TODO: report control error
|
530 |
+
//throw e;
|
531 |
+
//console.log('error building ' + feature);
|
532 |
+
//console.log(e);
|
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);
|
558 |
+
} else {
|
559 |
+
if (t.controlsEnabled) {
|
560 |
+
t.showControls(false);
|
561 |
+
}
|
562 |
+
}
|
563 |
+
});
|
564 |
+
|
565 |
+
} else {
|
566 |
+
// click to play/pause
|
567 |
+
t.media.addEventListener('click', function() {
|
568 |
+
if (t.options.clickToPlayPause) {
|
569 |
+
if (t.media.paused) {
|
570 |
+
t.media.play();
|
571 |
+
} else {
|
572 |
+
t.media.pause();
|
573 |
+
}
|
574 |
+
}
|
575 |
+
});
|
576 |
+
|
577 |
+
// show/hide controls
|
578 |
+
t.container
|
579 |
+
.bind('mouseenter mouseover', function () {
|
580 |
+
if (t.controlsEnabled) {
|
581 |
+
if (!t.options.alwaysShowControls) {
|
582 |
+
t.killControlsTimer('enter');
|
583 |
+
t.showControls();
|
584 |
+
t.startControlsTimer(2500);
|
585 |
+
}
|
586 |
+
}
|
587 |
+
})
|
588 |
+
.bind('mousemove', function() {
|
589 |
+
if (t.controlsEnabled) {
|
590 |
+
if (!t.controlsAreVisible) {
|
591 |
+
t.showControls();
|
592 |
+
}
|
593 |
+
//t.killControlsTimer('move');
|
594 |
+
if (!t.options.alwaysShowControls) {
|
595 |
+
t.startControlsTimer(2500);
|
596 |
+
}
|
597 |
+
}
|
598 |
+
})
|
599 |
+
.bind('mouseleave', function () {
|
600 |
+
if (t.controlsEnabled) {
|
601 |
+
if (!t.media.paused && !t.options.alwaysShowControls) {
|
602 |
+
t.startControlsTimer(1000);
|
603 |
+
}
|
604 |
+
}
|
605 |
+
});
|
606 |
+
}
|
607 |
+
|
608 |
+
// check for autoplay
|
609 |
+
if (autoplay && !t.options.alwaysShowControls) {
|
610 |
+
t.hideControls();
|
611 |
+
}
|
612 |
+
|
613 |
+
// resizer
|
614 |
+
if (t.options.enableAutosize) {
|
615 |
+
t.media.addEventListener('loadedmetadata', function(e) {
|
616 |
+
// if the <video height> was not set and the options.videoHeight was not set
|
617 |
+
// then resize to the real dimensions
|
618 |
+
if (t.options.videoHeight <= 0 && t.domNode.getAttribute('height') === null && !isNaN(e.target.videoHeight)) {
|
619 |
+
t.setPlayerSize(e.target.videoWidth, e.target.videoHeight);
|
620 |
+
t.setControlsSize();
|
621 |
+
t.media.setVideoSize(e.target.videoWidth, e.target.videoHeight);
|
622 |
+
}
|
623 |
+
}, false);
|
624 |
+
}
|
625 |
+
}
|
626 |
+
|
627 |
+
// EVENTS
|
628 |
+
|
629 |
+
// FOCUS: when a video starts playing, it takes focus from other players (possibily pausing them)
|
630 |
+
media.addEventListener('play', function() {
|
631 |
+
|
632 |
+
// go through all other players
|
633 |
+
for (var i=0, il=mejs.players.length; i<il; i++) {
|
634 |
+
var p = mejs.players[i];
|
635 |
+
if (p.id != t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended) {
|
636 |
+
p.pause();
|
637 |
+
}
|
638 |
+
p.hasFocus = false;
|
639 |
+
}
|
640 |
+
|
641 |
+
t.hasFocus = true;
|
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.pause();
|
655 |
+
|
656 |
+
if (t.setProgressRail)
|
657 |
+
t.setProgressRail();
|
658 |
+
if (t.setCurrentRail)
|
659 |
+
t.setCurrentRail();
|
660 |
+
|
661 |
+
if (t.options.loop) {
|
662 |
+
t.media.play();
|
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(e) {
|
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 |
+
$(window).resize(function() {
|
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 |
+
// TEMP: needs to be moved somewhere else
|
703 |
+
if (t.media.pluginType == 'youtube') {
|
704 |
+
t.container.find('.mejs-overlay-play').hide();
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
// force autoplay for HTML5
|
709 |
+
if (autoplay && media.pluginType == 'native') {
|
710 |
+
media.load();
|
711 |
+
media.play();
|
712 |
+
}
|
713 |
+
|
714 |
+
|
715 |
+
if (t.options.success) {
|
716 |
+
|
717 |
+
if (typeof t.options.success == 'string') {
|
718 |
+
window[t.options.success](t.media, t.domNode, t);
|
719 |
+
} else {
|
720 |
+
t.options.success(t.media, t.domNode, t);
|
721 |
+
}
|
722 |
+
}
|
723 |
+
},
|
724 |
+
|
725 |
+
handleError: function(e) {
|
726 |
+
var t = this;
|
727 |
+
|
728 |
+
t.controls.hide();
|
729 |
+
|
730 |
+
// Tell user that the file cannot be played
|
731 |
+
if (t.options.error) {
|
732 |
+
t.options.error(e);
|
733 |
+
}
|
734 |
+
},
|
735 |
+
|
736 |
+
setPlayerSize: function(width,height) {
|
737 |
+
var t = this;
|
738 |
+
|
739 |
+
if (typeof width != 'undefined')
|
740 |
+
t.width = width;
|
741 |
+
|
742 |
+
if (typeof height != 'undefined')
|
743 |
+
t.height = height;
|
744 |
+
|
745 |
+
// detect 100% mode - use currentStyle for IE since css() doesn't return percentages
|
746 |
+
if (t.height.toString().indexOf('%') > 0 || t.$node.css('max-width') === '100%' || (t.$node[0].currentStyle && t.$node[0].currentStyle.maxWidth === '100%')) {
|
747 |
+
|
748 |
+
// do we have the native dimensions yet?
|
749 |
+
var
|
750 |
+
nativeWidth = t.isVideo ? ((t.media.videoWidth && t.media.videoWidth > 0) ? t.media.videoWidth : t.options.defaultVideoWidth) : t.options.defaultAudioWidth,
|
751 |
+
nativeHeight = t.isVideo ? ((t.media.videoHeight && t.media.videoHeight > 0) ? t.media.videoHeight : t.options.defaultVideoHeight) : t.options.defaultAudioHeight,
|
752 |
+
parentWidth = t.container.parent().closest(':visible').width(),
|
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 |
+
if (t.media.setVideoSize) {
|
779 |
+
t.media.setVideoSize(parentWidth, newHeight);
|
780 |
+
}
|
781 |
+
}
|
782 |
+
|
783 |
+
// set the layers
|
784 |
+
t.layers.children('.mejs-layer')
|
785 |
+
.width('100%')
|
786 |
+
.height('100%');
|
787 |
+
}
|
788 |
+
|
789 |
+
|
790 |
+
} else {
|
791 |
+
|
792 |
+
t.container
|
793 |
+
.width(t.width)
|
794 |
+
.height(t.height);
|
795 |
+
|
796 |
+
t.layers.children('.mejs-layer')
|
797 |
+
.width(t.width)
|
798 |
+
.height(t.height);
|
799 |
+
|
800 |
+
}
|
801 |
+
},
|
802 |
+
|
803 |
+
setControlsSize: function() {
|
804 |
+
var t = this,
|
805 |
+
usedWidth = 0,
|
806 |
+
railWidth = 0,
|
807 |
+
rail = t.controls.find('.mejs-time-rail'),
|
808 |
+
total = t.controls.find('.mejs-time-total'),
|
809 |
+
current = t.controls.find('.mejs-time-current'),
|
810 |
+
loaded = t.controls.find('.mejs-time-loaded'),
|
811 |
+
others = rail.siblings();
|
812 |
+
|
813 |
+
|
814 |
+
// allow the size to come from custom CSS
|
815 |
+
if (t.options && !t.options.autosizeProgress) {
|
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 |
+
if ($(this).css('position') != 'absolute') {
|
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 |
+
// outer area
|
836 |
+
rail.width(railWidth);
|
837 |
+
// dark space
|
838 |
+
total.width(railWidth - (total.outerWidth(true) - total.width()));
|
839 |
+
|
840 |
+
if (t.setProgressRail)
|
841 |
+
t.setProgressRail();
|
842 |
+
if (t.setCurrentRail)
|
843 |
+
t.setCurrentRail();
|
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),
|
853 |
+
posterUrl = player.$media.attr('poster');
|
854 |
+
|
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 (posterUrl !== '' && posterUrl != null) {
|
862 |
+
t.setPoster(posterUrl);
|
863 |
+
} else {
|
864 |
+
poster.hide();
|
865 |
+
}
|
866 |
+
|
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 == 0) {
|
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 |
+
var t = this;
|
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(function() {
|
909 |
+
if (t.options.clickToPlayPause) {
|
910 |
+
if (media.paused) {
|
911 |
+
media.play();
|
912 |
+
} else {
|
913 |
+
media.pause();
|
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() {
|
928 |
+
bigPlay.hide();
|
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() {
|
942 |
+
loading.show();
|
943 |
+
controls.find('.mejs-time-buffering').show();
|
944 |
+
}, false);
|
945 |
+
|
946 |
+
media.addEventListener('seeked', function() {
|
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 |
+
}, false);
|
972 |
+
media.addEventListener('canplay',function() {
|
973 |
+
loading.hide();
|
974 |
+
controls.find('.mejs-time-buffering').hide();
|
975 |
+
}, false);
|
976 |
+
|
977 |
+
// error handling
|
978 |
+
media.addEventListener('error',function() {
|
979 |
+
loading.hide();
|
980 |
+
controls.find('.mejs-time-buffering').hide();
|
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 |
+
$(document).keydown(function(e) {
|
992 |
+
|
993 |
+
if (player.hasFocus && player.options.enableKeyboard) {
|
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 |
+
$(document).click(function(event) {
|
1014 |
+
if ($(event.target).closest('.mejs-container').length == 0) {
|
1015 |
+
player.hasFocus = false;
|
1016 |
+
}
|
1017 |
+
});
|
1018 |
+
|
1019 |
+
},
|
1020 |
+
|
1021 |
+
findTracks: function() {
|
1022 |
+
var t = this,
|
1023 |
+
tracktags = t.$media.find('track');
|
1024 |
+
|
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') || '',
|
1036 |
+
entries: [],
|
1037 |
+
isLoaded: false
|
1038 |
+
});
|
1039 |
+
});
|
1040 |
+
},
|
1041 |
+
changeSkin: function(className) {
|
1042 |
+
this.container[0].className = 'mejs-container ' + className;
|
1043 |
+
this.setPlayerSize(this.width, this.height);
|
1044 |
+
this.setControlsSize();
|
1045 |
+
},
|
1046 |
+
play: function() {
|
1047 |
+
this.media.play();
|
1048 |
+
},
|
1049 |
+
pause: function() {
|
1050 |
+
this.media.pause();
|
1051 |
+
},
|
1052 |
+
load: function() {
|
1053 |
+
this.media.load();
|
1054 |
+
},
|
1055 |
+
setMuted: function(muted) {
|
1056 |
+
this.media.setMuted(muted);
|
1057 |
+
},
|
1058 |
+
setCurrentTime: function(time) {
|
1059 |
+
this.media.setCurrentTime(time);
|
1060 |
+
},
|
1061 |
+
getCurrentTime: function() {
|
1062 |
+
return this.media.currentTime;
|
1063 |
+
},
|
1064 |
+
setVolume: function(volume) {
|
1065 |
+
this.media.setVolume(volume);
|
1066 |
+
},
|
1067 |
+
getVolume: function() {
|
1068 |
+
return this.media.volume;
|
1069 |
+
},
|
1070 |
+
setSrc: function(src) {
|
1071 |
+
this.media.setSrc(src);
|
1072 |
+
},
|
1073 |
+
remove: function() {
|
1074 |
+
var t = this;
|
1075 |
+
|
1076 |
+
if (t.media.pluginType === 'flash') {
|
1077 |
+
t.media.remove();
|
1078 |
+
} else if (t.media.pluginType === 'native') {
|
1079 |
+
t.$media.prop('controls', true);
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
// grab video and put it back in place
|
1083 |
+
if (!t.isDynamic) {
|
1084 |
+
t.$node.insertBefore(t.container)
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
t.container.remove();
|
1088 |
+
}
|
1089 |
+
};
|
1090 |
+
|
1091 |
+
// turn into jQuery plugin
|
1092 |
+
if (typeof jQuery != 'undefined') {
|
1093 |
+
jQuery.fn.mediaelementplayer = function (options) {
|
1094 |
+
return this.each(function () {
|
1095 |
+
new mejs.MediaElementPlayer(this, options);
|
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 |
+
|
1108 |
+
})(mejs.$);
|
1109 |
|
1110 |
(function($) {
|
1111 |
|
1173 |
media.pause();
|
1174 |
}
|
1175 |
if (media.currentTime > 0) {
|
1176 |
+
media.setCurrentTime(0);
|
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) );
|
1218 |
// mouse position relative to the object
|
1219 |
var x = e.pageX,
|
1220 |
offset = total.offset(),
|
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) {
|
1229 |
+
x = offset.left;
|
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;
|
1237 |
|
1238 |
// seek to where the mouse is
|
1239 |
+
if (mouseIsDown && newTime !== media.currentTime) {
|
1240 |
media.setCurrentTime(newTime);
|
1241 |
}
|
1242 |
|
1360 |
}
|
1361 |
});
|
1362 |
})(mejs.$);
|
1363 |
+
|
1364 |
+
(function($) {
|
1365 |
+
|
1366 |
+
// options
|
1367 |
+
$.extend(mejs.MepDefaults, {
|
1368 |
+
duration: -1,
|
1369 |
+
timeAndDurationSeparator: ' <span> | </span> '
|
1370 |
+
});
|
1371 |
+
|
1372 |
+
|
1373 |
+
// current and duration 00:00 / 00:00
|
1374 |
+
$.extend(MediaElementPlayer.prototype, {
|
1375 |
+
buildcurrent: function(player, controls, layers, media) {
|
1376 |
+
var t = this;
|
1377 |
+
|
1378 |
+
$('<div class="mejs-time">'+
|
1379 |
+
'<span class="mejs-currenttime">' + (player.options.alwaysShowHours ? '00:' : '')
|
1380 |
+
+ (player.options.showTimecodeFrameCount? '00:00:00':'00:00')+ '</span>'+
|
1381 |
+
'</div>')
|
1382 |
+
.appendTo(controls);
|
1383 |
+
|
1384 |
+
t.currenttime = t.controls.find('.mejs-currenttime');
|
1385 |
+
|
1386 |
+
media.addEventListener('timeupdate',function() {
|
1387 |
+
player.updateCurrent();
|
1388 |
+
}, false);
|
1389 |
+
},
|
1390 |
+
|
1391 |
+
|
1392 |
+
buildduration: function(player, controls, layers, media) {
|
1393 |
+
var t = this;
|
1394 |
+
|
1395 |
+
if (controls.children().last().find('.mejs-currenttime').length > 0) {
|
1396 |
+
$(t.options.timeAndDurationSeparator +
|
1397 |
+
'<span class="mejs-duration">' +
|
1398 |
+
(t.options.duration > 0 ?
|
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 {
|
1405 |
+
|
1406 |
+
// add class to current time
|
1407 |
+
controls.find('.mejs-currenttime').parent().addClass('mejs-currenttime-container');
|
1408 |
+
|
1409 |
+
$('<div class="mejs-time mejs-duration-container">'+
|
1410 |
+
'<span class="mejs-duration">' +
|
1411 |
+
(t.options.duration > 0 ?
|
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);
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
t.durationD = t.controls.find('.mejs-duration');
|
1421 |
+
|
1422 |
+
media.addEventListener('timeupdate',function() {
|
1423 |
+
player.updateDuration();
|
1424 |
+
}, false);
|
1425 |
+
},
|
1426 |
+
|
1427 |
+
updateCurrent: function() {
|
1428 |
+
var t = this;
|
1429 |
+
|
1430 |
+
if (t.currenttime) {
|
1431 |
+
t.currenttime.html(mejs.Utility.secondsToTimeCode(t.media.currentTime, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25));
|
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", t.media.duration > 3600);
|
1440 |
+
|
1441 |
+
if (t.media.duration && t.durationD) {
|
1442 |
+
t.durationD.html(mejs.Utility.secondsToTimeCode(t.media.duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25));
|
1443 |
+
}
|
1444 |
+
}
|
1445 |
+
});
|
1446 |
+
|
1447 |
})(mejs.$);
|
1448 |
(function($) {
|
1449 |
|
1495 |
|
1496 |
positionVolumeHandle = function(volume, secondTry) {
|
1497 |
|
1498 |
+
if (!volumeSlider.is(':visible') && typeof secondTry == 'undefined') {
|
1499 |
volumeSlider.show();
|
1500 |
positionVolumeHandle(volume, true);
|
1501 |
volumeSlider.hide()
|
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 );
|
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) {
|
1625 |
mouseIsDown = false;
|
1626 |
$(document).unbind('.vol');
|
1627 |
|
1628 |
+
if (!mouseIsOver && mode == 'vertical') {
|
1629 |
+
volumeSlider.hide();
|
1630 |
+
}
|
1631 |
+
});
|
1632 |
+
mouseIsDown = true;
|
1633 |
+
|
1634 |
+
return false;
|
1635 |
+
});
|
1636 |
+
|
1637 |
+
|
1638 |
+
// MUTE button
|
1639 |
+
mute.find('button').click(function() {
|
1640 |
+
media.setMuted( !media.muted );
|
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);
|
1648 |
+
mute.removeClass('mejs-mute').addClass('mejs-unmute');
|
1649 |
+
} else {
|
1650 |
+
positionVolumeHandle(media.volume);
|
1651 |
+
mute.removeClass('mejs-unmute').addClass('mejs-mute');
|
1652 |
+
}
|
1653 |
+
}
|
1654 |
+
}, false);
|
1655 |
+
|
1656 |
+
if (t.container.is(':visible')) {
|
1657 |
+
// set initial volume
|
1658 |
+
positionVolumeHandle(player.options.startVolume);
|
1659 |
+
|
1660 |
+
// shim gets the startvolume as a parameter, but we have to set it on the native <video> and <audio> elements
|
1661 |
+
if (media.pluginType === 'native') {
|
1662 |
+
media.setVolume(player.options.startVolume);
|
1663 |
+
}
|
1664 |
+
}
|
1665 |
+
}
|
1666 |
+
});
|
1667 |
+
|
1668 |
+
})(mejs.$);
|
1669 |
+
|
1670 |
+
(function($) {
|
1671 |
+
|
1672 |
+
$.extend(mejs.MepDefaults, {
|
1673 |
+
usePluginFullScreen: true,
|
1674 |
+
newWindowCallback: function() { return '';},
|
1675 |
+
fullscreenText: mejs.i18n.t('Fullscreen')
|
1676 |
+
});
|
1677 |
+
|
1678 |
+
$.extend(MediaElementPlayer.prototype, {
|
1679 |
+
|
1680 |
+
isFullScreen: false,
|
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 |
+
// native events
|
1696 |
+
if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
1697 |
+
|
1698 |
+
// chrome doesn't alays fire this in an iframe
|
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 |
+
normalHeight = 0,
|
1724 |
+
normalWidth = 0,
|
1725 |
+
container = player.container,
|
1726 |
+
fullscreenBtn =
|
1727 |
+
$('<div class="mejs-button mejs-fullscreen-button">' +
|
1728 |
+
'<button type="button" aria-controls="' + t.id + '" title="' + t.options.fullscreenText + '"></button>' +
|
1729 |
+
'</div>')
|
1730 |
+
.appendTo(controls);
|
1731 |
+
|
1732 |
+
if (t.media.pluginType === 'native' || (!t.options.usePluginFullScreen && !mejs.MediaFeatures.isFirefox)) {
|
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 |
+
} else {
|
1745 |
+
|
1746 |
+
var hideTimeout = null,
|
1747 |
+
supportsPointerEvents = (function() {
|
1748 |
+
// TAKEN FROM MODERNIZR
|
1749 |
+
var element = document.createElement('x'),
|
1750 |
+
documentElement = document.documentElement,
|
1751 |
+
getComputedStyle = window.getComputedStyle,
|
1752 |
+
supports;
|
1753 |
+
if(!('pointerEvents' in element.style)){
|
1754 |
+
return false;
|
1755 |
+
}
|
1756 |
+
element.style.pointerEvents = 'auto';
|
1757 |
+
element.style.pointerEvents = 'x';
|
1758 |
+
documentElement.appendChild(element);
|
1759 |
+
supports = getComputedStyle &&
|
1760 |
+
getComputedStyle(element, '').pointerEvents === 'auto';
|
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 |
+
$(document).resize(function() {
|
1826 |
+
positionHoverDivs();
|
1827 |
+
});
|
1828 |
+
|
1829 |
+
// on hover, kill the fullscreen button's HTML handling, allowing clicks down to Flash
|
1830 |
+
fullscreenBtn
|
1831 |
+
.mouseover(function() {
|
1832 |
+
|
1833 |
+
if (!t.isFullScreen) {
|
1834 |
+
|
1835 |
+
var buttonPos = fullscreenBtn.offset(),
|
1836 |
+
containerPos = player.container.offset();
|
1837 |
+
|
1838 |
+
// move the button in Flash into place
|
1839 |
+
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, false);
|
1840 |
+
|
1841 |
+
// allows click through
|
1842 |
+
fullscreenBtn.css('pointer-events', 'none');
|
1843 |
+
t.controls.css('pointer-events', 'none');
|
1844 |
+
|
1845 |
+
// show the divs that will restore things
|
1846 |
+
videoHoverDiv.show();
|
1847 |
+
controlsRightHoverDiv.show();
|
1848 |
+
controlsLeftHoverDiv.show();
|
1849 |
+
positionHoverDivs();
|
1850 |
+
|
1851 |
+
fullscreenIsDisabled = true;
|
1852 |
+
}
|
1853 |
+
|
1854 |
+
});
|
1855 |
+
|
1856 |
+
// restore controls anytime the user enters or leaves fullscreen
|
1857 |
+
media.addEventListener('fullscreenchange', function(e) {
|
1858 |
+
restoreControls();
|
1859 |
+
});
|
1860 |
+
|
1861 |
+
|
1862 |
+
// the mouseout event doesn't work on the fullscren button, because we already killed the pointer-events
|
1863 |
+
// so we use the document.mousemove event to restore controls when the mouse moves outside the fullscreen button
|
1864 |
+
/*
|
1865 |
+
$(document).mousemove(function(e) {
|
1866 |
+
|
1867 |
+
// if the mouse is anywhere but the fullsceen button, then restore it all
|
1868 |
+
if (fullscreenIsDisabled) {
|
1869 |
+
|
1870 |
+
var fullscreenBtnPos = fullscreenBtn.offset();
|
1871 |
+
|
1872 |
+
|
1873 |
+
if (e.pageY < fullscreenBtnPos.top || e.pageY > fullscreenBtnPos.top + fullscreenBtn.outerHeight(true) ||
|
1874 |
+
e.pageX < fullscreenBtnPos.left || e.pageX > fullscreenBtnPos.left + fullscreenBtn.outerWidth(true)
|
1875 |
+
) {
|
1876 |
+
|
1877 |
+
fullscreenBtn.css('pointer-events', '');
|
1878 |
+
t.controls.css('pointer-events', '');
|
1879 |
+
|
1880 |
+
fullscreenIsDisabled = false;
|
1881 |
+
}
|
1882 |
}
|
1883 |
});
|
1884 |
+
*/
|
|
|
|
|
|
|
1885 |
|
1886 |
|
1887 |
+
} else {
|
1888 |
+
|
1889 |
+
// the hover state will show the fullscreen button in Flash to hover up and click
|
1890 |
+
|
1891 |
+
fullscreenBtn
|
1892 |
+
.mouseover(function() {
|
1893 |
+
|
1894 |
+
if (hideTimeout !== null) {
|
1895 |
+
clearTimeout(hideTimeout);
|
1896 |
+
delete hideTimeout;
|
1897 |
+
}
|
1898 |
+
|
1899 |
+
var buttonPos = fullscreenBtn.offset(),
|
1900 |
+
containerPos = player.container.offset();
|
1901 |
+
|
1902 |
+
media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, true);
|
1903 |
+
|
1904 |
+
})
|
1905 |
+
.mouseout(function() {
|
1906 |
+
|
1907 |
+
if (hideTimeout !== null) {
|
1908 |
+
clearTimeout(hideTimeout);
|
1909 |
+
delete hideTimeout;
|
1910 |
+
}
|
1911 |
+
|
1912 |
+
hideTimeout = setTimeout(function() {
|
1913 |
+
media.hideFullscreenButton();
|
1914 |
+
}, 1500);
|
1915 |
+
|
1916 |
+
|
1917 |
+
});
|
1918 |
+
}
|
1919 |
+
}
|
1920 |
+
|
1921 |
+
player.fullscreenBtn = fullscreenBtn;
|
1922 |
+
|
1923 |
+
$(document).bind('keydown',function (e) {
|
1924 |
+
if (((mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || t.isFullScreen) && e.keyCode == 27) {
|
1925 |
+
player.exitFullScreen();
|
1926 |
+
}
|
1927 |
});
|
1928 |
|
1929 |
+
},
|
1930 |
+
enterFullScreen: function() {
|
1931 |
+
|
1932 |
+
var t = this;
|
1933 |
+
|
1934 |
+
// firefox+flash can't adjust plugin sizes without resetting :(
|
1935 |
+
if (t.media.pluginType !== 'native' && (mejs.MediaFeatures.isFirefox || t.options.usePluginFullScreen)) {
|
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 |
+
document.documentElement.style.overflow = 'hidden';
|
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 |
+
} else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
|
1979 |
+
t.media.webkitEnterFullscreen();
|
1980 |
+
return;
|
1981 |
}
|
1982 |
+
}
|
1983 |
|
1984 |
+
// check for iframe launch
|
1985 |
+
if (t.isInIframe) {
|
1986 |
+
var url = t.options.newWindowCallback(this);
|
1987 |
+
|
1988 |
+
|
1989 |
+
if (url !== '') {
|
1990 |
+
|
1991 |
+
// launch immediately
|
1992 |
+
if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
1993 |
+
t.pause();
|
1994 |
+
window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
|
1995 |
+
return;
|
1996 |
+
} else {
|
1997 |
+
setTimeout(function() {
|
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 |
+
}, 250);
|
2003 |
+
}
|
2004 |
}
|
2005 |
+
|
2006 |
+
}
|
2007 |
+
|
2008 |
+
// full window code
|
2009 |
+
|
2010 |
+
|
2011 |
+
|
2012 |
+
// make full size
|
2013 |
+
t.container
|
2014 |
+
.addClass('mejs-container-fullscreen')
|
2015 |
+
.width('100%')
|
2016 |
+
.height('100%');
|
2017 |
+
//.css({position: 'fixed', left: 0, top: 0, right: 0, bottom: 0, overflow: 'hidden', width: '100%', height: '100%', 'z-index': 1000});
|
2018 |
+
|
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('object, embed, iframe')
|
2034 |
+
.width('100%')
|
2035 |
+
.height('100%');
|
2036 |
+
|
2037 |
+
//if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
|
2038 |
+
t.media.setVideoSize($(window).width(),$(window).height());
|
2039 |
+
//}
|
2040 |
+
}
|
2041 |
+
|
2042 |
+
t.layers.children('div')
|
2043 |
+
.width('100%')
|
2044 |
+
.height('100%');
|
2045 |
+
|
2046 |
+
if (t.fullscreenBtn) {
|
2047 |
+
t.fullscreenBtn
|
2048 |
+
.removeClass('mejs-fullscreen')
|
2049 |
+
.addClass('mejs-unfullscreen');
|
2050 |
+
}
|
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 outo of native fullscreen
|
2068 |
+
if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || t.isFullScreen)) {
|
2069 |
+
mejs.MediaFeatures.cancelFullScreen();
|
2070 |
+
}
|
2071 |
+
|
2072 |
+
// restore scroll bars to document
|
2073 |
+
document.documentElement.style.overflow = docStyleOverflow;
|
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('object embed')
|
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 |
+
t.fullscreenBtn
|
2098 |
+
.removeClass('mejs-unfullscreen')
|
2099 |
+
.addClass('mejs-fullscreen');
|
2100 |
+
|
2101 |
+
t.setControlsSize();
|
2102 |
+
t.isFullScreen = false;
|
2103 |
}
|
2104 |
});
|
|
|
|
|
2105 |
|
2106 |
+
})(mejs.$);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2107 |
|
2108 |
(function($) {
|
2109 |
|
2180 |
if (!player.options.alwaysShowControls) {
|
2181 |
// move with controls
|
2182 |
player.container
|
2183 |
+
.bind('controlsshown', function () {
|
2184 |
// push captions above controls
|
2185 |
player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
|
2186 |
|
2187 |
})
|
2188 |
+
.bind('controlshidden', function () {
|
2189 |
if (!media.paused) {
|
2190 |
// move back to normal place
|
2191 |
player.container.find('.mejs-captions-position').removeClass('mejs-captions-position-hover');
|
2271 |
|
2272 |
};
|
2273 |
|
|
|
|
|
|
|
|
|
2274 |
|
2275 |
+
$.ajax({
|
2276 |
+
url: track.src,
|
2277 |
+
dataType: "text",
|
2278 |
+
success: function(d) {
|
2279 |
|
2280 |
+
// parse the loaded file
|
2281 |
+
if (typeof d == "string" && (/<tt\s+xml/ig).exec(d)) {
|
2282 |
+
track.entries = mejs.TrackFormatParser.dfxp.parse(d);
|
2283 |
+
} else {
|
2284 |
+
track.entries = mejs.TrackFormatParser.webvvt.parse(d);
|
2285 |
+
}
|
2286 |
+
|
2287 |
after();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2288 |
|
2289 |
+
if (track.kind == 'chapters') {
|
2290 |
+
t.media.addEventListener('play', function(e) {
|
2291 |
+
if (t.media.duration > 0) {
|
2292 |
+
t.displayChapters(track);
|
2293 |
+
}
|
2294 |
+
}, false);
|
2295 |
}
|
2296 |
+
},
|
2297 |
+
error: function() {
|
2298 |
+
t.loadNextTrack();
|
2299 |
+
}
|
2300 |
+
});
|
2301 |
},
|
2302 |
|
2303 |
enableTrackButton: function(lang, label) {
|
2515 |
Adapted from: http://www.delphiki.com/html5/playr
|
2516 |
*/
|
2517 |
mejs.TrackFormatParser = {
|
2518 |
+
webvvt: {
|
2519 |
+
// match start "chapter-" (or anythingelse)
|
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 |
+
// check for the line number
|
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 |
+
if (timecode && i<lines.length){
|
|
|
|
|
2538 |
i++;
|
2539 |
+
// grab all the (possibly multi-line) text that follows
|
2540 |
+
text = lines[i];
|
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 |
}
|
2560 |
+
},
|
2561 |
+
// Thanks to Justin Capella: https://github.com/johndyer/mediaelement/pull/420
|
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 |
+
|
2576 |
+
|
2577 |
+
if (styleNode.length) {
|
2578 |
+
var attributes = styleNode.removeAttr("id").get(0).attributes;
|
2579 |
+
if (attributes.length) {
|
2580 |
+
styles = {};
|
2581 |
+
for (i = 0; i < attributes.length; i++) {
|
2582 |
+
styles[attributes[i].name.split(":")[1]] = attributes[i].value;
|
2583 |
+
}
|
2584 |
+
}
|
2585 |
+
}
|
2586 |
|
2587 |
+
for(i = 0; i<lines.length; i++) {
|
2588 |
+
var style;
|
2589 |
+
var _temp_times = {
|
2590 |
+
start: null,
|
2591 |
+
stop: null,
|
2592 |
+
style: null
|
2593 |
+
};
|
2594 |
+
if (lines.eq(i).attr("begin")) _temp_times.start = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i).attr("begin"));
|
2595 |
+
if (!_temp_times.start && lines.eq(i-1).attr("end")) _temp_times.start = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i-1).attr("end"));
|
2596 |
+
if (lines.eq(i).attr("end")) _temp_times.stop = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i).attr("end"));
|
2597 |
+
if (!_temp_times.stop && lines.eq(i+1).attr("begin")) _temp_times.stop = mejs.Utility.convertSMPTEtoSeconds(lines.eq(i+1).attr("begin"));
|
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 == 0) _temp_times.start = 0.200;
|
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 |
+
}
|
2613 |
+
},
|
2614 |
+
split2: function (text, regex) {
|
2615 |
+
// normal version for compliant browsers
|
2616 |
+
// see below for IE fix
|
2617 |
+
return text.split(regex);
|
2618 |
}
|
2619 |
};
|
2620 |
|
2641 |
|
2642 |
})(mejs.$);
|
2643 |
|
2644 |
+
/*
|
2645 |
+
* ContextMenu Plugin
|
2646 |
+
*
|
2647 |
+
*
|
2648 |
+
*/
|
2649 |
+
|
2650 |
+
(function($) {
|
2651 |
+
|
2652 |
+
$.extend(mejs.MepDefaults,
|
2653 |
+
{ 'contextMenuItems': [
|
2654 |
+
// demo of a fullscreen option
|
2655 |
+
{
|
2656 |
+
render: function(player) {
|
2657 |
+
|
2658 |
+
// check for fullscreen plugin
|
2659 |
+
if (typeof player.enterFullScreen == 'undefined')
|
2660 |
+
return null;
|
2661 |
+
|
2662 |
+
if (player.isFullScreen) {
|
2663 |
+
return "Turn off Fullscreen";
|
2664 |
+
} else {
|
2665 |
+
return "Go Fullscreen";
|
2666 |
+
}
|
2667 |
+
},
|
2668 |
+
click: function(player) {
|
2669 |
+
if (player.isFullScreen) {
|
2670 |
+
player.exitFullScreen();
|
2671 |
+
} else {
|
2672 |
+
player.enterFullScreen();
|
2673 |
+
}
|
2674 |
+
}
|
2675 |
+
}
|
2676 |
+
,
|
2677 |
+
// demo of a mute/unmute button
|
2678 |
+
{
|
2679 |
+
render: function(player) {
|
2680 |
+
if (player.media.muted) {
|
2681 |
+
return "Unmute";
|
2682 |
+
} else {
|
2683 |
+
return "Mute";
|
2684 |
+
}
|
2685 |
+
},
|
2686 |
+
click: function(player) {
|
2687 |
+
if (player.media.muted) {
|
2688 |
+
player.setMuted(false);
|
2689 |
+
} else {
|
2690 |
+
player.setMuted(true);
|
2691 |
+
}
|
2692 |
+
}
|
2693 |
+
},
|
2694 |
+
// separator
|
2695 |
+
{
|
2696 |
+
isSeparator: true
|
2697 |
+
}
|
2698 |
+
,
|
2699 |
+
// demo of simple download video
|
2700 |
+
{
|
2701 |
+
render: function(player) {
|
2702 |
+
return "Download Video";
|
2703 |
+
},
|
2704 |
+
click: function(player) {
|
2705 |
+
window.location.href = player.media.currentSrc;
|
2706 |
+
}
|
2707 |
+
}
|
2708 |
+
]}
|
2709 |
+
);
|
2710 |
+
|
2711 |
+
|
2712 |
+
$.extend(MediaElementPlayer.prototype, {
|
2713 |
+
buildcontextmenu: function(player, controls, layers, media) {
|
2714 |
+
|
2715 |
+
// create context menu
|
2716 |
+
player.contextMenu = $('<div class="mejs-contextmenu"></div>')
|
2717 |
+
.appendTo($('body'))
|
2718 |
+
.hide();
|
2719 |
+
|
2720 |
+
// create events for showing context menu
|
2721 |
+
player.container.bind('contextmenu', function(e) {
|
2722 |
+
if (player.isContextMenuEnabled) {
|
2723 |
+
e.preventDefault();
|
2724 |
+
player.renderContextMenu(e.clientX-1, e.clientY-1);
|
2725 |
+
return false;
|
2726 |
+
}
|
2727 |
+
});
|
2728 |
+
player.container.bind('click', function() {
|
2729 |
+
player.contextMenu.hide();
|
2730 |
+
});
|
2731 |
+
player.contextMenu.bind('mouseleave', function() {
|
2732 |
+
|
2733 |
+
//console.log('context hover out');
|
2734 |
+
player.startContextMenuTimer();
|
2735 |
+
|
2736 |
+
});
|
2737 |
+
},
|
2738 |
+
|
2739 |
+
isContextMenuEnabled: true,
|
2740 |
+
enableContextMenu: function() {
|
2741 |
+
this.isContextMenuEnabled = true;
|
2742 |
+
},
|
2743 |
+
disableContextMenu: function() {
|
2744 |
+
this.isContextMenuEnabled = false;
|
2745 |
+
},
|
2746 |
+
|
2747 |
+
contextMenuTimeout: null,
|
2748 |
+
startContextMenuTimer: function() {
|
2749 |
+
//console.log('startContextMenuTimer');
|
2750 |
+
|
2751 |
+
var t = this;
|
2752 |
+
|
2753 |
+
t.killContextMenuTimer();
|
2754 |
+
|
2755 |
+
t.contextMenuTimer = setTimeout(function() {
|
2756 |
+
t.hideContextMenu();
|
2757 |
+
t.killContextMenuTimer();
|
2758 |
+
}, 750);
|
2759 |
+
},
|
2760 |
+
killContextMenuTimer: function() {
|
2761 |
+
var timer = this.contextMenuTimer;
|
2762 |
+
|
2763 |
+
//console.log('killContextMenuTimer', timer);
|
2764 |
+
|
2765 |
+
if (timer != null) {
|
2766 |
+
clearTimeout(timer);
|
2767 |
+
delete timer;
|
2768 |
+
timer = null;
|
2769 |
+
}
|
2770 |
+
},
|
2771 |
+
|
2772 |
+
hideContextMenu: function() {
|
2773 |
+
this.contextMenu.hide();
|
2774 |
+
},
|
2775 |
+
|
2776 |
+
renderContextMenu: function(x,y) {
|
2777 |
+
|
2778 |
+
// alway re-render the items so that things like "turn fullscreen on" and "turn fullscreen off" are always written correctly
|
2779 |
+
var t = this,
|
2780 |
+
html = '',
|
2781 |
+
items = t.options.contextMenuItems;
|
2782 |
+
|
2783 |
+
for (var i=0, il=items.length; i<il; i++) {
|
2784 |
+
|
2785 |
+
if (items[i].isSeparator) {
|
2786 |
+
html += '<div class="mejs-contextmenu-separator"></div>';
|
2787 |
+
} else {
|
2788 |
+
|
2789 |
+
var rendered = items[i].render(t);
|
2790 |
+
|
2791 |
+
// render can return null if the item doesn't need to be used at the moment
|
2792 |
+
if (rendered != null) {
|
2793 |
+
html += '<div class="mejs-contextmenu-item" data-itemindex="' + i + '" id="element-' + (Math.random()*1000000) + '">' + rendered + '</div>';
|
2794 |
+
}
|
2795 |
+
}
|
2796 |
+
}
|
2797 |
+
|
2798 |
+
// position and show the context menu
|
2799 |
+
t.contextMenu
|
2800 |
+
.empty()
|
2801 |
+
.append($(html))
|
2802 |
+
.css({top:y, left:x})
|
2803 |
+
.show();
|
2804 |
+
|
2805 |
+
// bind events
|
2806 |
+
t.contextMenu.find('.mejs-contextmenu-item').each(function() {
|
2807 |
+
|
2808 |
+
// which one is this?
|
2809 |
+
var $dom = $(this),
|
2810 |
+
itemIndex = parseInt( $dom.data('itemindex'), 10 ),
|
2811 |
+
item = t.options.contextMenuItems[itemIndex];
|
2812 |
+
|
2813 |
+
// bind extra functionality?
|
2814 |
+
if (typeof item.show != 'undefined')
|
2815 |
+
item.show( $dom , t);
|
2816 |
+
|
2817 |
+
// bind click action
|
2818 |
+
$dom.click(function() {
|
2819 |
+
// perform click action
|
2820 |
+
if (typeof item.click != 'undefined')
|
2821 |
+
item.click(t);
|
2822 |
+
|
2823 |
+
// close
|
2824 |
+
t.contextMenu.hide();
|
2825 |
+
});
|
2826 |
+
});
|
2827 |
+
|
2828 |
+
// stop the controls from hiding
|
2829 |
+
setTimeout(function() {
|
2830 |
+
t.killControlsTimer('rev3');
|
2831 |
+
}, 100);
|
2832 |
+
|
2833 |
+
}
|
2834 |
+
});
|
2835 |
+
|
2836 |
+
})(mejs.$);
|
2837 |
+
/**
|
2838 |
+
* Postroll plugin
|
2839 |
+
*/
|
2840 |
+
(function($) {
|
2841 |
+
|
2842 |
+
$.extend(mejs.MepDefaults, {
|
2843 |
+
postrollCloseText: mejs.i18n.t('Close')
|
2844 |
+
});
|
2845 |
+
|
2846 |
+
// Postroll
|
2847 |
+
$.extend(MediaElementPlayer.prototype, {
|
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;">' + t.options.postrollCloseText + '</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(layers).hide();
|
2856 |
+
|
2857 |
+
t.media.addEventListener('ended', function (e) {
|
2858 |
+
$.ajax({
|
2859 |
+
dataType: 'html',
|
2860 |
+
url: postrollLink,
|
2861 |
+
success: function (data, textStatus) {
|
2862 |
+
layers.find('.mejs-postroll-layer-content').html(data);
|
2863 |
+
}
|
2864 |
+
});
|
2865 |
+
player.postroll.show();
|
2866 |
+
}, false);
|
2867 |
+
}
|
2868 |
+
}
|
2869 |
+
});
|
2870 |
+
|
2871 |
})(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;}.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.png) no-repeat;}.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.png) no-repeat;}.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;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-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-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;}
|
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;}
|
mediaelement/mediaelementplayer.min.js
CHANGED
@@ -6,83 +6,89 @@
|
|
6 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
7 |
*
|
8 |
* Copyright 2010-2012, John Dyer (http://j.hn/)
|
9 |
-
*
|
10 |
*
|
11 |
*/if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
|
12 |
-
(function(f){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,
|
13 |
-
"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 |
-
228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}
|
15 |
-
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 |
-
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.
|
18 |
-
|
19 |
-
a.options["
|
20 |
-
"
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
function(){
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
30 |
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)-
|
31 |
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==
|
32 |
-
0)c=f('<img width="100%" height="100%" />').appendTo(b);c.attr("src",a)},buildoverlays:function(a,b,c,d){if(a.isVideo){var
|
33 |
-
d.pause()});d.addEventListener("play",function(){
|
34 |
-
false);d.addEventListener("waiting",function(){
|
35 |
-
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);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"),
|
36 |
-
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)},
|
37 |
-
getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){if(this.media.pluginType
|
38 |
window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
|
39 |
(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);
|
40 |
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.$);
|
41 |
-
(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);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));
|
42 |
b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-poster").show()}})}})})(mejs.$);
|
43 |
(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=
|
44 |
-
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(
|
45 |
-
1){p=true;n(
|
46 |
-
a.setCurrentRail(
|
47 |
-
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.$);
|
48 |
(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,
|
49 |
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");
|
50 |
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()},
|
51 |
-
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(){if(this.media.duration&&this.durationD)this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,
|
|
|
52 |
(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+
|
53 |
'"></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),
|
54 |
-
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,
|
55 |
-
if(e=="vertical"){var r=h.height(),s=h.position(),t=r-r*j;n.css("top",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",s.left+r-n.width()/2);o.width(r)}}},
|
56 |
-
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){
|
57 |
-
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.$);
|
58 |
-
(function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:true,newWindowCallback:function(){return""},fullscreenText:"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,
|
59 |
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()||
|
60 |
-
a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});else{var k=null;
|
61 |
-
"");
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
false}}})})(mejs.$);
|
70 |
(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");
|
71 |
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",
|
72 |
-
"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("
|
73 |
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",
|
74 |
"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=
|
75 |
-
this,c=b.tracks[a],
|
76 |
-
a
|
77 |
-
|
78 |
-
this.
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
settings:d[5]})}}return c}};
|
|
|
|
|
84 |
(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}}]});
|
85 |
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=
|
86 |
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<
|
87 |
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!=
|
88 |
"undefined"&&p.click(c);c.contextMenu.hide()})});setTimeout(function(){c.killControlsTimer("rev3")},100)}})})(mejs.$);
|
|
|
|
6 |
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
|
7 |
*
|
8 |
* Copyright 2010-2012, John Dyer (http://j.hn/)
|
9 |
+
* License: MIT
|
10 |
*
|
11 |
*/if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
|
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.$);
|
readme.txt
CHANGED
@@ -3,15 +3,15 @@ Contributors: johndyer
|
|
3 |
Donate link: http://mediaelementjs.com/
|
4 |
Tags: html5, video, audio, player, flash, mp4, mp3, ogg, webm, wmv, captions, subtitles, websrt, srt, accessible, Silverlight, javascript,
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to: 3.
|
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 |
|
@@ -156,10 +156,6 @@ View <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more inform
|
|
156 |
|
157 |
== Changelog ==
|
158 |
|
159 |
-
= 2.27.0 =
|
160 |
-
* Update to 2.7.0 codebase
|
161 |
-
* Lots of bug fixes and updates
|
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)
|
3 |
Donate link: http://mediaelementjs.com/
|
4 |
Tags: html5, video, audio, player, flash, mp4, mp3, ogg, webm, wmv, captions, subtitles, websrt, srt, accessible, Silverlight, javascript,
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 3.5
|
7 |
+
Stable tag: 2.10.3
|
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 |
|
156 |
|
157 |
== Changelog ==
|
158 |
|
|
|
|
|
|
|
|
|
159 |
= 2.2.5 =
|
160 |
* Update to 2.2.5 codebase
|
161 |
* Support for true fullscreen in Chrome and Firefox (in addition to Safari)
|