initial commit
29
COPYING.txt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
This software includes sources and binaries from:
|
||||||
|
|
||||||
|
jQuery
|
||||||
|
Copyright 2014 jQuery Foundation and other contributors
|
||||||
|
http://jquery.com/
|
||||||
|
|
||||||
|
MediaElement.js
|
||||||
|
Copyright 2010-2013, John Dyer (http://j.hn)
|
||||||
|
http://mediaelementjs.com/
|
||||||
|
|
||||||
|
MediaElement Playlist Feature (plugin) -
|
||||||
|
Andrew Berezovsky <andrew.berezovsky@gmail.com>
|
||||||
|
and Junaid Qadir Baloch <shekhanzai.baloch@gmail.com>
|
||||||
|
https://github.com/duozersk/mep-feature-playlist
|
||||||
|
|
||||||
|
JavaScript-ID3-Reader
|
||||||
|
Copyright (c) 2008 Jacob Seidelin, http://blog.nihilogic.dk/ BSD License
|
||||||
|
Copyright (c) 2009 Opera Software ASA BSD License
|
||||||
|
Copyright (c) 2010 AntÃâ³nio Afonso BSD License
|
||||||
|
Copyright (c) 2010 Joshua Kifer BSD License
|
||||||
|
https://github.com/aadsm/JavaScript-ID3-Reader
|
||||||
|
|
||||||
|
This software is:
|
||||||
|
|
||||||
|
MyPlayer
|
||||||
|
Copyright 2014 tilt@linuxfoo.de MIT License
|
||||||
|
|
||||||
|
See the file LICENSE.txt for licensing information
|
||||||
|
or contact the author for additional information.
|
20
LICENSE.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
MyPlayer
|
||||||
|
Copyright (C) 2014 tilt@linuxfoo.de
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
32
README.txt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
Project: MyPlayer - A Web-MP3-Player with Playlist Support
|
||||||
|
Author: tilt@linuxfoo.de
|
||||||
|
Release: 01-10-2014
|
||||||
|
License: MIT
|
||||||
|
|
||||||
|
About:
|
||||||
|
|
||||||
|
This project provides a JavaScript constructor MyPlayer({...options...}) that can be used
|
||||||
|
to embed lists of audio files as read from an index document or an M3U into a web document.
|
||||||
|
|
||||||
|
They will be displayed in a playback GUI with a playlist that can optionally be filled
|
||||||
|
from the "title" and "artist" values of the files' ID3 tags (v1 and v2 are supported).
|
||||||
|
|
||||||
|
The player is "detachable", meaning it can start in a detached state or the user can open
|
||||||
|
it in a new window, preventing that playback breaks when the user leaves the page.
|
||||||
|
|
||||||
|
Tested Compatibility:
|
||||||
|
|
||||||
|
MP3: Firefox, Chrome, Internet Exploder
|
||||||
|
OGG Audio: Firefox, Chrome
|
||||||
|
|
||||||
|
How to Use:
|
||||||
|
|
||||||
|
See demos/index.html for several examples.
|
||||||
|
|
||||||
|
How to Hack:
|
||||||
|
|
||||||
|
Directory src contains the input files. See player.js for the MyPLayer implementation.
|
||||||
|
Use build.sh (with the Google closure compiler) to rebuild myplayer.min.js.
|
||||||
|
|
||||||
|
The Flash and Silverlight plugins are taken from mediaelement.js and are included
|
||||||
|
in binary form only. If you want to modify them, use the mediaelement.js sources.
|
2
RELEASE.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
2-10-2014: fixed a bug in EXTINF parsing (time=-1).
|
||||||
|
1-10-2014: initial release.
|
BIN
css/ajax-loader.gif
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
css/background.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
css/bigplay.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
1
css/bigplay.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
<!-- Generator: Adobe Fireworks CS6, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg id="bigplay-gradient.fw-Page%201" viewBox="0 0 100 200" style="background-color:#ffffff00" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
x="0px" y="0px" width="100px" height="200px"
>
<defs>
<radialGradient id="gradient1" cx="50%" cy="50%" r="50%">
<stop stop-color="#222222" stop-opacity="0" offset="70%"/>
<stop stop-color="#222222" stop-opacity="0.0118" offset="70.202%"/>
<stop stop-color="#333333" stop-opacity="1" offset="85%"/>
<stop stop-color="#333333" stop-opacity="0" offset="100%"/>
</radialGradient>
<radialGradient id="gradient2" cx="50%" cy="50%" r="50%">
<stop stop-color="#bbbbbb" stop-opacity="0" offset="70%"/>
<stop stop-color="#bbbbbb" stop-opacity="0.0118" offset="70.202%"/>
<stop stop-color="#bbbbbb" stop-opacity="1" offset="85%"/>
<stop stop-color="#bbbbbb" stop-opacity="0" offset="100%"/>
</radialGradient>
<filter id="filter1" x="-100%" y="-100%" width="300%" height="300%">
<!-- Glow -->
<feColorMatrix result="out" in="SourceGraphic" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.251 0"/>
<feMorphology result="out" in="out" operator="dilate" radius="3"/>
<feGaussianBlur result="out" in="out" stdDeviation="1.5"/>
<feBlend in="SourceGraphic" in2="out" mode="normal" result="Glow1"/>
</filter>
<filter id="filter2" x="-100%" y="-100%" width="300%" height="300%">
<!-- Glow -->
<feColorMatrix result="out" in="SourceGraphic" type="matrix" values="0 0 0 0.8667 0 0 0 0 0.8667 0 0 0 0 0.8667 0 0 0 0 0.251 0"/>
<feMorphology result="out" in="out" operator="dilate" radius="3"/>
<feGaussianBlur result="out" in="out" stdDeviation="1.5"/>
<feBlend in="SourceGraphic" in2="out" mode="normal" result="Glow2"/>
</filter>
</defs>
<g id="Background">
</g>
<g id="dark%20shadow">
<path d="M 22 50 C 22 34.5358 34.5358 22 50 22 C 65.4642 22 78 34.5358 78 50 C 78 65.4642 65.4642 78 50 78 C 34.5358 78 22 65.4642 22 50 ZM 5 50 C 5 74.8531 25.1469 95 50 95 C 74.8531 95 95 74.8531 95 50 C 95 25.1469 74.8531 5 50 5 C 25.1469 5 5 25.1469 5 50 Z" fill="url(#gradient1)"/>
<path d="M 22 150 C 22 134.5358 34.5358 122 50 122 C 65.4642 122 78 134.5358 78 150 C 78 165.4642 65.4642 178 50 178 C 34.5358 178 22 165.4642 22 150 ZM 5 150 C 5 174.8531 25.1469 195 50 195 C 74.8531 195 95 174.8531 95 150 C 95 125.1469 74.8531 105 50 105 C 25.1469 105 5 125.1469 5 150 Z" fill="url(#gradient2)"/>
</g>
<g id="dark">
<path id="Polygon" filter="url(#filter1)" d="M 72.5 49.5 L 38.75 68.9856 L 38.75 30.0144 L 72.5 49.5 Z" fill="#ffffff"/>
<path id="Ellipse" d="M 13 50.5 C 13 29.7891 29.7891 13 50.5 13 C 71.2109 13 88 29.7891 88 50.5 C 88 71.2109 71.2109 88 50.5 88 C 29.7891 88 13 71.2109 13 50.5 Z" stroke="#ffffff" stroke-width="5" fill="none"/>
</g>
<g id="light">
<path id="Polygon2" filter="url(#filter2)" d="M 72.5 149.5 L 38.75 168.9856 L 38.75 130.0144 L 72.5 149.5 Z" fill="#ffffff"/>
<path id="Ellipse2" d="M 13 150.5 C 13 129.7891 29.7891 113 50.5 113 C 71.2109 113 88 129.7891 88 150.5 C 88 171.211 71.2109 188 50.5 188 C 29.7891 188 13 171.211 13 150.5 Z" stroke="#ffffff" stroke-width="5" fill="none"/>
</g>
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
BIN
css/controls-playlist.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
css/controls.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
1
css/controls.svg
Normal file
After Width: | Height: | Size: 10 KiB |
0
css/custom.css
Normal file
4
css/index.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
div.home { font-size: 1em; }
|
||||||
|
div.home a { display: inline-block; margin: 0 .2em 0 .2em; text-decoration: none; }
|
||||||
|
h1 { margin-top: 0; }
|
||||||
|
|
69
css/local.css
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
html {
|
||||||
|
overflow: hidden;
|
||||||
|
height: 100%
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
.mejs-audio {
|
||||||
|
}
|
||||||
|
.mejs-controls {
|
||||||
|
top: 0!important;
|
||||||
|
padding: 3px 0 0 0;
|
||||||
|
height: 2em!important;
|
||||||
|
background: none!important;
|
||||||
|
border-top: 2em!important;
|
||||||
|
}
|
||||||
|
.mejs-controls .mejs-time-rail .mejs-time-loaded {
|
||||||
|
background: #5a1a7a!important;
|
||||||
|
}
|
||||||
|
.mejs-controls .mejs-time-rail .mejs-time-float {
|
||||||
|
top: 2.5em!important;
|
||||||
|
}
|
||||||
|
.mejs-controls .mejs-time-rail .mejs-time-float .mejs-time-float-corner {
|
||||||
|
display: none!important;
|
||||||
|
}
|
||||||
|
.mejs li {
|
||||||
|
font-size: 0.8em!important;
|
||||||
|
line-height: 1em!important;
|
||||||
|
color: #ccddff;
|
||||||
|
}
|
||||||
|
.mejs-playlist {
|
||||||
|
width: 430px!important;
|
||||||
|
height: 265px!important;
|
||||||
|
}
|
||||||
|
.popupButton {
|
||||||
|
display: inline-block!important;
|
||||||
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
}
|
||||||
|
.popupButton button {
|
||||||
|
overflow: hidden;
|
||||||
|
width: 25px;
|
||||||
|
height: 22px;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border: 0;
|
||||||
|
background: url(popup.png);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.playerDetached {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
font-size: small;
|
||||||
|
font-family: sans-serif;
|
||||||
|
color: #cacaca;
|
||||||
|
}
|
||||||
|
.ajaxLoader {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
display: inline-block;
|
||||||
|
background: url(ajax-loader.gif);
|
||||||
|
}
|
||||||
|
noscript {
|
||||||
|
color: white;
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
1001
css/mediaelementplayer.css
Normal file
68
css/mep-feature-playlist.css
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
Document : mep-feature-playlist.css
|
||||||
|
Author : Andrew Berezovsky <andrew.berezovsky@gmail.com>
|
||||||
|
Original Author : Junaid Qadir Baloch <shekhanzai.baloch@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Start: Show/Hide Playlist*/
|
||||||
|
.mejs-controls .mejs-show-playlist button {
|
||||||
|
background: transparent url(controls-playlist.png) no-repeat;
|
||||||
|
background-position: -16px -16px;
|
||||||
|
}
|
||||||
|
.mejs-controls .mejs-hide-playlist button {
|
||||||
|
background: transparent url(controls-playlist.png) no-repeat;
|
||||||
|
background-position: -16px 0;
|
||||||
|
}
|
||||||
|
/* End: Show/Hide Playlist */
|
||||||
|
|
||||||
|
/* Start: Previous */
|
||||||
|
.mejs-controls .mejs-prevtrack button {
|
||||||
|
background: transparent url(controls-playlist.png) no-repeat;
|
||||||
|
background-position: 0 -16px;
|
||||||
|
}
|
||||||
|
/* End: Previous */
|
||||||
|
|
||||||
|
/* Start: Next */
|
||||||
|
.mejs-controls .mejs-nexttrack button {
|
||||||
|
background: transparent url(controls-playlist.png) no-repeat;
|
||||||
|
}
|
||||||
|
/* End: Next */
|
||||||
|
|
||||||
|
/* Start: Shuffle */
|
||||||
|
.mejs-controls .mejs-shuffle-on button {
|
||||||
|
background: transparent url(controls-playlist.png) no-repeat;
|
||||||
|
background-position: -32px 0;
|
||||||
|
}
|
||||||
|
.mejs-controls .mejs-shuffle-off button {
|
||||||
|
background: transparent url(controls-playlist.png) no-repeat;
|
||||||
|
background-position: -32px -16px;
|
||||||
|
}
|
||||||
|
/* End: Shuffle */
|
||||||
|
|
||||||
|
/*Start: Playlist*/
|
||||||
|
.mejs-playlist {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
height: 200px!important;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.mejs-playlist ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
.mejs-playlist li {
|
||||||
|
color: white;
|
||||||
|
font-size: 11px;
|
||||||
|
height: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.mejs-playlist li:hover {
|
||||||
|
color: #a8a8a8;
|
||||||
|
}
|
||||||
|
.mejs-playlist li.current {
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
/*End: Playlist*/
|
3
css/myplayer.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@import url('mediaelementplayer.css');
|
||||||
|
@import url('mep-feature-playlist.css');
|
||||||
|
@import url('local.css');
|
BIN
css/popup.png
Normal file
After Width: | Height: | Size: 744 B |
26
demo/autoplay.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer Autoplay/Loop Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/play.m3u',
|
||||||
|
id3: true,
|
||||||
|
autoplay: true,
|
||||||
|
loop: false
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
28
demo/detachable.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer Detachable Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/play.m3u',
|
||||||
|
detachable: false
|
||||||
|
})});</script>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
h1, p { color: white; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
34
demo/element.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer Element Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
element: '#myplayer',
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/play.m3u'
|
||||||
|
})});</script>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
h1, p { color: white; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
<h1>I Am A Heading</h1>
|
||||||
|
|
||||||
|
<p>I am a paragraph. The player UI will follow below.</p>
|
||||||
|
|
||||||
|
<div id="myplayer"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
23
demo/extm3u.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer EXTM3U Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/play.extm3u'
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
24
demo/filematch.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer filematch Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/play.m3u',
|
||||||
|
filematch: /(^|\/)[0-9][^\/]*\.mp3/i
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
24
demo/id3.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer ID3 Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/play.m3u',
|
||||||
|
id3: true
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
255
demo/index.html
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>MyPlayer Demos</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a name="top"></a>
|
||||||
|
|
||||||
|
<p>[<a title="Back to Index" target="_self" href="../index.html">Back to Index</a>]</p>
|
||||||
|
|
||||||
|
<h1>MyPlayer Usage by Examples</h1>
|
||||||
|
|
||||||
|
<h2>Table of Contents</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="#always" title="Alwas Required" target="_self">Always Required</a> - Including MyPlayer. Setting up MIME-Types.</li>
|
||||||
|
<li><a href="#list" title="Mode "list"" target="_self">Mode "list"</a> - Playing a JavaScript array of audio file URLs and titles.</li>
|
||||||
|
<li><a href="#mp3url" title="Mode "mp3url"" target="_self">Mode "mp3url"</a> - Reading lists of audio files from index documents.</li>
|
||||||
|
<li><a href="#m3u" title="Mode "m3u"" target="_self">Mode "m3u"</a> - Reading lists of audio files from <tt>.m3u</tt> files.</li>
|
||||||
|
<li><a href="#element" title="Option "element"" target="_self">Option "element"</a> - Where the player/playlist should be placed.</li>
|
||||||
|
<li><a href="#detachable" title="Option "detachable"" target="_self">Option "detachable"</a> - If the player can be detached or not.</li>
|
||||||
|
<li><a href="#id3" title="Option "id3"" target="_self">Option "id3"</a> - Interpreting ID3-tags.</li>
|
||||||
|
<li><a href="#autoplay" title="Option "autoplay/loop/shuffle"" target="_self">Options "autoplay", "loop" and "shuffle"</a> - Player behavior and defaults.</li>
|
||||||
|
<li><a href="#types" title="Option "types"" target="_self">Option "types"</a> - Specifying filename-endings to consider.</li>
|
||||||
|
<li><a href="#filematch" title="Option "filematch"" target="_self">Option "filematch"</a> - Specifying an URL-matching expression.</li>
|
||||||
|
<li><a href="#network" title="Option "network"" target="_self">Option "network"</a> - Limited support for network streams.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2><a name="always">Always Required</a></h2>
|
||||||
|
|
||||||
|
<p>To embed MyPlayer in your webpage put this in the <tt><head></tt>
|
||||||
|
section of your document:
|
||||||
|
|
||||||
|
<pre><script type="text/javascript" src="/path/to/js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="/path/to/js/myplayer.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="/path/to/css/myplayer.css" /></pre>
|
||||||
|
|
||||||
|
<p>Some (most?) webservers should be configured to serve audio files with their correct
|
||||||
|
MIME-Types so that playback in the browser works reliably. The following example
|
||||||
|
for the Apache webserver could be included in a file <tt>.htaccess</tt> in the
|
||||||
|
directory holding the audio files:</p>
|
||||||
|
|
||||||
|
<pre>AddType audio/mpeg .mp3
|
||||||
|
AddType audio/ogg .ogg</pre>
|
||||||
|
|
||||||
|
<p>This example will enable correct MIME-Types when serving files that end with
|
||||||
|
<tt>.mp3</tt> or <tt>.ogg</tt>.</p>
|
||||||
|
|
||||||
|
<h2><a name="list">Mode "list"</a></h2>
|
||||||
|
|
||||||
|
<p>If you have URLs of audio files as a JavaScript array, create the player
|
||||||
|
with option <tt>mode</tt> set to <tt>"list"</tt>. The list items are passed
|
||||||
|
either in object notation or as a plain strings containing the URLs:</p>
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'list',
|
||||||
|
list: [
|
||||||
|
{url: '/something.mp3', title: 'Something'},
|
||||||
|
{url: 'http://example.com/snd/else.mp3'},
|
||||||
|
"./entirely.ogg"
|
||||||
|
]
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer list Demo" href="list.html" target="_blank">list.html</a></p>
|
||||||
|
|
||||||
|
<p><i>Note:</i> The property <tt>title</tt> is optional, and if it is
|
||||||
|
omitted, the last component of the URL path is used as a title in
|
||||||
|
the playlist. In above example, the second entry's title would be
|
||||||
|
<tt>else.mp3</tt> and the third one's would be <tt>entirely.ogg</tt>.</p>
|
||||||
|
|
||||||
|
<h2><a name="mp3url">Mode "mp3url"</a></h2>
|
||||||
|
|
||||||
|
<p>Play all links ending with <tt>.mp3</tt> found at a given URL <tt>mp3url</tt>:.
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'mp3url',
|
||||||
|
mp3url: '/directory/with/your/mp3s/'
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p><i>Note:</i> Directory indexes should be enabled on the directory containing
|
||||||
|
the files, when using the Apache webserver this can be possible by placing an
|
||||||
|
<tt>.htaccess</tt> file into that directory:</p>
|
||||||
|
|
||||||
|
<pre>Options +Indexes</pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer mp3url Demo" href="mp3url.html" target="_blank">mp3url.html</a></p>
|
||||||
|
|
||||||
|
<h2><a name="m3u">Mode "m3u"</a></h2>
|
||||||
|
|
||||||
|
<p>Play all links found in an M3U-File specified by URL <tt>m3u</tt>:</p>
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: '/some/place/play.m3u'
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer m3u Demo" href="m3u.html" target="_blank">m3u.html</a></p>
|
||||||
|
|
||||||
|
<p>If the M3U is in EXTM3U format, the player will attempt to parse the EXTINF
|
||||||
|
information (playtime, title) where available.</p>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer extm3u Demo" href="extm3u.html" target="_blank">extm3u.html</a></p>
|
||||||
|
|
||||||
|
<p><i>Note:</i> The player will to some degree try to resolve relative entries
|
||||||
|
in an M3U. If an entry is encountered that is not an absolute <tt>https?|ftp|file</tt>
|
||||||
|
URL, it will try to make the entry absolute by prepending it with the path
|
||||||
|
of the M3U.</p>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer relative m3u Demo" href="relative-m3u.html" target="_blank">relative-m3u.html</a></p>
|
||||||
|
|
||||||
|
<h2><a name="element">Option "element"</a></h2>
|
||||||
|
|
||||||
|
<p>The default for the player is to append its UI to the <tt><body></tt>
|
||||||
|
of the current document. Using the <tt>element</tt> option you have more
|
||||||
|
control over the placement of the player UI. This option uses jQuery selector
|
||||||
|
notation.</p>
|
||||||
|
|
||||||
|
<p>Append the player UI to the contents of the element with ID <tt>myplayer</tt>:</p>
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
element: '#myplayer',
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: '/some/place/play.m3u'
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer element Demo" href="element.html" target="_blank">element.html</a></p>
|
||||||
|
|
||||||
|
<h2><a name="detachable">Option "detachable"</a></h2>
|
||||||
|
|
||||||
|
<p>The default for the player is to offer a "detach" button that will cause
|
||||||
|
it to re-open itself in a separate (popup) window. If you do not
|
||||||
|
want this, set the option <tt>detachable</tt> to <tt>false</tt>:</p>
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: '/some/place/play.m3u',
|
||||||
|
detachable: false
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer detachable Demo" href="detachable.html" target="_blank">detachable.html</a></p>
|
||||||
|
|
||||||
|
<h2><a name="id3">Option "id3"</a></h2>
|
||||||
|
|
||||||
|
<p><i>Important Note:</i> My tests prove the ID3 implementation provided
|
||||||
|
here to be unreliable. Please use this option with caution. If you want
|
||||||
|
to provide neatly formatted metadata for your tracks, please also consider
|
||||||
|
the <tt><a href="#m3u">m3u</a></tt> option with EXTINF information.</p>
|
||||||
|
|
||||||
|
<p>Setting the option <tt>id3</tt> to <tt>true</tt> will cause the player
|
||||||
|
to attempt reading artist name and track title from the ID3 tags found in
|
||||||
|
the <tt>.mp3</tt> files.</p>
|
||||||
|
|
||||||
|
<p>Playback can commence before the lookups are complete (they might take
|
||||||
|
a while). An Ajax loading indicator is displayed for a few seconds next to
|
||||||
|
the tracks currently being looked up.</p>
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: '/some/place/play.m3u',
|
||||||
|
id3: true
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer id3 Demo" href="id3.html" target="_blank">id3.html</a></p>
|
||||||
|
|
||||||
|
<p><i>Note:</i> If you do not want the animated loading indicator, you
|
||||||
|
can prevent it by setting the option <tt>loader</tt> to <tt>false</tt>.</p>
|
||||||
|
|
||||||
|
<h2><a name="autoplay">Options "autoplay", "loop", "shuffle"</a></h2>
|
||||||
|
|
||||||
|
<p>Setting the option <tt>autoplay</tt> to <tt>true</tt> will cause the
|
||||||
|
player to immediately start playback when the site is ready.</p>
|
||||||
|
|
||||||
|
<p>Setting the option <tt>loop</tt> to <tt>false</tt> will cause the
|
||||||
|
"Loop" function to be disabled when the player is loaded.</p>
|
||||||
|
|
||||||
|
<p>Setting the option <tt>shuffle</tt> to <tt>true</tt> will cause the
|
||||||
|
"Shuffle" function to be enabled when the player is loaded.</p>
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: '/some/place/play.m3u',
|
||||||
|
autoplay: true,
|
||||||
|
loop: false,
|
||||||
|
shuffle: true
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer autoplay/loop/shuffle Demo" href="autoplay.html" target="_blank">autoplay.html</a></p>
|
||||||
|
|
||||||
|
<h2><a name="types">Option "types"</a></h2>
|
||||||
|
|
||||||
|
<p>Setting the option <tt>types</tt> to a non-empty array of strings
|
||||||
|
will interpret those strings as filename endings to consider for playback.
|
||||||
|
The matching will be performed case-insensitive.</p>
|
||||||
|
|
||||||
|
<p>The following example will build the playlist from the lines in
|
||||||
|
the given <tt>play.m3u</tt>, but it will only consider entries that end
|
||||||
|
with <tt>.ogg</tt>:</p>
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: '/some/place/play.m3u',
|
||||||
|
types: ['ogg']
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer types Demo" href="types.html" target="_blank">types.html</a></p>
|
||||||
|
|
||||||
|
<h2><a name="filematch">Option "filematch"</a></h2>
|
||||||
|
|
||||||
|
<p>Setting the option <tt>filematch</tt> to a RegExp object will cause
|
||||||
|
filename matching to be performed using that regular expression.</p>
|
||||||
|
|
||||||
|
<p><i>Note:</i> If this option and the option <tt>types</tt> are both
|
||||||
|
present, then this option has no effect, and the values in the array
|
||||||
|
<tt>types</tt> apply instead.</p>
|
||||||
|
|
||||||
|
<p>The following example will build the playlist from the lines in
|
||||||
|
the given <tt>play.m3u</tt>, but it will only consider entries that
|
||||||
|
start with a digit and end with <tt>.ogg</tt>. Please note that
|
||||||
|
matching is performed on the entire URL, so in order to match
|
||||||
|
the filename only, more complex regular expressing is neccessary:</p>
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: '/some/place/play.m3u',
|
||||||
|
filematch: /(^|\/)[0-9][^\/]*\.mp3/i
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer filematch Demo" href="filematch.html" target="_blank">filematch.html</a></p>
|
||||||
|
|
||||||
|
<h2><a name="network">Option "network"</a></h2>
|
||||||
|
|
||||||
|
<p>Setting the option <tt>network</tt> to <tt>true</tt> enables limited support
|
||||||
|
for network streams (native playback does not work with some broadcast servers).</p>
|
||||||
|
|
||||||
|
<p>All filename matching will be disabled, meaning the <tt>types</tt>
|
||||||
|
and <tt>filematch</tt> options have no effect.</p>
|
||||||
|
|
||||||
|
<p>The timerail will be disabled in the GUI.</p>
|
||||||
|
|
||||||
|
<p>Play an M3U containing only network stream entries:</p>
|
||||||
|
|
||||||
|
<pre><script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: 'http://example.com/streaming.m3u',
|
||||||
|
network: true
|
||||||
|
})});</script></pre>
|
||||||
|
|
||||||
|
<p>Demo: <a title="MyPlayer network Demo" href="network.html" target="_blank">network.html</a></p>
|
||||||
|
|
||||||
|
<p><i>Implementation Note:</i> if <tt>network</tt> is set to <tt>true</tt> then
|
||||||
|
<tt>mediaelement.js</tt> will be forced to mode <tt>'native'</tt> on network streams
|
||||||
|
(this is accomplished by a patch to <tt>mediaelement.js</tt>).</p>
|
||||||
|
|
||||||
|
<p>[<a title="Back to Top" target="_self" href="#top">Back to Top</a>]</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
29
demo/list.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer M3U Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'list',
|
||||||
|
list: [
|
||||||
|
{ url: './snd/dreamz.mp3',
|
||||||
|
title: 'tilt - Dreamz' },
|
||||||
|
{ url: './snd/dreamz.mp3',
|
||||||
|
title: 'tilt - Dreamz (#2)' },
|
||||||
|
'./snd/dreamz.mp3',
|
||||||
|
]
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
23
demo/m3u.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer M3U Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/play.m3u'
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
23
demo/mp3url.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer mp3url Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'mp3url',
|
||||||
|
mp3url: './snd/'
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
24
demo/network.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer M3U With Streams Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/network.m3u',
|
||||||
|
network: true
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
10
demo/php/.htaccess
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
RewriteEngine on
|
||||||
|
|
||||||
|
# (as suggested by www.zeilenwechsel.de)
|
||||||
|
|
||||||
|
RewriteBase /
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond $1#%{REQUEST_URI} ([^#]*)#(.*)\1$
|
||||||
|
RewriteRule ^(.*)$ %2index.php/$1 [QSA,L]
|
||||||
|
|
7
demo/php/include/config.inc.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$waveform = array(
|
||||||
|
'snddir' => dirname(__FILE__).'/../../snd',
|
||||||
|
'cachedir' => dirname(__FILE__).'/../../tmp'
|
||||||
|
);
|
||||||
|
|
18
demo/php/include/functions.inc.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function fatal_error($msg, $status = '505 Internal Server Error') {
|
||||||
|
header('Status: '.$status);
|
||||||
|
|
||||||
|
echo $msg."\n";
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sanitize_path_request($path_info) {
|
||||||
|
return preg_replace(
|
||||||
|
array('|^/|', '/[^A-Za-z0-9\-\.]/'),
|
||||||
|
array('', ''),
|
||||||
|
$path_info
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
5
demo/php/include/init.inc.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once('config.inc.php');
|
||||||
|
require_once('functions.inc.php');
|
||||||
|
|
32
demo/php/index.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
set_include_path(dirname(__FILE__).'/include');
|
||||||
|
|
||||||
|
require_once('init.inc.php');
|
||||||
|
|
||||||
|
$path = sanitize_path_request($_SERVER['PATH_INFO']);
|
||||||
|
|
||||||
|
$cachefile = $waveform['cachedir'].'/'.sha1($path);
|
||||||
|
|
||||||
|
$mp3file = $waveform['snddir'].'/'.$path;
|
||||||
|
|
||||||
|
if(!is_file($mp3file))
|
||||||
|
exit(fatal_error("Error: requested file $mp3file not found"));
|
||||||
|
|
||||||
|
if(!file_exists($cachefile)) {
|
||||||
|
$cmdline = 'waveform draw "'.$mp3file.'" "'.$cachefile.'" 0 -1';
|
||||||
|
$system_rv = null;
|
||||||
|
|
||||||
|
system($cmdline, $system_rv);
|
||||||
|
|
||||||
|
if($system_rv!=0) {
|
||||||
|
if(file_Exists($cachefile))
|
||||||
|
unlink($cachefile);
|
||||||
|
|
||||||
|
exit(fatal_error('Error: generating the waveform diagram failed'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Content-type: image/jpeg');
|
||||||
|
|
||||||
|
echo file_get_contents($cachefile);
|
||||||
|
|
23
demo/relative-m3u.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer M3U (Relative Entries) Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/relative.m3u'
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
3
demo/snd/.htaccess
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Options +Indexes
|
||||||
|
AddType audio/ogg .ogg
|
||||||
|
AddType audio/mpeg .mp3
|
BIN
demo/snd/dreamz.mp3
Executable file
5
demo/snd/network.m3u
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#EXTM3U
|
||||||
|
#EXTINF:-1,NoLife-radio
|
||||||
|
http://37.187.79.56:2868/stream
|
||||||
|
#EXTINF:-1,ZaycevFM (128k)
|
||||||
|
http://radio.zaycev.fm:8999/ZaycevFM(128)
|
3
demo/snd/play.extm3u
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#EXTM3U
|
||||||
|
#EXTINF:59, tilt - Dreamz
|
||||||
|
dreamz.mp3
|
1
demo/snd/play.m3u
Normal file
@ -0,0 +1 @@
|
|||||||
|
snd/dreamz.mp3
|
1
demo/snd/relative.m3u
Normal file
@ -0,0 +1 @@
|
|||||||
|
dreamz.mp3
|
24
demo/stream-m3u.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer M3U With Streams Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/streaming.m3u',
|
||||||
|
filematch: /./
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
24
demo/types.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer types Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'm3u',
|
||||||
|
m3u: './snd/play.m3u',
|
||||||
|
types: ['ogg']
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
27
demo/waveform.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<base href="." />
|
||||||
|
|
||||||
|
<title>MyPlayer M3U Demo</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../js/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/myplayer.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../css/myplayer.css" />
|
||||||
|
|
||||||
|
<script type="text/javascript">$(function(){MyPlayer({
|
||||||
|
mode: 'list',
|
||||||
|
waveform: true,
|
||||||
|
list: [
|
||||||
|
{ url: './snd/dreamz.mp3',
|
||||||
|
title: 'tilt - Dreamz' }
|
||||||
|
]
|
||||||
|
})});</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
Javascript is required to use the MP3 player.
|
||||||
|
Please choose of the alternatives listed below.
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
44
index.html
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>MyPlayer - An Audio Player for the Web with Playlist and ID3 Support</title>
|
||||||
|
<link rel="stylesheet" href="css/index.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="home"><a href="http://tk-sls.de">//tk-sls.de</a></div>
|
||||||
|
<h1> MyPlayer</h1>
|
||||||
|
|
||||||
|
<p>An audio player (mp3, ogg) for the web with M3U-playlist and ID3-support.</p>
|
||||||
|
|
||||||
|
<p>Based on mediaelement.js. MIT-licensed. Cooks coffee (almost).</p>
|
||||||
|
|
||||||
|
<h2>About:</h2>
|
||||||
|
|
||||||
|
<p>This project provides a JavaScript constructor <tt>MyPlayer({...options...})</tt> that can be used
|
||||||
|
to embed lists of audio files as read from an index document or an M3U into a web document.</p>
|
||||||
|
|
||||||
|
<p>They will be displayed in a playback GUI with a playlist that can optionally be filled
|
||||||
|
from the "title" and "artist" values of the files' ID3 tags (v1 and v2 are supported).</p>
|
||||||
|
|
||||||
|
<p>The player is "detachable", meaning the user can open it in a new window,
|
||||||
|
preventing that playback breaks when the user leaves the page.</p>
|
||||||
|
|
||||||
|
<h2>Resources:</h2>
|
||||||
|
|
||||||
|
<p>Documentation & Examples: <a href="demo/index.html">demo/index.html</a></p>
|
||||||
|
|
||||||
|
<p>Current release is: 11-20-2015</p>
|
||||||
|
|
||||||
|
<p>Download URL (latest tarball): <a title="MyPlayer Download (.tar.gz)" href="http://tk-sls.de/ref/myplayer.dist.tar.gz">http://tk-sls.de/ref/myplayer.dist.tar.gz</a></p>
|
||||||
|
|
||||||
|
<p>Project website: <a title="MyPlayer Project Website" href="http://tk-sls.de/ref/myplayer/">http://tk-sls.de/ref/myplayer/</a></p>
|
||||||
|
|
||||||
|
<h2>Additional Reading:</h2>
|
||||||
|
|
||||||
|
<p>License: <a href="LICENSE.txt">MIT</a>.</p>
|
||||||
|
<p>See <a href="README.txt">README.txt</a> for further information.</p>
|
||||||
|
|
||||||
|
<h2>Author Contact:</h2>
|
||||||
|
|
||||||
|
<p>Please send questions to: tilt at linuxfoo dot de</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
9597
js/jquery.js
vendored
Normal file
231
js/myplayer.min.js
vendored
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
/*
|
||||||
|
jQuery
|
||||||
|
Copyright 2014 jQuery Foundation and other contributors
|
||||||
|
http://jquery.com/
|
||||||
|
MediaElement.js
|
||||||
|
Copyright 2010-2013, John Dyer (http://j.hn)
|
||||||
|
MediaElement Playlist Feature (plugin) -
|
||||||
|
Andrew Berezovsky <andrew.berezovsky@gmail.com>
|
||||||
|
and Junaid Qadir Baloch <shekhanzai.baloch@gmail.com>
|
||||||
|
JavaScript-ID3-Reader
|
||||||
|
Copyright (c) 2008 Jacob Seidelin, http://blog.nihilogic.dk/ BSD License
|
||||||
|
Copyright (c) 2009 Opera Software ASA BSD License
|
||||||
|
Copyright (c) 2010 António Afonso BSD License
|
||||||
|
Copyright (c) 2010 Joshua Kifer BSD License
|
||||||
|
MyPlayer
|
||||||
|
Copyright (c) 2014 tilt@linuxfoo.de MIT License
|
||||||
|
*/
|
||||||
|
var mejs=mejs||{};mejs.version="2.18.2";mejs.meIndex=0;
|
||||||
|
mejs.plugins={silverlight:[{version:[3,0],types:"video/mp4 video/m4v video/mov video/wmv audio/wma audio/m4a audio/mp3 audio/wav audio/mpeg".split(" ")}],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 video/dailymotion video/x-dailymotion application/x-mpegURL".split(" ")}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}],
|
||||||
|
vimeo:[{version:null,types:["video/vimeo","video/x-vimeo"]}]};
|
||||||
|
mejs.Utility={encodeUrl:function(c){return encodeURIComponent(c)},escapeHTML:function(c){return c.toString().split("&").join("&").split("<").join("<").split('"').join(""")},absolutizeUrl:function(c){var a=document.createElement("div");return a.innerHTML='<a href="'+this.escapeHTML(c)+'">x</a>',a.firstChild.href},getScriptPath:function(c){for(var a,b,f,e,d,g=0,h="",k="",l=document.getElementsByTagName("script"),n=l.length,m=c.length;n>g;g++){f=l[g].src;a=f.lastIndexOf("/");-1<a?(d=f.substring(a+
|
||||||
|
1),e=f.substring(0,a+1)):(d=f,e="");for(a=0;m>a;a++)if(k=c[a],b=d.indexOf(k),-1<b){h=e;break}if(""!==h)break}return h},calculateTimeFormat:function(c,a,b){0>c&&(c=0);"undefined"==typeof b&&(b=25);var f=a.timeFormat,e=f[0],d=f[1]==f[0],g=d?2:1,h=":",k=Math.floor(c/3600)%24,l=Math.floor(c/60)%60,n=Math.floor(c%60);c=[[Math.floor((c%1*b).toFixed(3)),"f"],[n,"s"],[l,"m"],[k,"h"]];f.length<g&&(h=f[g]);g=!1;b=0;for(k=c.length;k>b;b++)if(-1!==f.indexOf(c[b][1]))g=!0;else if(g){l=!1;for(n=b;k>n;n++)if(0<
|
||||||
|
c[n][0]){l=!0;break}if(!l)break;d||(f=e+f);f=c[b][1]+h+f;d&&(f=c[b][1]+f);e=c[b][1]}a.currentTimeFormat=f},twoDigitsString:function(c){return 10>c?"0"+c:String(c)},secondsToTimeCode:function(c,a,b,f){if(0>c&&(c=0),"object"!=typeof a)a=a?"hh:mm:ss":"m:ss",a={currentTimeFormat:b?a+":ff":a,framesPerSecond:f||25};b=a.framesPerSecond;"undefined"==typeof b&&(b=25);a=a.currentTimeFormat;f=Math.floor(c/3600)%24;var e=Math.floor(c/60)%60,d=Math.floor(c%60);lis=[[Math.floor((c%1*b).toFixed(3)),"f"],[d,"s"],
|
||||||
|
[e,"m"],[f,"h"]];c=a;i=0;for(len=lis.length;i<len;i++)c=c.replace(lis[i][1]+lis[i][1],this.twoDigitsString(lis[i][0])),c=c.replace(lis[i][1],lis[i][0]);return c},timeCodeToSeconds:function(c,a,b,f){"undefined"==typeof b?b=!1:"undefined"==typeof f&&(f=25);c=c.split(":");a=parseInt(c[0],10);var e=parseInt(c[1],10),d=parseInt(c[2],10),g=0;return b&&(g=parseInt(c[3])/f),3600*a+60*e+d+g},convertSMPTEtoSeconds:function(c){if("string"!=typeof c)return!1;c=c.replace(",",".");var a=0,b=-1!=c.indexOf(".")?
|
||||||
|
c.split(".")[1].length:0,f=1;c=c.split(":").reverse();for(var e=0;e<c.length;e++)f=1,0<e&&(f=Math.pow(60,e)),a+=Number(c[e])*f;return Number(a.toFixed(b))},removeSwf:function(c){var a=document.getElementById(c);a&&/object|embed/i.test(a.nodeName)&&(mejs.MediaFeatures.isIE?(a.style.display="none",function(){4==a.readyState?mejs.Utility.removeObjectInIE(c):setTimeout(arguments.callee,10)}()):a.parentNode.removeChild(a))},removeObjectInIE:function(c){if(c=document.getElementById(c)){for(var a in c)"function"==
|
||||||
|
typeof c[a]&&(c[a]=null);c.parentNode.removeChild(c)}}};
|
||||||
|
mejs.PluginDetector={hasPluginVersion:function(c,a){var b=this.plugins[c];return a[1]=a[1]||0,a[2]=a[2]||0,b[0]>a[0]||b[0]==a[0]&&b[1]>a[1]||b[0]==a[0]&&b[1]==a[1]&&b[2]>=a[2]?!0:!1},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(c,a,b,f,e){this.plugins[c]=this.detectPlugin(a,b,f,e)},detectPlugin:function(c,a,b,f){var e,d,g=[0,0,0];if("undefined"!=typeof this.nav.plugins&&"object"==typeof this.nav.plugins[c]){if(e=this.nav.plugins[c].description,e&&
|
||||||
|
("undefined"==typeof this.nav.mimeTypes||!this.nav.mimeTypes[a]||this.nav.mimeTypes[a].enabledPlugin))for(g=e.replace(c,"").replace(/^\s+/,"").replace(/\sr/gi,".").split("."),c=0;c<g.length;c++)g[c]=parseInt(g[c].match(/\d+/),10)}else if("undefined"!=typeof window.ActiveXObject)try{(d=new ActiveXObject(b))&&(g=f(d))}catch(h){}return g}};
|
||||||
|
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(c){var a=[];c=c.GetVariable("$version");return c&&(c=c.split(" ")[1].split(","),a=[parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10)]),a});
|
||||||
|
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(c){var a=[0,0,0,0],b=function(a,b,d,c){for(;a.isVersionSupported(b[0]+"."+b[1]+"."+b[2]+"."+b[3]);)b[d]+=c;b[d]-=c};return b(c,a,0,1),b(c,a,1,1),b(c,a,2,1E4),b(c,a,2,1E3),b(c,a,2,100),b(c,a,2,10),b(c,a,2,1),b(c,a,3,1),a});
|
||||||
|
mejs.MediaFeatures={init:function(){var c,a,b=this,f=document;c=mejs.PluginDetector.nav;var e=mejs.PluginDetector.ua.toLowerCase(),d=["source","track","audio","video"];b.isiPad=null!==e.match(/ipad/i);b.isiPhone=null!==e.match(/iphone/i);b.isiOS=b.isiPhone||b.isiPad;b.isAndroid=null!==e.match(/android/i);b.isBustedAndroid=null!==e.match(/android 2\.[12]/);b.isBustedNativeHTTPS="https:"===location.protocol&&(null!==e.match(/android [12]\./)||null!==e.match(/macintosh.* version.* safari/));b.isIE=-1!=
|
||||||
|
c.appName.toLowerCase().indexOf("microsoft")||null!==c.appName.toLowerCase().match(/trident/gi);b.isChrome=null!==e.match(/chrome/gi);b.isChromium=null!==e.match(/chromium/gi);b.isFirefox=null!==e.match(/firefox/gi);b.isWebkit=null!==e.match(/webkit/gi);b.isGecko=null!==e.match(/gecko/gi)&&!b.isWebkit&&!b.isIE;b.isOpera=null!==e.match(/opera/gi);b.hasTouch="ontouchstart"in window;b.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;for(c=0;c<
|
||||||
|
d.length;c++)a=document.createElement(d[c]);b.supportsMediaTag="undefined"!=typeof a.canPlayType||b.isBustedAndroid;try{a.canPlayType("video/mp4")}catch(g){b.supportsMediaTag=!1}b.hasSemiNativeFullScreen="undefined"!=typeof a.webkitEnterFullscreen;b.hasNativeFullscreen="undefined"!=typeof a.requestFullscreen;b.hasWebkitNativeFullScreen="undefined"!=typeof a.webkitRequestFullScreen;b.hasMozNativeFullScreen="undefined"!=typeof a.mozRequestFullScreen;b.hasMsNativeFullScreen="undefined"!=typeof a.msRequestFullscreen;
|
||||||
|
b.hasTrueNativeFullScreen=b.hasWebkitNativeFullScreen||b.hasMozNativeFullScreen||b.hasMsNativeFullScreen;b.nativeFullScreenEnabled=b.hasTrueNativeFullScreen;b.hasMozNativeFullScreen?b.nativeFullScreenEnabled=document.mozFullScreenEnabled:b.hasMsNativeFullScreen&&(b.nativeFullScreenEnabled=document.msFullscreenEnabled);b.isChrome&&(b.hasSemiNativeFullScreen=!1);b.hasTrueNativeFullScreen&&(b.fullScreenEventName="",b.hasWebkitNativeFullScreen?b.fullScreenEventName="webkitfullscreenchange":b.hasMozNativeFullScreen?
|
||||||
|
b.fullScreenEventName="mozfullscreenchange":b.hasMsNativeFullScreen&&(b.fullScreenEventName="MSFullscreenChange"),b.isFullScreen=function(){return b.hasMozNativeFullScreen?f.mozFullScreen:b.hasWebkitNativeFullScreen?f.webkitIsFullScreen:b.hasMsNativeFullScreen?null!==f.msFullscreenElement:void 0},b.requestFullScreen=function(a){b.hasWebkitNativeFullScreen?a.webkitRequestFullScreen():b.hasMozNativeFullScreen?a.mozRequestFullScreen():b.hasMsNativeFullScreen&&a.msRequestFullscreen()},b.cancelFullScreen=
|
||||||
|
function(){b.hasWebkitNativeFullScreen?document.webkitCancelFullScreen():b.hasMozNativeFullScreen?document.mozCancelFullScreen():b.hasMsNativeFullScreen&&document.msExitFullscreen()});b.hasSemiNativeFullScreen&&e.match(/mac os x 10_5/i)&&(b.hasNativeFullScreen=!1,b.hasSemiNativeFullScreen=!1)}};mejs.MediaFeatures.init();
|
||||||
|
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:!1,setCurrentTime:function(c){this.currentTime=c},setMuted:function(c){this.muted=c},setVolume:function(c){this.volume=c},stop:function(){this.pause()},setSrc:function(c){for(var a=this.getElementsByTagName("source");0<a.length;)this.removeChild(a[0]);if("string"==typeof c)this.src=c;else for(var b,a=0;a<c.length;a++)if(b=c[a],this.canPlayType(b.type)){this.src=b.src;break}},setVideoSize:function(c,a){this.width=c;this.height=a}};
|
||||||
|
mejs.PluginMediaElement=function(c,a,b){this.id=c;this.pluginType=a;this.src=b;this.events={};this.attributes={}};
|
||||||
|
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:!1,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:!0,ended:!1,seeking:!1,duration:0,error:null,tagName:"",muted:!1,volume:1,currentTime:0,play:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.playVideo():this.pluginApi.playMedia(),this.paused=!1)},load:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType||this.pluginApi.loadMedia(),
|
||||||
|
this.paused=!1)},pause:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia(),this.paused=!0)},stop:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.stopVideo():this.pluginApi.stopMedia(),this.paused=!0)},canPlayType:function(c){var a,b,f,e=mejs.plugins[this.pluginType];for(a=0;a<e.length;a++)if(f=e[a],mejs.PluginDetector.hasPluginVersion(this.pluginType,f.version))for(b=
|
||||||
|
0;b<f.types.length;b++)if(c==f.types[b])return"probably";return""},positionFullscreenButton:function(c,a,b){null!=this.pluginApi&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(Math.floor(c),Math.floor(a),b)},hideFullscreenButton:function(){null!=this.pluginApi&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},setSrc:function(c){if("string"==typeof c)this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c)),this.src=mejs.Utility.absolutizeUrl(c);
|
||||||
|
else{var a,b;for(a=0;a<c.length;a++)if(b=c[a],this.canPlayType(b.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(b.src));this.src=mejs.Utility.absolutizeUrl(b.src);break}}},setCurrentTime:function(c){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.seekTo(c):this.pluginApi.setCurrentTime(c),this.currentTime=c)},setVolume:function(c){null!=this.pluginApi&&("youtube"==this.pluginType?this.pluginApi.setVolume(100*c):this.pluginApi.setVolume(c),this.volume=
|
||||||
|
c)},setMuted:function(c){null!=this.pluginApi&&("youtube"==this.pluginType?(c?this.pluginApi.mute():this.pluginApi.unMute(),this.muted=c,this.dispatchEvent({type:"volumechange"})):this.pluginApi.setMuted(c),this.muted=c)},setVideoSize:function(c,a){this.pluginElement&&this.pluginElement.style&&(this.pluginElement.style.width=c+"px",this.pluginElement.style.height=a+"px");null!=this.pluginApi&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(c,a)},setFullscreen:function(c){null!=this.pluginApi&&
|
||||||
|
this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(c)},enterFullScreen:function(){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.setFullscreen(!0)},exitFullScreen:function(){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.setFullscreen(!1)},addEventListener:function(c,a,b){this.events[c]=this.events[c]||[];this.events[c].push(a)},removeEventListener:function(c,a){if(!c)return this.events={},!0;var b=this.events[c];if(!b)return!0;if(!a)return this.events[c]=[],!0;for(var f=
|
||||||
|
0;f<b.length;f++)if(b[f]===a)return this.events[c].splice(f,1),!0;return!1},dispatchEvent:function(c){var a,b=this.events[c.type];if(b)for(a=0;a<b.length;a++)b[a].apply(this,[c])},hasAttribute:function(c){return c in this.attributes},removeAttribute:function(c){delete this.attributes[c]},getAttribute:function(c){return this.hasAttribute(c)?this.attributes[c]:""},setAttribute:function(c,a){this.attributes[c]=a},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id);mejs.MediaPluginBridge.unregisterPluginElement(this.pluginElement.id)}};
|
||||||
|
mejs.MediaPluginBridge={pluginMediaElements:{},htmlMediaElements:{},registerPluginElement:function(c,a,b){this.pluginMediaElements[c]=a;this.htmlMediaElements[c]=b},unregisterPluginElement:function(c){delete this.pluginMediaElements[c];delete this.htmlMediaElements[c]},initPlugin:function(c){var a=this.pluginMediaElements[c],b=this.htmlMediaElements[c];if(a){switch(a.pluginType){case "flash":a.pluginElement=a.pluginApi=document.getElementById(c);break;case "silverlight":a.pluginElement=document.getElementById(a.id),
|
||||||
|
a.pluginApi=a.pluginElement.Content.MediaElementJS}null!=a.pluginApi&&a.success&&a.success(a,b)}},fireEvent:function(c,a,b){var f,e;if(c=this.pluginMediaElements[c]){a={type:a,target:c};for(f in b)c[f]=b[f],a[f]=b[f];e=b.bufferedTime||0;a.target.buffered=a.buffered={start:function(a){return 0},end:function(a){return e},length:1};c.dispatchEvent(a)}}};
|
||||||
|
mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:!1,httpsBasicAuthSite:!1,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",flashScriptAccess:"sameDomain",enablePluginSmoothing:!1,enablePseudoStreaming:!1,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,
|
||||||
|
defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:.8,success:function(){},error:function(){}};mejs.MediaElement=function(c,a){return mejs.HtmlMediaElementShim.create(c,a)};
|
||||||
|
mejs.HtmlMediaElementShim={create:function(c,a){var b,f,e={},d="string"==typeof c?document.getElementById(c):c,g=d.tagName.toLowerCase(),h=(g="audio"===g||"video"===g)?d.getAttribute("src"):d.getAttribute("href"),k=d.getAttribute("poster"),l=d.getAttribute("autoplay"),n=d.getAttribute("preload"),m=d.getAttribute("controls");for(f in mejs.MediaElementDefaults)e[f]=mejs.MediaElementDefaults[f];for(f in a)e[f]=a[f];return h="undefined"==typeof h||null===h||""==h?null:h,k="undefined"==typeof k||null===
|
||||||
|
k?"":k,n="undefined"==typeof n||null===n||"false"===n?"none":n,l=!("undefined"==typeof l||null===l||"false"===l),m=!("undefined"==typeof m||null===m||"false"===m),b=this.determinePlayback(d,e,mejs.MediaFeatures.supportsMediaTag,g,h),b.url=null!==b.url?mejs.Utility.absolutizeUrl(b.url):"","native"==b.method?(mejs.MediaFeatures.isBustedAndroid&&(d.src=b.url,d.addEventListener("click",function(){d.play()},!1)),this.updateNative(b,e,l,n)):""!==b.method?this.createPlugin(b,e,k,l,n,m):(this.createErrorMessage(b,
|
||||||
|
e,k),this)},determinePlayback:function(c,a,b,f,e){var d,g,h,k,l,n,m=[],p={method:"",url:"",htmlMediaElement:c,isVideo:"audio"!=c.tagName.toLowerCase()};if("undefined"!=typeof a.type&&""!==a.type)if("string"==typeof a.type)m.push({type:a.type,url:e});else for(d=0;d<a.type.length;d++)m.push({type:a.type[d],url:e});else if(null!==e)h=this.formatType(e,c.getAttribute("type")),m.push({type:h,url:e});else for(d=0;d<c.childNodes.length;d++)g=c.childNodes[d],1==g.nodeType&&"source"==g.tagName.toLowerCase()&&
|
||||||
|
(e=g.getAttribute("src"),h=this.formatType(e,g.getAttribute("type")),n=g.getAttribute("media"),(!n||!window.matchMedia||window.matchMedia&&window.matchMedia(n).matches)&&m.push({type:h,url:e}));if(!f&&0<m.length&&null!==m[0].url&&-1<this.getTypeFromFile(m[0].url).indexOf("audio")&&(p.isVideo=!1),mejs.MediaFeatures.isBustedAndroid&&(c.canPlayType=function(a){return null!==a.match(/video\/(mp4|m4v)/gi)?"maybe":""}),mejs.MediaFeatures.isChromium&&(c.canPlayType=function(a){return null!==a.match(/video\/(webm|ogv|ogg)/gi)?
|
||||||
|
"maybe":""}),!(!b||"auto"!==a.mode&&"auto_plugin"!==a.mode&&"native"!==a.mode||mejs.MediaFeatures.isBustedNativeHTTPS&&!0===a.httpsBasicAuthSite)){f||(l=document.createElement(p.isVideo?"video":"audio"),c.parentNode.insertBefore(l,c),c.style.display="none",p.htmlMediaElement=c=l);for(d=0;d<m.length;d++)if("video/m3u8"==m[d].type||""!==c.canPlayType(m[d].type).replace(/no/,"")||""!==c.canPlayType(m[d].type.replace(/mp3/,"mpeg")).replace(/no/,"")||""!==c.canPlayType(m[d].type.replace(/m4a/,"mp4")).replace(/no/,
|
||||||
|
"")){p.method="native";p.url=m[d].url;break}if("native"===p.method&&(null!==p.url&&(c.src=p.url),"auto_plugin"!==a.mode))return p}if("auto"===a.mode||"auto_plugin"===a.mode||"shim"===a.mode)for(d=0;d<m.length;d++)for(h=m[d].type,c=0;c<a.plugins.length;c++)for(e=a.plugins[c],g=mejs.plugins[e],b=0;b<g.length;b++)if(k=g[b],null==k.version||mejs.PluginDetector.hasPluginVersion(e,k.version))for(f=0;f<k.types.length;f++)if(h.toLowerCase()==k.types[f].toLowerCase())return p.method=e,p.url=m[d].url,p;return"auto_plugin"===
|
||||||
|
a.mode&&"native"===p.method?p:(""===p.method&&0<m.length&&(p.url=m[0].url),p)},formatType:function(c,a){return c&&!a?this.getTypeFromFile(c):a&&~a.indexOf(";")?a.substr(0,a.indexOf(";")):a},getTypeFromFile:function(c){c=c.split("?")[0];c=c.substring(c.lastIndexOf(".")+1).toLowerCase();var a=/(mp4|m4v|ogg|ogv|m3u8|webm|webmv|flv|wmv|mpeg|mov)/gi.test(c)?"video/":"audio/";return this.getTypeFromExtension(c,a)},getTypeFromExtension:function(c,a){switch(a=a||"",c){case "mp4":case "m4v":case "m4a":case "f4v":case "f4a":return a+
|
||||||
|
"mp4";case "flv":return a+"x-flv";case "webm":case "webma":case "webmv":return a+"webm";case "ogg":case "oga":case "ogv":return a+"ogg";case "m3u8":return"application/x-mpegurl";case "ts":return a+"mp2t";default:return a+c}},createErrorMessage:function(c,a,b){var f=c.htmlMediaElement,e=document.createElement("div"),d=a.customError;e.className="me-cannotplay";try{e.style.width=f.width+"px",e.style.height=f.height+"px"}catch(g){}d||(d='<a href="'+c.url+'">',""!==b&&(d+='<img src="'+b+'" width="100%" height="100%" alt="" />'),
|
||||||
|
d+="<span>"+mejs.i18n.t("Download File")+"</span></a>");e.innerHTML=d;f.parentNode.insertBefore(e,f);f.style.display="none";a.error(f)},createPlugin:function(c,a,b,f,e,d){var g,h,k;b=c.htmlMediaElement;var l=1,n=1,m="me_"+c.method+"_"+mejs.meIndex++,p=new mejs.PluginMediaElement(m,c.method,c.url),q=document.createElement("div");p.tagName=b.tagName;for(h=0;h<b.attributes.length;h++){var u=b.attributes[h];u.specified&&p.setAttribute(u.name,u.value)}for(h=b.parentNode;null!==h&&null!=h.tagName&&"body"!==
|
||||||
|
h.tagName.toLowerCase()&&null!=h.parentNode&&null!=h.parentNode.tagName&&null!=h.parentNode.constructor&&"ShadowRoot"===h.parentNode.constructor.name;){if("p"===h.parentNode.tagName.toLowerCase()){h.parentNode.parentNode.insertBefore(h,h.parentNode);break}h=h.parentNode}switch(c.isVideo?(l=0<a.pluginWidth?a.pluginWidth:0<a.videoWidth?a.videoWidth:null!==b.getAttribute("width")?b.getAttribute("width"):a.defaultVideoWidth,n=0<a.pluginHeight?a.pluginHeight:0<a.videoHeight?a.videoHeight:null!==b.getAttribute("height")?
|
||||||
|
b.getAttribute("height"):a.defaultVideoHeight,l=mejs.Utility.encodeUrl(l),n=mejs.Utility.encodeUrl(n)):a.enablePluginDebug&&(l=320,n=240),p.success=a.success,mejs.MediaPluginBridge.registerPluginElement(m,p,b),q.className="me-plugin",q.id=m+"_container",c.isVideo?b.parentNode.insertBefore(q,b):document.body.insertBefore(q,document.body.childNodes[0]),k=["id="+m,"jsinitfunction=mejs.MediaPluginBridge.initPlugin","jscallbackfunction=mejs.MediaPluginBridge.fireEvent","isvideo="+(c.isVideo?"true":"false"),
|
||||||
|
"autoplay="+(f?"true":"false"),"preload="+e,"width="+l,"startvolume="+a.startVolume,"timerrate="+a.timerRate,"flashstreamer="+a.flashStreamer,"height="+n,"pseudostreamstart="+a.pseudoStreamingStartQueryParam],null!==c.url&&("flash"==c.method?k.push("file="+mejs.Utility.encodeUrl(c.url)):k.push("file="+c.url)),a.enablePluginDebug&&k.push("debug=true"),a.enablePluginSmoothing&&k.push("smoothing=true"),a.enablePseudoStreaming&&k.push("pseudostreaming=true"),d&&k.push("controls=true"),a.pluginVars&&(k=
|
||||||
|
k.concat(a.pluginVars)),c.method){case "silverlight":q.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+m+'" name="'+m+'" width="'+l+'" height="'+n+'" class="mejs-shim"><param name="initParams" value="'+k.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="'+a.pluginPath+a.silverlightName+
|
||||||
|
'" /></object>';break;case "flash":mejs.MediaFeatures.isIE?(g=document.createElement("div"),q.appendChild(g),g.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+m+'" width="'+l+'" height="'+n+'" class="mejs-shim"><param name="movie" value="'+a.pluginPath+a.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+k.join("&")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="'+
|
||||||
|
a.flashScriptAccess+'" /><param name="allowFullScreen" value="true" /><param name="scale" value="default" /></object>'):q.innerHTML='<embed id="'+m+'" name="'+m+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="'+a.flashScriptAccess+'" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+a.pluginPath+a.flashName+'" flashvars="'+k.join("&")+'" width="'+l+'" height="'+n+'" scale="default"class="mejs-shim"></embed>';
|
||||||
|
break;case "youtube":var t;-1!=c.url.lastIndexOf("youtu.be")?(t=c.url.substr(c.url.lastIndexOf("/")+1),-1!=t.indexOf("?")&&(t=t.substr(0,t.indexOf("?")))):t=c.url.substr(c.url.lastIndexOf("=")+1);youtubeSettings={container:q,containerId:q.id,pluginMediaElement:p,pluginId:m,videoId:t,height:n,width:l};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings,a):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":if(a=m+"_player",p.vimeoid=c.url.substr(c.url.lastIndexOf("/")+
|
||||||
|
1),q.innerHTML='<iframe src="//player.vimeo.com/video/'+p.vimeoid+"?api=1&portrait=0&byline=0&title=0&player_id="+a+'" width="'+l+'" height="'+n+'" frameborder="0" class="mejs-shim" id="'+a+'" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',"function"==typeof $f){var r=$f(q.childNodes[0]);r.addEvent("ready",function(){function a(b,d,c,e){b={type:c,target:d};"timeupdate"==c&&(d.currentTime=b.currentTime=e.seconds,d.duration=b.duration=e.duration);d.dispatchEvent(b)}r.playVideo=
|
||||||
|
function(){r.api("play")};r.stopVideo=function(){r.api("unload")};r.pauseVideo=function(){r.api("pause")};r.seekTo=function(a){r.api("seekTo",a)};r.setVolume=function(a){r.api("setVolume",a)};r.setMuted=function(a){a?(r.lastVolume=r.api("getVolume"),r.api("setVolume",0)):(r.api("setVolume",r.lastVolume),delete r.lastVolume)};r.addEvent("play",function(){a(r,p,"play");a(r,p,"playing")});r.addEvent("pause",function(){a(r,p,"pause")});r.addEvent("finish",function(){a(r,p,"ended")});r.addEvent("playProgress",
|
||||||
|
function(b){a(r,p,"timeupdate",b)});p.pluginElement=q;p.pluginApi=r;mejs.MediaPluginBridge.initPlugin(m)})}else console.warn("You need to include froogaloop for vimeo to work")}return b.style.display="none",b.removeAttribute("autoplay"),p},updateNative:function(c,a,b,f){var e;c=c.htmlMediaElement;for(e in mejs.HtmlMediaElement)c[e]=mejs.HtmlMediaElement[e];return a.success(c,c),c}};
|
||||||
|
mejs.YouTubeApi={isIframeStarted:!1,isIframeLoaded:!1,loadIframeApi:function(){if(!this.isIframeStarted){var c=document.createElement("script");c.src="//www.youtube.com/player_api";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(c,a);this.isIframeStarted=!0}},iframeQueue:[],enqueueIframe:function(c){this.isLoaded?this.createIframe(c):(this.loadIframeApi(),this.iframeQueue.push(c))},createIframe:function(c){var a=c.pluginMediaElement,b=new YT.Player(c.containerId,{height:c.height,
|
||||||
|
width:c.width,videoId:c.videoId,playerVars:{controls:0},events:{onReady:function(){c.pluginMediaElement.pluginApi=b;mejs.MediaPluginBridge.initPlugin(c.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(b,a,"timeupdate")},250)},onStateChange:function(c){mejs.YouTubeApi.handleStateChange(c.data,b,a)}}})},createEvent:function(c,a,b){b={type:b,target:a};if(c&&c.getDuration){a.currentTime=b.currentTime=c.getCurrentTime();a.duration=b.duration=c.getDuration();b.paused=a.paused;b.ended=a.ended;
|
||||||
|
b.muted=c.isMuted();b.volume=c.getVolume()/100;b.bytesTotal=c.getVideoBytesTotal();b.bufferedBytes=c.getVideoBytesLoaded();var f=b.bufferedBytes/b.bytesTotal*b.duration;b.target.buffered=b.buffered={start:function(a){return 0},end:function(a){return f},length:1}}a.dispatchEvent(b)},iFrameReady:function(){for(this.isIframeLoaded=this.isLoaded=!0;0<this.iframeQueue.length;){var c=this.iframeQueue.pop();this.createIframe(c)}},flashPlayers:{},createFlash:function(c){this.flashPlayers[c.pluginId]=c;var a,
|
||||||
|
b="//www.youtube.com/apiplayer?enablejsapi=1&playerapiid="+c.pluginId+"&version=3&autoplay=0&controls=0&modestbranding=1&loop=0";mejs.MediaFeatures.isIE?(a=document.createElement("div"),c.container.appendChild(a),a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+c.pluginId+'" width="'+c.width+'" height="'+c.height+'" class="mejs-shim"><param name="movie" value="'+b+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="'+
|
||||||
|
options.flashScriptAccess+'" /><param name="allowFullScreen" value="true" /></object>'):c.container.innerHTML='<object type="application/x-shockwave-flash" id="'+c.pluginId+'" data="'+b+'" width="'+c.width+'" height="'+c.height+'" style="visibility: visible; " class="mejs-shim"><param name="allowScriptAccess" value="'+options.flashScriptAccess+'"><param name="wmode" value="transparent"></object>'},flashReady:function(c){var a=this.flashPlayers[c],b=document.getElementById(c),f=a.pluginMediaElement;
|
||||||
|
f.pluginApi=f.pluginElement=b;mejs.MediaPluginBridge.initPlugin(c);b.cueVideoById(a.videoId);c=a.containerId+"_callback";window[c]=function(a){mejs.YouTubeApi.handleStateChange(a,b,f)};b.addEventListener("onStateChange",c);setInterval(function(){mejs.YouTubeApi.createEvent(b,f,"timeupdate")},250);mejs.YouTubeApi.createEvent(b,f,"canplay")},handleStateChange:function(c,a,b){switch(c){case -1:b.paused=!0;b.ended=!0;mejs.YouTubeApi.createEvent(a,b,"loadedmetadata");break;case 0:b.paused=!1;b.ended=!0;
|
||||||
|
mejs.YouTubeApi.createEvent(a,b,"ended");break;case 1:b.paused=!1;b.ended=!1;mejs.YouTubeApi.createEvent(a,b,"play");mejs.YouTubeApi.createEvent(a,b,"playing");break;case 2:b.paused=!0;b.ended=!1;mejs.YouTubeApi.createEvent(a,b,"pause");break;case 3:mejs.YouTubeApi.createEvent(a,b,"progress")}}};window.onYouTubePlayerAPIReady=function(){mejs.YouTubeApi.iFrameReady()};window.onYouTubePlayerReady=function(c){mejs.YouTubeApi.flashReady(c)};window.mejs=mejs;window.MediaElement=mejs.MediaElement;
|
||||||
|
(function(c,a,b){var f={locale:{language:a.i18n&&a.i18n.locale.language||"",strings:a.i18n&&a.i18n.locale.strings||{}},ietf_lang_regex:/^(x\-)?[a-z]{2,}(\-\w{2,})?(\-\w{2,})?$/,methods:{},getLanguage:function(){var a=f.locale.language||window.navigator.userLanguage||window.navigator.language;return f.ietf_lang_regex.exec(a)?a:null}};"undefined"!=typeof mejsL10n&&(f.locale.language=mejsL10n.language);f.methods.checkPlain=function(a){var b,c,f={"&":"&",'"':""","<":"<",">":">"};a=String(a);
|
||||||
|
for(b in f)f.hasOwnProperty(b)&&(c=new RegExp(b,"g"),a=a.replace(c,f[b]));return a};f.methods.t=function(a,b){return f.locale.strings&&f.locale.strings[b.context]&&f.locale.strings[b.context][a]&&(a=f.locale.strings[b.context][a]),f.methods.checkPlain(a)};f.t=function(a,b){if("string"==typeof a&&0<a.length){var c=f.getLanguage();return b=b||{context:c},f.methods.t(a,b)}throw{name:"InvalidArgumentException",message:"First argument is either not a string or empty."};};a.i18n=f})(document,mejs);
|
||||||
|
(function(c,a){"undefined"!=typeof mejsL10n&&(c[mejsL10n.language]=mejsL10n.strings)})(mejs.i18n.locale.strings);"undefined"!=typeof jQuery?mejs.$=jQuery:"undefined"!=typeof Zepto?(mejs.$=Zepto,Zepto.fn.outerWidth=function(c){var a=$(this).width();return c&&(a+=parseInt($(this).css("margin-right"),10),a+=parseInt($(this).css("margin-left"),10)),a}):"undefined"!=typeof ender&&(mejs.$=ender);
|
||||||
|
(function(c){mejs.MepDefaults={poster:"",showPosterWhenEnded:!1,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return.05*a.duration},defaultSeekForwardInterval:function(a){return.05*a.duration},setDimensions:!0,audioWidth:-1,audioHeight:-1,startVolume:.8,loop:!1,autoRewind:!0,enableAutosize:!0,timeFormat:"",alwaysShowHours:!1,showTimecodeFrameCount:!1,framesPerSecond:25,autosizeProgress:!0,
|
||||||
|
alwaysShowControls:!1,hideVideoControlsOnLoad:!1,clickToPlayPause:!0,iPadUseNativeControls:!1,iPhoneUseNativeControls:!1,AndroidUseNativeControls:!1,features:"playpause current progress duration tracks volume fullscreen".split(" "),isVideo:!0,enableKeyboard:!0,pauseOtherPlayers:!0,keyActions:[{keys:[32,179],action:function(a,b){b.paused||b.ended?b.play():b.pause()}},{keys:[38],action:function(a,b){a.container.find(".mejs-volume-slider").css("display","block");a.isVideo&&(a.showControls(),a.startControlsTimer());
|
||||||
|
b.setVolume(Math.min(b.volume+.1,1))}},{keys:[40],action:function(a,b){a.container.find(".mejs-volume-slider").css("display","block");a.isVideo&&(a.showControls(),a.startControlsTimer());b.setVolume(Math.max(b.volume-.1,0))}},{keys:[37,227],action:function(a,b){if(!isNaN(b.duration)&&0<b.duration){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)&&
|
||||||
|
0<b.duration){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,b){"undefined"!=typeof a.enterFullScreen&&(a.isFullScreen?a.exitFullScreen():a.enterFullScreen())}},{keys:[77],action:function(a,b){a.container.find(".mejs-volume-slider").css("display","block");a.isVideo&&(a.showControls(),a.startControlsTimer());a.media.muted?a.setMuted(!1):a.setMuted(!0)}}]};mejs.mepIndex=
|
||||||
|
0;mejs.players={};mejs.MediaElementPlayer=function(a,b){return this instanceof mejs.MediaElementPlayer?(this.$media=this.$node=c(a),this.node=this.media=this.$media[0],this.node?"undefined"!=typeof this.node.player?this.node.player:("undefined"==typeof b&&(b=this.$node.data("mejsoptions")),this.options=c.extend({},mejs.MepDefaults,b),this.options.timeFormat||(this.options.timeFormat="mm:ss",this.options.alwaysShowHours&&(this.options.timeFormat="hh:mm:ss"),this.options.showTimecodeFrameCount&&(this.options.timeFormat+=
|
||||||
|
":ff")),mejs.Utility.calculateTimeFormat(0,this.options,this.options.framesPerSecond||25),this.id="mep_"+mejs.mepIndex++,mejs.players[this.id]=this,this.init(),this):void 0):new mejs.MediaElementPlayer(a,b)};mejs.MediaElementPlayer.prototype={hasFocus:!1,controlsAreVisible:!0,init:function(){var a=this,b=mejs.MediaFeatures,f=c.extend(!0,{},a.options,{success:function(b,c){a.meReady(b,c)},error:function(b){a.handleError(b)}}),e=a.media.tagName.toLowerCase();(a.isDynamic="audio"!==e&&"video"!==e,a.isDynamic?
|
||||||
|
a.isVideo=a.options.isVideo:a.isVideo="audio"!==e&&a.options.isVideo,b.isiPad&&a.options.iPadUseNativeControls||b.isiPhone&&a.options.iPhoneUseNativeControls)?(a.$media.attr("controls","controls"),b.isiPad&&null!==a.media.getAttribute("autoplay")&&a.play()):b.isAndroid&&a.options.AndroidUseNativeControls||(a.$media.removeAttr("controls"),e=a.isVideo?mejs.i18n.t("Video Player"):mejs.i18n.t("Audio Player"),(c('<span class="mejs-offscreen">'+e+"</span>").insertBefore(a.$media),a.container=c('<div id="'+
|
||||||
|
a.id+'" class="mejs-container '+(mejs.MediaFeatures.svg?"svg":"no-svg")+'" tabindex="0" role="application" aria-label="'+e+'"><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).focus(function(b){a.controlsAreVisible||(a.showControls(!0),a.container.find(".mejs-playpause-button > button").focus())}),a.container.addClass((b.isAndroid?
|
||||||
|
"mejs-android ":"")+(b.isiOS?"mejs-ios ":"")+(b.isiPad?"mejs-ipad ":"")+(b.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio ")),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]):a.container.find(".mejs-mediaelement").append(a.$media),a.node.player=a,a.controls=a.container.find(".mejs-controls"),a.layers=a.container.find(".mejs-layers"),b=a.isVideo?"video":"audio",e=b.substring(0,1).toUpperCase()+
|
||||||
|
b.substring(1),0<a.options[b+"Width"]||-1<a.options[b+"Width"].toString().indexOf("%")?a.width=a.options[b+"Width"]:""!==a.media.style.width&&null!==a.media.style.width?a.width=a.media.style.width:null!==a.media.getAttribute("width")?a.width=a.$media.attr("width"):a.width=a.options["default"+e+"Width"],0<a.options[b+"Height"]||-1<a.options[b+"Height"].toString().indexOf("%")?a.height=a.options[b+"Height"]:""!==a.media.style.height&&null!==a.media.style.height?a.height=a.media.style.height:null!==
|
||||||
|
a.$media[0].getAttribute("height")?a.height=a.$media.attr("height"):a.height=a.options["default"+e+"Height"],a.setPlayerSize(a.width,a.height),f.pluginWidth=a.width,f.pluginHeight=a.height);mejs.MediaElement(a.$media[0],f);"undefined"!=typeof a.container&&a.controlsAreVisible&&a.container.trigger("controlsshown")},showControls:function(a){var b=this;b.controlsAreVisible||("undefined"==typeof a||a?(b.controls.css("visibility","visible").stop(!0,!0).fadeIn(200,function(){b.controlsAreVisible=!0;b.container.trigger("controlsshown")}),
|
||||||
|
b.container.find(".mejs-control").css("visibility","visible").stop(!0,!0).fadeIn(200,function(){b.controlsAreVisible=!0})):(b.controls.css("visibility","visible").css("display","block"),b.container.find(".mejs-control").css("visibility","visible").css("display","block"),b.controlsAreVisible=!0,b.container.trigger("controlsshown")),b.setControlsSize())},hideControls:function(a){var b=this;!b.controlsAreVisible||b.options.alwaysShowControls||b.keyboardAction||("undefined"==typeof a||a?(b.controls.stop(!0,
|
||||||
|
!0).fadeOut(200,function(){c(this).css("visibility","hidden").css("display","block");b.controlsAreVisible=!1;b.container.trigger("controlshidden")}),b.container.find(".mejs-control").stop(!0,!0).fadeOut(200,function(){c(this).css("visibility","hidden").css("display","block")})):(b.controls.css("visibility","hidden").css("display","block"),b.container.find(".mejs-control").css("visibility","hidden").css("display","block"),b.controlsAreVisible=!1,b.container.trigger("controlshidden")))},controlsTimer:null,
|
||||||
|
startControlsTimer:function(a){var b=this;a="undefined"!=typeof a?a:1500;b.killControlsTimer("start");b.controlsTimer=setTimeout(function(){b.hideControls();b.killControlsTimer("hide")},a)},killControlsTimer:function(a){null!==this.controlsTimer&&(clearTimeout(this.controlsTimer),delete this.controlsTimer,this.controlsTimer=null)},controlsEnabled:!0,disableControls:function(){this.killControlsTimer();this.hideControls(!1);this.controlsEnabled=!1},enableControls:function(){this.showControls(!1);this.controlsEnabled=
|
||||||
|
!0},meReady:function(a,b){var f,e,d=this,g=mejs.MediaFeatures,h=b.getAttribute("autoplay"),h=!("undefined"==typeof h||null===h||"false"===h);if(!d.created){if(d.created=!0,d.media=a,d.domNode=b,!(g.isAndroid&&d.options.AndroidUseNativeControls||g.isiPad&&d.options.iPadUseNativeControls||g.isiPhone&&d.options.iPhoneUseNativeControls)){d.buildposter(d,d.controls,d.layers,d.media);d.buildkeyboard(d,d.controls,d.layers,d.media);d.buildoverlays(d,d.controls,d.layers,d.media);d.findTracks();for(f in d.options.features)if(e=
|
||||||
|
d.options.features[f],d["build"+e])try{d["build"+e](d,d.controls,d.layers,d.media)}catch(l){}d.container.trigger("controlsready");d.setPlayerSize(d.width,d.height);d.setControlsSize();d.isVideo&&(mejs.MediaFeatures.hasTouch?d.$media.bind("touchstart",function(){d.controlsAreVisible?d.hideControls(!1):d.controlsEnabled&&d.showControls(!1)}):(d.clickToPlayPauseCallback=function(){d.options.clickToPlayPause&&(d.media.paused?d.play():d.pause())},d.media.addEventListener("click",d.clickToPlayPauseCallback,
|
||||||
|
!1),d.container.bind("mouseenter",function(){d.controlsEnabled&&(d.options.alwaysShowControls||(d.killControlsTimer("enter"),d.showControls(),d.startControlsTimer(2500)))}).bind("mousemove",function(){d.controlsEnabled&&(d.controlsAreVisible||d.showControls(),d.options.alwaysShowControls||d.startControlsTimer(2500))}).bind("mouseleave",function(){d.controlsEnabled&&(d.media.paused||d.options.alwaysShowControls||d.startControlsTimer(1E3))})),d.options.hideVideoControlsOnLoad&&d.hideControls(!1),h&&
|
||||||
|
!d.options.alwaysShowControls&&d.hideControls(),d.options.enableAutosize&&d.media.addEventListener("loadedmetadata",function(a){0>=d.options.videoHeight&&null===d.domNode.getAttribute("height")&&!isNaN(a.target.videoHeight)&&(d.setPlayerSize(a.target.videoWidth,a.target.videoHeight),d.setControlsSize(),d.media.setVideoSize(a.target.videoWidth,a.target.videoHeight))},!1));a.addEventListener("play",function(){for(var a in mejs.players){var b=mejs.players[a];b.id==d.id||!d.options.pauseOtherPlayers||
|
||||||
|
b.paused||b.ended||b.pause();b.hasFocus=!1}d.hasFocus=!0},!1);d.media.addEventListener("ended",function(a){if(d.options.autoRewind)try{d.media.setCurrentTime(0),window.setTimeout(function(){c(d.container).find(".mejs-overlay-loading").parent().hide()},20)}catch(b){}d.media.pause();d.setProgressRail&&d.setProgressRail();d.setCurrentRail&&d.setCurrentRail();d.options.loop?d.play():!d.options.alwaysShowControls&&d.controlsEnabled&&d.showControls()},!1);d.media.addEventListener("loadedmetadata",function(a){d.updateDuration&&
|
||||||
|
d.updateDuration();d.updateCurrent&&d.updateCurrent();d.isFullScreen||(d.setPlayerSize(d.width,d.height),d.setControlsSize())},!1);var k=null;d.media.addEventListener("timeupdate",function(){k!==this.duration&&(k=this.duration,mejs.Utility.calculateTimeFormat(k,d.options,d.options.framesPerSecond||25))},!1);d.container.focusout(function(a){a.relatedTarget&&(a=c(a.relatedTarget),d.keyboardAction&&0===a.parents(".mejs-container").length&&(d.keyboardAction=!1,d.hideControls(!0)))});setTimeout(function(){d.setPlayerSize(d.width,
|
||||||
|
d.height);d.setControlsSize()},50);d.globalBind("resize",function(){d.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||d.setPlayerSize(d.width,d.height);d.setControlsSize()});"youtube"==d.media.pluginType&&(g.isiOS||g.isAndroid)&&d.container.find(".mejs-overlay-play").hide()}h&&"native"==a.pluginType&&d.play();d.options.success&&("string"==typeof d.options.success?window[d.options.success](d.media,d.domNode,d):d.options.success(d.media,d.domNode,d))}},handleError:function(a){this.controls.hide();
|
||||||
|
this.options.error&&this.options.error(a)},setPlayerSize:function(a,b){if(!this.options.setDimensions)return!1;if("undefined"!=typeof a&&(this.width=a),"undefined"!=typeof b&&(this.height=b),0<this.height.toString().indexOf("%")||"none"!==this.$node.css("max-width")&&"t.width"!==this.$node.css("max-width")||this.$node[0].currentStyle&&"100%"===this.$node[0].currentStyle.maxWidth){var f=this.isVideo?this.media.videoWidth&&0<this.media.videoWidth?this.media.videoWidth:null!==this.media.getAttribute("width")?
|
||||||
|
this.media.getAttribute("width"):this.options.defaultVideoWidth:this.options.defaultAudioWidth,e=this.isVideo?this.media.videoHeight&&0<this.media.videoHeight?this.media.videoHeight:null!==this.media.getAttribute("height")?this.media.getAttribute("height"):this.options.defaultVideoHeight:this.options.defaultAudioHeight,d=this.container.parent().closest(":visible").width(),g=this.container.parent().closest(":visible").height(),f=this.isVideo||!this.options.autosizeProgress?parseInt(d*e/f,10):e;isNaN(f)&&
|
||||||
|
(f=g);0<this.container.parent().length&&"body"===this.container.parent()[0].tagName.toLowerCase()&&(d=c(window).width(),f=c(window).height());f&&d&&(this.container.width(d).height(f),this.$media.add(this.container.find(".mejs-shim")).width("100%").height("100%"),this.isVideo&&this.media.setVideoSize&&this.media.setVideoSize(d,f),this.layers.children(".mejs-layer").width("100%").height("100%"))}else this.container.width(this.width).height(this.height),this.layers.children(".mejs-layer").width(this.width).height(this.height)},
|
||||||
|
setControlsSize:function(){var a=0,b=0,f=this.controls.find(".mejs-time-rail"),e=this.controls.find(".mejs-time-total"),d=f.siblings(),g=d.last(),h=null;if(this.container.is(":visible")&&f.length&&f.is(":visible")){this.options&&!this.options.autosizeProgress&&(b=parseInt(f.css("width"),10));0!==b&&b||(d.each(function(){var b=c(this);"absolute"!=b.css("position")&&b.is(":visible")&&(a+=c(this).outerWidth(!0))}),b=this.controls.width()-a-(f.outerWidth(!0)-f.width()));do f.width(b),e.width(b-(e.outerWidth(!0)-
|
||||||
|
e.width())),"absolute"!=g.css("position")&&(h=g.length?g.position():null,b--);while(null!==h&&0<h.top&&0<b);this.container.trigger("controlsresize")}},buildposter:function(a,b,f,e){var d=c('<div class="mejs-poster mejs-layer"></div>').appendTo(f);b=a.$media.attr("poster");""!==a.options.poster&&(b=a.options.poster);b?this.setPoster(b):d.hide();e.addEventListener("play",function(){d.hide()},!1);a.options.showPosterWhenEnded&&a.options.autoRewind&&e.addEventListener("ended",function(){d.show()},!1)},
|
||||||
|
setPoster:function(a){var b=this.container.find(".mejs-poster"),f=b.find("img");0===f.length&&(f=c('<img width="100%" height="100%" alt="" />').appendTo(b));f.attr("src",a);b.css({"background-image":"url("+a+")"})},buildoverlays:function(a,b,f,e){var d=this;if(a.isVideo){var g=c('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(f),h=c('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(f),
|
||||||
|
k=c('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(f).bind("click",function(){d.options.clickToPlayPause&&e.paused&&e.play()});e.addEventListener("play",function(){k.hide();g.hide();b.find(".mejs-time-buffering").hide();h.hide()},!1);e.addEventListener("playing",function(){k.hide();g.hide();b.find(".mejs-time-buffering").hide();h.hide()},!1);e.addEventListener("seeking",function(){g.show();b.find(".mejs-time-buffering").show()},!1);
|
||||||
|
e.addEventListener("seeked",function(){g.hide();b.find(".mejs-time-buffering").hide()},!1);e.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||k.show()},!1);e.addEventListener("waiting",function(){g.show();b.find(".mejs-time-buffering").show()},!1);e.addEventListener("loadeddata",function(){g.show();b.find(".mejs-time-buffering").show();mejs.MediaFeatures.isAndroid&&(e.canplayTimeout=window.setTimeout(function(){if(document.createEvent){var a=document.createEvent("HTMLEvents");return a.initEvent("canplay",
|
||||||
|
!0,!0),e.dispatchEvent(a)}},300))},!1);e.addEventListener("canplay",function(){g.hide();b.find(".mejs-time-buffering").hide();clearTimeout(e.canplayTimeout)},!1);e.addEventListener("error",function(a){d.handleError(a);g.hide();k.hide();h.show();h.find(".mejs-overlay-error").html("Error loading this resource")},!1);e.addEventListener("keydown",function(b){d.onkeydown(a,e,b)},!1)}},buildkeyboard:function(a,b,f,e){var d=this;d.container.keydown(function(){d.keyboardAction=!0});d.globalBind("keydown",
|
||||||
|
function(b){return a.hasFocus=0!==c(b.target).closest(".mejs-container").length,d.onkeydown(a,e,b)});d.globalBind("click",function(b){a.hasFocus=0!==c(b.target).closest(".mejs-container").length})},onkeydown:function(a,b,c){if(a.hasFocus&&a.options.enableKeyboard)for(var e=0,d=a.options.keyActions.length;d>e;e++)for(var g=a.options.keyActions[e],h=0,k=g.keys.length;k>h;h++)if(c.keyCode==g.keys[h])return"function"==typeof c.preventDefault&&c.preventDefault(),g.action(a,b,c.keyCode),!1;return!0},findTracks:function(){var a=
|
||||||
|
this,b=a.$media.find("track");a.tracks=[];b.each(function(b,e){e=c(e);a.tracks.push({srclang:e.attr("srclang")?e.attr("srclang").toLowerCase():"",src:e.attr("src"),kind:e.attr("kind"),label:e.attr("label")||"",entries:[],isLoaded:!1})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize(this.width,this.height);this.setControlsSize()},play:function(){this.load();this.media.play()},pause:function(){try{this.media.pause()}catch(a){}},load:function(){this.isLoaded||
|
||||||
|
this.media.load();this.isLoaded=!0},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){var a,b;this.container.prev(".mejs-offscreen").remove();for(a in this.options.features)if(b=this.options.features[a],this["clean"+b])try{this["clean"+b](this)}catch(c){}this.isDynamic?
|
||||||
|
this.$node.insertBefore(this.container):(this.$media.prop("controls",!0),this.$node.clone().insertBefore(this.container).show(),this.$node.remove());"native"!==this.media.pluginType&&this.media.remove();delete mejs.players[this.id];"object"==typeof this.container&&this.container.remove();this.globalUnbind();delete this.node.player},rebuildtracks:function(){this.findTracks();this.buildtracks(this,this.controls,this.layers,this.media)},resetSize:function(){var a=this;setTimeout(function(){a.setPlayerSize(a.width,
|
||||||
|
a.height);a.setControlsSize()},50)}};(function(){function a(a,e){var d={d:[],w:[]};return c.each((a||"").split(" "),function(a,c){var f=c+"."+e;0===f.indexOf(".")?(d.d.push(f),d.w.push(f)):d[b.test(c)?"w":"d"].push(f)}),d.d=d.d.join(" "),d.w=d.w.join(" "),d}var b=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;mejs.MediaElementPlayer.prototype.globalBind=function(b,e,d){var g=this.node?this.node.ownerDocument:document;b=a(b,this.id);
|
||||||
|
b.d&&c(g).bind(b.d,e,d);b.w&&c(window).bind(b.w,e,d)};mejs.MediaElementPlayer.prototype.globalUnbind=function(b,e){var d=this.node?this.node.ownerDocument:document;b=a(b,this.id);b.d&&c(d).unbind(b.d,e);b.w&&c(window).unbind(b.w,e)}})();"undefined"!=typeof c&&(c.fn.mediaelementplayer=function(a){return!1===a?this.each(function(){var a=c(this).data("mediaelementplayer");a&&a.remove();c(this).removeData("mediaelementplayer")}):this.each(function(){c(this).data("mediaelementplayer",new mejs.MediaElementPlayer(this,
|
||||||
|
a))}),this},c(document).ready(function(){c(".mejs-player").mediaelementplayer()}));window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{playText:mejs.i18n.t("Play"),pauseText:mejs.i18n.t("Pause")});c.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,b,f,e){function d(a){"play"===a?(h.removeClass("mejs-play").addClass("mejs-pause"),k.attr({title:g.pauseText,"aria-label":g.pauseText})):(h.removeClass("mejs-pause").addClass("mejs-play"),k.attr({title:g.playText,"aria-label":g.playText}))}var g=this.options,h=c('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+
|
||||||
|
this.id+'" title="'+g.playText+'" aria-label="'+g.playText+'"></button></div>').appendTo(b).click(function(a){return a.preventDefault(),e.paused?e.play():e.pause(),!1}),k=h.find("button");d("pse");e.addEventListener("play",function(){d("play")},!1);e.addEventListener("playing",function(){d("play")},!1);e.addEventListener("pause",function(){d("pse")},!1);e.addEventListener("paused",function(){d("pse")},!1)}})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{stopText:"Stop"});c.extend(MediaElementPlayer.prototype,{buildstop:function(a,b,f,e){c('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="'+this.options.stopText+'" aria-label="'+this.options.stopText+'"></button></div>').appendTo(b).click(function(){e.paused||e.pause();0<e.currentTime&&(e.setCurrentTime(0),e.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,a.options)),b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0,a.options)),f.find(".mejs-poster").show())})}})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{progessHelpText:mejs.i18n.t("Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.")});c.extend(MediaElementPlayer.prototype,{buildprogress:function(a,b,f,e){c('<div class="mejs-time-rail"><span class="mejs-time-total mejs-time-slider"><span class="mejs-time-buffering"></span><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><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 d=this,g=b.find(".mejs-time-total");f=b.find(".mejs-time-loaded");var h=b.find(".mejs-time-current"),k=b.find(".mejs-time-handle"),l=b.find(".mejs-time-float"),n=b.find(".mejs-time-float-current"),m=b.find(".mejs-time-slider"),p=function(b){var d=g.offset(),c=g.width(),f=0,h=0,k=0;b=b.originalEvent&&b.originalEvent.changedTouches?b.originalEvent.changedTouches[0].pageX:b.changedTouches?b.changedTouches[0].pageX:b.pageX;e.duration&&(b<d.left?b=d.left:b>c+d.left&&(b=c+d.left),k=b-d.left,f=k/c,h=
|
||||||
|
.02>=f?0:f*e.duration,q&&h!==e.currentTime&&e.setCurrentTime(h),mejs.MediaFeatures.hasTouch||(l.css("left",k),n.html(mejs.Utility.secondsToTimeCode(h,a.options)),l.show()))},q=!1,u=0,t=!1,r=a.options.autoRewind,v=function(){1E3<=new Date-u&&e.play()};m.bind("focus",function(b){a.options.autoRewind=!1});m.bind("blur",function(b){a.options.autoRewind=r});m.bind("keydown",function(a){1E3<=new Date-u&&(t=e.paused);var b=e.duration,d=e.currentTime;switch(a.keyCode){case 37:--d;break;case 39:d+=1;break;
|
||||||
|
case 38:d+=Math.floor(.1*b);break;case 40:d-=Math.floor(.1*b);break;case 36:d=0;break;case 35:d=b;break;case 10:return void(e.paused?e.play():e.pause());case 13:return void(e.paused?e.play():e.pause());default:return}return d=0>d?0:d>=b?b:Math.floor(d),u=new Date,t||e.pause(),d<e.duration&&!t&&setTimeout(v,1100),e.setCurrentTime(d),a.preventDefault(),a.stopPropagation(),!1});g.bind("mousedown touchstart",function(a){1!==a.which&&0!==a.which||(q=!0,p(a),d.globalBind("mousemove.dur touchmove.dur",function(a){p(a)}),
|
||||||
|
d.globalBind("mouseup.dur touchend.dur",function(a){q=!1;l.hide();d.globalUnbind(".dur")}))}).bind("mouseenter",function(a){d.globalBind("mousemove.dur",function(a){p(a)});mejs.MediaFeatures.hasTouch||l.show()}).bind("mouseleave",function(a){q||(d.globalUnbind(".dur"),l.hide())});e.addEventListener("progress",function(b){a.setProgressRail(b);a.setCurrentRail(b)},!1);e.addEventListener("timeupdate",function(b){a.setProgressRail(b);a.setCurrentRail(b);b=e.currentTime;var d=mejs.i18n.t("Time Slider"),
|
||||||
|
c=mejs.Utility.secondsToTimeCode(b,a.options);m.attr({"aria-label":d,"aria-valuemin":0,"aria-valuemax":e.duration,"aria-valuenow":b,"aria-valuetext":c,role:"slider",tabindex:0})},!1);d.container.on("controlsresize",function(){a.setProgressRail();a.setCurrentRail()});d.loaded=f;d.total=g;d.current=h;d.handle=k},setProgressRail:function(a){var b=void 0!==a?a.target:this.media,c=null;b&&b.buffered&&0<b.buffered.length&&b.buffered.end&&b.duration?c=b.buffered.end(b.buffered.length-1)/b.duration:b&&void 0!==
|
||||||
|
b.bytesTotal&&0<b.bytesTotal&&void 0!==b.bufferedBytes?c=b.bufferedBytes/b.bytesTotal:a&&a.lengthComputable&&0!==a.total&&(c=a.loaded/a.total);null!==c&&(c=Math.min(1,Math.max(0,c)),this.loaded&&this.total&&this.loaded.width(this.total.width()*c))},setCurrentRail:function(){if(void 0!==this.media.currentTime&&this.media.duration&&this.total&&this.handle){var a=Math.round(this.total.width()*this.media.currentTime/this.media.duration),b=a-Math.round(this.handle.outerWidth(!0)/2);this.current.width(a);
|
||||||
|
this.handle.css("left",b)}}})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:"<span> | </span>"});c.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,b,f,e){c('<div class="mejs-time" role="timer" aria-live="off"><span class="mejs-currenttime">'+mejs.Utility.secondsToTimeCode(0,a.options)+"</span></div>").appendTo(b);this.currenttime=this.controls.find(".mejs-currenttime");e.addEventListener("timeupdate",function(){a.updateCurrent()},!1)},buildduration:function(a,b,f,e){0<b.children().last().find(".mejs-currenttime").length?
|
||||||
|
c(this.options.timeAndDurationSeparator+'<span class="mejs-duration">'+mejs.Utility.secondsToTimeCode(this.options.duration,this.options)+"</span>").appendTo(b.find(".mejs-time")):(b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container"),c('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+mejs.Utility.secondsToTimeCode(this.options.duration,this.options)+"</span></div>").appendTo(b));this.durationD=this.controls.find(".mejs-duration");e.addEventListener("timeupdate",
|
||||||
|
function(){a.updateDuration()},!1)},updateCurrent:function(){this.currenttime&&this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options))},updateDuration:function(){this.container.toggleClass("mejs-long-video",3600<this.media.duration);this.durationD&&(0<this.options.duration||this.media.duration)&&this.durationD.html(mejs.Utility.secondsToTimeCode(0<this.options.duration?this.options.duration:this.media.duration,this.options))}})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{muteText:mejs.i18n.t("Mute Toggle"),allyVolumeControlText:mejs.i18n.t("Use Up/Down Arrow keys to increase or decrease volume."),hideVolumeOnTouchDevices:!0,audioVolume:"horizontal",videoVolume:"vertical"});c.extend(MediaElementPlayer.prototype,{buildvolume:function(a,b,f,e){if(!mejs.MediaFeatures.isAndroid&&!mejs.MediaFeatures.isiOS||!this.options.hideVolumeOnTouchDevices){var d=this,g=d.isVideo?d.options.videoVolume:d.options.audioVolume,h="horizontal"==g?
|
||||||
|
c('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+d.id+'" title="'+d.options.muteText+'" aria-label="'+d.options.muteText+'"></button></div><a href="javascript:void(0);" class="mejs-horizontal-volume-slider"><span class="mejs-offscreen">'+d.options.allyVolumeControlText+'</span><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></a>').appendTo(b):c('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+
|
||||||
|
d.id+'" title="'+d.options.muteText+'" aria-label="'+d.options.muteText+'"></button><a href="javascript:void(0);" class="mejs-volume-slider"><span class="mejs-offscreen">'+d.options.allyVolumeControlText+'</span><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></a></div>').appendTo(b),k=d.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),l=d.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),n=d.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),
|
||||||
|
m=d.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),p=function(a,b){if(!k.is(":visible")&&"undefined"==typeof b)return k.show(),p(a,!0),void k.hide();a=Math.max(0,a);a=Math.min(a,1);0===a?(h.removeClass("mejs-mute").addClass("mejs-unmute"),h.children("button").attr("title",mejs.i18n.t("Unmute")).attr("aria-label",mejs.i18n.t("Unmute"))):(h.removeClass("mejs-unmute").addClass("mejs-mute"),h.children("button").attr("title",mejs.i18n.t("Mute")).attr("aria-label",mejs.i18n.t("Mute")));
|
||||||
|
var d=l.position();if("vertical"==g){var c=l.height(),e=c-c*a;m.css("top",Math.round(d.top+e-m.height()/2));n.height(c-e);n.css("top",d.top+e)}else c=l.width()*a,m.css("left",Math.round(d.left+c-m.width()/2)),n.width(Math.round(c))},q=function(a){var b=null,d=l.offset();if("vertical"===g){if(b=l.height(),b=(b-(a.pageY-d.top))/b,0===d.top||0===d.left)return}else b=l.width(),b=(a.pageX-d.left)/b;b=Math.max(0,b);b=Math.min(b,1);p(b);0===b?e.setMuted(!0):e.setMuted(!1);e.setVolume(b)},u=!1,t=!1;h.hover(function(){k.show();
|
||||||
|
t=!0},function(){t=!1;u||"vertical"!=g||k.hide()});k.bind("mouseover",function(){t=!0}).bind("mousedown",function(a){return q(a),d.globalBind("mousemove.vol",function(a){q(a)}),d.globalBind("mouseup.vol",function(){u=!1;d.globalUnbind(".vol");t||"vertical"!=g||k.hide()}),u=!0,!1}).bind("keydown",function(a){var b=e.volume;switch(a.keyCode){case 38:b+=.1;break;case 40:b-=.1;break;default:return!0}return u=!1,p(b),e.setVolume(b),!1});h.find("button").click(function(){e.setMuted(!e.muted)});h.find("button").bind("focus",
|
||||||
|
function(){k.show()});e.addEventListener("volumechange",function(a){u||(e.muted?(p(0),h.removeClass("mejs-mute").addClass("mejs-unmute")):(p(e.volume),h.removeClass("mejs-unmute").addClass("mejs-mute")));a=Math.floor(100*e.volume);k.attr({"aria-label":mejs.i18n.t("volumeSlider"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,"aria-valuetext":a+"%",role:"slider",tabindex:0})},!1);0===a.options.startVolume&&e.setMuted(!0);"native"===e.pluginType&&e.setVolume(a.options.startVolume);d.container.on("controlsresize",
|
||||||
|
function(){p(e.volume)})}}})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{usePluginFullScreen:!0,newWindowCallback:function(){return""},fullscreenText:mejs.i18n.t("Fullscreen")});c.extend(MediaElementPlayer.prototype,{isFullScreen:!1,isNativeFullScreen:!1,isInIframe:!1,buildfullscreen:function(a,b,f,e){if(a.isVideo){(a.isInIframe=window.location!=window.parent.location,mejs.MediaFeatures.hasTrueNativeFullScreen)&&a.globalBind(mejs.MediaFeatures.fullScreenEventName,function(b){a.isFullScreen&&(mejs.MediaFeatures.isFullScreen()?(a.isNativeFullScreen=
|
||||||
|
!0,a.setControlsSize()):(a.isNativeFullScreen=!1,a.exitFullScreen()))});var d=this,g=c('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+d.id+'" title="'+d.options.fullscreenText+'" aria-label="'+d.options.fullscreenText+'"></button></div>').appendTo(b);if("native"===d.media.pluginType||!d.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||a.isFullScreen?
|
||||||
|
a.exitFullScreen():a.enterFullScreen()});else{var h=null;if(function(){var a,b=document.createElement("x"),d=document.documentElement,c=window.getComputedStyle;return"pointerEvents"in b.style?(b.style.pointerEvents="auto",b.style.pointerEvents="x",d.appendChild(b),a=c&&"auto"===c(b,"").pointerEvents,d.removeChild(b),!!a):!1}()&&!mejs.MediaFeatures.isOpera){var k,l=!1,n=function(){if(l){for(var a in m)m[a].hide();g.css("pointer-events","");d.controls.css("pointer-events","");d.media.removeEventListener("click",
|
||||||
|
d.clickToPlayPauseCallback);l=!1}},m={};f=["top","left","right","bottom"];var p=function(){var a=g.offset().left-d.container.offset().left,b=g.offset().top-d.container.offset().top,c=g.outerWidth(!0),e=g.outerHeight(!0),f=d.container.width(),h=d.container.height();for(k in m)m[k].css({position:"absolute",top:0,left:0});m.top.width(f).height(b);m.left.width(a).height(e).css({top:b});m.right.width(f-a-c).height(e).css({top:b,left:a+c});m.bottom.width(f).height(h-e-b).css({top:b+e})};d.globalBind("resize",
|
||||||
|
function(){p()});k=0;for(b=f.length;b>k;k++)m[f[k]]=c('<div class="mejs-fullscreen-hover" />').appendTo(d.container).mouseover(n).hide();g.on("mouseover",function(){if(!d.isFullScreen){var b=g.offset(),c=a.container.offset();e.positionFullscreenButton(b.left-c.left,b.top-c.top,!1);g.css("pointer-events","none");d.controls.css("pointer-events","none");d.media.addEventListener("click",d.clickToPlayPauseCallback);for(k in m)m[k].show();p();l=!0}});e.addEventListener("fullscreenchange",function(a){d.isFullScreen=
|
||||||
|
!d.isFullScreen;d.isFullScreen?d.media.removeEventListener("click",d.clickToPlayPauseCallback):d.media.addEventListener("click",d.clickToPlayPauseCallback);n()});d.globalBind("mousemove",function(a){if(l){var b=g.offset();(a.pageY<b.top||a.pageY>b.top+g.outerHeight(!0)||a.pageX<b.left||a.pageX>b.left+g.outerWidth(!0))&&(g.css("pointer-events",""),d.controls.css("pointer-events",""),l=!1)}})}else g.on("mouseover",function(){null!==h&&(clearTimeout(h),delete h);var b=g.offset(),d=a.container.offset();
|
||||||
|
e.positionFullscreenButton(b.left-d.left,b.top-d.top,!0)}).on("mouseout",function(){null!==h&&(clearTimeout(h),delete h);h=setTimeout(function(){e.hideFullscreenButton()},1500)})}a.fullscreenBtn=g;d.globalBind("keydown",function(b){(mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||d.isFullScreen)&&27==b.keyCode&&a.exitFullScreen()});d.normalHeight=0;d.normalWidth=0}},cleanfullscreen:function(a){a.exitFullScreen()},containerSizeTimeout:null,enterFullScreen:function(){var a=
|
||||||
|
this;if("native"===a.media.pluginType||!mejs.MediaFeatures.isFirefox&&!a.options.usePluginFullScreen){if(c(document.documentElement).addClass("mejs-fullscreen"),a.normalHeight=a.container.height(),a.normalWidth=a.container.width(),"native"===a.media.pluginType)if(mejs.MediaFeatures.hasTrueNativeFullScreen)mejs.MediaFeatures.requestFullScreen(a.container[0]),a.isInIframe&&setTimeout(function e(){if(a.isNativeFullScreen){var b=window.devicePixelRatio||1,g=b*c(window).width(),h=screen.width,b=b*g;Math.abs(h-
|
||||||
|
g)>Math.abs(h-b)&&(g=b);Math.abs(h-g)>.002*h?a.exitFullScreen():setTimeout(e,500)}},1E3);else if(mejs.MediaFeatures.hasSemiNativeFullScreen)return void a.media.webkitEnterFullscreen();if(a.isInIframe){var b=a.options.newWindowCallback(this);if(""!==b){if(!mejs.MediaFeatures.hasTrueNativeFullScreen)return a.pause(),void window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");setTimeout(function(){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)}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");a.containerSizeTimeout=setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);"native"===a.media.pluginType?a.$media.width("100%").height("100%"):(a.container.find(".mejs-shim").width("100%").height("100%"),a.media.setVideoSize(c(window).width(),
|
||||||
|
c(window).height()));a.layers.children("div").width("100%").height("100%");a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=!0;a.container.find(".mejs-captions-text").css("font-size",screen.width/a.width*100+"%");a.container.find(".mejs-captions-position").css("bottom","45px");a.container.trigger("enteredfullscreen")}},exitFullScreen:function(){return clearTimeout(this.containerSizeTimeout),"native"!==this.media.pluginType&&
|
||||||
|
mejs.MediaFeatures.isFirefox?void this.media.setFullscreen(!1):(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen)&&mejs.MediaFeatures.cancelFullScreen(),c(document.documentElement).removeClass("mejs-fullscreen"),this.container.removeClass("mejs-container-fullscreen").width(this.normalWidth).height(this.normalHeight),"native"===this.media.pluginType?this.$media.width(this.normalWidth).height(this.normalHeight):(this.container.find(".mejs-shim").width(this.normalWidth).height(this.normalHeight),
|
||||||
|
this.media.setVideoSize(this.normalWidth,this.normalHeight)),this.layers.children("div").width(this.normalWidth).height(this.normalHeight),this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen"),this.setControlsSize(),this.isFullScreen=!1,this.container.find(".mejs-captions-text").css("font-size",""),this.container.find(".mejs-captions-position").css("bottom",""),void this.container.trigger("exitedfullscreen"))}})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x"});c.extend(MediaElementPlayer.prototype,{buildspeed:function(a,b,f,e){if("native"==this.media.pluginType){var d=null,g=null,h=null;a=null;var k=[];a=!1;for(var l=0,n=this.options.speeds.length;n>l;l++)f=this.options.speeds[l],"string"==typeof f?(k.push({name:f+this.options.speedChar,value:f}),f===this.options.defaultSpeed&&(a=!0)):(k.push(f),f.value===this.options.defaultSpeed&&(a=
|
||||||
|
!0));a||k.push({name:this.options.defaultSpeed+this.options.speedChar,value:this.options.defaultSpeed});k.sort(function(a,b){return parseFloat(b.value)-parseFloat(a.value)});var m=function(a){l=0;for(n=k.length;n>l;l++)if(k[l].value===a)return k[l].name};f='<div class="mejs-button mejs-speed-button"><button type="button">'+m(this.options.defaultSpeed)+'</button><div class="mejs-speed-selector"><ul>';l=0;for(il=k.length;l<il;l++)a=this.id+"-speed-"+k[l].value,f+='<li><input type="radio" name="speed" value="'+
|
||||||
|
k[l].value+'" id="'+a+'" '+(k[l].value===this.options.defaultSpeed?" checked":"")+' /><label for="'+a+'" '+(k[l].value===this.options.defaultSpeed?' class="mejs-speed-selected"':"")+">"+k[l].name+"</label></li>";d=c(f+"</ul></div></div>").appendTo(b);g=d.find(".mejs-speed-selector");h=this.options.defaultSpeed;e.addEventListener("loadedmetadata",function(a){h&&(e.playbackRate=parseFloat(h))},!0);g.on("click",'input[type="radio"]',function(){var a=c(this).attr("value");h=a;e.playbackRate=parseFloat(a);
|
||||||
|
d.find("button").html(m(a));d.find(".mejs-speed-selected").removeClass("mejs-speed-selected");d.find('input[type="radio"]:checked').next().addClass("mejs-speed-selected")});d.one("mouseenter focusin",function(){g.height(d.find(".mejs-speed-selector ul").outerHeight(!0)+d.find(".mejs-speed-translations").outerHeight(!0)).css("top",-1*g.height()+"px")})}}})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{startLanguage:"",tracksText:mejs.i18n.t("Captions/Subtitles"),tracksAriaLive:!1,hideCaptionsButtonWhenEmpty:!0,toggleCaptionsButtonWhenOnlyOne:!1,slidesSelector:""});c.extend(MediaElementPlayer.prototype,{hasChapters:!1,cleartracks:function(a,b,c,e){a&&(a.captions&&a.captions.remove(),a.chapters&&a.chapters.remove(),a.captionsText&&a.captionsText.remove(),a.captionsButton&&a.captionsButton.remove())},buildtracks:function(a,b,f,e){if(0!==a.tracks.length){var d,
|
||||||
|
g=this,h=g.options.tracksAriaLive?'role="log" aria-live="assertive" aria-atomic="false"':"";if(g.domNode.textTracks)for(d=g.domNode.textTracks.length-1;0<=d;d--)g.domNode.textTracks[d].mode="hidden";g.cleartracks(a,b,f,e);a.chapters=c('<div class="mejs-chapters mejs-layer"></div>').prependTo(f).hide();a.captions=c('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover" '+h+'><span class="mejs-captions-text"></span></div></div>').prependTo(f).hide();
|
||||||
|
a.captionsText=a.captions.find(".mejs-captions-text");a.captionsButton=c('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+g.id+'" title="'+g.options.tracksText+'" aria-label="'+g.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">'+mejs.i18n.t("None")+"</label></li></ul></div></div>").appendTo(b);
|
||||||
|
for(d=b=0;d<a.tracks.length;d++)"subtitles"==a.tracks[d].kind&&b++;g.options.toggleCaptionsButtonWhenOnlyOne&&1==b?a.captionsButton.on("click",function(){null===a.selectedTrack?lang=a.tracks[0].srclang:lang="none";a.setTrack(lang)}):(a.captionsButton.on("mouseenter focusin",function(){c(this).find(".mejs-captions-selector").css("visibility","visible")}).on("click","input[type=radio]",function(){lang=this.value;a.setTrack(lang)}),a.captionsButton.on("mouseleave focusout",function(){c(this).find(".mejs-captions-selector").css("visibility",
|
||||||
|
"hidden")}));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",function(){e.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=!1;for(d=0;d<a.tracks.length;d++)"subtitles"==a.tracks[d].kind&&
|
||||||
|
a.addTrackButton(a.tracks[d].srclang,a.tracks[d].label);a.loadNextTrack();e.addEventListener("timeupdate",function(b){a.displayCaptions()},!1);""!==a.options.slidesSelector&&(a.slidesContainer=c(a.options.slidesSelector),e.addEventListener("timeupdate",function(b){a.displaySlides()},!1));e.addEventListener("loadedmetadata",function(b){a.displayChapters()},!1);a.container.hover(function(){a.hasChapters&&(a.chapters.css("visibility","visible"),a.chapters.fadeIn(200).height(a.chapters.find(".mejs-chapter").outerHeight()))},
|
||||||
|
function(){a.hasChapters&&!e.paused&&a.chapters.fadeOut(200,function(){c(this).css("visibility","hidden");c(this).css("display","block")})});g.container.on("controlsresize",function(){g.adjustLanguageBox()});null!==a.node.getAttribute("autoplay")&&a.chapters.css("visibility","hidden")}},setTrack:function(a){var b;if("none"==a)this.selectedTrack=null,this.captionsButton.removeClass("mejs-captions-enabled");else for(b=0;b<this.tracks.length;b++)if(this.tracks[b].srclang==a){null===this.selectedTrack&&
|
||||||
|
this.captionsButton.addClass("mejs-captions-enabled");this.selectedTrack=this.tracks[b];this.captions.attr("lang",this.selectedTrack.srclang);this.displayCaptions();break}},loadNextTrack:function(){this.trackToLoad++;this.trackToLoad<this.tracks.length?(this.isLoadingTrack=!0,this.loadTrack(this.trackToLoad)):(this.isLoadingTrack=!1,this.checkForTracks())},loadTrack:function(a){var b=this,f=b.tracks[a];c.ajax({url:f.src,dataType:"text",success:function(a){"string"==typeof a&&/<tt\s+xml/gi.exec(a)?
|
||||||
|
f.entries=mejs.TrackFormatParser.dfxp.parse(a):f.entries=mejs.TrackFormatParser.webvtt.parse(a);f.isLoaded=!0;b.enableTrackButton(f.srclang,f.label);b.loadNextTrack();"chapters"==f.kind&&b.media.addEventListener("play",function(a){0<b.media.duration&&b.displayChapters(f)},!1);"slides"==f.kind&&b.setupSlides(f)},error:function(){b.removeTrackButton(f.srclang);b.loadNextTrack()}})},enableTrackButton:function(a,b){""===b&&(b=mejs.language.codes[a]||a);this.captionsButton.find("input[value="+a+"]").prop("disabled",
|
||||||
|
!1).siblings("label").html(b);this.options.startLanguage==a&&c("#"+this.id+"_captions_"+a).prop("checked",!0).trigger("click");this.adjustLanguageBox()},removeTrackButton:function(a){this.captionsButton.find("input[value="+a+"]").closest("li").remove();this.adjustLanguageBox()},addTrackButton:function(a,b){""===b&&(b=mejs.language.codes[a]||a);this.captionsButton.find("ul").append(c('<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="+a+"]").remove()},adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(!0)+this.captionsButton.find(".mejs-captions-translations").outerHeight(!0))},checkForTracks:function(){var a=!1;if(this.options.hideCaptionsButtonWhenEmpty){for(i=0;i<this.tracks.length;i++)if("subtitles"==
|
||||||
|
this.tracks[i].kind&&this.tracks[i].isLoaded){a=!0;break}a||(this.captionsButton.hide(),this.setControlsSize())}},displayCaptions:function(){if("undefined"!=typeof this.tracks){var a,b=this.selectedTrack;if(null!==b&&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)return this.captionsText.html(b.entries.text[a]).attr("class","mejs-captions-text "+(b.entries.times[a].identifier||"")),void this.captions.show().height(0);
|
||||||
|
this.captions.hide()}},setupSlides:function(a){this.slides=a;this.slides.entries.imgs=[this.slides.entries.text.length];this.showSlide(0)},showSlide:function(a){if("undefined"!=typeof this.tracks&&"undefined"!=typeof this.slidesContainer){var b=this,f=b.slides.entries.text[a],e=b.slides.entries.imgs[a];"undefined"==typeof e||"undefined"==typeof e.fadeIn?b.slides.entries.imgs[a]=e=c('<img src="'+f+'">').on("load",function(){e.appendTo(b.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()}):
|
||||||
|
e.is(":visible")||e.is(":animated")||e.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if("undefined"!=typeof this.slides){var a,b=this.slides;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)return void this.showSlide(a)}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if("chapters"==this.tracks[a].kind&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);this.hasChapters=
|
||||||
|
!0;break}},drawChapters:function(a){var b,f,e=this,d=f=0;e.chapters.empty();for(b=0;b<a.entries.times.length;b++)f=a.entries.times[b].stop-a.entries.times[b].start,f=Math.floor(f/e.media.duration*100),(100<f+d||b==a.entries.times.length-1&&100>f+d)&&(f=100-d),e.chapters.append(c('<div class="mejs-chapter" rel="'+a.entries.times[b].start+'" style="left: '+d.toString()+"%;width: "+f.toString()+'%;"><div class="mejs-chapter-block'+(b==a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+
|
||||||
|
a.entries.text[b]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[b].start,e.options)+"–"+mejs.Utility.secondsToTimeCode(a.entries.times[b].stop,e.options)+"</span></div></div>")),d+=f;e.chapters.find("div.mejs-chapter").click(function(){e.media.setCurrentTime(parseFloat(c(this).attr("rel")));e.media.paused&&e.media.play()});e.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese",
|
||||||
|
"zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",
|
||||||
|
sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.TrackFormatParser={webvtt:{pattern_timecode:/^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(a){for(var b,f,e=0,d=mejs.TrackFormatParser.split2(a,/\r?\n/),g={text:[],times:[]};e<d.length;e++){if(b=this.pattern_timecode.exec(d[e]),b&&e<d.length){0<=
|
||||||
|
e-1&&""!==d[e-1]&&(f=d[e-1]);e++;a=d[e];for(e++;""!==d[e]&&e<d.length;)a=a+"\n"+d[e],e++;a=c.trim(a).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>");g.text.push(a);g.times.push({identifier:f,start:0===mejs.Utility.convertSMPTEtoSeconds(b[1])?.2:mejs.Utility.convertSMPTEtoSeconds(b[1]),stop:mejs.Utility.convertSMPTEtoSeconds(b[3]),settings:b[5]})}f=""}return g}},dfxp:{parse:function(a){a=c(a).filter("tt");var b,f,e=0,e=a.children("div").eq(0),
|
||||||
|
d=e.find("p"),e=a.find("#"+e.attr("style"));a={text:[],times:[]};if(e.length&&(f=e.removeAttr("id").get(0).attributes,f.length))for(b={},e=0;e<f.length;e++)b[f[e].name.split(":")[1]]=f[e].value;for(e=0;e<d.length;e++){var g;f={start:null,stop:null,style:null};if(d.eq(e).attr("begin")&&(f.start=mejs.Utility.convertSMPTEtoSeconds(d.eq(e).attr("begin"))),!f.start&&d.eq(e-1).attr("end")&&(f.start=mejs.Utility.convertSMPTEtoSeconds(d.eq(e-1).attr("end"))),d.eq(e).attr("end")&&(f.stop=mejs.Utility.convertSMPTEtoSeconds(d.eq(e).attr("end"))),
|
||||||
|
!f.stop&&d.eq(e+1).attr("begin")&&(f.stop=mejs.Utility.convertSMPTEtoSeconds(d.eq(e+1).attr("begin"))),b){g="";for(var h in b)g+=h+":"+b[h]+";"}g&&(f.style=g);0===f.start&&(f.start=.2);a.times.push(f);f=c.trim(d.eq(e).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>");a.text.push(f);0===a.times.start&&(a.times.start=2)}return a}},split2:function(a,b){return a.split(b)}};3!="x\n\ny".split(/\n/gi).length&&(mejs.TrackFormatParser.split2=
|
||||||
|
function(a,b){var c,e=[],d="";for(c=0;c<a.length;c++)d+=a.substring(c,c+1),b.test(d)&&(e.push(d.replace(b,"")),d="");return e.push(d),e})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){return"undefined"==typeof a.enterFullScreen?null:a.isFullScreen?mejs.i18n.t("Turn off Fullscreen"):mejs.i18n.t("Go Fullscreen")},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?mejs.i18n.t("Unmute"):mejs.i18n.t("Mute")},click:function(a){a.media.muted?a.setMuted(!1):a.setMuted(!0)}},{isSeparator:!0},{render:function(a){return mejs.i18n.t("Download Video")},
|
||||||
|
click:function(a){window.location.href=a.media.currentSrc}}]});c.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a,b,f,e){a.contextMenu=c('<div class="mejs-contextmenu"></div>').appendTo(c("body")).hide();a.container.bind("contextmenu",function(b){return a.isContextMenuEnabled?(b.preventDefault(),a.renderContextMenu(b.clientX-1,b.clientY-1),!1):void 0});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},
|
||||||
|
cleancontextmenu:function(a){a.contextMenu.remove()},isContextMenuEnabled:!0,enableContextMenu:function(){this.isContextMenuEnabled=!0},disableContextMenu:function(){this.isContextMenuEnabled=!1},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;null!=a&&(clearTimeout(a),delete a)},hideContextMenu:function(){this.contextMenu.hide()},
|
||||||
|
renderContextMenu:function(a,b){for(var f=this,e="",d=f.options.contextMenuItems,g=0,h=d.length;h>g;g++)if(d[g].isSeparator)e+='<div class="mejs-contextmenu-separator"></div>';else{var k=d[g].render(f);null!=k&&(e+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+1E6*Math.random()+'">'+k+"</div>")}f.contextMenu.empty().append(c(e)).css({top:b,left:a}).show();f.contextMenu.find(".mejs-contextmenu-item").each(function(){var a=c(this),b=parseInt(a.data("itemindex"),10),d=f.options.contextMenuItems[b];
|
||||||
|
"undefined"!=typeof d.show&&d.show(a,f);a.click(function(){"undefined"!=typeof d.click&&d.click(f);f.contextMenu.hide()})});setTimeout(function(){f.killControlsTimer("rev3")},100)}})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{skipBackInterval:30,skipBackText:mejs.i18n.t("Skip back %1 seconds")});c.extend(MediaElementPlayer.prototype,{buildskipback:function(a,b,f,e){var d=this;a=d.options.skipBackText.replace("%1",d.options.skipBackInterval);c('<div class="mejs-button mejs-skip-back-button"><button type="button" aria-controls="'+d.id+'" title="'+a+'" aria-label="'+a+'">'+d.options.skipBackInterval+"</button></div>").appendTo(b).click(function(){e.setCurrentTime(Math.max(e.currentTime-
|
||||||
|
d.options.skipBackInterval,0));c(this).find("button").blur()})}})})(mejs.$);
|
||||||
|
(function(c){c.extend(mejs.MepDefaults,{postrollCloseText:mejs.i18n.t("Close")});c.extend(MediaElementPlayer.prototype,{buildpostroll:function(a,b,f,e){var d=this.container.find('link[rel="postroll"]').attr("href");"undefined"!=typeof d&&(a.postroll=c('<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(f).hide(),this.media.addEventListener("ended",
|
||||||
|
function(b){c.ajax({dataType:"html",url:d,success:function(a,b){f.find(".mejs-postroll-layer-content").html(a)}});a.postroll.show()},!1))}})})(mejs.$);(function(c){c.extend(mejs.MepDefaults,{loopText:"Repeat On/Off",shuffleText:"Shuffle On/Off",nextText:"Next Track",prevText:"Previous Track",playlistText:"Show/Hide Playlist"});c.extend(MediaElementPlayer.prototype,{buildloop:function(a,b,f,e){var d=c('<div class="mejs-button mejs-loop-button '+(a.options.loop?"mejs-loop-on":"mejs-loop-off")+'"><button type="button" aria-controls="'+a.id+'" title="'+a.options.loopText+'"></button></div>').appendTo(b).click(function(b){a.options.loop=!a.options.loop;
|
||||||
|
c(e).trigger("mep-looptoggle",[a.options.loop]);a.options.loop?d.removeClass("mejs-loop-off").addClass("mejs-loop-on"):d.removeClass("mejs-loop-on").addClass("mejs-loop-off")});this.loopToggle=this.controls.find(".mejs-loop-button")},loopToggleClick:function(){this.loopToggle.trigger("click")},buildshuffle:function(a,b,f,e){var d=c('<div class="mejs-button mejs-shuffle-button '+(a.options.shuffle?"mejs-shuffle-on":"mejs-shuffle-off")+'"><button type="button" aria-controls="'+a.id+'" title="'+a.options.shuffleText+
|
||||||
|
'"></button></div>').appendTo(b).click(function(b){a.options.shuffle=!a.options.shuffle;c(e).trigger("mep-shuffletoggle",[a.options.shuffle]);a.options.shuffle?d.removeClass("mejs-shuffle-off").addClass("mejs-shuffle-on"):d.removeClass("mejs-shuffle-on").addClass("mejs-shuffle-off")});this.shuffleToggle=this.controls.find(".mejs-shuffle-button")},shuffleToggleClick:function(){this.shuffleToggle.trigger("click")},buildprevtrack:function(a,b,f,e){c('<div class="mejs-button mejs-prevtrack-button mejs-prevtrack"><button type="button" aria-controls="'+
|
||||||
|
a.id+'" title="'+a.options.prevText+'"></button></div>').appendTo(b).click(function(b){c(e).trigger("mep-playprevtrack");a.playPrevTrack()});this.prevTrack=this.controls.find(".mejs-prevtrack-button")},prevTrackClick:function(){this.prevTrack.trigger("click")},buildnexttrack:function(a,b,f,e){c('<div class="mejs-button mejs-nexttrack-button mejs-nexttrack"><button type="button" aria-controls="'+a.id+'" title="'+a.options.nextText+'"></button></div>').appendTo(b).click(function(b){c(e).trigger("mep-playnexttrack");
|
||||||
|
a.playNextTrack()});this.nextTrack=this.controls.find(".mejs-nexttrack-button")},nextTrackClick:function(){this.nextTrack.trigger("click")},buildplaylist:function(a,b,f,e){var d=c('<div class="mejs-button mejs-playlist-button '+(a.options.playlist?"mejs-hide-playlist":"mejs-show-playlist")+'"><button type="button" aria-controls="'+a.id+'" title="'+a.options.playlistText+'"></button></div>').appendTo(b).click(function(b){a.options.playlist=!a.options.playlist;c(e).trigger("mep-playlisttoggle",[a.options.playlist]);
|
||||||
|
a.options.playlist?(f.children(".mejs-playlist").show(),d.removeClass("mejs-show-playlist").addClass("mejs-hide-playlist")):(f.children(".mejs-playlist").hide(),d.removeClass("mejs-hide-playlist").addClass("mejs-show-playlist"))});this.playlistToggle=this.controls.find(".mejs-playlist-button")},playlistToggleClick:function(){this.playlistToggle.trigger("click")},buildplaylistfeature:function(a,b,f,e){b=c('<div class="mejs-playlist mejs-layer"><ul class="mejs"></ul></div>').appendTo(f);a.options.playlist||
|
||||||
|
b.hide();"bottom"==a.options.playlistposition?b.css("top",a.options.audioHeight+"px"):b.css("bottom",a.options.audioHeight+"px");var d=[];c("#"+a.id).find(".mejs-mediaelement source").each(function(a,b){if(""!=c.trim(this.src)){var e={};e.source=c.trim(this.src);if(""!=c.trim(this.title))e.name=c.trim(this.title);else{var f;f=e.source.split("/");f=0<f.length?decodeURIComponent(f[f.length-1]):"";e.name=f}d.push(e)}});for(var g in d)f.find(".mejs-playlist > ul").append('<li data-url="'+d[g].source+
|
||||||
|
'" title="'+d[g].name+'">'+d[g].name+"</li>");f.find("li:first").addClass("current played");f.find(".mejs-playlist > ul li").click(function(b){c(this).hasClass("current")?a.play():(c(this).addClass("played"),a.playTrack(c(this)))});e.addEventListener("ended",function(b){a.playNextTrack()},!1)},playNextTrack:function(){var a=this.layers.find(".mejs-playlist > ul > li"),b=a.filter(".current"),c=a.not(".played");1>c.length&&(b.removeClass("played").siblings().removeClass("played"),c=a.not(".current"));
|
||||||
|
this.options.shuffle?a=c.eq(Math.floor(Math.random()*c.length)):(a=b.next(),1>a.length&&this.options.loop&&(a=b.siblings().first()));1==a.length&&(a.addClass("played"),this.playTrack(a))},playPrevTrack:function(){var a=this.layers.find(".mejs-playlist > ul > li"),b=a.filter(".current"),c=a.filter(".played").not(".current");1>c.length&&(b.removeClass("played"),c=a.not(".current"));this.options.shuffle?a=c.eq(Math.floor(Math.random()*c.length)):(a=b.prev(),1>a.length&&this.options.loop&&(a=b.siblings().last()));
|
||||||
|
1==a.length&&(b.removeClass("played"),this.playTrack(a))},playTrack:function(a){this.pause();this.setSrc(a.attr("data-url"));this.load();this.play();a.addClass("current").siblings().removeClass("current")},playTrackURL:function(a){a=this.layers.find(".mejs-playlist > ul > li").filter('[data-url="'+a+'"]');this.playTrack(a)}})})(mejs.$);function A(c,a,b){var f=a||0,e=0;"string"==typeof c?(e=b||c.length,this.a=function(a){return c.charCodeAt(a+f)&255}):"unknown"==typeof c&&(e=b||IEBinary_getLength(c),this.a=function(a){return IEBinary_getByteAt(c,a+f)});this.l=function(a,b){for(var c=Array(b),e=0;e<b;e++)c[e]=this.a(a+e);return c};this.h=function(){return e};this.d=function(a,b){return 0!=(this.a(a)&1<<b)};this.w=function(a){a=(this.a(a+1)<<8)+this.a(a);0>a&&(a+=65536);return a};this.i=function(a){var b=this.a(a),c=this.a(a+1),e=
|
||||||
|
this.a(a+2);a=this.a(a+3);b=(((b<<8)+c<<8)+e<<8)+a;0>b&&(b+=4294967296);return b};this.o=function(a){var b=this.a(a),c=this.a(a+1);a=this.a(a+2);b=((b<<8)+c<<8)+a;0>b&&(b+=16777216);return b};this.c=function(a,b){for(var c=[],e=a,f=0;e<a+b;e++,f++)c[f]=String.fromCharCode(this.a(e));return c.join("")};this.e=function(a,b,c){a=this.l(a,b);switch(c.toLowerCase()){case "utf-16":case "utf-16le":case "utf-16be":b=c;var e,f=0,n=1;c=0;e=Math.min(e||a.length,a.length);254==a[0]&&255==a[1]?(b=!0,f=2):255==
|
||||||
|
a[0]&&254==a[1]&&(b=!1,f=2);b&&(n=0,c=1);b=[];for(var m=0;f<e;m++){var p=a[f+n],q=(p<<8)+a[f+c],f=f+2;if(0==q)break;else 216>p||224<=p?b[m]=String.fromCharCode(q):(p=(a[f+n]<<8)+a[f+c],f+=2,b[m]=String.fromCharCode(q,p))}a=new String(b.join(""));a.g=f;break;case "utf-8":e=0;f=Math.min(f||a.length,a.length);239==a[0]&&187==a[1]&&191==a[2]&&(e=3);n=[];for(c=0;e<f&&(b=a[e++],0!=b);c++)128>b?n[c]=String.fromCharCode(b):194<=b&&224>b?(m=a[e++],n[c]=String.fromCharCode(((b&31)<<6)+(m&63))):224<=b&&240>
|
||||||
|
b?(m=a[e++],q=a[e++],n[c]=String.fromCharCode(((b&255)<<12)+((m&63)<<6)+(q&63))):240<=b&&245>b&&(m=a[e++],q=a[e++],p=a[e++],b=((b&7)<<18)+((m&63)<<12)+((q&63)<<6)+(p&63)-65536,n[c]=String.fromCharCode((b>>10)+55296,(b&1023)+56320));a=new String(n.join(""));a.g=e;break;default:f=[];n=n||a.length;for(e=0;e<n;){c=a[e++];if(0==c)break;f[e-1]=String.fromCharCode(c)}a=new String(f.join(""));a.g=e}return a};this.f=function(a,b){b()}}document.write("<script type='text/vbscript'>\r\nFunction IEBinary_getByteAt(strBinary, iOffset)\r\n\tIEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\nEnd Function\r\nFunction IEBinary_getLength(strBinary)\r\n\tIEBinary_getLength = LenB(strBinary)\r\nEnd Function\r\n\x3c/script>\r\n");
|
||||||
|
function B(c,a,b){function f(a,b,c,d,f,g){var q=e();q?("undefined"===typeof g&&(g=!0),b&&("undefined"!=typeof q.onload?q.onload=function(){"200"==q.status||"206"==q.status?(q.fileSize=f||q.getResponseHeader("Content-Length"),b(q)):c&&c();q=null}:q.onreadystatechange=function(){4==q.readyState&&("200"==q.status||"206"==q.status?(q.fileSize=f||q.getResponseHeader("Content-Length"),b(q)):c&&c(),q=null)}),q.open("GET",a,g),q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined"),d&&
|
||||||
|
q.setRequestHeader("Range","bytes="+d[0]+"-"+d[1]),q.setRequestHeader("If-Modified-Since","Sat, 1 Jan 1970 00:00:00 GMT"),q.send(null)):c&&c()}function e(){var a=null;window.XMLHttpRequest?a=new XMLHttpRequest:window.ActiveXObject&&(a=new ActiveXObject("Microsoft.XMLHTTP"));return a}function d(a,b){var c=e();c&&(b&&("undefined"!=typeof c.onload?c.onload=function(){"200"==c.status&&b(this);c=null}:c.onreadystatechange=function(){4==c.readyState&&("200"==c.status&&b(this),c=null)}),c.open("HEAD",a,
|
||||||
|
!0),c.send(null))}function g(a,c){function d(a){var b=~~(a[0]/g)-p;a=~~(a[1]/g)+1+p;0>b&&(b=0);a>=blockTotal&&(a=blockTotal-1);return[b,a]}function e(d,l){for(;t[d[0]];)if(d[0]++,d[0]>d[1]){l&&l();return}for(;t[d[1]];)if(d[1]--,d[0]>d[1]){l&&l();return}var n=[d[0]*g,(d[1]+1)*g-1];f(a,function(a){parseInt(a.getResponseHeader("Content-Length"),10)==c&&(d[0]=0,d[1]=blockTotal-1,n[0]=0,n[1]=c-1);a={data:a.N||a.responseText,offset:n[0]};for(var b=d[0];b<=d[1];b++)t[b]=a;l&&l()},b,n,q,!!l)}var g,p,q,u=
|
||||||
|
new A("",0,c),t=[];g=g||2048;p="undefined"===typeof p?0:p;blockTotal=~~((c-1)/g)+1;for(var r in u)u.hasOwnProperty(r)&&"function"===typeof u[r]&&(this[r]=u[r]);this.a=function(a){var b;e(d([a,a]));b=t[~~(a/g)];if("string"==typeof b.data)return b.data.charCodeAt(a-b.offset)&255;if("unknown"==typeof b.data)return IEBinary_getByteAt(b.data,a-b.offset)};this.f=function(a,b){e(d(a),b)}}(function(){d(c,function(b){b=parseInt(b.getResponseHeader("Content-Length"),10)||-1;a(new g(c,b))})})()}
|
||||||
|
(function(c){c.FileAPIReader=function(a,b){return function(c,e){var d=b||new FileReader;d.onload=function(a){e(new A(a.target.result))};d.readAsBinaryString(a)}}})(this);
|
||||||
|
(function(c){var a=c.p={},b={},f=[0,7];a.t=function(a){delete b[a]};a.s=function(){b={}};a.B=function(a,c,g){g=g||{};(g.dataReader||B)(a,function(h){h.f(f,function(){var f="ftypM4A"==h.c(4,7)?ID4:"ID3"==h.c(0,3)?ID3v2:ID3v1;f.m(h,function(){var l=g.tags,n=f.n(h,l),l=b[a]||{},m;for(m in n)n.hasOwnProperty(m)&&(l[m]=n[m]);b[a]=l;c&&c()})})})};a.v=function(a){if(!b[a])return null;var c={},f;for(f in b[a])b[a].hasOwnProperty(f)&&(c[f]=b[a][f]);return c};a.A=function(a,c){return b[a]?b[a][c]:null};c.ID3=
|
||||||
|
c.p;a.loadTags=a.B;a.getAllTags=a.v;a.getTag=a.A;a.clearTags=a.t;a.clearAll=a.s})(this);
|
||||||
|
(function(c){var a=c.q={},b="Blues;Classic Rock;Country;Dance;Disco;Funk;Grunge;Hip-Hop;Jazz;Metal;New Age;Oldies;Other;Pop;R&B;Rap;Reggae;Rock;Techno;Industrial;Alternative;Ska;Death Metal;Pranks;Soundtrack;Euro-Techno;Ambient;Trip-Hop;Vocal;Jazz+Funk;Fusion;Trance;Classical;Instrumental;Acid;House;Game;Sound Clip;Gospel;Noise;AlternRock;Bass;Soul;Punk;Space;Meditative;Instrumental Pop;Instrumental Rock;Ethnic;Gothic;Darkwave;Techno-Industrial;Electronic;Pop-Folk;Eurodance;Dream;Southern Rock;Comedy;Cult;Gangsta;Top 40;Christian Rap;Pop/Funk;Jungle;Native American;Cabaret;New Wave;Psychadelic;Rave;Showtunes;Trailer;Lo-Fi;Tribal;Acid Punk;Acid Jazz;Polka;Retro;Musical;Rock & Roll;Hard Rock;Folk;Folk-Rock;National Folk;Swing;Fast Fusion;Bebob;Latin;Revival;Celtic;Bluegrass;Avantgarde;Gothic Rock;Progressive Rock;Psychedelic Rock;Symphonic Rock;Slow Rock;Big Band;Chorus;Easy Listening;Acoustic;Humour;Speech;Chanson;Opera;Chamber Music;Sonata;Symphony;Booty Bass;Primus;Porn Groove;Satire;Slow Jam;Club;Tango;Samba;Folklore;Ballad;Power Ballad;Rhythmic Soul;Freestyle;Duet;Punk Rock;Drum Solo;Acapella;Euro-House;Dance Hall".split(";");a.m=
|
||||||
|
function(a,b){var c=a.h();a.f([c-128-1,c],b)};a.n=function(a){var c=a.h()-128;if("TAG"==a.c(c,3)){var d=a.c(c+3,30).replace(/\0/g,""),g=a.c(c+33,30).replace(/\0/g,""),h=a.c(c+63,30).replace(/\0/g,""),k=a.c(c+93,4).replace(/\0/g,"");if(0==a.a(c+97+28))var l=a.c(c+97,28).replace(/\0/g,""),n=a.a(c+97+29);else l="",n=0;a=a.a(c+97+30);return{version:"1.1",title:d,artist:g,album:h,year:k,comment:l,track:n,genre:255>a?b[a]:""}}return{}};c.ID3v1=c.q})(this);
|
||||||
|
(function(c){function a(a,b){var c=b.a(a),e=b.a(a+1),f=b.a(a+2);return b.a(a+3)&127|(f&127)<<7|(e&127)<<14|(c&127)<<21}var b=c.D={};b.b={};b.frames={BUF:"Recommended buffer size",CNT:"Play counter",COM:"Comments",CRA:"Audio encryption",CRM:"Encrypted meta frame",ETC:"Event timing codes",EQU:"Equalization",GEO:"General encapsulated object",IPL:"Involved people list",LNK:"Linked information",MCI:"Music CD Identifier",MLL:"MPEG location lookup table",PIC:"Attached picture",POP:"Popularimeter",REV:"Reverb",
|
||||||
|
RVA:"Relative volume adjustment",SLT:"Synchronized lyric/text",STC:"Synced tempo codes",TAL:"Album/Movie/Show title",TBP:"BPM (Beats Per Minute)",TCM:"Composer",TCO:"Content type",TCR:"Copyright message",TDA:"Date",TDY:"Playlist delay",TEN:"Encoded by",TFT:"File type",TIM:"Time",TKE:"Initial key",TLA:"Language(s)",TLE:"Length",TMT:"Media type",TOA:"Original artist(s)/performer(s)",TOF:"Original filename",TOL:"Original Lyricist(s)/text writer(s)",TOR:"Original release year",TOT:"Original album/Movie/Show title",
|
||||||
|
TP1:"Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group",TP2:"Band/Orchestra/Accompaniment",TP3:"Conductor/Performer refinement",TP4:"Interpreted, remixed, or otherwise modified by",TPA:"Part of a set",TPB:"Publisher",TRC:"ISRC (International Standard Recording Code)",TRD:"Recording dates",TRK:"Track number/Position in set",TSI:"Size",TSS:"Software/hardware and settings used for encoding",TT1:"Content group description",TT2:"Title/Songname/Content description",TT3:"Subtitle/Description refinement",
|
||||||
|
TXT:"Lyricist/text writer",TXX:"User defined text information frame",TYE:"Year",UFI:"Unique file identifier",ULT:"Unsychronized lyric/text transcription",WAF:"Official audio file webpage",WAR:"Official artist/performer webpage",WAS:"Official audio source webpage",WCM:"Commercial information",WCP:"Copyright/Legal information",WPB:"Publishers official webpage",WXX:"User defined URL link frame",AENC:"Audio encryption",APIC:"Attached picture",COMM:"Comments",COMR:"Commercial frame",ENCR:"Encryption method registration",
|
||||||
|
EQUA:"Equalization",ETCO:"Event timing codes",GEOB:"General encapsulated object",GRID:"Group identification registration",IPLS:"Involved people list",LINK:"Linked information",MCDI:"Music CD identifier",MLLT:"MPEG location lookup table",OWNE:"Ownership frame",PRIV:"Private frame",PCNT:"Play counter",POPM:"Popularimeter",POSS:"Position synchronisation frame",RBUF:"Recommended buffer size",RVAD:"Relative volume adjustment",RVRB:"Reverb",SYLT:"Synchronized lyric/text",SYTC:"Synchronized tempo codes",
|
||||||
|
TALB:"Album/Movie/Show title",TBPM:"BPM (beats per minute)",TCOM:"Composer",TCON:"Content type",TCOP:"Copyright message",TDAT:"Date",TDLY:"Playlist delay",TENC:"Encoded by",TEXT:"Lyricist/Text writer",TFLT:"File type",TIME:"Time",TIT1:"Content group description",TIT2:"Title/songname/content description",TIT3:"Subtitle/Description refinement",TKEY:"Initial key",TLAN:"Language(s)",TLEN:"Length",TMED:"Media type",TOAL:"Original album/movie/show title",TOFN:"Original filename",TOLY:"Original lyricist(s)/text writer(s)",
|
||||||
|
TOPE:"Original artist(s)/performer(s)",TORY:"Original release year",TOWN:"File owner/licensee",TPE1:"Lead performer(s)/Soloist(s)",TPE2:"Band/orchestra/accompaniment",TPE3:"Conductor/performer refinement",TPE4:"Interpreted, remixed, or otherwise modified by",TPOS:"Part of a set",TPUB:"Publisher",TRCK:"Track number/Position in set",TRDA:"Recording dates",TRSN:"Internet radio station name",TRSO:"Internet radio station owner",TSIZ:"Size",TSRC:"ISRC (international standard recording code)",TSSE:"Software/Hardware and settings used for encoding",
|
||||||
|
TYER:"Year",TXXX:"User defined text information frame",UFID:"Unique file identifier",USER:"Terms of use",USLT:"Unsychronized lyric/text transcription",WCOM:"Commercial information",WCOP:"Copyright/Legal information",WOAF:"Official audio file webpage",WOAR:"Official artist/performer webpage",WOAS:"Official audio source webpage",WORS:"Official internet radio station homepage",WPAY:"Payment",WPUB:"Publishers official webpage",WXXX:"User defined URL link frame"};var f={title:["TIT2","TT2"],artist:["TPE1",
|
||||||
|
"TP1"],album:["TALB","TAL"],year:["TYER","TYE"],comment:["COMM","COM"],track:["TRCK","TRK"],genre:["TCON","TCO"],picture:["APIC","PIC"],lyrics:["USLT","ULT"]},e=["title","artist","album","track"];b.m=function(b,c){b.f([0,a(6,b)],c)};b.n=function(c,g){var h=0,k=c.a(h+3);if(4<k)return{version:">2.4"};var l=c.a(h+4),n=c.d(h+5,7),m=c.d(h+5,6),p=c.d(h+5,5),q=a(h+6,c),h=h+10;if(m)var u=c.i(h),h=h+(u+4);var k={version:"2."+k+"."+l,major:k,revision:l,flags:{unsynchronisation:n,extended_header:m,experimental_indicator:p},
|
||||||
|
size:q},t;if(n)t={};else{for(var q=q-10,n=c,l=g,m={},p=k.major,u=[],r=0,v;v=(l||e)[r];r++)u=u.concat(f[v]||[v]);for(l=u;h<q;){u=null;r=n;v=h;var y=null;switch(p){case 2:t=r.c(v,3);var w=r.o(v+3),x=6;break;case 3:t=r.c(v,4);w=r.i(v+4);x=10;break;case 4:t=r.c(v,4),w=a(v+4,r),x=10}if(""==t)break;h+=x+w;0>l.indexOf(t)||(2<p&&(y={message:{P:r.d(v+8,6),I:r.d(v+8,5),M:r.d(v+8,4)},k:{K:r.d(v+8+1,7),F:r.d(v+8+1,3),H:r.d(v+8+1,2),C:r.d(v+8+1,1),u:r.d(v+8+1,0)}}),v+=x,y&&y.k.u&&(a(v,r),v+=4,w-=4),y&&y.k.C||
|
||||||
|
(t in b.b?u=b.b[t]:"T"==t[0]&&(u=b.b["T*"]),u=u?u(v,w,r,y):void 0,u={id:t,size:w,description:t in b.frames?b.frames[t]:"Unknown",data:u},t in m?(m[t].id&&(m[t]=[m[t]]),m[t].push(u)):m[t]=u))}t=m}for(var z in f)if(f.hasOwnProperty(z)){a:{w=f[z];"string"==typeof w&&(w=[w]);for(x=0;h=w[x];x++)if(h in t){c=t[h].data;break a}c=void 0}c&&(k[z]=c)}for(var C in t)t.hasOwnProperty(C)&&(k[C]=t[C]);return k};c.ID3v2=b})(this);
|
||||||
|
(function(){function c(a){var c;switch(a){case 0:c="iso-8859-1";break;case 1:c="utf-16";break;case 2:c="utf-16be";break;case 3:c="utf-8"}return c}var a="32x32 pixels 'file icon' (PNG only);Other file icon;Cover (front);Cover (back);Leaflet page;Media (e.g. lable side of CD);Lead artist/lead performer/soloist;Artist/performer;Conductor;Band/Orchestra;Composer;Lyricist/text writer;Recording Location;During recording;During performance;Movie/video screen capture;A bright coloured fish;Illustration;Band/artist logotype;Publisher/Studio logotype".split(";");
|
||||||
|
ID3v2.b.APIC=function(b,f,e,d,g){g=g||"3";d=b;var h=c(e.a(b));switch(g){case "2":var k=e.c(b+1,3);b+=4;break;case "3":case "4":k=e.e(b+1,f-(b-d),h),b+=1+k.g}g=e.a(b,1);g=a[g];h=e.e(b+1,f-(b-d),h);b+=1+h.g;return{format:k.toString(),type:g,description:h.toString(),data:e.l(b,d+f-b)}};ID3v2.b.COMM=function(a,f,e){var d=a,g=c(e.a(a)),h=e.c(a+1,3),k=e.e(a+4,f-4,g);a+=4+k.g;a=e.e(a,d+f-a,g);return{language:h,O:k.toString(),text:a.toString()}};ID3v2.b.COM=ID3v2.b.COMM;ID3v2.b.PIC=function(a,c,e,d){return ID3v2.b.APIC(a,
|
||||||
|
c,e,d,"2")};ID3v2.b.PCNT=function(a,c,e){return e.J(a)};ID3v2.b.CNT=ID3v2.b.PCNT;ID3v2.b["T*"]=function(a,f,e){var d=c(e.a(a));return e.e(a+1,f-1,d).toString()};ID3v2.b.TCON=function(a,c,e){return ID3v2.b["T*"].apply(this,arguments).replace(/^\(\d+\)/,"")};ID3v2.b.TCO=ID3v2.b.TCON;ID3v2.b.USLT=function(a,f,e){var d=a,g=c(e.a(a)),h=e.c(a+1,3),k=e.e(a+4,f-4,g);a+=4+k.g;a=e.e(a,d+f-a,g);return{language:h,G:k.toString(),L:a.toString()}};ID3v2.b.ULT=ID3v2.b.USLT})();
|
||||||
|
(function(c){function a(b,c,g,h){var k=b.i(c);if(0==k)h();else{var l=b.c(c+4,4);-1<["moov","udta","meta","ilst"].indexOf(l)?("meta"==l&&(c+=4),b.f([c+8,c+8+8],function(){a(b,c+8,k-8,h)})):b.f([c+(l in f.j?0:k),c+k+8],function(){a(b,c+k,g,h)})}}function b(a,c,g,h,k){k=void 0===k?"":k+" ";for(var l=g;l<g+h;){var n=c.i(l);if(0==n)break;var m=c.c(l+4,4);if(-1<["moov","udta","meta","ilst"].indexOf(m)){"meta"==m&&(l+=4);b(a,c,l+8,n-8,k);break}if(f.j[m]){var p=c.o(l+16+1),q=f.j[m],p=f.types[p];if("trkn"==
|
||||||
|
m)a[q[0]]=c.a(l+16+11),a.count=c.a(l+16+13);else{var m=l+16+4+4,u=n-16-4-4,t;switch(p){case "text":t=c.e(m,u,"UTF-8");break;case "uint8":t=c.w(m);break;case "jpeg":case "png":t={k:"image/"+p,data:c.l(m,u)}}a[q[0]]="comment"===q[0]?{text:t}:t}}l+=n}}var f=c.r={};f.types={0:"uint8",1:"text",13:"jpeg",14:"png",21:"uint8"};f.j={"\u00a9alb":["album"],"\u00a9art":["artist"],"\u00a9ART":["artist"],aART:["artist"],"\u00a9day":["year"],"\u00a9nam":["title"],"\u00a9gen":["genre"],trkn:["track"],"\u00a9wrt":["composer"],
|
||||||
|
"\u00a9too":["encoder"],cprt:["copyright"],covr:["picture"],"\u00a9grp":["grouping"],keyw:["keyword"],"\u00a9lyr":["lyrics"],"\u00a9cmt":["comment"],tmpo:["tempo"],cpil:["compilation"],disk:["disc"]};f.m=function(b,c){b.f([0,7],function(){a(b,0,b.h(),c)})};f.n=function(a){var c={};b(c,a,0,a.h());return c};c.ID4=c.r})(this);var MyPlayer=function(c){var a=!1,b=null,f={detachable:!0,element:"body",id3:!1,mode:"mp3url",waveform:!1,autoplay:!1,loop:!0,shuffle:!1,list:[]},e="undefined"===typeof c?f:$.extend({},f,c),d=function(){var a=e.autoplay?'autoplay="true"':"";$(e.element).append('<audio controls="controls" '+a+"><p>Your browser does not understand the <audio> tag. </p></audio>");e.audio=e.element+" audio"},g=function(){$(e.element).find("ul.mejs li").each(function(a,b){var c=$(b).attr("data-url");$(b).prepend('<span class="ajaxLoader"> </span> ');
|
||||||
|
ID3.loadTags(c,function(){var b=ID3.getAllTags(c);if("undefined"!=typeof b.title){var d=b.title;"undefined"!=typeof b.artist&&(d=b.artist+" - "+d);$(e.element).find("ul.mejs li").each(function(b,c){a==b&&$(c).html(d)})}})})},h=function(){m();e.id3&&g()},k=function(){b=new MediaElementPlayer($(e.audio),{success:h,loop:e.loop,shuffle:e.shuffle,playlist:!0,audioHeight:32,playlistposition:"bottom",features:"playlistfeature prevtrack playpause nexttrack loop shuffle current progress duration volume".split(" "),
|
||||||
|
pluginPath:mejs.Utility.getScriptPath(["myplayer.min.js"])+"../plugins/"});$(e.element).append('<p class="playerDetached" style="display: none;">The player is currently detached.</p>')},l=function(a){for(var b=window.location.search.substring(1).split("&"),c=0;c<b.length;c++){var d=b[c].split("=");if(d[0]==a)return d[1]}return!1},n=function(){if(e.detachable){var a=function(a){b.pause();$(".mejs-audio").hide();$(".playerDetached").show();a=window.open(a,"myplayer","height="+Math.max($(e.element).height(),
|
||||||
|
298)+",width=408,resizable=false");window.focus&&a.focus();$("iframe",top.document).height(20);return!1};if(0==l("popup"))$(".mejs-controls").append('<div id="popupButton" class="popupButton"><button title="Open in separate window" type="button"></button></div>'),$(".popupButton button").click(function(){var c=b.getCurrentTime(),d=b.getVolume(),f=b.media.paused,g=0;$(e.element).find("ul.mejs li").each(function(a){$(this).hasClass("current")&&(g=a)});a($(location).attr("href")+"?popup&paused="+f+"¤tTime="+
|
||||||
|
c+"&volume="+d+"&trackNo="+g)});else{var c=$(window).height();window.onbeforeunload=function(){$("iframe",opener.top.document).height(c);$(".mejs-audio",opener.document).show();$(".playerDetached",opener.document).hide()}}}},m=function(){if(a){var c=l("paused")&&"true"==l("paused"),d=l("currentTime")?parseFloat(l("currentTime")):0,f=l("volume")?parseFloat(l("volume")):1,g=l("trackNo")?parseInt(l("trackNo")):0;b.setVolume(f);$(e.element).find("ul.mejs li").each(function(a){a==g&&(b.playTrack($(this)),
|
||||||
|
b.setCurrentTime(d))});c&&b.pause()}};!1!==l("popup")&&(a=!0,$("body").html('<div id="myplayer" style="width: '+$(e.element).width()+"px; height: "+$(e.element).height()+' px;"></div>'),e.element="#myplayer");if("mp3url"==e.mode){var p="undefined"===typeof e.mp3url?$(location).attr("href").replace(/\?.*/,"").replace(/\/[^\/]+\/?$/,""):e.mp3url;$.ajax({url:p,type:"GET",success:function(a){d();var b=document.createElement("html");b.innerHTML=a;$(b).find("a").each(function(a,b){var c=$(b).attr("href");
|
||||||
|
if(c.match(/\.mp3$/)){var c=p+"/"+c,d=b.innerHTML;$(e.audio).append('<source src="'+c+'" title="'+d+'"/>')}});k();n()}})}else if("m3u"==e.mode)c="undefined"===typeof e.m3u?$(location).attr("href").replace(/\?.*/,"").replace(/\/[^\/]+\/?$/,"/play.m3u"):e.m3u,d(),$.get(c,function(a){a=a.split("\n");for(var b=0,c=a.length;b<c;b++)if(!a[b].match(/^[ \t]*#/)&&a[b].match(/\.mp3$/)){var d=a[b],f=unescape(d.split("/").pop());$(e.audio).append('<source src="'+d+'" title="'+f+'"/>')}k();n()});else if("list"==
|
||||||
|
e.mode){d();c=0;for(f=e.list.length;c<f;c++){var q=e.list[c],u=typeof q,t="",r="";if(null!==q&&"object"===u){if(q.url)t=q.url;else{alert("MyPlayer: item["+c+']: property "url" is missing.');continue}r=q.title?q.title:q.url}else if("string"===u)r=t=q;else{alert("MyPlayer: item ["+c+']: unsupported type "'+u+'"');continue}$(e.audio).append('<source src="'+t+'" title="'+r+'"/>')}k();n()}else $(e.element).append('<p>Unsupported mode "'+e.mode+'"</p>')};
|
BIN
plugins/flashmediaelement-cdn.swf
Executable file
BIN
plugins/flashmediaelement.swf
Normal file
BIN
plugins/silverlightmediaelement.xap
Normal file
34
src/build.sh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# MyPlayer - Copyright 2014 tilt@linuxfoo.de GPLv3
|
||||||
|
# Build Script; recompiles the MyPlayer JavaScript from source.
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
echo '/*
|
||||||
|
jQuery
|
||||||
|
Copyright 2014 jQuery Foundation and other contributors
|
||||||
|
http://jquery.com/
|
||||||
|
MediaElement.js
|
||||||
|
Copyright 2010-2013, John Dyer (http://j.hn)
|
||||||
|
MediaElement Playlist Feature (plugin) -
|
||||||
|
Andrew Berezovsky <andrew.berezovsky@gmail.com>
|
||||||
|
and Junaid Qadir Baloch <shekhanzai.baloch@gmail.com>
|
||||||
|
JavaScript-ID3-Reader
|
||||||
|
Copyright (c) 2008 Jacob Seidelin, http://blog.nihilogic.dk/ BSD License
|
||||||
|
Copyright (c) 2009 Opera Software ASA BSD License
|
||||||
|
Copyright (c) 2010 António Afonso BSD License
|
||||||
|
Copyright (c) 2010 Joshua Kifer BSD License
|
||||||
|
MyPlayer
|
||||||
|
Copyright (c) 2014 tilt@linuxfoo.de MIT License
|
||||||
|
*/' > ../js/myplayer.min.js
|
||||||
|
|
||||||
|
# https://developers.google.com/closure/compiler/
|
||||||
|
java \
|
||||||
|
-jar /usr/local/lib/closure-compiler/compiler.jar \
|
||||||
|
--js mediaelement-and-player.min.js \
|
||||||
|
--js mep-feature-playlist.js \
|
||||||
|
--js id3-minimized.js \
|
||||||
|
--js player.js \
|
||||||
|
>> ../js/myplayer.min.js
|
||||||
|
|
||||||
|
echo "Done: Javascript source has compiled into ../js/myplayer.min.js"
|
23
src/id3-minimized.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
function A(h,g,b){var e=g||0,c=0;"string"==typeof h?(c=b||h.length,this.a=function(a){return h.charCodeAt(a+e)&255}):"unknown"==typeof h&&(c=b||IEBinary_getLength(h),this.a=function(a){return IEBinary_getByteAt(h,a+e)});this.l=function(a,f){for(var v=Array(f),b=0;b<f;b++)v[b]=this.a(a+b);return v};this.h=function(){return c};this.d=function(a,f){return 0!=(this.a(a)&1<<f)};this.w=function(a){a=(this.a(a+1)<<8)+this.a(a);0>a&&(a+=65536);return a};this.i=function(a){var f=this.a(a),b=this.a(a+1),c=
|
||||||
|
this.a(a+2);a=this.a(a+3);f=(((f<<8)+b<<8)+c<<8)+a;0>f&&(f+=4294967296);return f};this.o=function(a){var f=this.a(a),b=this.a(a+1);a=this.a(a+2);f=((f<<8)+b<<8)+a;0>f&&(f+=16777216);return f};this.c=function(a,f){for(var b=[],c=a,d=0;c<a+f;c++,d++)b[d]=String.fromCharCode(this.a(c));return b.join("")};this.e=function(a,b,c){a=this.l(a,b);switch(c.toLowerCase()){case "utf-16":case "utf-16le":case "utf-16be":b=c;var k,d=0,e=1;c=0;k=Math.min(k||a.length,a.length);254==a[0]&&255==a[1]?(b=!0,d=2):255==
|
||||||
|
a[0]&&254==a[1]&&(b=!1,d=2);b&&(e=0,c=1);b=[];for(var m=0;d<k;m++){var g=a[d+e],l=(g<<8)+a[d+c],d=d+2;if(0==l)break;else 216>g||224<=g?b[m]=String.fromCharCode(l):(g=(a[d+e]<<8)+a[d+c],d+=2,b[m]=String.fromCharCode(l,g))}a=new String(b.join(""));a.g=d;break;case "utf-8":k=0;d=Math.min(d||a.length,a.length);239==a[0]&&187==a[1]&&191==a[2]&&(k=3);e=[];for(c=0;k<d&&(b=a[k++],0!=b);c++)128>b?e[c]=String.fromCharCode(b):194<=b&&224>b?(m=a[k++],e[c]=String.fromCharCode(((b&31)<<6)+(m&63))):224<=b&&240>
|
||||||
|
b?(m=a[k++],l=a[k++],e[c]=String.fromCharCode(((b&255)<<12)+((m&63)<<6)+(l&63))):240<=b&&245>b&&(m=a[k++],l=a[k++],g=a[k++],b=((b&7)<<18)+((m&63)<<12)+((l&63)<<6)+(g&63)-65536,e[c]=String.fromCharCode((b>>10)+55296,(b&1023)+56320));a=new String(e.join(""));a.g=k;break;default:d=[];e=e||a.length;for(k=0;k<e;){c=a[k++];if(0==c)break;d[k-1]=String.fromCharCode(c)}a=new String(d.join(""));a.g=k}return a};this.f=function(a,b){b()}}document.write("<script type='text/vbscript'>\r\nFunction IEBinary_getByteAt(strBinary, iOffset)\r\n\tIEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\nEnd Function\r\nFunction IEBinary_getLength(strBinary)\r\n\tIEBinary_getLength = LenB(strBinary)\r\nEnd Function\r\n\x3c/script>\r\n");function B(h,g,b){function e(a,b,d,e,f,g){var l=c();l?("undefined"===typeof g&&(g=!0),b&&("undefined"!=typeof l.onload?l.onload=function(){"200"==l.status||"206"==l.status?(l.fileSize=f||l.getResponseHeader("Content-Length"),b(l)):d&&d();l=null}:l.onreadystatechange=function(){4==l.readyState&&("200"==l.status||"206"==l.status?(l.fileSize=f||l.getResponseHeader("Content-Length"),b(l)):d&&d(),l=null)}),l.open("GET",a,g),l.overrideMimeType&&l.overrideMimeType("text/plain; charset=x-user-defined"),e&&
|
||||||
|
l.setRequestHeader("Range","bytes="+e[0]+"-"+e[1]),l.setRequestHeader("If-Modified-Since","Sat, 1 Jan 1970 00:00:00 GMT"),l.send(null)):d&&d()}function c(){var a=null;window.XMLHttpRequest?a=new XMLHttpRequest:window.ActiveXObject&&(a=new ActiveXObject("Microsoft.XMLHTTP"));return a}function a(a,b){var d=c();d&&(b&&("undefined"!=typeof d.onload?d.onload=function(){"200"==d.status&&b(this);d=null}:d.onreadystatechange=function(){4==d.readyState&&("200"==d.status&&b(this),d=null)}),d.open("HEAD",a,
|
||||||
|
!0),d.send(null))}function f(a,c){var d,f;function g(a){var b=~~(a[0]/d)-f;a=~~(a[1]/d)+1+f;0>b&&(b=0);a>=blockTotal&&(a=blockTotal-1);return[b,a]}function h(f,g){for(;n[f[0]];)if(f[0]++,f[0]>f[1]){g&&g();return}for(;n[f[1]];)if(f[1]--,f[0]>f[1]){g&&g();return}var m=[f[0]*d,(f[1]+1)*d-1];e(a,function(a){parseInt(a.getResponseHeader("Content-Length"),10)==c&&(f[0]=0,f[1]=blockTotal-1,m[0]=0,m[1]=c-1);a={data:a.N||a.responseText,offset:m[0]};for(var b=f[0];b<=f[1];b++)n[b]=a;g&&g()},b,m,l,!!g)}var l,
|
||||||
|
r=new A("",0,c),n=[];d=d||2048;f="undefined"===typeof f?0:f;blockTotal=~~((c-1)/d)+1;for(var q in r)r.hasOwnProperty(q)&&"function"===typeof r[q]&&(this[q]=r[q]);this.a=function(a){var b;h(g([a,a]));b=n[~~(a/d)];if("string"==typeof b.data)return b.data.charCodeAt(a-b.offset)&255;if("unknown"==typeof b.data)return IEBinary_getByteAt(b.data,a-b.offset)};this.f=function(a,b){h(g(a),b)}}(function(){a(h,function(a){a=parseInt(a.getResponseHeader("Content-Length"),10)||-1;g(new f(h,a))})})()};(function(h){h.FileAPIReader=function(g,b){return function(e,c){var a=b||new FileReader;a.onload=function(a){c(new A(a.target.result))};a.readAsBinaryString(g)}}})(this);(function(h){var g=h.p={},b={},e=[0,7];g.t=function(c){delete b[c]};g.s=function(){b={}};g.B=function(c,a,f){f=f||{};(f.dataReader||B)(c,function(g){g.f(e,function(){var e="ftypM4A"==g.c(4,7)?ID4:"ID3"==g.c(0,3)?ID3v2:ID3v1;e.m(g,function(){var d=f.tags,h=e.n(g,d),d=b[c]||{},m;for(m in h)h.hasOwnProperty(m)&&(d[m]=h[m]);b[c]=d;a&&a()})})})};g.v=function(c){if(!b[c])return null;var a={},f;for(f in b[c])b[c].hasOwnProperty(f)&&(a[f]=b[c][f]);return a};g.A=function(c,a){return b[c]?b[c][a]:null};h.ID3=
|
||||||
|
h.p;g.loadTags=g.B;g.getAllTags=g.v;g.getTag=g.A;g.clearTags=g.t;g.clearAll=g.s})(this);(function(h){var g=h.q={},b="Blues;Classic Rock;Country;Dance;Disco;Funk;Grunge;Hip-Hop;Jazz;Metal;New Age;Oldies;Other;Pop;R&B;Rap;Reggae;Rock;Techno;Industrial;Alternative;Ska;Death Metal;Pranks;Soundtrack;Euro-Techno;Ambient;Trip-Hop;Vocal;Jazz+Funk;Fusion;Trance;Classical;Instrumental;Acid;House;Game;Sound Clip;Gospel;Noise;AlternRock;Bass;Soul;Punk;Space;Meditative;Instrumental Pop;Instrumental Rock;Ethnic;Gothic;Darkwave;Techno-Industrial;Electronic;Pop-Folk;Eurodance;Dream;Southern Rock;Comedy;Cult;Gangsta;Top 40;Christian Rap;Pop/Funk;Jungle;Native American;Cabaret;New Wave;Psychadelic;Rave;Showtunes;Trailer;Lo-Fi;Tribal;Acid Punk;Acid Jazz;Polka;Retro;Musical;Rock & Roll;Hard Rock;Folk;Folk-Rock;National Folk;Swing;Fast Fusion;Bebob;Latin;Revival;Celtic;Bluegrass;Avantgarde;Gothic Rock;Progressive Rock;Psychedelic Rock;Symphonic Rock;Slow Rock;Big Band;Chorus;Easy Listening;Acoustic;Humour;Speech;Chanson;Opera;Chamber Music;Sonata;Symphony;Booty Bass;Primus;Porn Groove;Satire;Slow Jam;Club;Tango;Samba;Folklore;Ballad;Power Ballad;Rhythmic Soul;Freestyle;Duet;Punk Rock;Drum Solo;Acapella;Euro-House;Dance Hall".split(";");
|
||||||
|
g.m=function(b,c){var a=b.h();b.f([a-128-1,a],c)};g.n=function(e){var c=e.h()-128;if("TAG"==e.c(c,3)){var a=e.c(c+3,30).replace(/\0/g,""),f=e.c(c+33,30).replace(/\0/g,""),g=e.c(c+63,30).replace(/\0/g,""),k=e.c(c+93,4).replace(/\0/g,"");if(0==e.a(c+97+28))var d=e.c(c+97,28).replace(/\0/g,""),h=e.a(c+97+29);else d="",h=0;e=e.a(c+97+30);return{version:"1.1",title:a,artist:f,album:g,year:k,comment:d,track:h,genre:255>e?b[e]:""}}return{}};h.ID3v1=h.q})(this);(function(h){function g(a,b){var c=b.a(a),e=b.a(a+1),d=b.a(a+2);return b.a(a+3)&127|(d&127)<<7|(e&127)<<14|(c&127)<<21}var b=h.D={};b.b={};b.frames={BUF:"Recommended buffer size",CNT:"Play counter",COM:"Comments",CRA:"Audio encryption",CRM:"Encrypted meta frame",ETC:"Event timing codes",EQU:"Equalization",GEO:"General encapsulated object",IPL:"Involved people list",LNK:"Linked information",MCI:"Music CD Identifier",MLL:"MPEG location lookup table",PIC:"Attached picture",POP:"Popularimeter",REV:"Reverb",
|
||||||
|
RVA:"Relative volume adjustment",SLT:"Synchronized lyric/text",STC:"Synced tempo codes",TAL:"Album/Movie/Show title",TBP:"BPM (Beats Per Minute)",TCM:"Composer",TCO:"Content type",TCR:"Copyright message",TDA:"Date",TDY:"Playlist delay",TEN:"Encoded by",TFT:"File type",TIM:"Time",TKE:"Initial key",TLA:"Language(s)",TLE:"Length",TMT:"Media type",TOA:"Original artist(s)/performer(s)",TOF:"Original filename",TOL:"Original Lyricist(s)/text writer(s)",TOR:"Original release year",TOT:"Original album/Movie/Show title",
|
||||||
|
TP1:"Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group",TP2:"Band/Orchestra/Accompaniment",TP3:"Conductor/Performer refinement",TP4:"Interpreted, remixed, or otherwise modified by",TPA:"Part of a set",TPB:"Publisher",TRC:"ISRC (International Standard Recording Code)",TRD:"Recording dates",TRK:"Track number/Position in set",TSI:"Size",TSS:"Software/hardware and settings used for encoding",TT1:"Content group description",TT2:"Title/Songname/Content description",TT3:"Subtitle/Description refinement",
|
||||||
|
TXT:"Lyricist/text writer",TXX:"User defined text information frame",TYE:"Year",UFI:"Unique file identifier",ULT:"Unsychronized lyric/text transcription",WAF:"Official audio file webpage",WAR:"Official artist/performer webpage",WAS:"Official audio source webpage",WCM:"Commercial information",WCP:"Copyright/Legal information",WPB:"Publishers official webpage",WXX:"User defined URL link frame",AENC:"Audio encryption",APIC:"Attached picture",COMM:"Comments",COMR:"Commercial frame",ENCR:"Encryption method registration",
|
||||||
|
EQUA:"Equalization",ETCO:"Event timing codes",GEOB:"General encapsulated object",GRID:"Group identification registration",IPLS:"Involved people list",LINK:"Linked information",MCDI:"Music CD identifier",MLLT:"MPEG location lookup table",OWNE:"Ownership frame",PRIV:"Private frame",PCNT:"Play counter",POPM:"Popularimeter",POSS:"Position synchronisation frame",RBUF:"Recommended buffer size",RVAD:"Relative volume adjustment",RVRB:"Reverb",SYLT:"Synchronized lyric/text",SYTC:"Synchronized tempo codes",
|
||||||
|
TALB:"Album/Movie/Show title",TBPM:"BPM (beats per minute)",TCOM:"Composer",TCON:"Content type",TCOP:"Copyright message",TDAT:"Date",TDLY:"Playlist delay",TENC:"Encoded by",TEXT:"Lyricist/Text writer",TFLT:"File type",TIME:"Time",TIT1:"Content group description",TIT2:"Title/songname/content description",TIT3:"Subtitle/Description refinement",TKEY:"Initial key",TLAN:"Language(s)",TLEN:"Length",TMED:"Media type",TOAL:"Original album/movie/show title",TOFN:"Original filename",TOLY:"Original lyricist(s)/text writer(s)",
|
||||||
|
TOPE:"Original artist(s)/performer(s)",TORY:"Original release year",TOWN:"File owner/licensee",TPE1:"Lead performer(s)/Soloist(s)",TPE2:"Band/orchestra/accompaniment",TPE3:"Conductor/performer refinement",TPE4:"Interpreted, remixed, or otherwise modified by",TPOS:"Part of a set",TPUB:"Publisher",TRCK:"Track number/Position in set",TRDA:"Recording dates",TRSN:"Internet radio station name",TRSO:"Internet radio station owner",TSIZ:"Size",TSRC:"ISRC (international standard recording code)",TSSE:"Software/Hardware and settings used for encoding",
|
||||||
|
TYER:"Year",TXXX:"User defined text information frame",UFID:"Unique file identifier",USER:"Terms of use",USLT:"Unsychronized lyric/text transcription",WCOM:"Commercial information",WCOP:"Copyright/Legal information",WOAF:"Official audio file webpage",WOAR:"Official artist/performer webpage",WOAS:"Official audio source webpage",WORS:"Official internet radio station homepage",WPAY:"Payment",WPUB:"Publishers official webpage",WXXX:"User defined URL link frame"};var e={title:["TIT2","TT2"],artist:["TPE1",
|
||||||
|
"TP1"],album:["TALB","TAL"],year:["TYER","TYE"],comment:["COMM","COM"],track:["TRCK","TRK"],genre:["TCON","TCO"],picture:["APIC","PIC"],lyrics:["USLT","ULT"]},c=["title","artist","album","track"];b.m=function(a,b){a.f([0,g(6,a)],b)};b.n=function(a,f){var h=0,k=a.a(h+3);if(4<k)return{version:">2.4"};var d=a.a(h+4),t=a.d(h+5,7),m=a.d(h+5,6),u=a.d(h+5,5),l=g(h+6,a),h=h+10;if(m)var r=a.i(h),h=h+(r+4);var k={version:"2."+k+"."+d,major:k,revision:d,flags:{unsynchronisation:t,extended_header:m,experimental_indicator:u},
|
||||||
|
size:l},n;if(t)n={};else{for(var l=l-10,t=a,d=f,m={},u=k.major,r=[],q=0,p;p=(d||c)[q];q++)r=r.concat(e[p]||[p]);for(d=r;h<l;){r=null;q=t;p=h;var x=null;switch(u){case 2:n=q.c(p,3);var s=q.o(p+3),w=6;break;case 3:n=q.c(p,4);s=q.i(p+4);w=10;break;case 4:n=q.c(p,4),s=g(p+4,q),w=10}if(""==n)break;h+=w+s;0>d.indexOf(n)||(2<u&&(x={message:{P:q.d(p+8,6),I:q.d(p+8,5),M:q.d(p+8,4)},k:{K:q.d(p+8+1,7),F:q.d(p+8+1,3),H:q.d(p+8+1,2),C:q.d(p+8+1,1),u:q.d(p+8+1,0)}}),p+=w,x&&x.k.u&&(g(p,q),p+=4,s-=4),x&&x.k.C||
|
||||||
|
(n in b.b?r=b.b[n]:"T"==n[0]&&(r=b.b["T*"]),r=r?r(p,s,q,x):void 0,r={id:n,size:s,description:n in b.frames?b.frames[n]:"Unknown",data:r},n in m?(m[n].id&&(m[n]=[m[n]]),m[n].push(r)):m[n]=r))}n=m}for(var y in e)if(e.hasOwnProperty(y)){a:{s=e[y];"string"==typeof s&&(s=[s]);w=0;for(h=void 0;h=s[w];w++)if(h in n){a=n[h].data;break a}a=void 0}a&&(k[y]=a)}for(var z in n)n.hasOwnProperty(z)&&(k[z]=n[z]);return k};h.ID3v2=b})(this);(function(){function h(b){var e;switch(b){case 0:e="iso-8859-1";break;case 1:e="utf-16";break;case 2:e="utf-16be";break;case 3:e="utf-8"}return e}var g="32x32 pixels 'file icon' (PNG only);Other file icon;Cover (front);Cover (back);Leaflet page;Media (e.g. lable side of CD);Lead artist/lead performer/soloist;Artist/performer;Conductor;Band/Orchestra;Composer;Lyricist/text writer;Recording Location;During recording;During performance;Movie/video screen capture;A bright coloured fish;Illustration;Band/artist logotype;Publisher/Studio logotype".split(";");
|
||||||
|
ID3v2.b.APIC=function(b,e,c,a,f){f=f||"3";a=b;var v=h(c.a(b));switch(f){case "2":var k=c.c(b+1,3);b+=4;break;case "3":case "4":k=c.e(b+1,e-(b-a),v),b+=1+k.g}f=c.a(b,1);f=g[f];v=c.e(b+1,e-(b-a),v);b+=1+v.g;return{format:k.toString(),type:f,description:v.toString(),data:c.l(b,a+e-b)}};ID3v2.b.COMM=function(b,e,c){var a=b,f=h(c.a(b)),g=c.c(b+1,3),k=c.e(b+4,e-4,f);b+=4+k.g;b=c.e(b,a+e-b,f);return{language:g,O:k.toString(),text:b.toString()}};ID3v2.b.COM=ID3v2.b.COMM;ID3v2.b.PIC=function(b,e,c,a){return ID3v2.b.APIC(b,
|
||||||
|
e,c,a,"2")};ID3v2.b.PCNT=function(b,e,c){return c.J(b)};ID3v2.b.CNT=ID3v2.b.PCNT;ID3v2.b["T*"]=function(b,e,c){var a=h(c.a(b));return c.e(b+1,e-1,a).toString()};ID3v2.b.TCON=function(b,e,c){return ID3v2.b["T*"].apply(this,arguments).replace(/^\(\d+\)/,"")};ID3v2.b.TCO=ID3v2.b.TCON;ID3v2.b.USLT=function(b,e,c){var a=b,f=h(c.a(b)),g=c.c(b+1,3),k=c.e(b+4,e-4,f);b+=4+k.g;b=c.e(b,a+e-b,f);return{language:g,G:k.toString(),L:b.toString()}};ID3v2.b.ULT=ID3v2.b.USLT})();(function(h){function g(b,a,f,h){var k=b.i(a);if(0==k)h();else{var d=b.c(a+4,4);-1<["moov","udta","meta","ilst"].indexOf(d)?("meta"==d&&(a+=4),b.f([a+8,a+8+8],function(){g(b,a+8,k-8,h)})):b.f([a+(d in e.j?0:k),a+k+8],function(){g(b,a+k,f,h)})}}function b(c,a,f,g,h){h=void 0===h?"":h+" ";for(var d=f;d<f+g;){var t=a.i(d);if(0==t)break;var m=a.c(d+4,4);if(-1<["moov","udta","meta","ilst"].indexOf(m)){"meta"==m&&(d+=4);b(c,a,d+8,t-8,h);break}if(e.j[m]){var u=a.o(d+16+1),l=e.j[m],u=e.types[u];if("trkn"==
|
||||||
|
m)c[l[0]]=a.a(d+16+11),c.count=a.a(d+16+13);else{var m=d+16+4+4,r=t-16-4-4,n;switch(u){case "text":n=a.e(m,r,"UTF-8");break;case "uint8":n=a.w(m);break;case "jpeg":case "png":n={k:"image/"+u,data:a.l(m,r)}}c[l[0]]="comment"===l[0]?{text:n}:n}}d+=t}}var e=h.r={};e.types={0:"uint8",1:"text",13:"jpeg",14:"png",21:"uint8"};e.j={"\u00a9alb":["album"],"\u00a9art":["artist"],"\u00a9ART":["artist"],aART:["artist"],"\u00a9day":["year"],"\u00a9nam":["title"],"\u00a9gen":["genre"],trkn:["track"],"\u00a9wrt":["composer"],
|
||||||
|
"\u00a9too":["encoder"],cprt:["copyright"],covr:["picture"],"\u00a9grp":["grouping"],keyw:["keyword"],"\u00a9lyr":["lyrics"],"\u00a9cmt":["comment"],tmpo:["tempo"],cpil:["compilation"],disk:["disc"]};e.m=function(b,a){b.f([0,7],function(){g(b,0,b.h(),a)})};e.n=function(c){var a={};b(a,c,0,c.h());return a};h.ID4=h.r})(this);
|
28
src/mediaelement-and-player.min.js
vendored
Normal file
268
src/mep-feature-playlist.js
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
/**
|
||||||
|
* @file MediaElement Playlist Feature (plugin).
|
||||||
|
* @author Andrew Berezovsky <andrew.berezovsky@gmail.com>
|
||||||
|
* Twitter handle: duozersk
|
||||||
|
* @author Original author: Junaid Qadir Baloch <shekhanzai.baloch@gmail.com>
|
||||||
|
* Twitter handle: jeykeu
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function($) {
|
||||||
|
$.extend(mejs.MepDefaults, {
|
||||||
|
loopText: 'Repeat On/Off',
|
||||||
|
shuffleText: 'Shuffle On/Off',
|
||||||
|
nextText: 'Next Track',
|
||||||
|
prevText: 'Previous Track',
|
||||||
|
playlistText: 'Show/Hide Playlist'
|
||||||
|
});
|
||||||
|
|
||||||
|
$.extend(MediaElementPlayer.prototype, {
|
||||||
|
// LOOP TOGGLE
|
||||||
|
buildloop: function(player, controls, layers, media) {
|
||||||
|
var t = this;
|
||||||
|
|
||||||
|
var loop = $('<div class="mejs-button mejs-loop-button ' + ((player.options.loop) ? 'mejs-loop-on' : 'mejs-loop-off') + '">' +
|
||||||
|
'<button type="button" aria-controls="' + player.id + '" title="' + player.options.loopText + '"></button>' +
|
||||||
|
'</div>')
|
||||||
|
// append it to the toolbar
|
||||||
|
.appendTo(controls)
|
||||||
|
// add a click toggle event
|
||||||
|
.click(function(e) {
|
||||||
|
player.options.loop = !player.options.loop;
|
||||||
|
$(media).trigger('mep-looptoggle', [player.options.loop]);
|
||||||
|
if (player.options.loop) {
|
||||||
|
loop.removeClass('mejs-loop-off').addClass('mejs-loop-on');
|
||||||
|
//media.setAttribute('loop', 'loop');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loop.removeClass('mejs-loop-on').addClass('mejs-loop-off');
|
||||||
|
//media.removeAttribute('loop');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
t.loopToggle = t.controls.find('.mejs-loop-button');
|
||||||
|
},
|
||||||
|
loopToggleClick: function() {
|
||||||
|
var t = this;
|
||||||
|
t.loopToggle.trigger('click');
|
||||||
|
},
|
||||||
|
// SHUFFLE TOGGLE
|
||||||
|
buildshuffle: function(player, controls, layers, media) {
|
||||||
|
var t = this;
|
||||||
|
|
||||||
|
var shuffle = $('<div class="mejs-button mejs-shuffle-button ' + ((player.options.shuffle) ? 'mejs-shuffle-on' : 'mejs-shuffle-off') + '">' +
|
||||||
|
'<button type="button" aria-controls="' + player.id + '" title="' + player.options.shuffleText + '"></button>' +
|
||||||
|
'</div>')
|
||||||
|
// append it to the toolbar
|
||||||
|
.appendTo(controls)
|
||||||
|
// add a click toggle event
|
||||||
|
.click(function(e) {
|
||||||
|
player.options.shuffle = !player.options.shuffle;
|
||||||
|
$(media).trigger('mep-shuffletoggle', [player.options.shuffle]);
|
||||||
|
if (player.options.shuffle) {
|
||||||
|
shuffle.removeClass('mejs-shuffle-off').addClass('mejs-shuffle-on');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shuffle.removeClass('mejs-shuffle-on').addClass('mejs-shuffle-off');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
t.shuffleToggle = t.controls.find('.mejs-shuffle-button');
|
||||||
|
},
|
||||||
|
shuffleToggleClick: function() {
|
||||||
|
var t = this;
|
||||||
|
t.shuffleToggle.trigger('click');
|
||||||
|
},
|
||||||
|
// PREVIOUS TRACK BUTTON
|
||||||
|
buildprevtrack: function(player, controls, layers, media) {
|
||||||
|
var t = this;
|
||||||
|
|
||||||
|
var prevTrack = $('<div class="mejs-button mejs-prevtrack-button mejs-prevtrack">' +
|
||||||
|
'<button type="button" aria-controls="' + player.id + '" title="' + player.options.prevText + '"></button>' +
|
||||||
|
'</div>')
|
||||||
|
.appendTo(controls)
|
||||||
|
.click(function(e){
|
||||||
|
$(media).trigger('mep-playprevtrack');
|
||||||
|
player.playPrevTrack();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.prevTrack = t.controls.find('.mejs-prevtrack-button');
|
||||||
|
},
|
||||||
|
prevTrackClick: function() {
|
||||||
|
var t = this;
|
||||||
|
t.prevTrack.trigger('click');
|
||||||
|
},
|
||||||
|
// NEXT TRACK BUTTON
|
||||||
|
buildnexttrack: function(player, controls, layers, media) {
|
||||||
|
var t = this;
|
||||||
|
|
||||||
|
var nextTrack = $('<div class="mejs-button mejs-nexttrack-button mejs-nexttrack">' +
|
||||||
|
'<button type="button" aria-controls="' + player.id + '" title="' + player.options.nextText + '"></button>' +
|
||||||
|
'</div>')
|
||||||
|
.appendTo(controls)
|
||||||
|
.click(function(e){
|
||||||
|
$(media).trigger('mep-playnexttrack');
|
||||||
|
player.playNextTrack();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.nextTrack = t.controls.find('.mejs-nexttrack-button');
|
||||||
|
},
|
||||||
|
nextTrackClick: function() {
|
||||||
|
var t = this;
|
||||||
|
t.nextTrack.trigger('click');
|
||||||
|
},
|
||||||
|
// PLAYLIST TOGGLE
|
||||||
|
buildplaylist: function(player, controls, layers, media) {
|
||||||
|
var t = this;
|
||||||
|
|
||||||
|
var playlistToggle = $('<div class="mejs-button mejs-playlist-button ' + ((player.options.playlist) ? 'mejs-hide-playlist' : 'mejs-show-playlist') + '">' +
|
||||||
|
'<button type="button" aria-controls="' + player.id + '" title="' + player.options.playlistText + '"></button>' +
|
||||||
|
'</div>')
|
||||||
|
.appendTo(controls)
|
||||||
|
.click(function(e) {
|
||||||
|
player.options.playlist = !player.options.playlist;
|
||||||
|
$(media).trigger('mep-playlisttoggle', [player.options.playlist]);
|
||||||
|
if (player.options.playlist) {
|
||||||
|
layers.children('.mejs-playlist').show();
|
||||||
|
playlistToggle.removeClass('mejs-show-playlist').addClass('mejs-hide-playlist');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
layers.children('.mejs-playlist').hide();
|
||||||
|
playlistToggle.removeClass('mejs-hide-playlist').addClass('mejs-show-playlist');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
t.playlistToggle = t.controls.find('.mejs-playlist-button');
|
||||||
|
},
|
||||||
|
playlistToggleClick: function() {
|
||||||
|
var t = this;
|
||||||
|
t.playlistToggle.trigger('click');
|
||||||
|
},
|
||||||
|
// PLAYLIST WINDOW
|
||||||
|
buildplaylistfeature: function(player, controls, layers, media) {
|
||||||
|
var playlist = $('<div class="mejs-playlist mejs-layer">' +
|
||||||
|
'<ul class="mejs"></ul>' +
|
||||||
|
'</div>')
|
||||||
|
.appendTo(layers);
|
||||||
|
if (!player.options.playlist) {
|
||||||
|
playlist.hide();
|
||||||
|
}
|
||||||
|
if (player.options.playlistposition == 'bottom') {
|
||||||
|
playlist.css('top', player.options.audioHeight + 'px');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
playlist.css('bottom', player.options.audioHeight + 'px');
|
||||||
|
}
|
||||||
|
var getTrackName = function(trackUrl) {
|
||||||
|
var trackUrlParts = trackUrl.split("/");
|
||||||
|
if (trackUrlParts.length > 0) {
|
||||||
|
return decodeURIComponent(trackUrlParts[trackUrlParts.length-1]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// calculate tracks and build playlist
|
||||||
|
var tracks = [];
|
||||||
|
//$(media).children('source').each(function(index, element) { // doesn't work in Opera 12.12
|
||||||
|
$('#'+player.id).find('.mejs-mediaelement source').each(function(index, element) {
|
||||||
|
if ($.trim(this.src) != '') {
|
||||||
|
var track = {};
|
||||||
|
track.source = $.trim(this.src);
|
||||||
|
if ($.trim(this.title) != '') {
|
||||||
|
track.name = $.trim(this.title);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
track.name = getTrackName(track.source);
|
||||||
|
}
|
||||||
|
tracks.push(track);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for (var track in tracks) {
|
||||||
|
layers.find('.mejs-playlist > ul').append('<li data-url="' + tracks[track].source + '" title="' + tracks[track].name + '">' + tracks[track].name + '</li>');
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the first track as current
|
||||||
|
layers.find('li:first').addClass('current played');
|
||||||
|
// play track from playlist when clicking it
|
||||||
|
layers.find('.mejs-playlist > ul li').click(function(e) {
|
||||||
|
if (!$(this).hasClass('current')) {
|
||||||
|
$(this).addClass('played');
|
||||||
|
player.playTrack($(this));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
player.play();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// when current track ends - play the next one
|
||||||
|
media.addEventListener('ended', function(e) {
|
||||||
|
player.playNextTrack();
|
||||||
|
}, false);
|
||||||
|
},
|
||||||
|
playNextTrack: function() {
|
||||||
|
var t = this;
|
||||||
|
var tracks = t.layers.find('.mejs-playlist > ul > li');
|
||||||
|
var current = tracks.filter('.current');
|
||||||
|
var notplayed = tracks.not('.played');
|
||||||
|
if (notplayed.length < 1) {
|
||||||
|
current.removeClass('played').siblings().removeClass('played');
|
||||||
|
notplayed = tracks.not('.current');
|
||||||
|
}
|
||||||
|
if (t.options.shuffle) {
|
||||||
|
var random = Math.floor(Math.random()*notplayed.length);
|
||||||
|
var nxt = notplayed.eq(random);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var nxt = current.next();
|
||||||
|
if (nxt.length < 1 && t.options.loop) {
|
||||||
|
nxt = current.siblings().first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nxt.length == 1) {
|
||||||
|
nxt.addClass('played');
|
||||||
|
t.playTrack(nxt);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
playPrevTrack: function() {
|
||||||
|
var t = this;
|
||||||
|
var tracks = t.layers.find('.mejs-playlist > ul > li');
|
||||||
|
var current = tracks.filter('.current');
|
||||||
|
var played = tracks.filter('.played').not('.current');
|
||||||
|
if (played.length < 1) {
|
||||||
|
current.removeClass('played');
|
||||||
|
played = tracks.not('.current');
|
||||||
|
}
|
||||||
|
if (t.options.shuffle) {
|
||||||
|
var random = Math.floor(Math.random()*played.length);
|
||||||
|
var prev = played.eq(random);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var prev = current.prev();
|
||||||
|
if (prev.length < 1 && t.options.loop) {
|
||||||
|
prev = current.siblings().last();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (prev.length == 1) {
|
||||||
|
current.removeClass('played');
|
||||||
|
t.playTrack(prev);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
playTrack: function(track) {
|
||||||
|
var t = this;
|
||||||
|
t.pause();
|
||||||
|
t.setSrc(track.attr('data-url'));
|
||||||
|
t.load();
|
||||||
|
t.play();
|
||||||
|
track.addClass('current').siblings().removeClass('current');
|
||||||
|
},
|
||||||
|
playTrackURL: function(url) {
|
||||||
|
var t = this;
|
||||||
|
var tracks = t.layers.find('.mejs-playlist > ul > li');
|
||||||
|
var track = tracks.filter('[data-url="'+url+'"]');
|
||||||
|
t.playTrack(track);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})(mejs.$);
|
332
src/player.js
Normal file
@ -0,0 +1,332 @@
|
|||||||
|
/* Copyright (C) 2013, 2014 Tilman Kranz <tilt@linuxfoo.de>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use, copy,
|
||||||
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
* of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||||
|
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||||
|
* OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
|
||||||
|
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||||
|
* THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE */
|
||||||
|
|
||||||
|
var MyPlayer = function(_args) {
|
||||||
|
var failed = false;
|
||||||
|
var detached = false;
|
||||||
|
var player = null;
|
||||||
|
|
||||||
|
var defaultArgs = {
|
||||||
|
detachable: true,
|
||||||
|
element: 'body',
|
||||||
|
id3: false,
|
||||||
|
mode: 'mp3url',
|
||||||
|
waveform: false,
|
||||||
|
autoplay: false,
|
||||||
|
loop: true,
|
||||||
|
shuffle: false,
|
||||||
|
list: []
|
||||||
|
};
|
||||||
|
|
||||||
|
var args = (typeof(_args)==='undefined')
|
||||||
|
? defaultArgs
|
||||||
|
: $.extend({}, defaultArgs, _args);
|
||||||
|
|
||||||
|
var createAudio = function() {
|
||||||
|
var autoplay = args.autoplay ? 'autoplay="true"' : '';
|
||||||
|
|
||||||
|
$(args.element).append(
|
||||||
|
'<audio controls="controls" ' + autoplay + '>'+
|
||||||
|
'<p>'+
|
||||||
|
'Your browser does not understand '+
|
||||||
|
'the <audio> tag. '+
|
||||||
|
'</p>'+
|
||||||
|
'</audio>'
|
||||||
|
);
|
||||||
|
|
||||||
|
args.audio = args.element + ' audio';
|
||||||
|
}
|
||||||
|
|
||||||
|
var readId3 = function() {
|
||||||
|
$(args.element).find('ul.mejs li').each(function(i, track){
|
||||||
|
var url = $(track).attr('data-url');
|
||||||
|
|
||||||
|
$(track).prepend('<span class="ajaxLoader"> </span> ');
|
||||||
|
|
||||||
|
ID3.loadTags(url, function() {
|
||||||
|
var tags = ID3.getAllTags(url);
|
||||||
|
|
||||||
|
if(typeof(tags.title)!='undefined') {
|
||||||
|
var track_title = tags.title;
|
||||||
|
|
||||||
|
if(typeof(tags.artist)!='undefined')
|
||||||
|
track_title = tags.artist + ' - ' + track_title;
|
||||||
|
|
||||||
|
$(args.element).find('ul.mejs li').each(function(j, _track){
|
||||||
|
if(i==j)
|
||||||
|
$(_track).html(track_title);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var playerCreated = function() {
|
||||||
|
restoreParams();
|
||||||
|
|
||||||
|
if(args.id3)
|
||||||
|
readId3();
|
||||||
|
}
|
||||||
|
|
||||||
|
var createPlayer = function() {
|
||||||
|
player = new MediaElementPlayer(
|
||||||
|
$(args.audio), {
|
||||||
|
success: playerCreated,
|
||||||
|
loop: args.loop,
|
||||||
|
shuffle: args.shuffle,
|
||||||
|
playlist: true,
|
||||||
|
audioHeight: 32,
|
||||||
|
playlistposition: 'bottom',
|
||||||
|
features: ['playlistfeature', 'prevtrack', 'playpause',
|
||||||
|
'nexttrack', 'loop', 'shuffle', 'current', 'progress',
|
||||||
|
'duration', 'volume'],
|
||||||
|
pluginPath: mejs.Utility.getScriptPath(['myplayer.min.js'])+'../plugins/'
|
||||||
|
});
|
||||||
|
|
||||||
|
$(args.element).append(
|
||||||
|
'<p class="playerDetached" style="display: none;">'+
|
||||||
|
'The player is currently detached.'+
|
||||||
|
'</p>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var param = function(name) {
|
||||||
|
var query = window.location.search.substring(1);
|
||||||
|
var vars = query.split("&");
|
||||||
|
|
||||||
|
for(var i=0; i<vars.length; i++) {
|
||||||
|
var pair = vars[i].split("=");
|
||||||
|
|
||||||
|
if(pair[0] == name)
|
||||||
|
return pair[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var setupDetach = function() {
|
||||||
|
if(!args.detachable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var popup = function(url) {
|
||||||
|
player.pause();
|
||||||
|
$('.mejs-audio').hide();
|
||||||
|
$('.playerDetached').show();
|
||||||
|
|
||||||
|
var playerWindow = window.open(
|
||||||
|
url, 'myplayer',
|
||||||
|
'height='+ Math.max($(args.element).height(), 298)+','+
|
||||||
|
'width='+408+','+
|
||||||
|
'resizable=false'
|
||||||
|
);
|
||||||
|
|
||||||
|
if(window.focus)
|
||||||
|
playerWindow.focus();
|
||||||
|
|
||||||
|
$("iframe",top.document).height(20);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(param('popup')==false) {
|
||||||
|
$('.mejs-controls').append(
|
||||||
|
'<div id="popupButton" '+
|
||||||
|
'class="popupButton">'+
|
||||||
|
'<button '+
|
||||||
|
'title="Open in separate window" '+
|
||||||
|
'type="button">'+
|
||||||
|
'</button>'+
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$('.popupButton button').click(function(){
|
||||||
|
var currentTime = player.getCurrentTime();
|
||||||
|
var volume = player.getVolume();
|
||||||
|
var paused = player.media.paused;
|
||||||
|
var trackNo = 0;
|
||||||
|
|
||||||
|
$(args.element).find('ul.mejs li').each(function(i){
|
||||||
|
if($(this).hasClass('current'))
|
||||||
|
trackNo = i;
|
||||||
|
});
|
||||||
|
|
||||||
|
popup(
|
||||||
|
$(location).attr('href')+'?'+
|
||||||
|
'popup&'+
|
||||||
|
'paused='+paused+'&'+
|
||||||
|
'currentTime='+currentTime+'&'+
|
||||||
|
'volume='+volume+'&'+
|
||||||
|
'trackNo='+trackNo
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var windowHeight = $(window).height();
|
||||||
|
|
||||||
|
window.onbeforeunload = function(){
|
||||||
|
$("iframe", opener.top.document).height(windowHeight);
|
||||||
|
$('.mejs-audio', opener.document).show();
|
||||||
|
$('.playerDetached', opener.document).hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var restoreParams = function() {
|
||||||
|
if(!detached)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var paused = (param('paused') && param('paused')=='true');
|
||||||
|
var currentTime = param('currentTime') ? parseFloat(param('currentTime')) : 0.0;
|
||||||
|
var volume = param('volume') ? parseFloat(param('volume')) : 1.0;
|
||||||
|
var trackNo = param('trackNo') ? parseInt(param('trackNo')) : 0;
|
||||||
|
|
||||||
|
player.setVolume(volume);
|
||||||
|
|
||||||
|
$(args.element).find('ul.mejs li').each(function(i){
|
||||||
|
if(i==trackNo) {
|
||||||
|
player.playTrack($(this));
|
||||||
|
player.setCurrentTime(currentTime);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(paused)
|
||||||
|
player.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(param('popup')!==false) {
|
||||||
|
detached = true;
|
||||||
|
|
||||||
|
$('body').html(
|
||||||
|
'<div '+
|
||||||
|
'id="myplayer" '+
|
||||||
|
'style="'+
|
||||||
|
'width: '+$(args.element).width()+'px; '+
|
||||||
|
'height: '+$(args.element).height()+' px;'+
|
||||||
|
'"></div>'
|
||||||
|
);
|
||||||
|
|
||||||
|
args.element = '#myplayer';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.mode=='mp3url') {
|
||||||
|
var mp3url = (typeof args.mp3url === "undefined")
|
||||||
|
? $(location).attr('href').replace(/\?.*/, '').replace(/\/[^\/]+\/?$/, '')
|
||||||
|
: args.mp3url;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: mp3url,
|
||||||
|
type: 'GET',
|
||||||
|
success: function(res) {
|
||||||
|
createAudio();
|
||||||
|
|
||||||
|
var doc = document.createElement('html');
|
||||||
|
doc.innerHTML = res;
|
||||||
|
|
||||||
|
var head = $(doc).find('a').each(function(idx,item) {
|
||||||
|
var src = $(item).attr('href');
|
||||||
|
|
||||||
|
if(src.match(/\.mp3$/)) {
|
||||||
|
var url = mp3url+'/'+src;
|
||||||
|
var title = item.innerHTML;
|
||||||
|
|
||||||
|
$(args.audio).append('<source src="'+url+'" title="'+title+'"/>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
createPlayer();
|
||||||
|
setupDetach();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if(args.mode=='m3u') {
|
||||||
|
var m3u = (typeof args.m3u === "undefined")
|
||||||
|
? $(location).attr('href').replace(/\?.*/, '').replace(/\/[^\/]+\/?$/, '/play.m3u')
|
||||||
|
: args.m3u;
|
||||||
|
|
||||||
|
createAudio();
|
||||||
|
|
||||||
|
$.get(m3u, function(txt){
|
||||||
|
var lines = txt.split("\n");
|
||||||
|
|
||||||
|
for(var i = 0, len = lines.length; i < len; i++)
|
||||||
|
if(!lines[i].match(/^[ \t]*#/) && lines[i].match(/\.mp3$/)) {
|
||||||
|
var mp3 = lines[i];
|
||||||
|
var title = unescape(mp3.split('/').pop());
|
||||||
|
|
||||||
|
$(args.audio).append('<source src="'+mp3+'" title="'+title+'"/>');
|
||||||
|
}
|
||||||
|
|
||||||
|
createPlayer();
|
||||||
|
setupDetach();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if(args.mode=='list') {
|
||||||
|
createAudio();
|
||||||
|
|
||||||
|
for(var i = 0, len = args.list.length; i < len; i++) {
|
||||||
|
var item = args.list[i];
|
||||||
|
var type = typeof item;
|
||||||
|
var src = '';
|
||||||
|
var title = '';
|
||||||
|
|
||||||
|
if(item !== null && type === 'object') {
|
||||||
|
if(item.url)
|
||||||
|
src = item.url;
|
||||||
|
else {
|
||||||
|
alert(
|
||||||
|
'MyPlayer: item[' + i + ']: '+
|
||||||
|
'property "url" is missing.'
|
||||||
|
);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(item.title)
|
||||||
|
title = item.title;
|
||||||
|
else
|
||||||
|
title = url.replace(/(.*\/)?([^\/]+)/, '$2');
|
||||||
|
}
|
||||||
|
else if(type === 'string') {
|
||||||
|
src = item;
|
||||||
|
title = src;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert(
|
||||||
|
'MyPlayer: item [' + i + ']: '+
|
||||||
|
'unsupported type "' + type + '"'
|
||||||
|
);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(args.audio).append('<source src="'+src+'" title="'+title+'"/>');
|
||||||
|
}
|
||||||
|
|
||||||
|
createPlayer();
|
||||||
|
setupDetach();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(args.element).append('<p>Unsupported mode "'+args.mode+'"</p>');
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|