diff options
author | Frank Karlitschek <frank@owncloud.org> | 2012-08-26 17:30:07 +0200 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2012-08-26 17:30:07 +0200 |
commit | 72e9a2ce57ee88503db83614cec5ccda71f0b58e (patch) | |
tree | 8bc301ca22d9ca08ea54426bcb61f62bd1c1cb75 /apps/media | |
parent | 32bad688bdb4fea55eba9d4255fc55f1c60a0aca (diff) | |
download | nextcloud-server-72e9a2ce57ee88503db83614cec5ccda71f0b58e.tar.gz nextcloud-server-72e9a2ce57ee88503db83614cec5ccda71f0b58e.zip |
moved to apps repository
Diffstat (limited to 'apps/media')
87 files changed, 0 insertions, 7867 deletions
diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php deleted file mode 100644 index 7f5cdb22c12..00000000000 --- a/apps/media/ajax/api.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php - -/** -* ownCloud - media plugin -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -header('Content-type: text/html; charset=UTF-8') ; - -OCP\JSON::checkAppEnabled('media'); - -error_reporting(E_ALL); //no script error reporting because of getID3 - -$arguments=$_POST; - -if(!isset($_POST['action']) and isset($_GET['action'])){ - $arguments=$_GET; -} - -foreach($arguments as &$argument){ - $argument=stripslashes($argument); -} -@ob_clean(); -if(!isset($arguments['artist'])){ - $arguments['artist']=0; -} -if(!isset($arguments['album'])){ - $arguments['album']=0; -} -if(!isset($arguments['search'])){ - $arguments['search']=''; -} - -session_write_close(); - -OC_MEDIA_COLLECTION::$uid=OCP\USER::getUser(); -if($arguments['action']){ - switch($arguments['action']){ - case 'delete': - $path=$arguments['path']; - OC_MEDIA_COLLECTION::deleteSongByPath($path); - $paths=explode(PATH_SEPARATOR,OCP\Config::getUserValue(OCP\USER::getUser(),'media','paths','')); - if(array_search($path,$paths)!==false){ - unset($paths[array_search($path,$paths)]); - OCP\Config::setUserValue(OCP\USER::getUser(),'media','paths',implode(PATH_SEPARATOR,$paths)); - } - case 'get_collection': - $data=array(); - $data['artists']=OC_MEDIA_COLLECTION::getArtists(); - $data['albums']=OC_MEDIA_COLLECTION::getAlbums(); - $data['songs']=OC_MEDIA_COLLECTION::getSongs(); - OCP\JSON::encodedPrint($data); - break; - case 'scan': - OCP\DB::beginTransaction(); - set_time_limit(0); //recursive scan can take a while - $eventSource=new OC_EventSource(); - OC_MEDIA_SCANNER::scanCollection($eventSource); - $eventSource->close(); - OCP\DB::commit(); - break; - case 'scanFile': - echo (OC_MEDIA_SCANNER::scanFile($arguments['path']))?'true':'false'; - break; - case 'get_artists': - OCP\JSON::encodedPrint(OC_MEDIA_COLLECTION::getArtists($arguments['search'])); - break; - case 'get_albums': - OCP\JSON::encodedPrint(OC_MEDIA_COLLECTION::getAlbums($arguments['artist'],$arguments['search'])); - break; - case 'get_songs': - OCP\JSON::encodedPrint(OC_MEDIA_COLLECTION::getSongs($arguments['artist'],$arguments['album'],$arguments['search'])); - break; - case 'get_path_info': - if(OC_Filesystem::file_exists($arguments['path'])){ - $songId=OC_MEDIA_COLLECTION::getSongByPath($arguments['path']); - if($songId==0){ - unset($_SESSION['collection']); - $songId= OC_MEDIA_SCANNER::scanFile($arguments['path']); - } - if($songId>0){ - $song=OC_MEDIA_COLLECTION::getSong($songId); - $song['artist']=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']); - $song['album']=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']); - OCP\JSON::encodedPrint($song); - } - } - break; - case 'play': - @ob_end_clean(); - - $ftype=OC_Filesystem::getMimeType( $arguments['path'] ); - if(substr($ftype,0,5)!='audio' and $ftype!='application/ogg'){ - echo 'Not an audio file'; - exit(); - } - - $songId=OC_MEDIA_COLLECTION::getSongByPath($arguments['path']); - OC_MEDIA_COLLECTION::registerPlay($songId); - - header('Content-Type:'.$ftype); - OCP\Response::enableCaching(3600 * 24); // 24 hour - header('Accept-Ranges: bytes'); - header('Content-Length: '.OC_Filesystem::filesize($arguments['path'])); - $mtime = OC_Filesystem::filemtime($arguments['path']); - OCP\Response::setLastModifiedHeader($mtime); - - OC_Filesystem::readfile($arguments['path']); - exit; - case 'find_music': - $music=OC_FileCache::searchByMime('audio'); - $ogg=OC_FileCache::searchByMime('application','ogg'); - $music=array_merge($music,$ogg); - OCP\JSON::encodedPrint($music); - exit; - } -} diff --git a/apps/media/ajax/autoupdate.php b/apps/media/ajax/autoupdate.php deleted file mode 100644 index a5801f1a0e0..00000000000 --- a/apps/media/ajax/autoupdate.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -/** -* ownCloud - media plugin -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -header('Content-type: text/html; charset=UTF-8') ; - -OCP\JSON::checkAppEnabled('media'); - -$autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true'); - -OCP\Config::setUserValue(OCP\USER::getUser(),'media','autoupdate',(integer)$autoUpdate); - -OCP\JSON::success(array('data' => $autoUpdate)); diff --git a/apps/media/appinfo/app.php b/apps/media/appinfo/app.php deleted file mode 100644 index 75015d627b4..00000000000 --- a/apps/media/appinfo/app.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * ownCloud - media plugin - * - * @author Robin Appelman - * @copyright 2010 Robin Appelman icewind1991@gmail.com - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either - * version 3 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/ - * - */ - -$l=OC_L10N::get('media'); - -OC::$CLASSPATH['OC_MEDIA'] = 'media/lib_media.php'; -OC::$CLASSPATH['OC_MediaSearchProvider'] = 'media/lib_media.php'; -OC::$CLASSPATH['OC_MEDIA_COLLECTION'] = 'media/lib_collection.php'; -OC::$CLASSPATH['OC_MEDIA_SCANNER'] = 'media/lib_scanner.php'; - -//we need to have the sha256 hash of passwords for ampache -OCP\Util::connectHook('OC_User','post_login','OC_MEDIA','loginListener'); - -//connect to the filesystem for auto updating -OCP\Util::connectHook('OC_Filesystem','post_write','OC_MEDIA','updateFile'); - -//listen for file deletions to clean the database if a song is deleted -OCP\Util::connectHook('OC_Filesystem','post_delete','OC_MEDIA','deleteFile'); - -//list for file moves to update the database -OCP\Util::connectHook('OC_Filesystem','post_rename','OC_MEDIA','moveFile'); - -OCP\Util::addscript('media','loader'); -OCP\App::registerPersonal('media','settings'); - -OCP\App::addNavigationEntry(array('id' => 'media_index', 'order' => 2, 'href' => OCP\Util::linkTo('media', 'index.php'), 'icon' => OCP\Util::imagePath('core', 'places/music.svg'), 'name' => $l->t('Music'))); - -OC_Search::registerProvider('OC_MediaSearchProvider'); diff --git a/apps/media/appinfo/database.xml b/apps/media/appinfo/database.xml deleted file mode 100644 index 067f7bc0590..00000000000 --- a/apps/media/appinfo/database.xml +++ /dev/null @@ -1,298 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<database> - - <name>*dbname*</name> - <create>true</create> - <overwrite>false</overwrite> - - <charset>utf8</charset> - - <table> - - <name>*dbprefix*media_albums</name> - - <declaration> - - <field> - <name>album_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>album_name</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>200</length> - </field> - - <field> - <name>album_artist</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>album_art</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>200</length> - </field> - - <index> - <name>album_name_index</name> - <field> - <name>album_name</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>album_artist_index</name> - <field> - <name>album_artist</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <name>*dbprefix*media_artists</name> - - <declaration> - - <field> - <name>artist_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>artist_name</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>200</length> - </field> - - <index> - <name>artist_name</name> - <unique>true</unique> - <field> - <name>artist_name</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <name>*dbprefix*media_sessions</name> - - <declaration> - - <field> - <name>session_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>token</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>user_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>start</name> - <type>timestamp</type> - <notnull>true</notnull> - </field> - - </declaration> - - </table> - - <table> - - <name>*dbprefix*media_songs</name> - - <declaration> - - <field> - <name>song_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>song_name</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>200</length> - </field> - - <field> - <name>song_artist</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>song_album</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>song_path</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>200</length> - </field> - - <field> - <name>song_user</name> - <type>text</type> - <default>0</default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>song_length</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>song_track</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>song_size</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>song_playcount</name> - <type>integer</type> - <default> - </default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>song_lastplayed</name> - <type>integer</type> - <default> - </default> - <notnull>true</notnull> - <length>4</length> - </field> - - <index> - <name>song_album_index</name> - <field> - <name>song_album</name> - <sorting>ascending</sorting> - </field> - </index> - <index> - <name>song_artist_index</name> - <field> - <name>song_artist</name> - <sorting>ascending</sorting> - </field> - </index> - <index> - <name>song_name_index</name> - <field> - <name>song_name</name> - <sorting>ascending</sorting> - </field> - </index> - - - </declaration> - - </table> - - <table> - - <name>*dbprefix*media_users</name> - - <declaration> - - <field> - <name>user_id</name> - <type>text</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>64</length> - </field> - - <field> - <name>user_password_sha256</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - </declaration> - - </table> - - -</database> diff --git a/apps/media/appinfo/info.xml b/apps/media/appinfo/info.xml deleted file mode 100644 index e2d97467081..00000000000 --- a/apps/media/appinfo/info.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> -<info> - <id>media</id> - <name>Media</name> - <description>Media player and server for ownCloud</description> - <licence>AGPL</licence> - <author>Robin Appelman</author> - <require>4</require> - <shipped>true</shipped> - <standalone/> - <default_enable/> - <remote> - <ampache>remote.php</ampache> - </remote> -</info> diff --git a/apps/media/appinfo/version b/apps/media/appinfo/version deleted file mode 100644 index 44bb5d1f743..00000000000 --- a/apps/media/appinfo/version +++ /dev/null @@ -1 +0,0 @@ -0.4.1
\ No newline at end of file diff --git a/apps/media/css/music.css b/apps/media/css/music.css deleted file mode 100644 index c782e8afeeb..00000000000 --- a/apps/media/css/music.css +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net - This file is licensed under the Affero General Public License version 3 or later. - See the COPYING-README file. */ - -#controls ul.jp-controls { padding:0; } -#controls ul.jp-controls li { display:inline; } -#controls ul.jp-controls li a { position:absolute; padding:.8em 1em .8em 0; } -a.jp-play, a.jp-pause { left:2.5em; } -a.jp-pause { display:none; } -a.jp-next { left:5em; } - -div.jp-progress { position:absolute; overflow:hidden; top:.5em; left:8em; width:15em; height:1.2em; padding:0; } -div.jp-seek-bar { background:#eee; width:0; height:100%; cursor:pointer; } -div.jp-play-bar { background:#ccc; width:0; height:100%; } -div.jp-current-time,div.jp-duration { position:absolute; font-size:.64em; font-style:oblique; top:0.9em; left:13.5em; } -div.jp-duration { display: none } -div.jp-current-song { left: 33em; position: absolute; top: 0.9em; } -div.jp-duration { text-align:right; } - -a.jp-mute,a.jp-unmute { left:24em; } -div.jp-volume-bar { position:absolute; overflow:hidden; background:#eee; width:4em; height:0.4em; cursor:pointer; top:1.3em; left:27em; } -div.jp-volume-bar-value { background:#ccc; width:0; height:0.4em; } - -#collection { position:relative; width:100%; float:left; table-layout:fixed; } -#collection td { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } -#leftcontent img.remove { display:none; float:right; cursor:pointer; opacity: 0; } -#leftcontent li:hover img.remove { display:inline; opacity: .3; } -#leftcontent li div.label { float: left; width: 200px; overflow: hidden; text-overflow: ellipsis; } -#rightcontent { overflow: auto; } -#playlist li { list-style-type:none; } -.template { display:none; } -.collection_playing { background:#eee; font-weight: bold; } - -#searchresults input.play, #searchresults input.add { float:left; height:1em; width:1em; } -#collection tr.collapsed td.album, #collection tr.collapsed td.title { color:#ddd; } -#collection td.artist-expander, #collection td.album-expander { width:2em; text-align:center; } -td.artist a.expander, td.album a.expander { float:right; padding:0 1em; } -tr.active td { background-color:#eee; font-weight:bold; } -tr td { border-bottom:1px solid #eee; height:2.2em; } -tr .artist img { vertical-align:middle; } -tr.album td.artist { padding-left:1em; } -tr.song td.artist { padding-left:2em; } -.add {margin: 0 0.5em 0 0; } - -#scan { position:absolute; right:13.5em; top:0em; } -#scan .start { position:relative; display:inline; float:right; } -#scan .stop { position:relative; display:inline; float:right; } -#scan #scanprogressbar { position:relative; display:inline-block; width:10em; height:1.5em; top:.4em; } diff --git a/apps/media/css/player.css b/apps/media/css/player.css deleted file mode 100644 index 0f29748f351..00000000000 --- a/apps/media/css/player.css +++ /dev/null @@ -1,23 +0,0 @@ -#playercontrols{ - display:inline; - margin-left:1em; - width:4em; - height:1em; - position:fixed; - top:auto; - left:auto; - background:transparent; - box-shadow:none; - -webkit-box-shadow:none; -} -#playercontrols li{ - float:left; -} -#playercontrols a, #playercontrols li{ - margin:0px; - padding:0; - left:0; - background:transparent !important; - border:none !important; - text-shadow:none; -}
\ No newline at end of file diff --git a/apps/media/index.php b/apps/media/index.php deleted file mode 100644 index ae85abc8aab..00000000000 --- a/apps/media/index.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -/** -* ownCloud - media plugin -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - - - - -// Check if we are a user -OCP\User::checkLoggedIn(); -OCP\App::checkAppEnabled('media'); - -OCP\Util::addscript('media','player'); -OCP\Util::addscript('media','music'); -OCP\Util::addscript('media','playlist'); -OCP\Util::addscript('media','collection'); -OCP\Util::addscript('media','scanner'); -OCP\Util::addscript('media','jquery.jplayer.min'); -OCP\Util::addStyle('media','music'); - -OCP\App::setActiveNavigationEntry( 'media_index' ); - -$tmpl = new OCP\Template( 'media', 'music', 'user' ); -$tmpl->printPage(); diff --git a/apps/media/js/Jplayer.swf b/apps/media/js/Jplayer.swf Binary files differdeleted file mode 100644 index c213fd578e5..00000000000 --- a/apps/media/js/Jplayer.swf +++ /dev/null diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js deleted file mode 100644 index 161fc0c6810..00000000000 --- a/apps/media/js/collection.js +++ /dev/null @@ -1,368 +0,0 @@ -var initScanned = false; - -Collection={ - artists:[], - albums:[], - songs:[], - artistsById:{}, - albumsById:{}, - loaded:false, - loading:false, - loadedListeners:[], - load:function(ready){ - if(ready){ - Collection.loadedListeners.push(ready); - } - if(!Collection.loading){ - Collection.loading=true; - Collection.artists=[]; - Collection.albums=[]; - Collection.songs=[]; - Collection.artistsById={}; - Collection.albumsById={}; - $.ajax({ - url: OC.linkTo('media','ajax/api.php')+'?action=get_collection', - dataType: 'json', - success: function(data){ - //normalize the data - for(var i=0;i<data.artists.length;i++){ - var artist=data.artists[i]; - var artistData={name:artist.artist_name,songs:[],albums:[]}; - Collection.artistsById[artist.artist_id]=artistData; - Collection.artists.push(artistData); - } - for(var i=0;i<data.albums.length;i++){ - var album=data.albums[i]; - if(Collection.artistsById[album.album_artist]){ - var artistName=Collection.artistsById[album.album_artist].name; - }else{ - var artistName='unknown'; - } - var albumData={name:album.album_name,artist:artistName,songs:[]}; - Collection.albumsById[album.album_id]=albumData; - Collection.albums.push(albumData); - if(Collection.artistsById[album.album_artist]){ - Collection.artistsById[album.album_artist].albums.push(albumData); - } - } - for(var i=0;i<data.songs.length;i++){ - var song=data.songs[i]; - if(Collection.artistsById[song.song_artist] && Collection.albumsById[song.song_album]){ - var songData={ - name:song.song_name, - artist:Collection.artistsById[song.song_artist].name, - album:Collection.albumsById[song.song_album].name, - lastPlayed:song.song_lastplayed, - length:song.song_length, - path:song.song_path, - playCount:song.song_playcount, - }; - Collection.songs.push(songData); - Collection.artistsById[song.song_artist].songs.push(songData); - Collection.albumsById[song.song_album].songs.push(songData); - } - } - - Collection.artists.sort(function(a,b){ - if(!a.name){ - return -1; - } - return a.name.localeCompare(b.name); - }); - - Collection.loaded=true; - Collection.loading=false; - for(var i=0;i<Collection.loadedListeners.length;i++){ - Collection.loadedListeners[i](); - } - if(data.songs.length==0 && initScanned == false){ - $('#scan input.start').click(); - initScanned = true; - } - } - }); - } - }, - display:function(){ - if(Collection.parent){ - Collection.parent.show(); - } - if(!Collection.loaded){ - Collection.load(Collection.display); - }else{ - if(Collection.parent){ - Collection.parent.find('tr:not(.template)').remove(); - var template=Collection.parent.find('tr.template'); - $.each(Collection.artists,function(i,artist){ - if(artist.name && artist.songs.length>0){ - var tr=template.clone().removeClass('template'); - if(artist.songs.length>1){ - tr.find('td.title a').html(artist.songs.length+' '+t('media','songs')); - tr.find('td.album a').html(artist.albums.length+' '+t('media','albums')); - }else{ - tr.find('td.title a').html(artist.songs[0].name); - tr.find('td.album a').html(artist.albums[0].name); - } - tr.find('td.artist a').html(artist.name); - tr.data('artistData',artist); - tr.find('td.artist a').click(function(event){ - event.preventDefault(); - PlayList.add(artist); - PlayList.play(0); - Collection.parent.find('tr').removeClass('active'); - $('tr[data-artist="'+artist.name+'"]').addClass('active'); - }); - var expander=''; - if(artist.songs.length>1){ - expander=$('<a class="expander">></a>'); - expander.data('expanded',false); - expander.click(function(event){ - var tr=$(this).parent().parent(); - if(expander.data('expanded')){ - Collection.hideArtist(tr.data('artist')); - }else{ - Collection.showArtist(tr.data('artist')); - } - }); - } - tr.find('td.artist').addClass('buttons'); - Collection.addButtons(tr,artist); - tr.children('td.artist-expander').append(expander); - tr.attr('data-artist',artist.name); - Collection.parent.find('tbody').append(tr); - } - }); - } - } - }, - showArtist:function(artist){ - var tr=Collection.parent.find('tr[data-artist="'+artist+'"]'); - var lastRow=tr; - var artist=tr.data('artistData'); - var first=true; - $.each(artist.albums,function(j,album){ - $.each(album.songs,function(i,song){ - var newRow; - if(first){ - newRow=tr; - }else{ - newRow=tr.clone(); - newRow.find('td.artist').text(''); - newRow.find('.expander').remove(); - } - newRow.find('td.album-expander .expander').remove(); - if(i==0){ - newRow.find('td.album a').text(album.name); - newRow.find('td.album a').click(function(event){ - event.preventDefault(); - PlayList.add(album); - PlayList.play(0); - Collection.parent.find('tr').removeClass('active'); - $('tr[data-album="'+album.name+'"]').addClass('active'); - }); - if(album.songs.length>1){ - var expander=$('<a class="expander">v </a>'); - expander.data('expanded',true); - expander.click(function(event){ - var tr=$(this).parent().parent(); - if(expander.data('expanded')) { - Collection.hideAlbum(tr.data('artist'),tr.data('album')); - } else { - Collection.showAlbum(tr.data('artist'),tr.data('album')); - } - }); - newRow.children('td.album-expander').append(expander); - } - Collection.addButtons(newRow,album); - } else { - newRow.find('td.album a').text(''); - Collection.addButtons(newRow,song); - } - newRow.find('td.title a').text(song.name); - newRow.find('td.title a').click(function(event){ - event.preventDefault(); - PlayList.add(song); - PlayList.play(0); - Collection.parent.find('tr').removeClass('active'); - $('tr[data-title="'+song.name+'"]').addClass('active'); - }); - newRow.attr('data-album',album.name); - newRow.attr('data-title',song.name); - newRow.attr('data-artist',artist.name); - newRow.data('albumData',album); - if(!first){ - lastRow.after(newRow); - } - first=false; - lastRow=newRow; - }); - }); - tr.removeClass('collapsed'); - tr.find('td.artist-expander a.expander').data('expanded',true); - tr.find('td.artist-expander a.expander').addClass('expanded'); - tr.find('td.artist-expander a.expander').text('v'); - }, - hideArtist:function(artist){ - var tr=Collection.parent.find('tr[data-artist="'+artist+'"]'); - var artist=tr.first().data('artistData'); - tr.first().find('td.album a').first().text(artist.albums.length+' '+t('media','albums')); - tr.first().find('td.album-expander a.expander').remove(); - tr.first().find('td.title a').text(artist.songs.length+' '+t('media','songs')); - tr.first().find('td.album a').unbind('click'); - tr.first().find('td.title a').unbind('click'); - tr.each(function(i,row){ - if(i>0){ - $(row).remove(); - } - }); - tr.find('td.artist-expander a.expander').data('expanded',false); - tr.find('td.artist-expander a.expander').removeClass('expanded'); - tr.find('td.artist-expander a.expander').text('>'); - Collection.addButtons(tr,artist); - }, - showAlbum:function(artist,album){ - var tr = Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]'); - var lastRow=tr; - var albumData=tr.data('albumData'); - tr.find('td.album-expander a.expander').data('expanded',true); - tr.find('td.album-expander a.expander').addClass('expanded'); - tr.find('td.album-expander a.expander').text('v'); - $.each(albumData.songs,function(i,song){ - var newRow; - if(i>0){ - newRow=tr.clone(); - newRow.find('a.expander').remove(); - newRow.find('td.album a').text(''); - newRow.find('td.artist a').text(''); - }else{ - newRow=tr; - } - newRow.find('td.title a').text(song.name); - newRow.find('td.title a').click(function(event){ - event.preventDefault(); - PlayList.add(song); - PlayList.play(0); - Collection.parent.find('tr').removeClass('active'); - $('tr[data-title="'+song.name+'"]').addClass('active'); - }); - if(i>0){ - lastRow.after(newRow); - } - lastRow=newRow; - }); - }, - hideAlbum:function(artist,album){ - var tr = Collection.parent.find('tr[data-artist="'+artist+'"][data-album="'+album+'"]'); - var albumData=tr.data('albumData'); - tr.first().find('td.title a').text(albumData.songs.length+' '+t('media','songs')); - tr.find('td.album-expander a.expander').data('expanded',false); - tr.find('td.album-expander a.expander').removeClass('expanded'); - tr.find('td.album-expander a.expander').text('> '); - tr.each(function(i,row){ - if(i>0){ - $(row).remove(); - } - }); - }, - parent:null, - hide:function(){ - if(Collection.parent){ - Collection.parent.hide(); - } - }, - registerPlay:function(item){ - if(item){ - var song=Collection.findSong(item.artist,item.album,item.name); - song.song_playcount++; - } - }, - addButtons:function(parent,data){ - buttons = parent.find('.buttons'); - if(buttons.find('.add').length<=0) { - buttons.prepend('<img class="add action" src="'+OC.imagePath('core','actions/play-add')+'" title="Add to playlist" />'); - } - buttons.find('.add').unbind('click'); - buttons.find('.add').click(function(event){ - event.preventDefault(); - PlayList.add(data,true); - PlayList.render(); - }); - }, - find:function(artistName,albumName,songName){ - if(songName){ - return Collection.findSong(artistName,albumName,songName); - }else if(albumName){ - return Collection.findAlbum(artistName,albumName); - }else{ - return Collection.findArtist(artistName); - } - }, - findArtist:function(name){ - for(var i=0;i<Collection.artists.length;i++){ - if(Collection.artists[i].name==name){ - return Collection.artists[i]; - } - } - }, - findAlbum:function(artistName,albumName){ - var artist=Collection.findArtist(artistName); - if(artist){ - for(var i=0;i<artist.albums.length;i++){ - if(artist.albums[i].name==albumName){ - return artist.albums[i]; - } - } - } - }, - findSong:function(artistName,albumName,songName){ - var album=Collection.findAlbum(artistName,albumName); - if(album){ - for(var i=0;i<album.songs.length;i++){ - if(album.songs[i].name==songName){ - return album.songs[i]; - } - } - } - }, - addSong:function(song){ - var artist=Collection.findArtist(song.artist); - if(!artist){ - artist={name:song.artist,albums:[],songs:[]}; - Collection.artists.push(artist); - Collection.artistsById[song.song_artist]=artist; - } - var album=Collection.findAlbum(song.artist,song.album); - if(!album){ - album={name:song.album,artist:song.song_artist,songs:[]}; - artist.albums.push(album); - Collection.albums.push(album); - Collection.albumsById[song.song_album]=album; - } - var songData={ - name:song.song_name, - artist:Collection.artistsById[song.song_artist].name, - album:Collection.albumsById[song.song_album].name, - lastPlayed:song.song_lastplayed, - length:song.song_length, - path:song.song_path, - playCount:song.song_playcount, - }; - album.songs.push(songData); - artist.songs.push(songData); - Collection.songs.push(songData); - } -}; - -$(document).ready(function(){ - Collection.parent=$('#collection'); - Collection.load(); - Collection.parent.hide(); - $('#scan input.start').click(function(){ - $('#scan input.start').hide(); - $('#scan input.stop').show(); - $('#scan input.stop').click(function(){ - Scanner.toggle(); - }); - Scanner.scanCollection(); - }); -}); diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.as deleted file mode 100644 index 1178dacc345..00000000000 --- a/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.as +++ /dev/null @@ -1,415 +0,0 @@ -/*
- * jPlayer Plugin for jQuery JavaScript Library
- * http://www.happyworm.com/jquery/jplayer
- *
- * Copyright (c) 2009 - 2011 Happyworm Ltd
- * Dual licensed under the MIT and GPL licenses.
- * - http://www.opensource.org/licenses/mit-license.php
- * - http://www.gnu.org/copyleft/gpl.html
- *
- * Author: Mark J Panaghiston
- * Version: 2.1.0
- * Date: 1st September 2011
- *
- * FlashVars expected: (AS3 property of: loaderInfo.parameters)
- * id: (URL Encoded: String) Id of jPlayer instance
- * vol: (Number) Sets the initial volume
- * muted: (Boolean in a String) Sets the initial muted state
- * jQuery: (URL Encoded: String) Sets the jQuery var name. Used with: someVar = jQuery.noConflict(true);
- *
- * Compiled using: Adobe Flex Compiler (mxmlc) Version 4.5.1 build 21328
- */
-
-package {
- import flash.system.Security;
- import flash.external.ExternalInterface;
-
- import flash.utils.Timer;
- import flash.events.TimerEvent;
-
- import flash.text.TextField;
- import flash.text.TextFormat;
-
- import flash.events.KeyboardEvent;
-
- import flash.display.Sprite;
- import happyworm.jPlayer.*;
-
- import flash.display.StageAlign;
- import flash.display.StageScaleMode;
- import flash.events.Event;
- import flash.events.MouseEvent;
-
- import flash.ui.ContextMenu;
- import flash.ui.ContextMenuItem;
- import flash.events.ContextMenuEvent;
- import flash.net.URLRequest;
- import flash.net.navigateToURL;
-
- public class Jplayer extends Sprite {
- private var jQuery:String;
- private var sentNumberFractionDigits:uint = 2;
-
- public var commonStatus:JplayerStatus = new JplayerStatus(); // Used for inital ready event so volume is correct.
-
- private var myInitTimer:Timer = new Timer(100, 0);
-
- private var myMp3Player:JplayerMp3;
- private var myMp4Player:JplayerMp4;
-
- private var isMp3:Boolean = false;
- private var isVideo:Boolean = false;
-
- private var txLog:TextField;
- private var debug:Boolean = false; // Set debug to false for release compile!
-
- public function Jplayer() {
- flash.system.Security.allowDomain("*");
-
- jQuery = loaderInfo.parameters.jQuery + "('#" + loaderInfo.parameters.id + "').jPlayer";
- commonStatus.volume = Number(loaderInfo.parameters.vol);
- commonStatus.muted = loaderInfo.parameters.muted == "true";
-
- stage.scaleMode = StageScaleMode.NO_SCALE;
- stage.align = StageAlign.TOP_LEFT;
- stage.addEventListener(Event.RESIZE, resizeHandler);
- stage.addEventListener(MouseEvent.CLICK, clickHandler);
-
- var initialVolume:Number = commonStatus.volume;
- if(commonStatus.muted) {
- initialVolume = 0;
- }
- myMp3Player = new JplayerMp3(initialVolume);
- addChild(myMp3Player);
-
- myMp4Player = new JplayerMp4(initialVolume);
- addChild(myMp4Player);
-
- setupListeners(!isMp3, isMp3); // Set up the listeners to the default isMp3 state.
-
- // The ContextMenu only partially works. The menu select events never occur.
- // Investigated and it is something to do with the way jPlayer inserts the Flash on the page.
- // A simple test inserting the Jplayer.swf on a page using: 1) SWFObject 2.2 works. 2) AC_FL_RunContent() works.
- // jPlayer Flash insertion is based on SWFObject 2.2 and the resaon behind this failure is not clear. The Flash insertion HTML on the page looks similar.
- var myContextMenu:ContextMenu = new ContextMenu();
- myContextMenu.hideBuiltInItems();
- var menuItem_jPlayer:ContextMenuItem = new ContextMenuItem("jPlayer " + JplayerStatus.VERSION);
- var menuItem_happyworm:ContextMenuItem = new ContextMenuItem("© 2009-2011 Happyworm Ltd", true);
- menuItem_jPlayer.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuSelectHandler_jPlayer);
- menuItem_happyworm.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuSelectHandler_happyworm);
- myContextMenu.customItems.push(menuItem_jPlayer, menuItem_happyworm);
- contextMenu = myContextMenu;
-
- // Log console for dev compile option: debug
- if(debug) {
- txLog = new TextField();
- txLog.x = 5;
- txLog.y = 5;
- txLog.width = 540;
- txLog.height = 390;
- txLog.border = true;
- txLog.background = true;
- txLog.backgroundColor = 0xEEEEFF;
- txLog.multiline = true;
- txLog.text = "jPlayer " + JplayerStatus.VERSION;
- txLog.visible = false;
- this.addChild(txLog);
- this.stage.addEventListener(KeyboardEvent.KEY_UP, keyboardHandler);
-
- myMp3Player.addEventListener(JplayerEvent.DEBUG_MSG, debugMsgHandler);
- myMp4Player.addEventListener(JplayerEvent.DEBUG_MSG, debugMsgHandler);
- }
-
- // Delay init() because Firefox 3.5.7+ developed a bug with local testing in Firebug.
- myInitTimer.addEventListener(TimerEvent.TIMER, init);
- myInitTimer.start();
- }
-
- private function init(e:TimerEvent):void {
- myInitTimer.stop();
- if(ExternalInterface.available) {
- ExternalInterface.addCallback("fl_setAudio_mp3", fl_setAudio_mp3);
- ExternalInterface.addCallback("fl_setAudio_m4a", fl_setAudio_m4a);
- ExternalInterface.addCallback("fl_setVideo_m4v", fl_setVideo_m4v);
- ExternalInterface.addCallback("fl_clearMedia", fl_clearMedia);
- ExternalInterface.addCallback("fl_load", fl_load);
- ExternalInterface.addCallback("fl_play", fl_play);
- ExternalInterface.addCallback("fl_pause", fl_pause);
- ExternalInterface.addCallback("fl_play_head", fl_play_head);
- ExternalInterface.addCallback("fl_volume", fl_volume);
- ExternalInterface.addCallback("fl_mute", fl_mute);
-
- ExternalInterface.call(jQuery, "jPlayerFlashEvent", JplayerEvent.JPLAYER_READY, extractStatusData(commonStatus)); // See JplayerStatus() class for version number.
- }
- }
- private function setupListeners(oldMP3:Boolean, newMP3:Boolean):void {
- if(oldMP3 != newMP3) {
- if(newMP3) {
- listenToMp3(true);
- listenToMp4(false);
- } else {
- listenToMp3(false);
- listenToMp4(true);
- }
- }
- }
- private function listenToMp3(active:Boolean):void {
- if(active) {
- myMp3Player.addEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
- myMp3Player.addEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
- myMp3Player.addEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
- myMp3Player.addEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
-
- myMp3Player.addEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
- myMp3Player.addEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
- myMp3Player.addEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
-
- myMp3Player.addEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
- myMp3Player.addEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
- } else {
- myMp3Player.removeEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
- myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
- myMp3Player.removeEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
- myMp3Player.removeEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
-
- myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
- myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
- myMp3Player.removeEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
-
- myMp3Player.removeEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
- myMp3Player.removeEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
- }
- }
- private function listenToMp4(active:Boolean):void {
- if(active) {
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
-
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
-
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
-
- myMp4Player.addEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler
- } else {
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
-
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
-
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
-
- myMp4Player.removeEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler
- }
- }
- private function fl_setAudio_mp3(src:String):Boolean {
- if (src != null) {
- log("fl_setAudio_mp3: "+src);
- setupListeners(isMp3, true);
- isMp3 = true;
- isVideo = false;
- myMp4Player.clearFile();
- myMp3Player.setFile(src);
- return true;
- } else {
- log("fl_setAudio_mp3: null");
- return false;
- }
- }
- private function fl_setAudio_m4a(src:String):Boolean {
- if (src != null) {
- log("fl_setAudio_m4a: "+src);
- setupListeners(isMp3, false);
- isMp3 = false;
- isVideo = false;
- myMp3Player.clearFile();
- myMp4Player.setFile(src);
- return true;
- } else {
- log("fl_setAudio_m4a: null");
- return false;
- }
- }
- private function fl_setVideo_m4v(src:String):Boolean {
- if (src != null) {
- log("fl_setVideo_m4v: "+src);
- setupListeners(isMp3, false);
- isMp3 = false;
- isVideo = true;
- myMp3Player.clearFile();
- myMp4Player.setFile(src);
- return true;
- } else {
- log("fl_setVideo_m4v: null");
- return false;
- }
- }
- private function fl_clearMedia():void {
- log("clearMedia.");
- myMp3Player.clearFile();
- myMp4Player.clearFile();
- }
- private function fl_load():Boolean {
- log("load.");
- if(isMp3) {
- return myMp3Player.load();
- } else {
- return myMp4Player.load();
- }
- }
- private function fl_play(time:Number = NaN):Boolean {
- log("play: time = " + time);
- if(isMp3) {
- return myMp3Player.play(time * 1000); // Flash uses milliseconds
- } else {
- return myMp4Player.play(time * 1000); // Flash uses milliseconds
- }
- }
- private function fl_pause(time:Number = NaN):Boolean {
- log("pause: time = " + time);
- if(isMp3) {
- return myMp3Player.pause(time * 1000); // Flash uses milliseconds
- } else {
- return myMp4Player.pause(time * 1000); // Flash uses milliseconds
- }
- }
- private function fl_play_head(percent:Number):Boolean {
- log("play_head: "+percent+"%");
- if(isMp3) {
- return myMp3Player.playHead(percent);
- } else {
- return myMp4Player.playHead(percent);
- }
- }
- private function fl_volume(v:Number):void {
- log("volume: "+v);
- commonStatus.volume = v;
- if(!commonStatus.muted) {
- myMp3Player.setVolume(v);
- myMp4Player.setVolume(v);
- }
- }
- private function fl_mute(mute:Boolean):void {
- log("mute: "+mute);
- commonStatus.muted = mute;
- if(mute) {
- myMp3Player.setVolume(0);
- myMp4Player.setVolume(0);
- } else {
- myMp3Player.setVolume(commonStatus.volume);
- myMp4Player.setVolume(commonStatus.volume);
- }
- }
- private function jPlayerFlashEvent(e:JplayerEvent):void {
- log("jPlayer Flash Event: " + e.type + ": " + e.target);
- if(ExternalInterface.available) {
- ExternalInterface.call(jQuery, "jPlayerFlashEvent", e.type, extractStatusData(e.data));
- }
- }
- private function extractStatusData(data:JplayerStatus):Object {
- var myStatus:Object = {
- version: JplayerStatus.VERSION,
- src: data.src,
- paused: !data.isPlaying, // Changing this name requires inverting all assignments and conditional statements.
- srcSet: data.srcSet,
- seekPercent: data.seekPercent,
- currentPercentRelative: data.currentPercentRelative,
- currentPercentAbsolute: data.currentPercentAbsolute,
- currentTime: data.currentTime / 1000, // JavaScript uses seconds
- duration: data.duration / 1000, // JavaScript uses seconds
- volume: commonStatus.volume,
- muted: commonStatus.muted
- };
- log("extractStatusData: sp="+myStatus.seekPercent+" cpr="+myStatus.currentPercentRelative+" cpa="+myStatus.currentPercentAbsolute+" ct="+myStatus.currentTime+" d="+myStatus.duration);
- return myStatus;
- }
- private function jPlayerMetaDataHandler(e:JplayerEvent):void {
- log("jPlayerMetaDataHandler:" + e.target);
- if(ExternalInterface.available) {
- resizeHandler(new Event(Event.RESIZE));
- ExternalInterface.call(jQuery, "jPlayerFlashEvent", e.type, extractStatusData(e.data));
- }
- }
- private function resizeHandler(e:Event):void {
- log("resizeHandler: stageWidth = " + stage.stageWidth + " | stageHeight = " + stage.stageHeight);
-
- var mediaX:Number = 0;
- var mediaY:Number = 0;
- var mediaWidth:Number = 0;
- var mediaHeight:Number = 0;
-
- if(stage.stageWidth > 0 && stage.stageHeight > 0 && myMp4Player.myVideo.width > 0 && myMp4Player.myVideo.height > 0) {
- var aspectRatioStage:Number = stage.stageWidth / stage.stageHeight;
- var aspectRatioVideo:Number = myMp4Player.myVideo.width / myMp4Player.myVideo.height;
- if(aspectRatioStage < aspectRatioVideo) {
- mediaWidth = stage.stageWidth;
- mediaHeight = stage.stageWidth / aspectRatioVideo;
- mediaX = 0;
- mediaY = (stage.stageHeight - mediaHeight) / 2;
- } else {
- mediaWidth = stage.stageHeight * aspectRatioVideo;
- mediaHeight = stage.stageHeight;
- mediaX = (stage.stageWidth - mediaWidth) / 2;
- mediaY = 0;
- }
- resizeEntity(myMp4Player, mediaX, mediaY, mediaWidth, mediaHeight);
- }
- if(debug && stage.stageWidth > 20 && stage.stageHeight > 20) {
- txLog.width = stage.stageWidth - 10;
- txLog.height = stage.stageHeight - 10;
- }
- }
- private function resizeEntity(entity:Sprite, mediaX:Number, mediaY:Number, mediaWidth:Number, mediaHeight:Number):void {
- entity.x = mediaX;
- entity.y = mediaY;
- entity.width = mediaWidth;
- entity.height = mediaHeight;
- }
- private function clickHandler(e:MouseEvent):void {
- if(isMp3) {
- jPlayerFlashEvent(new JplayerEvent(JplayerEvent.JPLAYER_CLICK, myMp3Player.myStatus, "click"))
- } else {
- jPlayerFlashEvent(new JplayerEvent(JplayerEvent.JPLAYER_CLICK, myMp4Player.myStatus, "click"))
- }
- }
- // This event is never called. See comments in class constructor.
- private function menuSelectHandler_jPlayer(e:ContextMenuEvent):void {
- navigateToURL(new URLRequest("http://jplayer.org/"), "_blank");
- }
- // This event is never called. See comments in class constructor.
- private function menuSelectHandler_happyworm(e:ContextMenuEvent):void {
- navigateToURL(new URLRequest("http://happyworm.com/"), "_blank");
- }
- private function log(t:String):void {
- if(debug) {
- txLog.text = t + "\n" + txLog.text;
- }
- }
- private function debugMsgHandler(e:JplayerEvent):void {
- log(e.msg);
- }
- private function keyboardHandler(e:KeyboardEvent):void {
- log("keyboardHandler: e.keyCode = " + e.keyCode);
- switch(e.keyCode) {
- case 68 : // d
- txLog.visible = !txLog.visible;
- log("Toggled log display: " + txLog.visible);
- break;
- case 76 : // l
- if(e.ctrlKey && e.shiftKey) {
- txLog.text = "Cleared log.";
- }
- break;
- }
- }
- }
-}
diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.fla b/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.fla Binary files differdeleted file mode 100644 index 61ae40d3ac2..00000000000 --- a/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.fla +++ /dev/null diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jplayer.playlist.js b/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jplayer.playlist.js deleted file mode 100644 index 0eaa0ddf3d7..00000000000 --- a/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jplayer.playlist.js +++ /dev/null @@ -1,452 +0,0 @@ -/*
- * Playlist Object for the jPlayer Plugin
- * http://www.jplayer.org
- *
- * Copyright (c) 2009 - 2011 Happyworm Ltd
- * Dual licensed under the MIT and GPL licenses.
- * - http://www.opensource.org/licenses/mit-license.php
- * - http://www.gnu.org/copyleft/gpl.html
- *
- * Author: Mark J Panaghiston
- * Version: 2.1.0 (jPlayer 2.1.0)
- * Date: 1st September 2011
- */
-
-/* Code verified using http://www.jshint.com/ */
-/*jshint asi:false, bitwise:false, boss:false, browser:true, curly:true, debug:false, eqeqeq:true, eqnull:false, evil:false, forin:false, immed:false, jquery:true, laxbreak:false, newcap:true, noarg:true, noempty:true, nonew:true, nomem:false, onevar:false, passfail:false, plusplus:false, regexp:false, undef:true, sub:false, strict:false, white:false */
-/*global jPlayerPlaylist: true, jQuery:false, alert:false */
-
-(function($, undefined) {
-
- jPlayerPlaylist = function(cssSelector, playlist, options) {
- var self = this;
-
- this.current = 0;
- this.loop = false; // Flag used with the jPlayer repeat event
- this.shuffled = false;
- this.removing = false; // Flag is true during remove animation, disabling the remove() method until complete.
-
- this.cssSelector = $.extend({}, this._cssSelector, cssSelector); // Object: Containing the css selectors for jPlayer and its cssSelectorAncestor
- this.options = $.extend(true, {}, this._options, options); // Object: The jPlayer constructor options for this playlist and the playlist options
-
- this.playlist = []; // Array of Objects: The current playlist displayed (Un-shuffled or Shuffled)
- this.original = []; // Array of Objects: The original playlist
-
- this._initPlaylist(playlist); // Copies playlist to this.original. Then mirrors this.original to this.playlist. Creating two arrays, where the element pointers match. (Enables pointer comparison.)
-
- // Setup the css selectors for the extra interface items used by the playlist.
- this.cssSelector.title = this.cssSelector.cssSelectorAncestor + " .jp-title"; // Note that the text is written to the decendant li node.
- this.cssSelector.playlist = this.cssSelector.cssSelectorAncestor + " .jp-playlist";
- this.cssSelector.next = this.cssSelector.cssSelectorAncestor + " .jp-next";
- this.cssSelector.previous = this.cssSelector.cssSelectorAncestor + " .jp-previous";
- this.cssSelector.shuffle = this.cssSelector.cssSelectorAncestor + " .jp-shuffle";
- this.cssSelector.shuffleOff = this.cssSelector.cssSelectorAncestor + " .jp-shuffle-off";
-
- // Override the cssSelectorAncestor given in options
- this.options.cssSelectorAncestor = this.cssSelector.cssSelectorAncestor;
-
- // Override the default repeat event handler
- this.options.repeat = function(event) {
- self.loop = event.jPlayer.options.loop;
- };
-
- // Create a ready event handler to initialize the playlist
- $(this.cssSelector.jPlayer).bind($.jPlayer.event.ready, function(event) {
- self._init();
- });
-
- // Create an ended event handler to move to the next item
- $(this.cssSelector.jPlayer).bind($.jPlayer.event.ended, function(event) {
- self.next();
- });
-
- // Create a play event handler to pause other instances
- $(this.cssSelector.jPlayer).bind($.jPlayer.event.play, function(event) {
- $(this).jPlayer("pauseOthers");
- });
-
- // Create a resize event handler to show the title in full screen mode.
- $(this.cssSelector.jPlayer).bind($.jPlayer.event.resize, function(event) {
- if(event.jPlayer.options.fullScreen) {
- $(self.cssSelector.title).show();
- } else {
- $(self.cssSelector.title).hide();
- }
- });
-
- // Create click handlers for the extra buttons that do playlist functions.
- $(this.cssSelector.previous).click(function() {
- self.previous();
- $(this).blur();
- return false;
- });
-
- $(this.cssSelector.next).click(function() {
- self.next();
- $(this).blur();
- return false;
- });
-
- $(this.cssSelector.shuffle).click(function() {
- self.shuffle(true);
- return false;
- });
- $(this.cssSelector.shuffleOff).click(function() {
- self.shuffle(false);
- return false;
- }).hide();
-
- // Put the title in its initial display state
- if(!this.options.fullScreen) {
- $(this.cssSelector.title).hide();
- }
-
- // Remove the empty <li> from the page HTML. Allows page to be valid HTML, while not interfereing with display animations
- $(this.cssSelector.playlist + " ul").empty();
-
- // Create .live() handlers for the playlist items along with the free media and remove controls.
- this._createItemHandlers();
-
- // Instance jPlayer
- $(this.cssSelector.jPlayer).jPlayer(this.options);
- };
-
- jPlayerPlaylist.prototype = {
- _cssSelector: { // static object, instanced in constructor
- jPlayer: "#jquery_jplayer_1",
- cssSelectorAncestor: "#jp_container_1"
- },
- _options: { // static object, instanced in constructor
- playlistOptions: {
- autoPlay: false,
- loopOnPrevious: false,
- shuffleOnLoop: true,
- enableRemoveControls: false,
- displayTime: 'slow',
- addTime: 'fast',
- removeTime: 'fast',
- shuffleTime: 'slow',
- itemClass: "jp-playlist-item",
- freeGroupClass: "jp-free-media",
- freeItemClass: "jp-playlist-item-free",
- removeItemClass: "jp-playlist-item-remove"
- }
- },
- option: function(option, value) { // For changing playlist options only
- if(value === undefined) {
- return this.options.playlistOptions[option];
- }
-
- this.options.playlistOptions[option] = value;
-
- switch(option) {
- case "enableRemoveControls":
- this._updateControls();
- break;
- case "itemClass":
- case "freeGroupClass":
- case "freeItemClass":
- case "removeItemClass":
- this._refresh(true); // Instant
- this._createItemHandlers();
- break;
- }
- return this;
- },
- _init: function() {
- var self = this;
- this._refresh(function() {
- if(self.options.playlistOptions.autoPlay) {
- self.play(self.current);
- } else {
- self.select(self.current);
- }
- });
- },
- _initPlaylist: function(playlist) {
- this.current = 0;
- this.shuffled = false;
- this.removing = false;
- this.original = $.extend(true, [], playlist); // Copy the Array of Objects
- this._originalPlaylist();
- },
- _originalPlaylist: function() {
- var self = this;
- this.playlist = [];
- // Make both arrays point to the same object elements. Gives us 2 different arrays, each pointing to the same actual object. ie., Not copies of the object.
- $.each(this.original, function(i,v) {
- self.playlist[i] = self.original[i];
- });
- },
- _refresh: function(instant) {
- /* instant: Can be undefined, true or a function.
- * undefined -> use animation timings
- * true -> no animation
- * function -> use animation timings and excute function at half way point.
- */
- var self = this;
-
- if(instant && !$.isFunction(instant)) {
- $(this.cssSelector.playlist + " ul").empty();
- $.each(this.playlist, function(i,v) {
- $(self.cssSelector.playlist + " ul").append(self._createListItem(self.playlist[i]));
- });
- this._updateControls();
- } else {
- var displayTime = $(this.cssSelector.playlist + " ul").children().length ? this.options.playlistOptions.displayTime : 0;
-
- $(this.cssSelector.playlist + " ul").slideUp(displayTime, function() {
- var $this = $(this);
- $(this).empty();
-
- $.each(self.playlist, function(i,v) {
- $this.append(self._createListItem(self.playlist[i]));
- });
- self._updateControls();
- if($.isFunction(instant)) {
- instant();
- }
- if(self.playlist.length) {
- $(this).slideDown(self.options.playlistOptions.displayTime);
- } else {
- $(this).show();
- }
- });
- }
- },
- _createListItem: function(media) {
- var self = this;
-
- // Wrap the <li> contents in a <div>
- var listItem = "<li><div>";
-
- // Create remove control
- listItem += "<a href='javascript:;' class='" + this.options.playlistOptions.removeItemClass + "'>×</a>";
-
- // Create links to free media
- if(media.free) {
- var first = true;
- listItem += "<span class='" + this.options.playlistOptions.freeGroupClass + "'>(";
- $.each(media, function(property,value) {
- if($.jPlayer.prototype.format[property]) { // Check property is a media format.
- if(first) {
- first = false;
- } else {
- listItem += " | ";
- }
- listItem += "<a class='" + self.options.playlistOptions.freeItemClass + "' href='" + value + "' tabindex='1'>" + property + "</a>";
- }
- });
- listItem += ")</span>";
- }
-
- // The title is given next in the HTML otherwise the float:right on the free media corrupts in IE6/7
- listItem += "<a href='javascript:;' class='" + this.options.playlistOptions.itemClass + "' tabindex='1'>" + media.title + (media.artist ? " <span class='jp-artist'>by " + media.artist + "</span>" : "") + "</a>";
- listItem += "</div></li>";
-
- return listItem;
- },
- _createItemHandlers: function() {
- var self = this;
- // Create .live() handlers for the playlist items
- $(this.cssSelector.playlist + " a." + this.options.playlistOptions.itemClass).die("click").live("click", function() {
- var index = $(this).parent().parent().index();
- if(self.current !== index) {
- self.play(index);
- } else {
- $(self.cssSelector.jPlayer).jPlayer("play");
- }
- $(this).blur();
- return false;
- });
-
- // Create .live() handlers that disable free media links to force access via right click
- $(self.cssSelector.playlist + " a." + this.options.playlistOptions.freeItemClass).die("click").live("click", function() {
- $(this).parent().parent().find("." + self.options.playlistOptions.itemClass).click();
- $(this).blur();
- return false;
- });
-
- // Create .live() handlers for the remove controls
- $(self.cssSelector.playlist + " a." + this.options.playlistOptions.removeItemClass).die("click").live("click", function() {
- var index = $(this).parent().parent().index();
- self.remove(index);
- $(this).blur();
- return false;
- });
- },
- _updateControls: function() {
- if(this.options.playlistOptions.enableRemoveControls) {
- $(this.cssSelector.playlist + " ." + this.options.playlistOptions.removeItemClass).show();
- } else {
- $(this.cssSelector.playlist + " ." + this.options.playlistOptions.removeItemClass).hide();
- }
- if(this.shuffled) {
- $(this.cssSelector.shuffleOff).show();
- $(this.cssSelector.shuffle).hide();
- } else {
- $(this.cssSelector.shuffleOff).hide();
- $(this.cssSelector.shuffle).show();
- }
- },
- _highlight: function(index) {
- if(this.playlist.length && index !== undefined) {
- $(this.cssSelector.playlist + " .jp-playlist-current").removeClass("jp-playlist-current");
- $(this.cssSelector.playlist + " li:nth-child(" + (index + 1) + ")").addClass("jp-playlist-current").find(".jp-playlist-item").addClass("jp-playlist-current");
- $(this.cssSelector.title + " li").html(this.playlist[index].title + (this.playlist[index].artist ? " <span class='jp-artist'>by " + this.playlist[index].artist + "</span>" : ""));
- }
- },
- setPlaylist: function(playlist) {
- this._initPlaylist(playlist);
- this._init();
- },
- add: function(media, playNow) {
- $(this.cssSelector.playlist + " ul").append(this._createListItem(media)).find("li:last-child").hide().slideDown(this.options.playlistOptions.addTime);
- this._updateControls();
- this.original.push(media);
- this.playlist.push(media); // Both array elements share the same object pointer. Comforms with _initPlaylist(p) system.
-
- if(playNow) {
- this.play(this.playlist.length - 1);
- } else {
- if(this.original.length === 1) {
- this.select(0);
- }
- }
- },
- remove: function(index) {
- var self = this;
-
- if(index === undefined) {
- this._initPlaylist([]);
- this._refresh(function() {
- $(self.cssSelector.jPlayer).jPlayer("clearMedia");
- });
- return true;
- } else {
-
- if(this.removing) {
- return false;
- } else {
- index = (index < 0) ? self.original.length + index : index; // Negative index relates to end of array.
- if(0 <= index && index < this.playlist.length) {
- this.removing = true;
-
- $(this.cssSelector.playlist + " li:nth-child(" + (index + 1) + ")").slideUp(this.options.playlistOptions.removeTime, function() {
- $(this).remove();
-
- if(self.shuffled) {
- var item = self.playlist[index];
- $.each(self.original, function(i,v) {
- if(self.original[i] === item) {
- self.original.splice(i, 1);
- return false; // Exit $.each
- }
- });
- self.playlist.splice(index, 1);
- } else {
- self.original.splice(index, 1);
- self.playlist.splice(index, 1);
- }
-
- if(self.original.length) {
- if(index === self.current) {
- self.current = (index < self.original.length) ? self.current : self.original.length - 1; // To cope when last element being selected when it was removed
- self.select(self.current);
- } else if(index < self.current) {
- self.current--;
- }
- } else {
- $(self.cssSelector.jPlayer).jPlayer("clearMedia");
- self.current = 0;
- self.shuffled = false;
- self._updateControls();
- }
-
- self.removing = false;
- });
- }
- return true;
- }
- }
- },
- select: function(index) {
- index = (index < 0) ? this.original.length + index : index; // Negative index relates to end of array.
- if(0 <= index && index < this.playlist.length) {
- this.current = index;
- this._highlight(index);
- $(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
- } else {
- this.current = 0;
- }
- },
- play: function(index) {
- index = (index < 0) ? this.original.length + index : index; // Negative index relates to end of array.
- if(0 <= index && index < this.playlist.length) {
- if(this.playlist.length) {
- this.select(index);
- $(this.cssSelector.jPlayer).jPlayer("play");
- }
- } else if(index === undefined) {
- $(this.cssSelector.jPlayer).jPlayer("play");
- }
- },
- pause: function() {
- $(this.cssSelector.jPlayer).jPlayer("pause");
- },
- next: function() {
- var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0;
-
- if(this.loop) {
- // See if we need to shuffle before looping to start, and only shuffle if more than 1 item.
- if(index === 0 && this.shuffled && this.options.playlistOptions.shuffleOnLoop && this.playlist.length > 1) {
- this.shuffle(true, true); // playNow
- } else {
- this.play(index);
- }
- } else {
- // The index will be zero if it just looped round
- if(index > 0) {
- this.play(index);
- }
- }
- },
- previous: function() {
- var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1;
-
- if(this.loop && this.options.playlistOptions.loopOnPrevious || index < this.playlist.length - 1) {
- this.play(index);
- }
- },
- shuffle: function(shuffled, playNow) {
- var self = this;
-
- if(shuffled === undefined) {
- shuffled = !this.shuffled;
- }
-
- if(shuffled || shuffled !== this.shuffled) {
-
- $(this.cssSelector.playlist + " ul").slideUp(this.options.playlistOptions.shuffleTime, function() {
- self.shuffled = shuffled;
- if(shuffled) {
- self.playlist.sort(function() {
- return 0.5 - Math.random();
- });
- } else {
- self._originalPlaylist();
- }
- self._refresh(true); // Instant
-
- if(playNow || !$(self.cssSelector.jPlayer).data("jPlayer").status.paused) {
- self.play(0);
- } else {
- self.select(0);
- }
-
- $(this).slideDown(self.options.playlistOptions.shuffleTime);
- });
- }
- }
- };
-})(jQuery);
diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jquery.jplayer.inspector.js b/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jquery.jplayer.inspector.js deleted file mode 100644 index 46c090a1b01..00000000000 --- a/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jquery.jplayer.inspector.js +++ /dev/null @@ -1,331 +0,0 @@ -/*
- * jPlayerInspector Plugin for jPlayer (2.0.0+) Plugin for jQuery JavaScript Library
- * http://www.happyworm.com/jquery/jplayer
- *
- * Copyright (c) 2009 - 2011 Happyworm Ltd
- * Dual licensed under the MIT and GPL licenses.
- * - http://www.opensource.org/licenses/mit-license.php
- * - http://www.gnu.org/copyleft/gpl.html
- *
- * Author: Mark J Panaghiston
- * Version: 1.0.3
- * Date: 7th August 2011
- *
- * For use with jPlayer Version: 2.0.29
- *
- * Note: Declare inspector instances after jPlayer instances. ie., Otherwise the jPlayer instance is nonsense.
- */
-
-(function($, undefined) {
- $.jPlayerInspector = {};
- $.jPlayerInspector.i = 0;
- $.jPlayerInspector.defaults = {
- jPlayer: undefined, // The jQuery selector of the jPlayer instance to inspect.
- idPrefix: "jplayer_inspector_",
- visible: false
- };
-
- var methods = {
- init: function(options) {
- var self = this;
- var $this = $(this);
-
- var config = $.extend({}, $.jPlayerInspector.defaults, options);
- $(this).data("jPlayerInspector", config);
-
- config.id = $(this).attr("id");
- config.jPlayerId = config.jPlayer.attr("id");
-
- config.windowId = config.idPrefix + "window_" + $.jPlayerInspector.i;
- config.statusId = config.idPrefix + "status_" + $.jPlayerInspector.i;
- config.configId = config.idPrefix + "config_" + $.jPlayerInspector.i;
- config.toggleId = config.idPrefix + "toggle_" + $.jPlayerInspector.i;
- config.eventResetId = config.idPrefix + "event_reset_" + $.jPlayerInspector.i;
- config.updateId = config.idPrefix + "update_" + $.jPlayerInspector.i;
- config.eventWindowId = config.idPrefix + "event_window_" + $.jPlayerInspector.i;
-
- config.eventId = {};
- config.eventJq = {};
- config.eventTimeout = {};
- config.eventOccurrence = {};
-
- $.each($.jPlayer.event, function(eventName,eventType) {
- config.eventId[eventType] = config.idPrefix + "event_" + eventName + "_" + $.jPlayerInspector.i;
- config.eventOccurrence[eventType] = 0;
- });
-
- var structure =
- '<p><a href="#" id="' + config.toggleId + '">' + (config.visible ? "Hide" : "Show") + '</a> jPlayer Inspector</p>'
- + '<div id="' + config.windowId + '">'
- + '<div id="' + config.statusId + '"></div>'
- + '<div id="' + config.eventWindowId + '" style="padding:5px 5px 0 5px;background-color:#eee;border:1px dotted #000;">'
- + '<p style="margin:0 0 10px 0;"><strong>jPlayer events that have occurred over the past 1 second:</strong>'
- + '<br />(Backgrounds: <span style="padding:0 5px;background-color:#eee;border:1px dotted #000;">Never occurred</span> <span style="padding:0 5px;background-color:#fff;border:1px dotted #000;">Occurred before</span> <span style="padding:0 5px;background-color:#9f9;border:1px dotted #000;">Occurred</span> <span style="padding:0 5px;background-color:#ff9;border:1px dotted #000;">Multiple occurrences</span> <a href="#" id="' + config.eventResetId + '">reset</a>)</p>';
-
- // MJP: Would use the next 3 lines for ease, but the events are just slapped on the page.
- // $.each($.jPlayer.event, function(eventName,eventType) {
- // structure += '<div id="' + config.eventId[eventType] + '" style="float:left;">' + eventName + '</div>';
- // });
-
- var eventStyle = "float:left;margin:0 5px 5px 0;padding:0 5px;border:1px dotted #000;";
- // MJP: Doing it longhand so order and layout easier to control.
- structure +=
- '<div id="' + config.eventId[$.jPlayer.event.ready] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.flashreset] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.resize] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.repeat] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.click] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.error] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.warning] + '" style="' + eventStyle + '"></div>'
-
- + '<div id="' + config.eventId[$.jPlayer.event.loadstart] + '" style="clear:left;' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.progress] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.timeupdate] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.volumechange] + '" style="' + eventStyle + '"></div>'
-
- + '<div id="' + config.eventId[$.jPlayer.event.play] + '" style="clear:left;' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.pause] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.waiting] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.playing] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.seeking] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.seeked] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.ended] + '" style="' + eventStyle + '"></div>'
-
- + '<div id="' + config.eventId[$.jPlayer.event.loadeddata] + '" style="clear:left;' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.loadedmetadata] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.canplay] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.canplaythrough] + '" style="' + eventStyle + '"></div>'
-
- + '<div id="' + config.eventId[$.jPlayer.event.suspend] + '" style="clear:left;' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.abort] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.emptied] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.stalled] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.ratechange] + '" style="' + eventStyle + '"></div>'
- + '<div id="' + config.eventId[$.jPlayer.event.durationchange] + '" style="' + eventStyle + '"></div>'
-
- + '<div style="clear:both"></div>';
-
- // MJP: Would like a check here in case we missed an event.
-
- // MJP: Check fails, since it is not on the page yet.
-/* $.each($.jPlayer.event, function(eventName,eventType) {
- if($("#" + config.eventId[eventType])[0] === undefined) {
- structure += '<div id="' + config.eventId[eventType] + '" style="clear:left;' + eventStyle + '">' + eventName + '</div>';
- }
- });
-*/
- structure +=
- '</div>'
- + '<p><a href="#" id="' + config.updateId + '">Update</a> jPlayer Inspector</p>'
- + '<div id="' + config.configId + '"></div>'
- + '</div>';
- $(this).html(structure);
-
- config.windowJq = $("#" + config.windowId);
- config.statusJq = $("#" + config.statusId);
- config.configJq = $("#" + config.configId);
- config.toggleJq = $("#" + config.toggleId);
- config.eventResetJq = $("#" + config.eventResetId);
- config.updateJq = $("#" + config.updateId);
-
- $.each($.jPlayer.event, function(eventName,eventType) {
- config.eventJq[eventType] = $("#" + config.eventId[eventType]);
- config.eventJq[eventType].text(eventName + " (" + config.eventOccurrence[eventType] + ")"); // Sets the text to the event name and (0);
-
- config.jPlayer.bind(eventType + ".jPlayerInspector", function(e) {
- config.eventOccurrence[e.type]++;
- if(config.eventOccurrence[e.type] > 1) {
- config.eventJq[e.type].css("background-color","#ff9");
- } else {
- config.eventJq[e.type].css("background-color","#9f9");
- }
- config.eventJq[e.type].text(eventName + " (" + config.eventOccurrence[e.type] + ")");
- // The timer to handle the color
- clearTimeout(config.eventTimeout[e.type]);
- config.eventTimeout[e.type] = setTimeout(function() {
- config.eventJq[e.type].css("background-color","#fff");
- }, 1000);
- // The timer to handle the occurences.
- setTimeout(function() {
- config.eventOccurrence[e.type]--;
- config.eventJq[e.type].text(eventName + " (" + config.eventOccurrence[e.type] + ")");
- }, 1000);
- if(config.visible) { // Update the status, if inspector open.
- $this.jPlayerInspector("updateStatus");
- }
- });
- });
-
- config.jPlayer.bind($.jPlayer.event.ready + ".jPlayerInspector", function(e) {
- $this.jPlayerInspector("updateConfig");
- });
-
- config.toggleJq.click(function() {
- if(config.visible) {
- $(this).text("Show");
- config.windowJq.hide();
- config.statusJq.empty();
- config.configJq.empty();
- } else {
- $(this).text("Hide");
- config.windowJq.show();
- config.updateJq.click();
- }
- config.visible = !config.visible;
- $(this).blur();
- return false;
- });
-
- config.eventResetJq.click(function() {
- $.each($.jPlayer.event, function(eventName,eventType) {
- config.eventJq[eventType].css("background-color","#eee");
- });
- $(this).blur();
- return false;
- });
-
- config.updateJq.click(function() {
- $this.jPlayerInspector("updateStatus");
- $this.jPlayerInspector("updateConfig");
- return false;
- });
-
- if(!config.visible) {
- config.windowJq.hide();
- } else {
- // config.updateJq.click();
- }
-
- $.jPlayerInspector.i++;
-
- return this;
- },
- destroy: function() {
- $(this).data("jPlayerInspector") && $(this).data("jPlayerInspector").jPlayer.unbind(".jPlayerInspector");
- $(this).empty();
- },
- updateConfig: function() { // This displays information about jPlayer's configuration in inspector
-
- var jPlayerInfo = "<p>This jPlayer instance is running in your browser where:<br />"
-
- for(i = 0; i < $(this).data("jPlayerInspector").jPlayer.data("jPlayer").solutions.length; i++) {
- var solution = $(this).data("jPlayerInspector").jPlayer.data("jPlayer").solutions[i];
- jPlayerInfo += " jPlayer's <strong>" + solution + "</strong> solution is";
- if($(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].used) {
- jPlayerInfo += " being <strong>used</strong> and will support:<strong>";
- for(format in $(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].support) {
- if($(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].support[format]) {
- jPlayerInfo += " " + format;
- }
- }
- jPlayerInfo += "</strong><br />";
- } else {
- jPlayerInfo += " <strong>not required</strong><br />";
- }
- }
- jPlayerInfo += "</p>";
-
- if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.active) {
- if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").flash.active) {
- jPlayerInfo += "<strong>Problem with jPlayer since both HTML5 and Flash are active.</strong>";
- } else {
- jPlayerInfo += "The <strong>HTML5 is active</strong>.";
- }
- } else {
- if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").flash.active) {
- jPlayerInfo += "The <strong>Flash is active</strong>.";
- } else {
- jPlayerInfo += "No solution is currently active. jPlayer needs a setMedia().";
- }
- }
- jPlayerInfo += "</p>";
-
- var formatType = $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.formatType;
- jPlayerInfo += "<p><code>status.formatType = '" + formatType + "'</code><br />";
- if(formatType) {
- jPlayerInfo += "<code>Browser canPlay('" + $.jPlayer.prototype.format[formatType].codec + "')</code>";
- } else {
- jPlayerInfo += "</p>";
- }
-
- jPlayerInfo += "<p><code>status.src = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.src + "'</code></p>";
-
- jPlayerInfo += "<p><code>status.media = {<br />";
- for(prop in $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.media) {
- jPlayerInfo += " " + prop + ": " + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.media[prop] + "<br />"; // Some are strings
- }
- jPlayerInfo += "};</code></p>"
-
- + "<p>Raw browser test for HTML5 support. Should equal a function if HTML5 is available.<br />";
- if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.audio.available) {
- jPlayerInfo += "<code>htmlElement.audio.canPlayType = " + (typeof $(this).data("jPlayerInspector").jPlayer.data("jPlayer").htmlElement.audio.canPlayType) +"</code><br />"
- }
- if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.video.available) {
- jPlayerInfo += "<code>htmlElement.video.canPlayType = " + (typeof $(this).data("jPlayerInspector").jPlayer.data("jPlayer").htmlElement.video.canPlayType) +"</code>";
- }
- jPlayerInfo += "</p>";
-
- jPlayerInfo += "<p>This instance is using the constructor options:<br />"
- + "<code>$('#" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").internal.self.id + "').jPlayer({<br />"
-
- + " swfPath: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "swfPath") + "',<br />"
-
- + " solution: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "solution") + "',<br />"
-
- + " supplied: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "supplied") + "',<br />"
-
- + " preload: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "preload") + "',<br />"
-
- + " volume: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "volume") + ",<br />"
-
- + " muted: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "muted") + ",<br />"
-
- + " backgroundColor: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "backgroundColor") + "',<br />"
-
- + " cssSelectorAncestor: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelectorAncestor") + "',<br />"
-
- + " cssSelector: {";
-
- var cssSelector = $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelector");
- for(prop in cssSelector) {
-
- // jPlayerInfo += "<br /> " + prop + ": '" + cssSelector[prop] + "'," // This works too of course, but want to use option method for deep keys.
- jPlayerInfo += "<br /> " + prop + ": '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelector." + prop) + "',"
- }
-
- jPlayerInfo = jPlayerInfo.slice(0, -1); // Because the sloppy comma was bugging me.
-
- jPlayerInfo += "<br /> },<br />"
-
- + " errorAlerts: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "errorAlerts") + ",<br />"
-
- + " warningAlerts: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "warningAlerts") + "<br />"
-
- + "});</code></p>";
- $(this).data("jPlayerInspector").configJq.html(jPlayerInfo);
- return this;
- },
- updateStatus: function() { // This displays information about jPlayer's status in the inspector
- $(this).data("jPlayerInspector").statusJq.html(
- "<p>jPlayer is " +
- ($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.paused ? "paused" : "playing") +
- " at time: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentTime*10)/10 + "s." +
- " (d: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.duration*10)/10 + "s" +
- ", sp: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.seekPercent) + "%" +
- ", cpr: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentPercentRelative) + "%" +
- ", cpa: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentPercentAbsolute) + "%)</p>"
- );
- return this;
- }
- };
- $.fn.jPlayerInspector = function( method ) {
- // Method calling logic
- if ( methods[method] ) {
- return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
- } else if ( typeof method === 'object' || ! method ) {
- return methods.init.apply( this, arguments );
- } else {
- $.error( 'Method ' + method + ' does not exist on jQuery.jPlayerInspector' );
- }
- };
-})(jQuery);
diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerEvent.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerEvent.as deleted file mode 100644 index addb97a7ae4..00000000000 --- a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerEvent.as +++ /dev/null @@ -1,69 +0,0 @@ -/*
- * jPlayer Plugin for jQuery JavaScript Library
- * http://www.happyworm.com/jquery/jplayer
- *
- * Copyright (c) 2009 - 2011 Happyworm Ltd
- * Dual licensed under the MIT and GPL licenses.
- * - http://www.opensource.org/licenses/mit-license.php
- * - http://www.gnu.org/copyleft/gpl.html
- *
- * Author: Mark J Panaghiston
- * Date: 8th August 2011
- */
-
-package happyworm.jPlayer {
- import flash.events.Event;
-
- public class JplayerEvent extends Event {
-
- // The event strings must match those in the JavaScript's $.jPlayer.event object
-
- public static const JPLAYER_READY:String = "jPlayer_ready";
- public static const JPLAYER_FLASHRESET:String = "jPlayer_flashreset"; // Handled in JavaScript
- public static const JPLAYER_RESIZE:String = "jPlayer_resize"; // Handled in JavaScript
- public static const JPLAYER_REPEAT:String = "jPlayer_repeat"; // Handled in JavaScript
- public static const JPLAYER_CLICK:String = "jPlayer_click";
- public static const JPLAYER_ERROR:String = "jPlayer_error";
- public static const JPLAYER_WARNING:String = "jPlayer_warning"; // Currently not used by the flash solution
-
- public static const JPLAYER_LOADSTART:String = "jPlayer_loadstart";
- public static const JPLAYER_PROGRESS:String = "jPlayer_progress";
- public static const JPLAYER_SUSPEND:String = "jPlayer_suspend"; // Not implemented
- public static const JPLAYER_ABORT:String = "jPlayer_abort"; // Not implemented
- public static const JPLAYER_EMPTIED:String = "jPlayer_emptied"; // Not implemented
- public static const JPLAYER_STALLED:String = "jPlayer_stalled"; // Not implemented
- public static const JPLAYER_PLAY:String = "jPlayer_play";
- public static const JPLAYER_PAUSE:String = "jPlayer_pause";
- public static const JPLAYER_LOADEDMETADATA:String = "jPlayer_loadedmetadata"; // MP3 has no equivilent
- public static const JPLAYER_LOADEDDATA:String = "jPlayer_loadeddata"; // Not implemented
- public static const JPLAYER_WAITING:String = "jPlayer_waiting"; // Not implemented
- public static const JPLAYER_PLAYING:String = "jPlayer_playing"; // Not implemented
- public static const JPLAYER_CANPLAY:String = "jPlayer_canplay"; // Not implemented
- public static const JPLAYER_CANPLAYTHROUGH:String = "jPlayer_canplaythrough"; // Not implemented
- public static const JPLAYER_SEEKING:String = "jPlayer_seeking";
- public static const JPLAYER_SEEKED:String = "jPlayer_seeked";
- public static const JPLAYER_TIMEUPDATE:String = "jPlayer_timeupdate";
- public static const JPLAYER_ENDED:String = "jPlayer_ended";
- public static const JPLAYER_RATECHANGE:String = "jPlayer_ratechange"; // Not implemented
- public static const JPLAYER_DURATIONCHANGE:String = "jPlayer_durationchange"; // Not implemented
- public static const JPLAYER_VOLUMECHANGE:String = "jPlayer_volumechange"; // See JavaScript
-
- // Events used internal to jPlayer's Flash.
- public static const DEBUG_MSG:String = "debug_msg";
-
- public var data:JplayerStatus;
- public var msg:String = ""
-
- public function JplayerEvent(type:String, data:JplayerStatus, msg:String = "", bubbles:Boolean = false, cancelable:Boolean = false) {
- super(type, bubbles, cancelable);
- this.data = data;
- this.msg = msg;
- }
- public override function clone():Event {
- return new JplayerEvent(type, data, msg, bubbles, cancelable);
- }
- public override function toString():String {
- return formatToString("JplayerEvent", "type", "bubbles", "cancelable", "eventPhase", "data", "msg");
- }
- }
-}
\ No newline at end of file diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp3.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp3.as deleted file mode 100644 index 8c51d5b7633..00000000000 --- a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp3.as +++ /dev/null @@ -1,328 +0,0 @@ -/*
- * jPlayer Plugin for jQuery JavaScript Library
- * http://www.happyworm.com/jquery/jplayer
- *
- * Copyright (c) 2009 - 2011 Happyworm Ltd
- * Dual licensed under the MIT and GPL licenses.
- * - http://www.opensource.org/licenses/mit-license.php
- * - http://www.gnu.org/copyleft/gpl.html
- *
- * Author: Mark J Panaghiston
- * Date: 1st September 2011
- */
-
-package happyworm.jPlayer {
- import flash.display.Sprite;
-
- import flash.media.Sound;
- import flash.media.SoundChannel;
- import flash.media.SoundLoaderContext;
- import flash.media.SoundTransform;
- import flash.net.URLRequest;
- import flash.utils.Timer;
- import flash.errors.IOError;
- import flash.events.*;
-
- public class JplayerMp3 extends Sprite {
- private var mySound:Sound = new Sound();
- private var myChannel:SoundChannel = new SoundChannel();
- private var myContext:SoundLoaderContext = new SoundLoaderContext(3000, false);
- private var myTransform:SoundTransform = new SoundTransform();
- private var myRequest:URLRequest = new URLRequest();
-
- private var timeUpdateTimer:Timer = new Timer(250, 0); // Matched to HTML event freq
- private var progressTimer:Timer = new Timer(250, 0); // Matched to HTML event freq
- private var seekingTimer:Timer = new Timer(100, 0); // Internal: How often seeking is checked to see if it is over.
-
- public var myStatus:JplayerStatus = new JplayerStatus();
-
- public function JplayerMp3(volume:Number) {
- timeUpdateTimer.addEventListener(TimerEvent.TIMER, timeUpdateHandler);
- progressTimer.addEventListener(TimerEvent.TIMER, progressHandler);
- seekingTimer.addEventListener(TimerEvent.TIMER, seekingHandler);
- setVolume(volume);
- }
- public function setFile(src:String):void {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "setFile: " + src));
- if(myStatus.isPlaying) {
- myChannel.stop();
- progressUpdates(false);
- timeUpdates(false);
- }
- try {
- mySound.close();
- } catch (err:IOError) {
- // Occurs if the file is either yet to be opened or has finished downloading.
- }
- mySound = null;
- mySound = new Sound();
- mySound.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
- mySound.addEventListener(Event.OPEN, loadOpen);
- mySound.addEventListener(Event.COMPLETE, loadComplete);
- myRequest = new URLRequest(src);
- myStatus.reset();
- myStatus.src = src;
- myStatus.srcSet = true;
- timeUpdateEvent();
- }
- public function clearFile():void {
- setFile("");
- myStatus.srcSet = false;
- }
- private function errorHandler(err:IOErrorEvent):void {
- // MP3 player needs to stop progress and timeupdate events as they are started before the error occurs.
- // NB: The MP4 player works differently and the error occurs before they are started.
- progressUpdates(false);
- timeUpdates(false);
- myStatus.error(); // Resets status except the src, and it sets srcError property.
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ERROR, myStatus));
- }
- private function loadOpen(e:Event):void {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "loadOpen:"));
- myStatus.loading();
- if(myStatus.playOnLoad) {
- myStatus.playOnLoad = false; // Capture the flag
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus)); // So loadstart event happens before play event occurs.
- play();
- } else {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus));
- pause();
- }
- progressUpdates(true);
- }
- private function loadComplete(e:Event):void {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "loadComplete:"));
- myStatus.loaded();
- progressUpdates(false);
- progressEvent();
- }
- private function soundCompleteHandler(e:Event):void {
- myStatus.pausePosition = 0;
- myStatus.isPlaying = false;
- timeUpdates(false);
- timeUpdateEvent();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED, myStatus));
- }
- private function progressUpdates(active:Boolean):void {
- // Using a timer rather than Flash's load progress event, because that event gave data at about 200Hz. The 10Hz timer is closer to HTML5 norm.
- if(active) {
- progressTimer.start();
- } else {
- progressTimer.stop();
- }
- }
- private function progressHandler(e:TimerEvent):void {
- progressEvent();
- }
- private function progressEvent():void {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressEvent:"));
- updateStatusValues();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PROGRESS, myStatus));
- }
- private function timeUpdates(active:Boolean):void {
- if(active) {
- timeUpdateTimer.start();
- } else {
- timeUpdateTimer.stop();
- }
- }
- private function timeUpdateHandler(e:TimerEvent):void {
- timeUpdateEvent();
- }
- private function timeUpdateEvent():void {
- updateStatusValues();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_TIMEUPDATE, myStatus));
- }
- private function seeking(active:Boolean):void {
- if(active) {
- if(!myStatus.isSeeking) {
- seekingEvent();
- seekingTimer.start();
- }
- } else {
- seekingTimer.stop();
- }
- }
- private function seekingHandler(e:TimerEvent):void {
- if(myStatus.pausePosition <= getDuration()) {
- seekedEvent();
- seeking(false);
- if(myStatus.playOnSeek) {
- myStatus.playOnSeek = false; // Capture the flag.
- play();
- }
- } else if(myStatus.isLoaded && (myStatus.pausePosition > getDuration())) {
- // Illegal seek time
- seeking(false);
- seekedEvent();
- pause(0);
- }
- }
- private function seekingEvent():void {
- myStatus.isSeeking = true;
- updateStatusValues();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKING, myStatus));
- }
- private function seekedEvent():void {
- myStatus.isSeeking = false;
- updateStatusValues();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKED, myStatus));
- }
- public function load():Boolean {
- if(myStatus.loadRequired()) {
- myStatus.startingDownload();
- mySound.load(myRequest, myContext);
- return true;
- } else {
- return false;
- }
- }
- public function play(time:Number = NaN):Boolean {
- var wasPlaying:Boolean = myStatus.isPlaying;
-
- if(!isNaN(time) && myStatus.srcSet) {
- if(myStatus.isPlaying) {
- myChannel.stop();
- myStatus.isPlaying = false;
- }
- myStatus.pausePosition = time;
- }
-
- if(myStatus.isStartingDownload) {
- myStatus.playOnLoad = true; // Raise flag, captured in loadOpen()
- return true;
- } else if(myStatus.loadRequired()) {
- myStatus.playOnLoad = true; // Raise flag, captured in loadOpen()
- return load();
- } else if((myStatus.isLoading || myStatus.isLoaded) && !myStatus.isPlaying) {
- if(myStatus.isLoaded && myStatus.pausePosition > getDuration()) { // The time is invalid, ie., past the end.
- myStatus.pausePosition = 0;
- timeUpdates(false);
- timeUpdateEvent();
- if(wasPlaying) { // For when playing and then get a play(huge)
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus));
- }
- } else if(myStatus.pausePosition > getDuration()) {
- myStatus.playOnSeek = true;
- seeking(true);
- } else {
- myStatus.isPlaying = true; // Set immediately before playing. Could affects events.
- myChannel = mySound.play(myStatus.pausePosition);
- myChannel.soundTransform = myTransform;
- myChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
- timeUpdates(true);
- if(!wasPlaying) {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY, myStatus));
- }
- }
- return true;
- } else {
- return false;
- }
- }
- public function pause(time:Number = NaN):Boolean {
- myStatus.playOnLoad = false; // Reset flag in case load/play issued immediately before this command, ie., before loadOpen() event.
- myStatus.playOnSeek = false; // Reset flag in case play(time) issued before the command and is still seeking to time set.
-
- var wasPlaying:Boolean = myStatus.isPlaying;
-
- // To avoid possible loops with timeupdate and pause(time). A pause() does not have the problem.
- var alreadyPausedAtTime:Boolean = false;
- if(!isNaN(time) && myStatus.pausePosition == time) {
- alreadyPausedAtTime = true;
- }
-
- if(myStatus.isPlaying) {
- myStatus.isPlaying = false;
- myChannel.stop();
- if(myChannel.position > 0) { // Required otherwise a fast play then pause causes myChannel.position to equal zero and not the correct value. ie., When it happens leave pausePosition alone.
- myStatus.pausePosition = myChannel.position;
- }
- }
-
- if(!isNaN(time) && myStatus.srcSet) {
- myStatus.pausePosition = time;
- }
-
- if(wasPlaying) {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus));
- }
-
- if(myStatus.isStartingDownload) {
- return true;
- } else if(myStatus.loadRequired()) {
- if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation.
- return load();
- } else {
- return true; // Technically the pause(0) succeeded. ie., It did nothing, since nothing was required.
- }
- } else if(myStatus.isLoading || myStatus.isLoaded) {
- if(myStatus.isLoaded && myStatus.pausePosition > getDuration()) { // The time is invalid, ie., past the end.
- myStatus.pausePosition = 0;
- } else if(myStatus.pausePosition > getDuration()) {
- seeking(true);
- }
- timeUpdates(false);
- // Need to be careful with timeupdate event, otherwise a pause in a timeupdate event can cause a loop.
- // Neither pause() nor pause(time) will cause a timeupdate loop.
- if(wasPlaying || !isNaN(time) && !alreadyPausedAtTime) {
- timeUpdateEvent();
- }
- return true;
- } else {
- return false;
- }
- }
- public function playHead(percent:Number):Boolean {
- var time:Number = percent * getDuration() / 100;
- if(myStatus.isPlaying || myStatus.playOnLoad || myStatus.playOnSeek) {
- return play(time);
- } else {
- return pause(time);
- }
- }
- public function setVolume(v:Number):void {
- myStatus.volume = v;
- myTransform.volume = v;
- myChannel.soundTransform = myTransform;
- }
- private function updateStatusValues():void {
- myStatus.seekPercent = 100 * getLoadRatio();
- myStatus.currentTime = getCurrentTime();
- myStatus.currentPercentRelative = 100 * getCurrentRatioRel();
- myStatus.currentPercentAbsolute = 100 * getCurrentRatioAbs();
- myStatus.duration = getDuration();
- }
- public function getLoadRatio():Number {
- if((myStatus.isLoading || myStatus.isLoaded) && mySound.bytesTotal > 0) {
- return mySound.bytesLoaded / mySound.bytesTotal;
- } else {
- return 0;
- }
- }
- public function getDuration():Number {
- if(mySound.length > 0) {
- return mySound.length;
- } else {
- return 0;
- }
- }
- public function getCurrentTime():Number {
- if(myStatus.isPlaying) {
- return myChannel.position;
- } else {
- return myStatus.pausePosition;
- }
- }
- public function getCurrentRatioRel():Number {
- if((getDuration() > 0) && (getCurrentTime() <= getDuration())) {
- return getCurrentTime() / getDuration();
- } else {
- return 0;
- }
- }
- public function getCurrentRatioAbs():Number {
- return getCurrentRatioRel() * getLoadRatio();
- }
- }
-}
diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp4.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp4.as deleted file mode 100644 index dcdc0655d0d..00000000000 --- a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp4.as +++ /dev/null @@ -1,413 +0,0 @@ -/*
- * jPlayer Plugin for jQuery JavaScript Library
- * http://www.happyworm.com/jquery/jplayer
- *
- * Copyright (c) 2009 - 2011 Happyworm Ltd
- * Dual licensed under the MIT and GPL licenses.
- * - http://www.opensource.org/licenses/mit-license.php
- * - http://www.gnu.org/copyleft/gpl.html
- *
- * Author: Mark J Panaghiston
- * Date: 7th August 2011
- */
-
-package happyworm.jPlayer {
- import flash.display.Sprite;
-
- import flash.media.Video;
- import flash.media.SoundTransform;
-
- import flash.net.NetConnection;
- import flash.net.NetStream;
-
- import flash.utils.Timer;
-
- import flash.events.NetStatusEvent;
- import flash.events.SecurityErrorEvent;
- import flash.events.TimerEvent;
-
- public class JplayerMp4 extends Sprite {
-
- public var myVideo:Video = new Video();
- private var myConnection:NetConnection;
- private var myStream:NetStream;
-
- private var myTransform:SoundTransform = new SoundTransform();
-
- public var myStatus:JplayerStatus = new JplayerStatus();
-
- private var timeUpdateTimer:Timer = new Timer(250, 0); // Matched to HTML event freq
- private var progressTimer:Timer = new Timer(250, 0); // Matched to HTML event freq
- private var seekingTimer:Timer = new Timer(100, 0); // Internal: How often seeking is checked to see if it is over.
-
- public function JplayerMp4(volume:Number) {
- myConnection = new NetConnection();
- myConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
- myConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
- myVideo.smoothing = true;
- this.addChild(myVideo);
-
- timeUpdateTimer.addEventListener(TimerEvent.TIMER, timeUpdateHandler);
- progressTimer.addEventListener(TimerEvent.TIMER, progressHandler);
- seekingTimer.addEventListener(TimerEvent.TIMER, seekingHandler);
-
- myStatus.volume = volume;
- }
- private function progressUpdates(active:Boolean):void {
- if(active) {
- progressTimer.start();
- } else {
- progressTimer.stop();
- }
- }
- private function progressHandler(e:TimerEvent):void {
- if(myStatus.isLoading) {
- if(getLoadRatio() == 1) { // Close as can get to a loadComplete event since client.onPlayStatus only works with FMS
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressHandler: loadComplete"));
- myStatus.loaded();
- progressUpdates(false);
- }
- }
- progressEvent();
- }
- private function progressEvent():void {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressEvent:"));
- updateStatusValues();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PROGRESS, myStatus));
- }
- private function timeUpdates(active:Boolean):void {
- if(active) {
- timeUpdateTimer.start();
- } else {
- timeUpdateTimer.stop();
- }
- }
- private function timeUpdateHandler(e:TimerEvent):void {
- timeUpdateEvent();
- }
- private function timeUpdateEvent():void {
- updateStatusValues();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_TIMEUPDATE, myStatus));
- }
- private function seeking(active:Boolean):void {
- if(active) {
- if(!myStatus.isSeeking) {
- seekingEvent();
- }
- seekingTimer.start();
- } else {
- if(myStatus.isSeeking) {
- seekedEvent();
- }
- seekingTimer.stop();
- }
- }
- private function seekingHandler(e:TimerEvent):void {
- if(getSeekTimeRatio() <= getLoadRatio()) {
- seeking(false);
- if(myStatus.playOnSeek) {
- myStatus.playOnSeek = false; // Capture the flag.
- play(myStatus.pausePosition); // Must pass time or the seek time is never set.
- } else {
- pause(myStatus.pausePosition); // Must pass time or the stream.time is read.
- }
- } else if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) {
- // Illegal seek time
- seeking(false);
- pause(0);
- }
- }
- private function seekingEvent():void {
- myStatus.isSeeking = true;
- updateStatusValues();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKING, myStatus));
- }
- private function seekedEvent():void {
- myStatus.isSeeking = false;
- updateStatusValues();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKED, myStatus));
- }
- private function netStatusHandler(e:NetStatusEvent):void {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "netStatusHandler: '" + e.info.code + "'"));
- switch(e.info.code) {
- case "NetConnection.Connect.Success":
- connectStream();
- break;
- case "NetStream.Play.Start":
- // This event code occurs once, when the media is opened. Equiv to loadOpen() in mp3 player.
- myStatus.loading();
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus));
- progressUpdates(true);
- // See onMetaDataHandler() for other condition, since duration is vital.
- break;
- case "NetStream.Play.Stop":
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "NetStream.Play.Stop: getDuration() - getCurrentTime() = " + (getDuration() - getCurrentTime())));
-
- // Check if media is at the end (or close) otherwise this was due to download bandwidth stopping playback. ie., Download is not fast enough.
- if(Math.abs(getDuration() - getCurrentTime()) < 150) { // Testing found 150ms worked best for M4A files, where playHead(99.9) caused a stuck state due to firing with ~116ms left to play.
- endedEvent();
- }
- break;
- case "NetStream.Seek.InvalidTime":
- // Used for capturing invalid set times and clicks on the end of the progress bar.
- endedEvent();
- break;
- case "NetStream.Play.StreamNotFound":
- myStatus.error(); // Resets status except the src, and it sets srcError property.
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ERROR, myStatus));
- break;
- }
- // "NetStream.Seek.Notify" event code is not very useful. It occurs after every seek(t) command issued and does not appear to wait for the media to be ready.
- }
- private function endedEvent():void {
- var wasPlaying:Boolean = myStatus.isPlaying;
- pause(0);
- timeUpdates(false);
- timeUpdateEvent();
- if(wasPlaying) {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED, myStatus));
- }
- }
- private function securityErrorHandler(event:SecurityErrorEvent):void {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "securityErrorHandler."));
- }
- private function connectStream():void {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "connectStream."));
- var customClient:Object = new Object();
- customClient.onMetaData = onMetaDataHandler;
- // customClient.onPlayStatus = onPlayStatusHandler; // According to the forums and my tests, onPlayStatus only works with FMS (Flash Media Server).
- myStream = null;
- myStream = new NetStream(myConnection);
- myStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
- myStream.client = customClient;
- myVideo.attachNetStream(myStream);
- setVolume(myStatus.volume);
- myStream.play(myStatus.src);
- }
- public function setFile(src:String):void {
- if(myStream != null) {
- myStream.close();
- }
- myVideo.clear();
- progressUpdates(false);
- timeUpdates(false);
-
- myStatus.reset();
- myStatus.src = src;
- myStatus.srcSet = true;
- timeUpdateEvent();
- }
- public function clearFile():void {
- setFile("");
- myStatus.srcSet = false;
- }
- public function load():Boolean {
- if(myStatus.loadRequired()) {
- myStatus.startingDownload();
- myConnection.connect(null);
- return true;
- } else {
- return false;
- }
- }
- public function play(time:Number = NaN):Boolean {
- var wasPlaying:Boolean = myStatus.isPlaying;
-
- if(!isNaN(time) && myStatus.srcSet) {
- if(myStatus.isPlaying) {
- myStream.pause();
- myStatus.isPlaying = false;
- }
- myStatus.pausePosition = time;
- }
-
- if(myStatus.isStartingDownload) {
- myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler()
- return true;
- } else if(myStatus.loadRequired()) {
- myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler()
- return load();
- } else if((myStatus.isLoading || myStatus.isLoaded) && !myStatus.isPlaying) {
- if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { // The time is invalid, ie., past the end.
- myStream.pause(); // Since it is playing by default at this point.
- myStatus.pausePosition = 0;
- myStream.seek(0);
- timeUpdates(false);
- timeUpdateEvent();
- if(wasPlaying) { // For when playing and then get a play(huge)
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus));
- }
- } else if(getSeekTimeRatio() > getLoadRatio()) { // Use an estimate based on the downloaded amount
- myStatus.playOnSeek = true;
- seeking(true);
- myStream.pause(); // Since it is playing by default at this point.
- } else {
- if(!isNaN(time)) { // Avoid using seek() when it is already correct.
- myStream.seek(myStatus.pausePosition/1000); // Since time is in ms and seek() takes seconds
- }
- myStatus.isPlaying = true; // Set immediately before playing. Could affects events.
- myStream.resume();
- timeUpdates(true);
- if(!wasPlaying) {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY, myStatus));
- }
- }
- return true;
- } else {
- return false;
- }
- }
- public function pause(time:Number = NaN):Boolean {
- myStatus.playOnLoad = false; // Reset flag in case load/play issued immediately before this command, ie., before onMetadata() event.
- myStatus.playOnSeek = false; // Reset flag in case play(time) issued before the command and is still seeking to time set.
-
- var wasPlaying:Boolean = myStatus.isPlaying;
-
- // To avoid possible loops with timeupdate and pause(time). A pause() does not have the problem.
- var alreadyPausedAtTime:Boolean = false;
- if(!isNaN(time) && myStatus.pausePosition == time) {
- alreadyPausedAtTime = true;
- }
-
- // Need to wait for metadata to load before ever issuing a pause. The metadata handler will call this function if needed, when ready.
- if(myStream != null && myStatus.metaDataReady) { // myStream is a null until the 1st media is loaded. ie., The 1st ever setMedia being followed by a pause() or pause(t).
- myStream.pause();
- }
- if(myStatus.isPlaying) {
- myStatus.isPlaying = false;
- myStatus.pausePosition = myStream.time * 1000;
- }
-
- if(!isNaN(time) && myStatus.srcSet) {
- myStatus.pausePosition = time;
- }
-
- if(wasPlaying) {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus));
- }
-
- if(myStatus.isStartingDownload) {
- return true;
- } else if(myStatus.loadRequired()) {
- if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation.
- return load();
- } else {
- return true; // Technically the pause(0) succeeded. ie., It did nothing, since nothing was required.
- }
- } else if(myStatus.isLoading || myStatus.isLoaded) {
- if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { // The time is invalid, ie., past the end.
- myStatus.pausePosition = 0;
- myStream.seek(0);
- seekedEvent(); // Deals with seeking effect when using setMedia() then pause(huge). NB: There is no preceeding seeking event.
- } else if(!isNaN(time)) {
- if(getSeekTimeRatio() > getLoadRatio()) { // Use an estimate based on the downloaded amount
- seeking(true);
- } else {
- if(myStatus.metaDataReady) { // Otherwise seek(0) will stop the metadata loading.
- myStream.seek(myStatus.pausePosition/1000);
- }
- }
- }
- timeUpdates(false);
- // Need to be careful with timeupdate event, otherwise a pause in a timeupdate event can cause a loop.
- // Neither pause() nor pause(time) will cause a timeupdate loop.
- if(wasPlaying || !isNaN(time) && !alreadyPausedAtTime) {
- timeUpdateEvent();
- }
- return true;
- } else {
- return false;
- }
- }
- public function playHead(percent:Number):Boolean {
- var time:Number = percent * getDuration() * getLoadRatio() / 100;
- if(myStatus.isPlaying || myStatus.playOnLoad || myStatus.playOnSeek) {
- return play(time);
- } else {
- return pause(time);
- }
- }
- public function setVolume(v:Number):void {
- myStatus.volume = v;
- myTransform.volume = v;
- if(myStream != null) {
- myStream.soundTransform = myTransform;
- }
- }
- private function updateStatusValues():void {
- myStatus.seekPercent = 100 * getLoadRatio();
- myStatus.currentTime = getCurrentTime();
- myStatus.currentPercentRelative = 100 * getCurrentRatioRel();
- myStatus.currentPercentAbsolute = 100 * getCurrentRatioAbs();
- myStatus.duration = getDuration();
- }
- public function getLoadRatio():Number {
- if((myStatus.isLoading || myStatus.isLoaded) && myStream.bytesTotal > 0) {
- return myStream.bytesLoaded / myStream.bytesTotal;
- } else {
- return 0;
- }
- }
- public function getDuration():Number {
- return myStatus.duration; // Set from meta data.
- }
- public function getCurrentTime():Number {
- if(myStatus.isPlaying) {
- return myStream.time * 1000;
- } else {
- return myStatus.pausePosition;
- }
- }
- public function getCurrentRatioRel():Number {
- if((getLoadRatio() > 0) && (getCurrentRatioAbs() <= getLoadRatio())) {
- return getCurrentRatioAbs() / getLoadRatio();
- } else {
- return 0;
- }
- }
- public function getCurrentRatioAbs():Number {
- if(getDuration() > 0) {
- return getCurrentTime() / getDuration();
- } else {
- return 0;
- }
- }
- public function getSeekTimeRatio():Number {
- if(getDuration() > 0) {
- return myStatus.pausePosition / getDuration();
- } else {
- return 1;
- }
- }
- public function onMetaDataHandler(info:Object):void { // Used in connectStream() in myStream.client object.
- // This event occurs when jumping to the start of static files! ie., seek(0) will cause this event to occur.
- if(!myStatus.metaDataReady) {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "onMetaDataHandler: " + info.duration + " | " + info.width + "x" + info.height));
-
- myStatus.metaDataReady = true; // Set flag so that this event only effects jPlayer the 1st time.
- myStatus.metaData = info;
- myStatus.duration = info.duration * 1000; // Only available via Meta Data.
- if(info.width != undefined) {
- myVideo.width = info.width;
- }
- if(info.height != undefined) {
- myVideo.height = info.height;
- }
-
- if(myStatus.playOnLoad) {
- myStatus.playOnLoad = false; // Capture the flag
- if(myStatus.pausePosition > 0 ) { // Important for setMedia followed by play(time).
- play(myStatus.pausePosition);
- } else {
- play(); // Not always sending pausePosition avoids the extra seek(0) for a normal play() command.
- }
- } else {
- pause(myStatus.pausePosition); // Always send the pausePosition. Important for setMedia() followed by pause(time). Deals with not reading stream.time with setMedia() and play() immediately followed by stop() or pause(0)
- }
- this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADEDMETADATA, myStatus));
- } else {
- this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "onMetaDataHandler: Already read (NO EFFECT)"));
- }
- }
- }
-}
diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerStatus.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerStatus.as deleted file mode 100644 index 5cc1e1ff4b3..00000000000 --- a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerStatus.as +++ /dev/null @@ -1,101 +0,0 @@ -/*
- * jPlayer Plugin for jQuery JavaScript Library
- * http://www.happyworm.com/jquery/jplayer
- *
- * Copyright (c) 2009 - 2011 Happyworm Ltd
- * Dual licensed under the MIT and GPL licenses.
- * - http://www.opensource.org/licenses/mit-license.php
- * - http://www.gnu.org/copyleft/gpl.html
- *
- * Author: Mark J Panaghiston
- * Date: 1st September 2011
- */
-
-package happyworm.jPlayer {
- public class JplayerStatus {
-
- public static const VERSION:String = "2.1.0"; // The version of the Flash jPlayer entity.
-
- public var volume:Number = 0.5; // Not affected by reset()
- public var muted:Boolean = false; // Not affected by reset()
-
- public var src:String;
- public var srcError:Boolean;
-
- public var srcSet:Boolean;
- public var isPlaying:Boolean;
- public var isSeeking:Boolean;
-
- public var playOnLoad:Boolean;
- public var playOnSeek:Boolean;
-
- public var isStartingDownload:Boolean;
- public var isLoading:Boolean;
- public var isLoaded:Boolean;
-
- public var pausePosition:Number;
-
- public var seekPercent:Number;
- public var currentTime:Number;
- public var currentPercentRelative:Number;
- public var currentPercentAbsolute:Number;
- public var duration:Number;
-
- public var metaDataReady:Boolean;
- public var metaData:Object;
-
- public function JplayerStatus() {
- reset();
- }
- public function reset():void {
- src = "";
- srcError = false;
-
- srcSet = false;
- isPlaying = false;
- isSeeking = false;
-
- playOnLoad = false;
- playOnSeek = false;
-
- isStartingDownload = false;
- isLoading = false;
- isLoaded = false;
-
- pausePosition = 0;
-
- seekPercent = 0;
- currentTime = 0;
- currentPercentRelative = 0;
- currentPercentAbsolute = 0;
- duration = 0;
-
- metaDataReady = false;
- metaData = {};
- }
- public function error():void {
- var srcSaved:String = src;
- reset();
- src = srcSaved;
- srcError = true;
- }
- public function loadRequired():Boolean {
- return (srcSet && !isStartingDownload && !isLoading && !isLoaded);
- }
- public function startingDownload():void {
- isStartingDownload = true;
- isLoading = false;
- isLoaded = false;
- }
- public function loading():void {
- isStartingDownload = false;
- isLoading = true;
- isLoaded = false;
- }
- public function loaded():void {
- isStartingDownload = false;
- isLoading = false;
- isLoaded = true;
- }
- }
-}
diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/jquery.jplayer.js b/apps/media/js/jQuery.jPlayer.2.1.0.source/jquery.jplayer.js deleted file mode 100644 index 9d41a12ee6c..00000000000 --- a/apps/media/js/jQuery.jPlayer.2.1.0.source/jquery.jplayer.js +++ /dev/null @@ -1,2349 +0,0 @@ -/*
- * jPlayer Plugin for jQuery JavaScript Library
- * http://www.jplayer.org
- *
- * Copyright (c) 2009 - 2011 Happyworm Ltd
- * Dual licensed under the MIT and GPL licenses.
- * - http://www.opensource.org/licenses/mit-license.php
- * - http://www.gnu.org/copyleft/gpl.html
- *
- * Author: Mark J Panaghiston
- * Version: 2.1.0
- * Date: 1st September 2011
- */
-
-/* Code verified using http://www.jshint.com/ */
-/*jshint asi:false, bitwise:false, boss:false, browser:true, curly:true, debug:false, eqeqeq:true, eqnull:false, evil:false, forin:false, immed:false, jquery:true, laxbreak:false, newcap:true, noarg:true, noempty:true, nonew:true, nomem:false, onevar:false, passfail:false, plusplus:false, regexp:false, undef:true, sub:false, strict:false, white:false */
-/*global jQuery:false, ActiveXObject:false, alert:false */
-
-(function($, undefined) {
-
- // Adapted from jquery.ui.widget.js (1.8.7): $.widget.bridge
- $.fn.jPlayer = function( options ) {
- var name = "jPlayer";
- var isMethodCall = typeof options === "string",
- args = Array.prototype.slice.call( arguments, 1 ),
- returnValue = this;
-
- // allow multiple hashes to be passed on init
- options = !isMethodCall && args.length ?
- $.extend.apply( null, [ true, options ].concat(args) ) :
- options;
-
- // prevent calls to internal methods
- if ( isMethodCall && options.charAt( 0 ) === "_" ) {
- return returnValue;
- }
-
- if ( isMethodCall ) {
- this.each(function() {
- var instance = $.data( this, name ),
- methodValue = instance && $.isFunction( instance[options] ) ?
- instance[ options ].apply( instance, args ) :
- instance;
- if ( methodValue !== instance && methodValue !== undefined ) {
- returnValue = methodValue;
- return false;
- }
- });
- } else {
- this.each(function() {
- var instance = $.data( this, name );
- if ( instance ) {
- // instance.option( options || {} )._init(); // Orig jquery.ui.widget.js code: Not recommend for jPlayer. ie., Applying new options to an existing instance (via the jPlayer constructor) and performing the _init(). The _init() is what concerns me. It would leave a lot of event handlers acting on jPlayer instance and the interface.
- instance.option( options || {} ); // The new constructor only changes the options. Changing options only has basic support atm.
- } else {
- $.data( this, name, new $.jPlayer( options, this ) );
- }
- });
- }
-
- return returnValue;
- };
-
- $.jPlayer = function( options, element ) {
- // allow instantiation without initializing for simple inheritance
- if ( arguments.length ) {
- this.element = $(element);
- this.options = $.extend(true, {},
- this.options,
- options
- );
- var self = this;
- this.element.bind( "remove.jPlayer", function() {
- self.destroy();
- });
- this._init();
- }
- };
- // End of: (Adapted from jquery.ui.widget.js (1.8.7))
-
- // Emulated HTML5 methods and properties
- $.jPlayer.emulateMethods = "load play pause";
- $.jPlayer.emulateStatus = "src readyState networkState currentTime duration paused ended playbackRate";
- $.jPlayer.emulateOptions = "muted volume";
-
- // Reserved event names generated by jPlayer that are not part of the HTML5 Media element spec
- $.jPlayer.reservedEvent = "ready flashreset resize repeat error warning";
-
- // Events generated by jPlayer
- $.jPlayer.event = {
- ready: "jPlayer_ready",
- flashreset: "jPlayer_flashreset", // Similar to the ready event if the Flash solution is set to display:none and then shown again or if it's reloaded for another reason by the browser. For example, using CSS position:fixed on Firefox for the full screen feature.
- resize: "jPlayer_resize", // Occurs when the size changes through a full/restore screen operation or if the size/sizeFull options are changed.
- repeat: "jPlayer_repeat", // Occurs when the repeat status changes. Usually through clicks on the repeat button of the interface.
- click: "jPlayer_click", // Occurs when the user clicks on one of the following: poster image, html video, flash video.
- error: "jPlayer_error", // Event error code in event.jPlayer.error.type. See $.jPlayer.error
- warning: "jPlayer_warning", // Event warning code in event.jPlayer.warning.type. See $.jPlayer.warning
-
- // Other events match HTML5 spec.
- loadstart: "jPlayer_loadstart",
- progress: "jPlayer_progress",
- suspend: "jPlayer_suspend",
- abort: "jPlayer_abort",
- emptied: "jPlayer_emptied",
- stalled: "jPlayer_stalled",
- play: "jPlayer_play",
- pause: "jPlayer_pause",
- loadedmetadata: "jPlayer_loadedmetadata",
- loadeddata: "jPlayer_loadeddata",
- waiting: "jPlayer_waiting",
- playing: "jPlayer_playing",
- canplay: "jPlayer_canplay",
- canplaythrough: "jPlayer_canplaythrough",
- seeking: "jPlayer_seeking",
- seeked: "jPlayer_seeked",
- timeupdate: "jPlayer_timeupdate",
- ended: "jPlayer_ended",
- ratechange: "jPlayer_ratechange",
- durationchange: "jPlayer_durationchange",
- volumechange: "jPlayer_volumechange"
- };
-
- $.jPlayer.htmlEvent = [ // These HTML events are bubbled through to the jPlayer event, without any internal action.
- "loadstart",
- // "progress", // jPlayer uses internally before bubbling.
- // "suspend", // jPlayer uses internally before bubbling.
- "abort",
- // "error", // jPlayer uses internally before bubbling.
- "emptied",
- "stalled",
- // "play", // jPlayer uses internally before bubbling.
- // "pause", // jPlayer uses internally before bubbling.
- "loadedmetadata",
- "loadeddata",
- // "waiting", // jPlayer uses internally before bubbling.
- // "playing", // jPlayer uses internally before bubbling.
- "canplay",
- "canplaythrough",
- // "seeking", // jPlayer uses internally before bubbling.
- // "seeked", // jPlayer uses internally before bubbling.
- // "timeupdate", // jPlayer uses internally before bubbling.
- // "ended", // jPlayer uses internally before bubbling.
- "ratechange"
- // "durationchange" // jPlayer uses internally before bubbling.
- // "volumechange" // jPlayer uses internally before bubbling.
- ];
-
- $.jPlayer.pause = function() {
- $.each($.jPlayer.prototype.instances, function(i, element) {
- if(element.data("jPlayer").status.srcSet) { // Check that media is set otherwise would cause error event.
- element.jPlayer("pause");
- }
- });
- };
-
- $.jPlayer.timeFormat = {
- showHour: false,
- showMin: true,
- showSec: true,
- padHour: false,
- padMin: true,
- padSec: true,
- sepHour: ":",
- sepMin: ":",
- sepSec: ""
- };
-
- $.jPlayer.convertTime = function(s) {
- var myTime = new Date(s * 1000);
- var hour = myTime.getUTCHours();
- var min = myTime.getUTCMinutes();
- var sec = myTime.getUTCSeconds();
- var strHour = ($.jPlayer.timeFormat.padHour && hour < 10) ? "0" + hour : hour;
- var strMin = ($.jPlayer.timeFormat.padMin && min < 10) ? "0" + min : min;
- var strSec = ($.jPlayer.timeFormat.padSec && sec < 10) ? "0" + sec : sec;
- return (($.jPlayer.timeFormat.showHour) ? strHour + $.jPlayer.timeFormat.sepHour : "") + (($.jPlayer.timeFormat.showMin) ? strMin + $.jPlayer.timeFormat.sepMin : "") + (($.jPlayer.timeFormat.showSec) ? strSec + $.jPlayer.timeFormat.sepSec : "");
- };
-
- // Adapting jQuery 1.4.4 code for jQuery.browser. Required since jQuery 1.3.2 does not detect Chrome as webkit.
- $.jPlayer.uaBrowser = function( userAgent ) {
- var ua = userAgent.toLowerCase();
-
- // Useragent RegExp
- var rwebkit = /(webkit)[ \/]([\w.]+)/;
- var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/;
- var rmsie = /(msie) ([\w.]+)/;
- var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/;
-
- var match = rwebkit.exec( ua ) ||
- ropera.exec( ua ) ||
- rmsie.exec( ua ) ||
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
- [];
-
- return { browser: match[1] || "", version: match[2] || "0" };
- };
-
- // Platform sniffer for detecting mobile devices
- $.jPlayer.uaPlatform = function( userAgent ) {
- var ua = userAgent.toLowerCase();
-
- // Useragent RegExp
- var rplatform = /(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/;
- var rtablet = /(ipad|playbook)/;
- var randroid = /(android)/;
- var rmobile = /(mobile)/;
-
- var platform = rplatform.exec( ua ) || [];
- var tablet = rtablet.exec( ua ) ||
- !rmobile.exec( ua ) && randroid.exec( ua ) ||
- [];
-
- if(platform[1]) {
- platform[1] = platform[1].replace(/\s/g, "_"); // Change whitespace to underscore. Enables dot notation.
- }
-
- return { platform: platform[1] || "", tablet: tablet[1] || "" };
- };
-
- $.jPlayer.browser = {
- };
- $.jPlayer.platform = {
- };
-
- var browserMatch = $.jPlayer.uaBrowser(navigator.userAgent);
- if ( browserMatch.browser ) {
- $.jPlayer.browser[ browserMatch.browser ] = true;
- $.jPlayer.browser.version = browserMatch.version;
- }
- var platformMatch = $.jPlayer.uaPlatform(navigator.userAgent);
- if ( platformMatch.platform ) {
- $.jPlayer.platform[ platformMatch.platform ] = true;
- $.jPlayer.platform.mobile = !platformMatch.tablet;
- $.jPlayer.platform.tablet = !!platformMatch.tablet;
- }
-
- $.jPlayer.prototype = {
- count: 0, // Static Variable: Change it via prototype.
- version: { // Static Object
- script: "2.1.0",
- needFlash: "2.1.0",
- flash: "unknown"
- },
- options: { // Instanced in $.jPlayer() constructor
- swfPath: "js", // Path to Jplayer.swf. Can be relative, absolute or server root relative.
- solution: "html, flash", // Valid solutions: html, flash. Order defines priority. 1st is highest,
- supplied: "mp3", // Defines which formats jPlayer will try and support and the priority by the order. 1st is highest,
- preload: 'metadata', // HTML5 Spec values: none, metadata, auto.
- volume: 0.8, // The volume. Number 0 to 1.
- muted: false,
- wmode: "opaque", // Valid wmode: window, transparent, opaque, direct, gpu.
- backgroundColor: "#000000", // To define the jPlayer div and Flash background color.
- cssSelectorAncestor: "#jp_container_1",
- cssSelector: { // * denotes properties that should only be required when video media type required. _cssSelector() would require changes to enable splitting these into Audio and Video defaults.
- videoPlay: ".jp-video-play", // *
- play: ".jp-play",
- pause: ".jp-pause",
- stop: ".jp-stop",
- seekBar: ".jp-seek-bar",
- playBar: ".jp-play-bar",
- mute: ".jp-mute",
- unmute: ".jp-unmute",
- volumeBar: ".jp-volume-bar",
- volumeBarValue: ".jp-volume-bar-value",
- volumeMax: ".jp-volume-max",
- currentTime: ".jp-current-time",
- duration: ".jp-duration",
- fullScreen: ".jp-full-screen", // *
- restoreScreen: ".jp-restore-screen", // *
- repeat: ".jp-repeat",
- repeatOff: ".jp-repeat-off",
- gui: ".jp-gui", // The interface used with autohide feature.
- noSolution: ".jp-no-solution" // For error feedback when jPlayer cannot find a solution.
- },
- fullScreen: false,
- autohide: {
- restored: false, // Controls the interface autohide feature.
- full: true, // Controls the interface autohide feature.
- fadeIn: 200, // Milliseconds. The period of the fadeIn anim.
- fadeOut: 600, // Milliseconds. The period of the fadeOut anim.
- hold: 1000 // Milliseconds. The period of the pause before autohide beings.
- },
- loop: false,
- repeat: function(event) { // The default jPlayer repeat event handler
- if(event.jPlayer.options.loop) {
- $(this).unbind(".jPlayerRepeat").bind($.jPlayer.event.ended + ".jPlayer.jPlayerRepeat", function() {
- $(this).jPlayer("play");
- });
- } else {
- $(this).unbind(".jPlayerRepeat");
- }
- },
- nativeVideoControls: {
- // Works well on standard browsers.
- // Phone and tablet browsers can have problems with the controls disappearing.
- },
- noFullScreen: {
- msie: /msie [0-6]/,
- ipad: /ipad.*?os [0-4]/,
- iphone: /iphone/,
- ipod: /ipod/,
- android_pad: /android [0-3](?!.*?mobile)/,
- android_phone: /android.*?mobile/,
- blackberry: /blackberry/,
- windows_ce: /windows ce/,
- webos: /webos/
- },
- noVolume: {
- ipad: /ipad/,
- iphone: /iphone/,
- ipod: /ipod/,
- android_pad: /android(?!.*?mobile)/,
- android_phone: /android.*?mobile/,
- blackberry: /blackberry/,
- windows_ce: /windows ce/,
- webos: /webos/,
- playbook: /playbook/
- },
- verticalVolume: false, // Calculate volume from the bottom of the volume bar. Default is from the left. Also volume affects either width or height.
- // globalVolume: false, // Not implemented: Set to make volume changes affect all jPlayer instances
- // globalMute: false, // Not implemented: Set to make mute changes affect all jPlayer instances
- idPrefix: "jp", // Prefix for the ids of html elements created by jPlayer. For flash, this must not include characters: . - + * / \
- noConflict: "jQuery",
- emulateHtml: false, // Emulates the HTML5 Media element on the jPlayer element.
- errorAlerts: false,
- warningAlerts: false
- },
- optionsAudio: {
- size: {
- width: "0px",
- height: "0px",
- cssClass: ""
- },
- sizeFull: {
- width: "0px",
- height: "0px",
- cssClass: ""
- }
- },
- optionsVideo: {
- size: {
- width: "480px",
- height: "270px",
- cssClass: "jp-video-270p"
- },
- sizeFull: {
- width: "100%",
- height: "100%",
- cssClass: "jp-video-full"
- }
- },
- instances: {}, // Static Object
- status: { // Instanced in _init()
- src: "",
- media: {},
- paused: true,
- format: {},
- formatType: "",
- waitForPlay: true, // Same as waitForLoad except in case where preloading.
- waitForLoad: true,
- srcSet: false,
- video: false, // True if playing a video
- seekPercent: 0,
- currentPercentRelative: 0,
- currentPercentAbsolute: 0,
- currentTime: 0,
- duration: 0,
- readyState: 0,
- networkState: 0,
- playbackRate: 1,
- ended: 0
-
-/* Persistant status properties created dynamically at _init():
- width
- height
- cssClass
- nativeVideoControls
- noFullScreen
- noVolume
-*/
- },
-
- internal: { // Instanced in _init()
- ready: false
- // instance: undefined
- // domNode: undefined
- // htmlDlyCmdId: undefined
- // autohideId: undefined
- },
- solution: { // Static Object: Defines the solutions built in jPlayer.
- html: true,
- flash: true
- },
- // 'MPEG-4 support' : canPlayType('video/mp4; codecs="mp4v.20.8"')
- format: { // Static Object
- mp3: {
- codec: 'audio/mpeg; codecs="mp3"',
- flashCanPlay: true,
- media: 'audio'
- },
- m4a: { // AAC / MP4
- codec: 'audio/mp4; codecs="mp4a.40.2"',
- flashCanPlay: true,
- media: 'audio'
- },
- oga: { // OGG
- codec: 'audio/ogg; codecs="vorbis"',
- flashCanPlay: false,
- media: 'audio'
- },
- wav: { // PCM
- codec: 'audio/wav; codecs="1"',
- flashCanPlay: false,
- media: 'audio'
- },
- webma: { // WEBM
- codec: 'audio/webm; codecs="vorbis"',
- flashCanPlay: false,
- media: 'audio'
- },
- fla: { // FLV / F4A
- codec: 'audio/x-flv',
- flashCanPlay: true,
- media: 'audio'
- },
- m4v: { // H.264 / MP4
- codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
- flashCanPlay: true,
- media: 'video'
- },
- ogv: { // OGG
- codec: 'video/ogg; codecs="theora, vorbis"',
- flashCanPlay: false,
- media: 'video'
- },
- webmv: { // WEBM
- codec: 'video/webm; codecs="vorbis, vp8"',
- flashCanPlay: false,
- media: 'video'
- },
- flv: { // FLV / F4V
- codec: 'video/x-flv',
- flashCanPlay: true,
- media: 'video'
- }
- },
- _init: function() {
- var self = this;
-
- this.element.empty();
-
- this.status = $.extend({}, this.status); // Copy static to unique instance.
- this.internal = $.extend({}, this.internal); // Copy static to unique instance.
-
- this.internal.domNode = this.element.get(0);
-
- this.formats = []; // Array based on supplied string option. Order defines priority.
- this.solutions = []; // Array based on solution string option. Order defines priority.
- this.require = {}; // Which media types are required: video, audio.
-
- this.htmlElement = {}; // DOM elements created by jPlayer
- this.html = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.
- this.html.audio = {};
- this.html.video = {};
- this.flash = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.
-
- this.css = {};
- this.css.cs = {}; // Holds the css selector strings
- this.css.jq = {}; // Holds jQuery selectors. ie., $(css.cs.method)
-
- this.ancestorJq = []; // Holds jQuery selector of cssSelectorAncestor. Init would use $() instead of [], but it is only 1.4+
-
- this.options.volume = this._limitValue(this.options.volume, 0, 1); // Limit volume value's bounds.
-
- // Create the formats array, with prority based on the order of the supplied formats string
- $.each(this.options.supplied.toLowerCase().split(","), function(index1, value1) {
- var format = value1.replace(/^\s+|\s+$/g, ""); //trim
- if(self.format[format]) { // Check format is valid.
- var dupFound = false;
- $.each(self.formats, function(index2, value2) { // Check for duplicates
- if(format === value2) {
- dupFound = true;
- return false;
- }
- });
- if(!dupFound) {
- self.formats.push(format);
- }
- }
- });
-
- // Create the solutions array, with prority based on the order of the solution string
- $.each(this.options.solution.toLowerCase().split(","), function(index1, value1) {
- var solution = value1.replace(/^\s+|\s+$/g, ""); //trim
- if(self.solution[solution]) { // Check solution is valid.
- var dupFound = false;
- $.each(self.solutions, function(index2, value2) { // Check for duplicates
- if(solution === value2) {
- dupFound = true;
- return false;
- }
- });
- if(!dupFound) {
- self.solutions.push(solution);
- }
- }
- });
-
- this.internal.instance = "jp_" + this.count;
- this.instances[this.internal.instance] = this.element;
-
- // Check the jPlayer div has an id and create one if required. Important for Flash to know the unique id for comms.
- if(!this.element.attr("id")) {
- this.element.attr("id", this.options.idPrefix + "_jplayer_" + this.count);
- }
-
- this.internal.self = $.extend({}, {
- id: this.element.attr("id"),
- jq: this.element
- });
- this.internal.audio = $.extend({}, {
- id: this.options.idPrefix + "_audio_" + this.count,
- jq: undefined
- });
- this.internal.video = $.extend({}, {
- id: this.options.idPrefix + "_video_" + this.count,
- jq: undefined
- });
- this.internal.flash = $.extend({}, {
- id: this.options.idPrefix + "_flash_" + this.count,
- jq: undefined,
- swf: this.options.swfPath + (this.options.swfPath.toLowerCase().slice(-4) !== ".swf" ? (this.options.swfPath && this.options.swfPath.slice(-1) !== "/" ? "/" : "") + "Jplayer.swf" : "")
- });
- this.internal.poster = $.extend({}, {
- id: this.options.idPrefix + "_poster_" + this.count,
- jq: undefined
- });
-
- // Register listeners defined in the constructor
- $.each($.jPlayer.event, function(eventName,eventType) {
- if(self.options[eventName] !== undefined) {
- self.element.bind(eventType + ".jPlayer", self.options[eventName]); // With .jPlayer namespace.
- self.options[eventName] = undefined; // Destroy the handler pointer copy on the options. Reason, events can be added/removed in other ways so this could be obsolete and misleading.
- }
- });
-
- // Determine if we require solutions for audio, video or both media types.
- this.require.audio = false;
- this.require.video = false;
- $.each(this.formats, function(priority, format) {
- self.require[self.format[format].media] = true;
- });
-
- // Now required types are known, finish the options default settings.
- if(this.require.video) {
- this.options = $.extend(true, {},
- this.optionsVideo,
- this.options
- );
- } else {
- this.options = $.extend(true, {},
- this.optionsAudio,
- this.options
- );
- }
- this._setSize(); // update status and jPlayer element size
-
- // Determine the status for Blocklisted options.
- this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls);
- this.status.noFullScreen = this._uaBlocklist(this.options.noFullScreen);
- this.status.noVolume = this._uaBlocklist(this.options.noVolume);
-
- // The native controls are only for video and are disabled when audio is also used.
- this._restrictNativeVideoControls();
-
- // Create the poster image.
- this.htmlElement.poster = document.createElement('img');
- this.htmlElement.poster.id = this.internal.poster.id;
- this.htmlElement.poster.onload = function() { // Note that this did not work on Firefox 3.6: poster.addEventListener("onload", function() {}, false); Did not investigate x-browser.
- if(!self.status.video || self.status.waitForPlay) {
- self.internal.poster.jq.show();
- }
- };
- this.element.append(this.htmlElement.poster);
- this.internal.poster.jq = $("#" + this.internal.poster.id);
- this.internal.poster.jq.css({'width': this.status.width, 'height': this.status.height});
- this.internal.poster.jq.hide();
- this.internal.poster.jq.bind("click.jPlayer", function() {
- self._trigger($.jPlayer.event.click);
- });
-
- // Generate the required media elements
- this.html.audio.available = false;
- if(this.require.audio) { // If a supplied format is audio
- this.htmlElement.audio = document.createElement('audio');
- this.htmlElement.audio.id = this.internal.audio.id;
- this.html.audio.available = !!this.htmlElement.audio.canPlayType && this._testCanPlayType(this.htmlElement.audio); // Test is for IE9 on Win Server 2008.
- }
- this.html.video.available = false;
- if(this.require.video) { // If a supplied format is video
- this.htmlElement.video = document.createElement('video');
- this.htmlElement.video.id = this.internal.video.id;
- this.html.video.available = !!this.htmlElement.video.canPlayType && this._testCanPlayType(this.htmlElement.video); // Test is for IE9 on Win Server 2008.
- }
-
- this.flash.available = this._checkForFlash(10);
-
- this.html.canPlay = {};
- this.flash.canPlay = {};
- $.each(this.formats, function(priority, format) {
- self.html.canPlay[format] = self.html[self.format[format].media].available && "" !== self.htmlElement[self.format[format].media].canPlayType(self.format[format].codec);
- self.flash.canPlay[format] = self.format[format].flashCanPlay && self.flash.available;
- });
- this.html.desired = false;
- this.flash.desired = false;
- $.each(this.solutions, function(solutionPriority, solution) {
- if(solutionPriority === 0) {
- self[solution].desired = true;
- } else {
- var audioCanPlay = false;
- var videoCanPlay = false;
- $.each(self.formats, function(formatPriority, format) {
- if(self[self.solutions[0]].canPlay[format]) { // The other solution can play
- if(self.format[format].media === 'video') {
- videoCanPlay = true;
- } else {
- audioCanPlay = true;
- }
- }
- });
- self[solution].desired = (self.require.audio && !audioCanPlay) || (self.require.video && !videoCanPlay);
- }
- });
- // This is what jPlayer will support, based on solution and supplied.
- this.html.support = {};
- this.flash.support = {};
- $.each(this.formats, function(priority, format) {
- self.html.support[format] = self.html.canPlay[format] && self.html.desired;
- self.flash.support[format] = self.flash.canPlay[format] && self.flash.desired;
- });
- // If jPlayer is supporting any format in a solution, then the solution is used.
- this.html.used = false;
- this.flash.used = false;
- $.each(this.solutions, function(solutionPriority, solution) {
- $.each(self.formats, function(formatPriority, format) {
- if(self[solution].support[format]) {
- self[solution].used = true;
- return false;
- }
- });
- });
-
- // Init solution active state and the event gates to false.
- this._resetActive();
- this._resetGate();
-
- // Set up the css selectors for the control and feedback entities.
- this._cssSelectorAncestor(this.options.cssSelectorAncestor);
-
- // If neither html nor flash are being used by this browser, then media playback is not possible. Trigger an error event.
- if(!(this.html.used || this.flash.used)) {
- this._error( {
- type: $.jPlayer.error.NO_SOLUTION,
- context: "{solution:'" + this.options.solution + "', supplied:'" + this.options.supplied + "'}",
- message: $.jPlayer.errorMsg.NO_SOLUTION,
- hint: $.jPlayer.errorHint.NO_SOLUTION
- });
- if(this.css.jq.noSolution.length) {
- this.css.jq.noSolution.show();
- }
- } else {
- if(this.css.jq.noSolution.length) {
- this.css.jq.noSolution.hide();
- }
- }
-
- // Add the flash solution if it is being used.
- if(this.flash.used) {
- var htmlObj,
- flashVars = 'jQuery=' + encodeURI(this.options.noConflict) + '&id=' + encodeURI(this.internal.self.id) + '&vol=' + this.options.volume + '&muted=' + this.options.muted;
-
- // Code influenced by SWFObject 2.2: http://code.google.com/p/swfobject/
- // Non IE browsers have an initial Flash size of 1 by 1 otherwise the wmode affected the Flash ready event.
-
- if($.browser.msie && Number($.browser.version) <= 8) {
- var objStr = '<object id="' + this.internal.flash.id + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0"></object>';
-
- var paramStr = [
- '<param name="movie" value="' + this.internal.flash.swf + '" />',
- '<param name="FlashVars" value="' + flashVars + '" />',
- '<param name="allowScriptAccess" value="always" />',
- '<param name="bgcolor" value="' + this.options.backgroundColor + '" />',
- '<param name="wmode" value="' + this.options.wmode + '" />'
- ];
-
- htmlObj = document.createElement(objStr);
- for(var i=0; i < paramStr.length; i++) {
- htmlObj.appendChild(document.createElement(paramStr[i]));
- }
- } else {
- var createParam = function(el, n, v) {
- var p = document.createElement("param");
- p.setAttribute("name", n);
- p.setAttribute("value", v);
- el.appendChild(p);
- };
-
- htmlObj = document.createElement("object");
- htmlObj.setAttribute("id", this.internal.flash.id);
- htmlObj.setAttribute("data", this.internal.flash.swf);
- htmlObj.setAttribute("type", "application/x-shockwave-flash");
- htmlObj.setAttribute("width", "1"); // Non-zero
- htmlObj.setAttribute("height", "1"); // Non-zero
- createParam(htmlObj, "flashvars", flashVars);
- createParam(htmlObj, "allowscriptaccess", "always");
- createParam(htmlObj, "bgcolor", this.options.backgroundColor);
- createParam(htmlObj, "wmode", this.options.wmode);
- }
-
- this.element.append(htmlObj);
- this.internal.flash.jq = $(htmlObj);
- }
-
- // Add the HTML solution if being used.
- if(this.html.used) {
-
- // The HTML Audio handlers
- if(this.html.audio.available) {
- this._addHtmlEventListeners(this.htmlElement.audio, this.html.audio);
- this.element.append(this.htmlElement.audio);
- this.internal.audio.jq = $("#" + this.internal.audio.id);
- }
-
- // The HTML Video handlers
- if(this.html.video.available) {
- this._addHtmlEventListeners(this.htmlElement.video, this.html.video);
- this.element.append(this.htmlElement.video);
- this.internal.video.jq = $("#" + this.internal.video.id);
- if(this.status.nativeVideoControls) {
- this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height});
- } else {
- this.internal.video.jq.css({'width':'0px', 'height':'0px'}); // Using size 0x0 since a .hide() causes issues in iOS
- }
- this.internal.video.jq.bind("click.jPlayer", function() {
- self._trigger($.jPlayer.event.click);
- });
- }
- }
-
- // Create the bridge that emulates the HTML Media element on the jPlayer DIV
- if( this.options.emulateHtml ) {
- this._emulateHtmlBridge();
- }
-
- if(this.html.used && !this.flash.used) { // If only HTML, then emulate flash ready() call after 100ms.
- setTimeout( function() {
- self.internal.ready = true;
- self.version.flash = "n/a";
- self._trigger($.jPlayer.event.repeat); // Trigger the repeat event so its handler can initialize itself with the loop option.
- self._trigger($.jPlayer.event.ready);
- }, 100);
- }
-
- // Initialize the interface components with the options.
- this._updateNativeVideoControls(); // Must do this first, otherwise there is a bizarre bug in iOS 4.3.2, where the native controls are not shown. Fails in iOS if called after _updateButtons() below. Works if called later in setMedia too, so it odd.
- this._updateInterface();
- this._updateButtons(false);
- this._updateAutohide();
- this._updateVolume(this.options.volume);
- this._updateMute(this.options.muted);
- if(this.css.jq.videoPlay.length) {
- this.css.jq.videoPlay.hide();
- }
-
- $.jPlayer.prototype.count++; // Change static variable via prototype.
- },
- destroy: function() {
- // MJP: The background change remains. Would need to store the original to restore it correctly.
- // MJP: The jPlayer element's size change remains.
-
- // Clear the media to reset the GUI and stop any downloads. Streams on some browsers had persited. (Chrome)
- this.clearMedia();
- // Remove the size/sizeFull cssClass from the cssSelectorAncestor
- this._removeUiClass();
- // Remove the times from the GUI
- if(this.css.jq.currentTime.length) {
- this.css.jq.currentTime.text("");
- }
- if(this.css.jq.duration.length) {
- this.css.jq.duration.text("");
- }
- // Remove any bindings from the interface controls.
- $.each(this.css.jq, function(fn, jq) {
- // Check selector is valid before trying to execute method.
- if(jq.length) {
- jq.unbind(".jPlayer");
- }
- });
- // Remove the click handlers for $.jPlayer.event.click
- this.internal.poster.jq.unbind(".jPlayer");
- if(this.internal.video.jq) {
- this.internal.video.jq.unbind(".jPlayer");
- }
- // Destroy the HTML bridge.
- if(this.options.emulateHtml) {
- this._destroyHtmlBridge();
- }
- this.element.removeData("jPlayer"); // Remove jPlayer data
- this.element.unbind(".jPlayer"); // Remove all event handlers created by the jPlayer constructor
- this.element.empty(); // Remove the inserted child elements
-
- delete this.instances[this.internal.instance]; // Clear the instance on the static instance object
- },
- enable: function() { // Plan to implement
- // options.disabled = false
- },
- disable: function () { // Plan to implement
- // options.disabled = true
- },
- _testCanPlayType: function(elem) {
- // IE9 on Win Server 2008 did not implement canPlayType(), but it has the property.
- try {
- elem.canPlayType(this.format.mp3.codec); // The type is irrelevant.
- return true;
- } catch(err) {
- return false;
- }
- },
- _uaBlocklist: function(list) {
- // list : object with properties that are all regular expressions. Property names are irrelevant.
- // Returns true if the user agent is matched in list.
- var ua = navigator.userAgent.toLowerCase(),
- block = false;
-
- $.each(list, function(p, re) {
- if(re && re.test(ua)) {
- block = true;
- return false; // exit $.each.
- }
- });
- return block;
- },
- _restrictNativeVideoControls: function() {
- // Fallback to noFullScreen when nativeVideoControls is true and audio media is being used. Affects when both media types are used.
- if(this.require.audio) {
- if(this.status.nativeVideoControls) {
- this.status.nativeVideoControls = false;
- this.status.noFullScreen = true;
- }
- }
- },
- _updateNativeVideoControls: function() {
- if(this.html.video.available && this.html.used) {
- // Turn the HTML Video controls on/off
- this.htmlElement.video.controls = this.status.nativeVideoControls;
- // Show/hide the jPlayer GUI.
- this._updateAutohide();
- // For when option changed. The poster image is not updated, as it is dealt with in setMedia(). Acceptable degradation since seriously doubt these options will change on the fly. Can again review later.
- if(this.status.nativeVideoControls && this.require.video) {
- this.internal.poster.jq.hide();
- this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height});
- } else if(this.status.waitForPlay && this.status.video) {
- this.internal.poster.jq.show();
- this.internal.video.jq.css({'width': '0px', 'height': '0px'});
- }
- }
- },
- _addHtmlEventListeners: function(mediaElement, entity) {
- var self = this;
- mediaElement.preload = this.options.preload;
- mediaElement.muted = this.options.muted;
- mediaElement.volume = this.options.volume;
-
- // Create the event listeners
- // Only want the active entity to affect jPlayer and bubble events.
- // Using entity.gate so that object is referenced and gate property always current
-
- mediaElement.addEventListener("progress", function() {
- if(entity.gate) {
- self._getHtmlStatus(mediaElement);
- self._updateInterface();
- self._trigger($.jPlayer.event.progress);
- }
- }, false);
- mediaElement.addEventListener("timeupdate", function() {
- if(entity.gate) {
- self._getHtmlStatus(mediaElement);
- self._updateInterface();
- self._trigger($.jPlayer.event.timeupdate);
- }
- }, false);
- mediaElement.addEventListener("durationchange", function() {
- if(entity.gate) {
- self.status.duration = this.duration;
- self._getHtmlStatus(mediaElement);
- self._updateInterface();
- self._trigger($.jPlayer.event.durationchange);
- }
- }, false);
- mediaElement.addEventListener("play", function() {
- if(entity.gate) {
- self._updateButtons(true);
- self._html_checkWaitForPlay(); // So the native controls update this variable and puts the hidden interface in the correct state. Affects toggling native controls.
- self._trigger($.jPlayer.event.play);
- }
- }, false);
- mediaElement.addEventListener("playing", function() {
- if(entity.gate) {
- self._updateButtons(true);
- self._seeked();
- self._trigger($.jPlayer.event.playing);
- }
- }, false);
- mediaElement.addEventListener("pause", function() {
- if(entity.gate) {
- self._updateButtons(false);
- self._trigger($.jPlayer.event.pause);
- }
- }, false);
- mediaElement.addEventListener("waiting", function() {
- if(entity.gate) {
- self._seeking();
- self._trigger($.jPlayer.event.waiting);
- }
- }, false);
- mediaElement.addEventListener("seeking", function() {
- if(entity.gate) {
- self._seeking();
- self._trigger($.jPlayer.event.seeking);
- }
- }, false);
- mediaElement.addEventListener("seeked", function() {
- if(entity.gate) {
- self._seeked();
- self._trigger($.jPlayer.event.seeked);
- }
- }, false);
- mediaElement.addEventListener("volumechange", function() {
- if(entity.gate) {
- // Read the values back from the element as the Blackberry PlayBook shares the volume with the physical buttons master volume control.
- // However, when tested 6th July 2011, those buttons do not generate an event. The physical play/pause button does though.
- self.options.volume = mediaElement.volume;
- self.options.muted = mediaElement.muted;
- self._updateMute();
- self._updateVolume();
- self._trigger($.jPlayer.event.volumechange);
- }
- }, false);
- mediaElement.addEventListener("suspend", function() { // Seems to be the only way of capturing that the iOS4 browser did not actually play the media from the page code. ie., It needs a user gesture.
- if(entity.gate) {
- self._seeked();
- self._trigger($.jPlayer.event.suspend);
- }
- }, false);
- mediaElement.addEventListener("ended", function() {
- if(entity.gate) {
- // Order of the next few commands are important. Change the time and then pause.
- // Solves a bug in Firefox, where issuing pause 1st causes the media to play from the start. ie., The pause is ignored.
- if(!$.jPlayer.browser.webkit) { // Chrome crashes if you do this in conjunction with a setMedia command in an ended event handler. ie., The playlist demo.
- self.htmlElement.media.currentTime = 0; // Safari does not care about this command. ie., It works with or without this line. (Both Safari and Chrome are Webkit.)
- }
- self.htmlElement.media.pause(); // Pause otherwise a click on the progress bar will play from that point, when it shouldn't, since it stopped playback.
- self._updateButtons(false);
- self._getHtmlStatus(mediaElement, true); // With override true. Otherwise Chrome leaves progress at full.
- self._updateInterface();
- self._trigger($.jPlayer.event.ended);
- }
- }, false);
- mediaElement.addEventListener("error", function() {
- if(entity.gate) {
- self._updateButtons(false);
- self._seeked();
- if(self.status.srcSet) { // Deals with case of clearMedia() causing an error event.
- clearTimeout(self.internal.htmlDlyCmdId); // Clears any delayed commands used in the HTML solution.
- self.status.waitForLoad = true; // Allows the load operation to try again.
- self.status.waitForPlay = true; // Reset since a play was captured.
- if(self.status.video && !self.status.nativeVideoControls) {
- self.internal.video.jq.css({'width':'0px', 'height':'0px'});
- }
- if(self._validString(self.status.media.poster) && !self.status.nativeVideoControls) {
- self.internal.poster.jq.show();
- }
- if(self.css.jq.videoPlay.length) {
- self.css.jq.videoPlay.show();
- }
- self._error( {
- type: $.jPlayer.error.URL,
- context: self.status.src, // this.src shows absolute urls. Want context to show the url given.
- message: $.jPlayer.errorMsg.URL,
- hint: $.jPlayer.errorHint.URL
- });
- }
- }
- }, false);
- // Create all the other event listeners that bubble up to a jPlayer event from html, without being used by jPlayer.
- $.each($.jPlayer.htmlEvent, function(i, eventType) {
- mediaElement.addEventListener(this, function() {
- if(entity.gate) {
- self._trigger($.jPlayer.event[eventType]);
- }
- }, false);
- });
- },
- _getHtmlStatus: function(media, override) {
- var ct = 0, d = 0, cpa = 0, sp = 0, cpr = 0;
-
- if(media.duration) { // Fixes the duration bug in iOS, where the durationchange event occurs when media.duration is not always correct.
- this.status.duration = media.duration;
- }
- ct = media.currentTime;
- cpa = (this.status.duration > 0) ? 100 * ct / this.status.duration : 0;
- if((typeof media.seekable === "object") && (media.seekable.length > 0)) {
- sp = (this.status.duration > 0) ? 100 * media.seekable.end(media.seekable.length-1) / this.status.duration : 100;
- cpr = 100 * media.currentTime / media.seekable.end(media.seekable.length-1);
- } else {
- sp = 100;
- cpr = cpa;
- }
-
- if(override) {
- ct = 0;
- cpr = 0;
- cpa = 0;
- }
-
- this.status.seekPercent = sp;
- this.status.currentPercentRelative = cpr;
- this.status.currentPercentAbsolute = cpa;
- this.status.currentTime = ct;
-
- this.status.readyState = media.readyState;
- this.status.networkState = media.networkState;
- this.status.playbackRate = media.playbackRate;
- this.status.ended = media.ended;
- },
- _resetStatus: function() {
- this.status = $.extend({}, this.status, $.jPlayer.prototype.status); // Maintains the status properties that persist through a reset.
- },
- _trigger: function(eventType, error, warning) { // eventType always valid as called using $.jPlayer.event.eventType
- var event = $.Event(eventType);
- event.jPlayer = {};
- event.jPlayer.version = $.extend({}, this.version);
- event.jPlayer.options = $.extend(true, {}, this.options); // Deep copy
- event.jPlayer.status = $.extend(true, {}, this.status); // Deep copy
- event.jPlayer.html = $.extend(true, {}, this.html); // Deep copy
- event.jPlayer.flash = $.extend(true, {}, this.flash); // Deep copy
- if(error) {
- event.jPlayer.error = $.extend({}, error);
- }
- if(warning) {
- event.jPlayer.warning = $.extend({}, warning);
- }
- this.element.trigger(event);
- },
- jPlayerFlashEvent: function(eventType, status) { // Called from Flash
- if(eventType === $.jPlayer.event.ready) {
- if(!this.internal.ready) {
- this.internal.ready = true;
- this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); // Once Flash generates the ready event, minimise to zero as it is not affected by wmode anymore.
-
- this.version.flash = status.version;
- if(this.version.needFlash !== this.version.flash) {
- this._error( {
- type: $.jPlayer.error.VERSION,
- context: this.version.flash,
- message: $.jPlayer.errorMsg.VERSION + this.version.flash,
- hint: $.jPlayer.errorHint.VERSION
- });
- }
- this._trigger($.jPlayer.event.repeat); // Trigger the repeat event so its handler can initialize itself with the loop option.
- this._trigger(eventType);
- } else {
- // This condition occurs if the Flash is hidden and then shown again.
- // Firefox also reloads the Flash if the CSS position changes. position:fixed is used for full screen.
-
- // Only do this if the Flash is the solution being used at the moment. Affects Media players where both solution may be being used.
- if(this.flash.gate) {
-
- // Send the current status to the Flash now that it is ready (available) again.
- if(this.status.srcSet) {
-
- // Need to read original status before issuing the setMedia command.
- var currentTime = this.status.currentTime,
- paused = this.status.paused;
-
- this.setMedia(this.status.media);
- if(currentTime > 0) {
- if(paused) {
- this.pause(currentTime);
- } else {
- this.play(currentTime);
- }
- }
- }
- this._trigger($.jPlayer.event.flashreset);
- }
- }
- }
- if(this.flash.gate) {
- switch(eventType) {
- case $.jPlayer.event.progress:
- this._getFlashStatus(status);
- this._updateInterface();
- this._trigger(eventType);
- break;
- case $.jPlayer.event.timeupdate:
- this._getFlashStatus(status);
- this._updateInterface();
- this._trigger(eventType);
- break;
- case $.jPlayer.event.play:
- this._seeked();
- this._updateButtons(true);
- this._trigger(eventType);
- break;
- case $.jPlayer.event.pause:
- this._updateButtons(false);
- this._trigger(eventType);
- break;
- case $.jPlayer.event.ended:
- this._updateButtons(false);
- this._trigger(eventType);
- break;
- case $.jPlayer.event.click:
- this._trigger(eventType); // This could be dealt with by the default
- break;
- case $.jPlayer.event.error:
- this.status.waitForLoad = true; // Allows the load operation to try again.
- this.status.waitForPlay = true; // Reset since a play was captured.
- if(this.status.video) {
- this.internal.flash.jq.css({'width':'0px', 'height':'0px'});
- }
- if(this._validString(this.status.media.poster)) {
- this.internal.poster.jq.show();
- }
- if(this.css.jq.videoPlay.length && this.status.video) {
- this.css.jq.videoPlay.show();
- }
- if(this.status.video) { // Set up for another try. Execute before error event.
- this._flash_setVideo(this.status.media);
- } else {
- this._flash_setAudio(this.status.media);
- }
- this._updateButtons(false);
- this._error( {
- type: $.jPlayer.error.URL,
- context:status.src,
- message: $.jPlayer.errorMsg.URL,
- hint: $.jPlayer.errorHint.URL
- });
- break;
- case $.jPlayer.event.seeking:
- this._seeking();
- this._trigger(eventType);
- break;
- case $.jPlayer.event.seeked:
- this._seeked();
- this._trigger(eventType);
- break;
- case $.jPlayer.event.ready:
- // The ready event is handled outside the switch statement.
- // Captured here otherwise 2 ready events would be generated if the ready event handler used setMedia.
- break;
- default:
- this._trigger(eventType);
- }
- }
- return false;
- },
- _getFlashStatus: function(status) {
- this.status.seekPercent = status.seekPercent;
- this.status.currentPercentRelative = status.currentPercentRelative;
- this.status.currentPercentAbsolute = status.currentPercentAbsolute;
- this.status.currentTime = status.currentTime;
- this.status.duration = status.duration;
-
- // The Flash does not generate this information in this release
- this.status.readyState = 4; // status.readyState;
- this.status.networkState = 0; // status.networkState;
- this.status.playbackRate = 1; // status.playbackRate;
- this.status.ended = false; // status.ended;
- },
- _updateButtons: function(playing) {
- if(playing !== undefined) {
- this.status.paused = !playing;
- if(this.css.jq.play.length && this.css.jq.pause.length) {
- if(playing) {
- this.css.jq.play.hide();
- this.css.jq.pause.show();
- } else {
- this.css.jq.play.show();
- this.css.jq.pause.hide();
- }
- }
- }
- if(this.css.jq.restoreScreen.length && this.css.jq.fullScreen.length) {
- if(this.status.noFullScreen) {
- this.css.jq.fullScreen.hide();
- this.css.jq.restoreScreen.hide();
- } else if(this.options.fullScreen) {
- this.css.jq.fullScreen.hide();
- this.css.jq.restoreScreen.show();
- } else {
- this.css.jq.fullScreen.show();
- this.css.jq.restoreScreen.hide();
- }
- }
- if(this.css.jq.repeat.length && this.css.jq.repeatOff.length) {
- if(this.options.loop) {
- this.css.jq.repeat.hide();
- this.css.jq.repeatOff.show();
- } else {
- this.css.jq.repeat.show();
- this.css.jq.repeatOff.hide();
- }
- }
- },
- _updateInterface: function() {
- if(this.css.jq.seekBar.length) {
- this.css.jq.seekBar.width(this.status.seekPercent+"%");
- }
- if(this.css.jq.playBar.length) {
- this.css.jq.playBar.width(this.status.currentPercentRelative+"%");
- }
- if(this.css.jq.currentTime.length) {
- this.css.jq.currentTime.text($.jPlayer.convertTime(this.status.currentTime));
- }
- if(this.css.jq.duration.length) {
- this.css.jq.duration.text($.jPlayer.convertTime(this.status.duration));
- }
- },
- _seeking: function() {
- if(this.css.jq.seekBar.length) {
- this.css.jq.seekBar.addClass("jp-seeking-bg");
- }
- },
- _seeked: function() {
- if(this.css.jq.seekBar.length) {
- this.css.jq.seekBar.removeClass("jp-seeking-bg");
- }
- },
- _resetGate: function() {
- this.html.audio.gate = false;
- this.html.video.gate = false;
- this.flash.gate = false;
- },
- _resetActive: function() {
- this.html.active = false;
- this.flash.active = false;
- },
- setMedia: function(media) {
-
- /* media[format] = String: URL of format. Must contain all of the supplied option's video or audio formats.
- * media.poster = String: Video poster URL.
- * media.subtitles = String: * NOT IMPLEMENTED * URL of subtitles SRT file
- * media.chapters = String: * NOT IMPLEMENTED * URL of chapters SRT file
- * media.stream = Boolean: * NOT IMPLEMENTED * Designating actual media streams. ie., "false/undefined" for files. Plan to refresh the flash every so often.
- */
-
- var self = this,
- supported = false,
- posterChanged = this.status.media.poster !== media.poster; // Compare before reset. Important for OSX Safari as this.htmlElement.poster.src is absolute, even if original poster URL was relative.
-
- this._resetMedia();
- this._resetGate();
- this._resetActive();
-
- $.each(this.formats, function(formatPriority, format) {
- var isVideo = self.format[format].media === 'video';
- $.each(self.solutions, function(solutionPriority, solution) {
- if(self[solution].support[format] && self._validString(media[format])) { // Format supported in solution and url given for format.
- var isHtml = solution === 'html';
-
- if(isVideo) {
- if(isHtml) {
- self.html.video.gate = true;
- self._html_setVideo(media);
- self.html.active = true;
- } else {
- self.flash.gate = true;
- self._flash_setVideo(media);
- self.flash.active = true;
- }
- if(self.css.jq.videoPlay.length) {
- self.css.jq.videoPlay.show();
- }
- self.status.video = true;
- } else {
- if(isHtml) {
- self.html.audio.gate = true;
- self._html_setAudio(media);
- self.html.active = true;
- } else {
- self.flash.gate = true;
- self._flash_setAudio(media);
- self.flash.active = true;
- }
- if(self.css.jq.videoPlay.length) {
- self.css.jq.videoPlay.hide();
- }
- self.status.video = false;
- }
-
- supported = true;
- return false; // Exit $.each
- }
- });
- if(supported) {
- return false; // Exit $.each
- }
- });
-
- if(supported) {
- if(!(this.status.nativeVideoControls && this.html.video.gate)) {
- // Set poster IMG if native video controls are not being used
- // Note: With IE the IMG onload event occurs immediately when cached.
- // Note: Poster hidden by default in _resetMedia()
- if(this._validString(media.poster)) {
- if(posterChanged) { // Since some browsers do not generate img onload event.
- this.htmlElement.poster.src = media.poster;
- } else {
- this.internal.poster.jq.show();
- }
- }
- }
- this.status.srcSet = true;
- this.status.media = $.extend({}, media);
- this._updateButtons(false);
- this._updateInterface();
- } else { // jPlayer cannot support any formats provided in this browser
- // Send an error event
- this._error( {
- type: $.jPlayer.error.NO_SUPPORT,
- context: "{supplied:'" + this.options.supplied + "'}",
- message: $.jPlayer.errorMsg.NO_SUPPORT,
- hint: $.jPlayer.errorHint.NO_SUPPORT
- });
- }
- },
- _resetMedia: function() {
- this._resetStatus();
- this._updateButtons(false);
- this._updateInterface();
- this._seeked();
- this.internal.poster.jq.hide();
-
- clearTimeout(this.internal.htmlDlyCmdId);
-
- if(this.html.active) {
- this._html_resetMedia();
- } else if(this.flash.active) {
- this._flash_resetMedia();
- }
- },
- clearMedia: function() {
- this._resetMedia();
-
- if(this.html.active) {
- this._html_clearMedia();
- } else if(this.flash.active) {
- this._flash_clearMedia();
- }
-
- this._resetGate();
- this._resetActive();
- },
- load: function() {
- if(this.status.srcSet) {
- if(this.html.active) {
- this._html_load();
- } else if(this.flash.active) {
- this._flash_load();
- }
- } else {
- this._urlNotSetError("load");
- }
- },
- play: function(time) {
- time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler
- if(this.status.srcSet) {
- if(this.html.active) {
- this._html_play(time);
- } else if(this.flash.active) {
- this._flash_play(time);
- }
- } else {
- this._urlNotSetError("play");
- }
- },
- videoPlay: function(e) { // Handles clicks on the play button over the video poster
- this.play();
- },
- pause: function(time) {
- time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler
- if(this.status.srcSet) {
- if(this.html.active) {
- this._html_pause(time);
- } else if(this.flash.active) {
- this._flash_pause(time);
- }
- } else {
- this._urlNotSetError("pause");
- }
- },
- pauseOthers: function() {
- var self = this;
- $.each(this.instances, function(i, element) {
- if(self.element !== element) { // Do not this instance.
- if(element.data("jPlayer").status.srcSet) { // Check that media is set otherwise would cause error event.
- element.jPlayer("pause");
- }
- }
- });
- },
- stop: function() {
- if(this.status.srcSet) {
- if(this.html.active) {
- this._html_pause(0);
- } else if(this.flash.active) {
- this._flash_pause(0);
- }
- } else {
- this._urlNotSetError("stop");
- }
- },
- playHead: function(p) {
- p = this._limitValue(p, 0, 100);
- if(this.status.srcSet) {
- if(this.html.active) {
- this._html_playHead(p);
- } else if(this.flash.active) {
- this._flash_playHead(p);
- }
- } else {
- this._urlNotSetError("playHead");
- }
- },
- _muted: function(muted) {
- this.options.muted = muted;
- if(this.html.used) {
- this._html_mute(muted);
- }
- if(this.flash.used) {
- this._flash_mute(muted);
- }
-
- // The HTML solution generates this event from the media element itself.
- if(!this.html.video.gate && !this.html.audio.gate) {
- this._updateMute(muted);
- this._updateVolume(this.options.volume);
- this._trigger($.jPlayer.event.volumechange);
- }
- },
- mute: function(mute) { // mute is either: undefined (true), an event object (true) or a boolean (muted).
- mute = mute === undefined ? true : !!mute;
- this._muted(mute);
- },
- unmute: function(unmute) { // unmute is either: undefined (true), an event object (true) or a boolean (!muted).
- unmute = unmute === undefined ? true : !!unmute;
- this._muted(!unmute);
- },
- _updateMute: function(mute) {
- if(mute === undefined) {
- mute = this.options.muted;
- }
- if(this.css.jq.mute.length && this.css.jq.unmute.length) {
- if(this.status.noVolume) {
- this.css.jq.mute.hide();
- this.css.jq.unmute.hide();
- } else if(mute) {
- this.css.jq.mute.hide();
- this.css.jq.unmute.show();
- } else {
- this.css.jq.mute.show();
- this.css.jq.unmute.hide();
- }
- }
- },
- volume: function(v) {
- v = this._limitValue(v, 0, 1);
- this.options.volume = v;
-
- if(this.html.used) {
- this._html_volume(v);
- }
- if(this.flash.used) {
- this._flash_volume(v);
- }
-
- // The HTML solution generates this event from the media element itself.
- if(!this.html.video.gate && !this.html.audio.gate) {
- this._updateVolume(v);
- this._trigger($.jPlayer.event.volumechange);
- }
- },
- volumeBar: function(e) { // Handles clicks on the volumeBar
- if(this.css.jq.volumeBar.length) {
- var offset = this.css.jq.volumeBar.offset(),
- x = e.pageX - offset.left,
- w = this.css.jq.volumeBar.width(),
- y = this.css.jq.volumeBar.height() - e.pageY + offset.top,
- h = this.css.jq.volumeBar.height();
-
- if(this.options.verticalVolume) {
- this.volume(y/h);
- } else {
- this.volume(x/w);
- }
- }
- if(this.options.muted) {
- this._muted(false);
- }
- },
- volumeBarValue: function(e) { // Handles clicks on the volumeBarValue
- this.volumeBar(e);
- },
- _updateVolume: function(v) {
- if(v === undefined) {
- v = this.options.volume;
- }
- v = this.options.muted ? 0 : v;
-
- if(this.status.noVolume) {
- if(this.css.jq.volumeBar.length) {
- this.css.jq.volumeBar.hide();
- }
- if(this.css.jq.volumeBarValue.length) {
- this.css.jq.volumeBarValue.hide();
- }
- if(this.css.jq.volumeMax.length) {
- this.css.jq.volumeMax.hide();
- }
- } else {
- if(this.css.jq.volumeBar.length) {
- this.css.jq.volumeBar.show();
- }
- if(this.css.jq.volumeBarValue.length) {
- this.css.jq.volumeBarValue.show();
- this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((v*100)+"%");
- }
- if(this.css.jq.volumeMax.length) {
- this.css.jq.volumeMax.show();
- }
- }
- },
- volumeMax: function() { // Handles clicks on the volume max
- this.volume(1);
- if(this.options.muted) {
- this._muted(false);
- }
- },
- _cssSelectorAncestor: function(ancestor) {
- var self = this;
- this.options.cssSelectorAncestor = ancestor;
- this._removeUiClass();
- this.ancestorJq = ancestor ? $(ancestor) : []; // Would use $() instead of [], but it is only 1.4+
- if(ancestor && this.ancestorJq.length !== 1) { // So empty strings do not generate the warning.
- this._warning( {
- type: $.jPlayer.warning.CSS_SELECTOR_COUNT,
- context: ancestor,
- message: $.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.ancestorJq.length + " found for cssSelectorAncestor.",
- hint: $.jPlayer.warningHint.CSS_SELECTOR_COUNT
- });
- }
- this._addUiClass();
- $.each(this.options.cssSelector, function(fn, cssSel) {
- self._cssSelector(fn, cssSel);
- });
- },
- _cssSelector: function(fn, cssSel) {
- var self = this;
- if(typeof cssSel === 'string') {
- if($.jPlayer.prototype.options.cssSelector[fn]) {
- if(this.css.jq[fn] && this.css.jq[fn].length) {
- this.css.jq[fn].unbind(".jPlayer");
- }
- this.options.cssSelector[fn] = cssSel;
- this.css.cs[fn] = this.options.cssSelectorAncestor + " " + cssSel;
-
- if(cssSel) { // Checks for empty string
- this.css.jq[fn] = $(this.css.cs[fn]);
- } else {
- this.css.jq[fn] = []; // To comply with the css.jq[fn].length check before its use. As of jQuery 1.4 could have used $() for an empty set.
- }
-
- if(this.css.jq[fn].length) {
- var handler = function(e) {
- self[fn](e);
- $(this).blur();
- return false;
- };
- this.css.jq[fn].bind("click.jPlayer", handler); // Using jPlayer namespace
- }
-
- if(cssSel && this.css.jq[fn].length !== 1) { // So empty strings do not generate the warning. ie., they just remove the old one.
- this._warning( {
- type: $.jPlayer.warning.CSS_SELECTOR_COUNT,
- context: this.css.cs[fn],
- message: $.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.css.jq[fn].length + " found for " + fn + " method.",
- hint: $.jPlayer.warningHint.CSS_SELECTOR_COUNT
- });
- }
- } else {
- this._warning( {
- type: $.jPlayer.warning.CSS_SELECTOR_METHOD,
- context: fn,
- message: $.jPlayer.warningMsg.CSS_SELECTOR_METHOD,
- hint: $.jPlayer.warningHint.CSS_SELECTOR_METHOD
- });
- }
- } else {
- this._warning( {
- type: $.jPlayer.warning.CSS_SELECTOR_STRING,
- context: cssSel,
- message: $.jPlayer.warningMsg.CSS_SELECTOR_STRING,
- hint: $.jPlayer.warningHint.CSS_SELECTOR_STRING
- });
- }
- },
- seekBar: function(e) { // Handles clicks on the seekBar
- if(this.css.jq.seekBar) {
- var offset = this.css.jq.seekBar.offset();
- var x = e.pageX - offset.left;
- var w = this.css.jq.seekBar.width();
- var p = 100*x/w;
- this.playHead(p);
- }
- },
- playBar: function(e) { // Handles clicks on the playBar
- this.seekBar(e);
- },
- repeat: function() { // Handle clicks on the repeat button
- this._loop(true);
- },
- repeatOff: function() { // Handle clicks on the repeatOff button
- this._loop(false);
- },
- _loop: function(loop) {
- if(this.options.loop !== loop) {
- this.options.loop = loop;
- this._updateButtons();
- this._trigger($.jPlayer.event.repeat);
- }
- },
-
- // Plan to review the cssSelector method to cope with missing associated functions accordingly.
-
- currentTime: function(e) { // Handles clicks on the text
- // Added to avoid errors using cssSelector system for the text
- },
- duration: function(e) { // Handles clicks on the text
- // Added to avoid errors using cssSelector system for the text
- },
- gui: function(e) { // Handles clicks on the gui
- // Added to avoid errors using cssSelector system for the gui
- },
- noSolution: function(e) { // Handles clicks on the error message
- // Added to avoid errors using cssSelector system for no-solution
- },
-
- // Options code adapted from ui.widget.js (1.8.7). Made changes so the key can use dot notation. To match previous getData solution in jPlayer 1.
- option: function(key, value) {
- var options = key;
-
- // Enables use: options(). Returns a copy of options object
- if ( arguments.length === 0 ) {
- return $.extend( true, {}, this.options );
- }
-
- if(typeof key === "string") {
- var keys = key.split(".");
-
- // Enables use: options("someOption") Returns a copy of the option. Supports dot notation.
- if(value === undefined) {
-
- var opt = $.extend(true, {}, this.options);
- for(var i = 0; i < keys.length; i++) {
- if(opt[keys[i]] !== undefined) {
- opt = opt[keys[i]];
- } else {
- this._warning( {
- type: $.jPlayer.warning.OPTION_KEY,
- context: key,
- message: $.jPlayer.warningMsg.OPTION_KEY,
- hint: $.jPlayer.warningHint.OPTION_KEY
- });
- return undefined;
- }
- }
- return opt;
- }
-
- // Enables use: options("someOptionObject", someObject}). Creates: {someOptionObject:someObject}
- // Enables use: options("someOption", someValue). Creates: {someOption:someValue}
- // Enables use: options("someOptionObject.someOption", someValue). Creates: {someOptionObject:{someOption:someValue}}
-
- options = {};
- var opts = options;
-
- for(var j = 0; j < keys.length; j++) {
- if(j < keys.length - 1) {
- opts[keys[j]] = {};
- opts = opts[keys[j]];
- } else {
- opts[keys[j]] = value;
- }
- }
- }
-
- // Otherwise enables use: options(optionObject). Uses original object (the key)
-
- this._setOptions(options);
-
- return this;
- },
- _setOptions: function(options) {
- var self = this;
- $.each(options, function(key, value) { // This supports the 2 level depth that the options of jPlayer has. Would review if we ever need more depth.
- self._setOption(key, value);
- });
-
- return this;
- },
- _setOption: function(key, value) {
- var self = this;
-
- // The ability to set options is limited at this time.
-
- switch(key) {
- case "volume" :
- this.volume(value);
- break;
- case "muted" :
- this._muted(value);
- break;
- case "cssSelectorAncestor" :
- this._cssSelectorAncestor(value); // Set and refresh all associations for the new ancestor.
- break;
- case "cssSelector" :
- $.each(value, function(fn, cssSel) {
- self._cssSelector(fn, cssSel); // NB: The option is set inside this function, after further validity checks.
- });
- break;
- case "fullScreen" :
- if(this.options[key] !== value) { // if changed
- this._removeUiClass();
- this.options[key] = value;
- this._refreshSize();
- }
- break;
- case "size" :
- if(!this.options.fullScreen && this.options[key].cssClass !== value.cssClass) {
- this._removeUiClass();
- }
- this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
- this._refreshSize();
- break;
- case "sizeFull" :
- if(this.options.fullScreen && this.options[key].cssClass !== value.cssClass) {
- this._removeUiClass();
- }
- this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
- this._refreshSize();
- break;
- case "autohide" :
- this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
- this._updateAutohide();
- break;
- case "loop" :
- this._loop(value);
- break;
- case "nativeVideoControls" :
- this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
- this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls);
- this._restrictNativeVideoControls();
- this._updateNativeVideoControls();
- break;
- case "noFullScreen" :
- this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
- this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls); // Need to check again as noFullScreen can depend on this flag and the restrict() can override it.
- this.status.noFullScreen = this._uaBlocklist(this.options.noFullScreen);
- this._restrictNativeVideoControls();
- this._updateButtons();
- break;
- case "noVolume" :
- this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
- this.status.noVolume = this._uaBlocklist(this.options.noVolume);
- this._updateVolume();
- this._updateMute();
- break;
- case "emulateHtml" :
- if(this.options[key] !== value) { // To avoid multiple event handlers being created, if true already.
- this.options[key] = value;
- if(value) {
- this._emulateHtmlBridge();
- } else {
- this._destroyHtmlBridge();
- }
- }
- break;
- }
-
- return this;
- },
- // End of: (Options code adapted from ui.widget.js)
-
- _refreshSize: function() {
- this._setSize(); // update status and jPlayer element size
- this._addUiClass(); // update the ui class
- this._updateSize(); // update internal sizes
- this._updateButtons();
- this._updateAutohide();
- this._trigger($.jPlayer.event.resize);
- },
- _setSize: function() {
- // Determine the current size from the options
- if(this.options.fullScreen) {
- this.status.width = this.options.sizeFull.width;
- this.status.height = this.options.sizeFull.height;
- this.status.cssClass = this.options.sizeFull.cssClass;
- } else {
- this.status.width = this.options.size.width;
- this.status.height = this.options.size.height;
- this.status.cssClass = this.options.size.cssClass;
- }
-
- // Set the size of the jPlayer area.
- this.element.css({'width': this.status.width, 'height': this.status.height});
- },
- _addUiClass: function() {
- if(this.ancestorJq.length) {
- this.ancestorJq.addClass(this.status.cssClass);
- }
- },
- _removeUiClass: function() {
- if(this.ancestorJq.length) {
- this.ancestorJq.removeClass(this.status.cssClass);
- }
- },
- _updateSize: function() {
- // The poster uses show/hide so can simply resize it.
- this.internal.poster.jq.css({'width': this.status.width, 'height': this.status.height});
-
- // Video html or flash resized if necessary at this time, or if native video controls being used.
- if(!this.status.waitForPlay && this.html.active && this.status.video || this.html.video.available && this.html.used && this.status.nativeVideoControls) {
- this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height});
- }
- else if(!this.status.waitForPlay && this.flash.active && this.status.video) {
- this.internal.flash.jq.css({'width': this.status.width, 'height': this.status.height});
- }
- },
- _updateAutohide: function() {
- var self = this,
- event = "mousemove.jPlayer",
- namespace = ".jPlayerAutohide",
- eventType = event + namespace,
- handler = function() {
- self.css.jq.gui.fadeIn(self.options.autohide.fadeIn, function() {
- clearTimeout(self.internal.autohideId);
- self.internal.autohideId = setTimeout( function() {
- self.css.jq.gui.fadeOut(self.options.autohide.fadeOut);
- }, self.options.autohide.hold);
- });
- };
-
- if(this.css.jq.gui.length) {
-
- // End animations first so that its callback is executed now.
- // Otherwise an in progress fadeIn animation still has the callback to fadeOut again.
- this.css.jq.gui.stop(true, true);
-
- // Removes the fadeOut operation from the fadeIn callback.
- clearTimeout(this.internal.autohideId);
-
- this.element.unbind(namespace);
- this.css.jq.gui.unbind(namespace);
-
- if(!this.status.nativeVideoControls) {
- if(this.options.fullScreen && this.options.autohide.full || !this.options.fullScreen && this.options.autohide.restored) {
- this.element.bind(eventType, handler);
- this.css.jq.gui.bind(eventType, handler);
- this.css.jq.gui.hide();
- } else {
- this.css.jq.gui.show();
- }
- } else {
- this.css.jq.gui.hide();
- }
- }
- },
- fullScreen: function() {
- this._setOption("fullScreen", true);
- },
- restoreScreen: function() {
- this._setOption("fullScreen", false);
- },
- _html_initMedia: function() {
- this.htmlElement.media.src = this.status.src;
-
- if(this.options.preload !== 'none') {
- this._html_load(); // See function for comments
- }
- this._trigger($.jPlayer.event.timeupdate); // The flash generates this event for its solution.
- },
- _html_setAudio: function(media) {
- var self = this;
- // Always finds a format due to checks in setMedia()
- $.each(this.formats, function(priority, format) {
- if(self.html.support[format] && media[format]) {
- self.status.src = media[format];
- self.status.format[format] = true;
- self.status.formatType = format;
- return false;
- }
- });
- this.htmlElement.media = this.htmlElement.audio;
- this._html_initMedia();
- },
- _html_setVideo: function(media) {
- var self = this;
- // Always finds a format due to checks in setMedia()
- $.each(this.formats, function(priority, format) {
- if(self.html.support[format] && media[format]) {
- self.status.src = media[format];
- self.status.format[format] = true;
- self.status.formatType = format;
- return false;
- }
- });
- if(this.status.nativeVideoControls) {
- this.htmlElement.video.poster = this._validString(media.poster) ? media.poster : "";
- }
- this.htmlElement.media = this.htmlElement.video;
- this._html_initMedia();
- },
- _html_resetMedia: function() {
- if(this.htmlElement.media) {
- if(this.htmlElement.media.id === this.internal.video.id && !this.status.nativeVideoControls) {
- this.internal.video.jq.css({'width':'0px', 'height':'0px'});
- }
- this.htmlElement.media.pause();
- }
- },
- _html_clearMedia: function() {
- if(this.htmlElement.media) {
- this.htmlElement.media.src = "";
- this.htmlElement.media.load(); // Stops an old, "in progress" download from continuing the download. Triggers the loadstart, error and emptied events, due to the empty src. Also an abort event if a download was in progress.
- }
- },
- _html_load: function() {
- // This function remains to allow the early HTML5 browsers to work, such as Firefox 3.6
- // A change in the W3C spec for the media.load() command means that this is no longer necessary.
- // This command should be removed and actually causes minor undesirable effects on some browsers. Such as loading the whole file and not only the metadata.
- if(this.status.waitForLoad) {
- this.status.waitForLoad = false;
- this.htmlElement.media.load();
- }
- clearTimeout(this.internal.htmlDlyCmdId);
- },
- _html_play: function(time) {
- var self = this;
- this._html_load(); // Loads if required and clears any delayed commands.
-
- this.htmlElement.media.play(); // Before currentTime attempt otherwise Firefox 4 Beta never loads.
-
- if(!isNaN(time)) {
- try {
- this.htmlElement.media.currentTime = time;
- } catch(err) {
- this.internal.htmlDlyCmdId = setTimeout(function() {
- self.play(time);
- }, 100);
- return; // Cancel execution and wait for the delayed command.
- }
- }
- this._html_checkWaitForPlay();
- },
- _html_pause: function(time) {
- var self = this;
-
- if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation.
- this._html_load(); // Loads if required and clears any delayed commands.
- } else {
- clearTimeout(this.internal.htmlDlyCmdId);
- }
-
- // Order of these commands is important for Safari (Win) and IE9. Pause then change currentTime.
- this.htmlElement.media.pause();
-
- if(!isNaN(time)) {
- try {
- this.htmlElement.media.currentTime = time;
- } catch(err) {
- this.internal.htmlDlyCmdId = setTimeout(function() {
- self.pause(time);
- }, 100);
- return; // Cancel execution and wait for the delayed command.
- }
- }
- if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button.
- this._html_checkWaitForPlay();
- }
- },
- _html_playHead: function(percent) {
- var self = this;
- this._html_load(); // Loads if required and clears any delayed commands.
- try {
- if((typeof this.htmlElement.media.seekable === "object") && (this.htmlElement.media.seekable.length > 0)) {
- this.htmlElement.media.currentTime = percent * this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1) / 100;
- } else if(this.htmlElement.media.duration > 0 && !isNaN(this.htmlElement.media.duration)) {
- this.htmlElement.media.currentTime = percent * this.htmlElement.media.duration / 100;
- } else {
- throw "e";
- }
- } catch(err) {
- this.internal.htmlDlyCmdId = setTimeout(function() {
- self.playHead(percent);
- }, 100);
- return; // Cancel execution and wait for the delayed command.
- }
- if(!this.status.waitForLoad) {
- this._html_checkWaitForPlay();
- }
- },
- _html_checkWaitForPlay: function() {
- if(this.status.waitForPlay) {
- this.status.waitForPlay = false;
- if(this.css.jq.videoPlay.length) {
- this.css.jq.videoPlay.hide();
- }
- if(this.status.video) {
- this.internal.poster.jq.hide();
- this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height});
- }
- }
- },
- _html_volume: function(v) {
- if(this.html.audio.available) {
- this.htmlElement.audio.volume = v;
- }
- if(this.html.video.available) {
- this.htmlElement.video.volume = v;
- }
- },
- _html_mute: function(m) {
- if(this.html.audio.available) {
- this.htmlElement.audio.muted = m;
- }
- if(this.html.video.available) {
- this.htmlElement.video.muted = m;
- }
- },
- _flash_setAudio: function(media) {
- var self = this;
- try {
- // Always finds a format due to checks in setMedia()
- $.each(this.formats, function(priority, format) {
- if(self.flash.support[format] && media[format]) {
- switch (format) {
- case "m4a" :
- case "fla" :
- self._getMovie().fl_setAudio_m4a(media[format]);
- break;
- case "mp3" :
- self._getMovie().fl_setAudio_mp3(media[format]);
- break;
- }
- self.status.src = media[format];
- self.status.format[format] = true;
- self.status.formatType = format;
- return false;
- }
- });
-
- if(this.options.preload === 'auto') {
- this._flash_load();
- this.status.waitForLoad = false;
- }
- } catch(err) { this._flashError(err); }
- },
- _flash_setVideo: function(media) {
- var self = this;
- try {
- // Always finds a format due to checks in setMedia()
- $.each(this.formats, function(priority, format) {
- if(self.flash.support[format] && media[format]) {
- switch (format) {
- case "m4v" :
- case "flv" :
- self._getMovie().fl_setVideo_m4v(media[format]);
- break;
- }
- self.status.src = media[format];
- self.status.format[format] = true;
- self.status.formatType = format;
- return false;
- }
- });
-
- if(this.options.preload === 'auto') {
- this._flash_load();
- this.status.waitForLoad = false;
- }
- } catch(err) { this._flashError(err); }
- },
- _flash_resetMedia: function() {
- this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); // Must do via CSS as setting attr() to zero causes a jQuery error in IE.
- this._flash_pause(NaN);
- },
- _flash_clearMedia: function() {
- try {
- this._getMovie().fl_clearMedia();
- } catch(err) { this._flashError(err); }
- },
- _flash_load: function() {
- try {
- this._getMovie().fl_load();
- } catch(err) { this._flashError(err); }
- this.status.waitForLoad = false;
- },
- _flash_play: function(time) {
- try {
- this._getMovie().fl_play(time);
- } catch(err) { this._flashError(err); }
- this.status.waitForLoad = false;
- this._flash_checkWaitForPlay();
- },
- _flash_pause: function(time) {
- try {
- this._getMovie().fl_pause(time);
- } catch(err) { this._flashError(err); }
- if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button.
- this.status.waitForLoad = false;
- this._flash_checkWaitForPlay();
- }
- },
- _flash_playHead: function(p) {
- try {
- this._getMovie().fl_play_head(p);
- } catch(err) { this._flashError(err); }
- if(!this.status.waitForLoad) {
- this._flash_checkWaitForPlay();
- }
- },
- _flash_checkWaitForPlay: function() {
- if(this.status.waitForPlay) {
- this.status.waitForPlay = false;
- if(this.css.jq.videoPlay.length) {
- this.css.jq.videoPlay.hide();
- }
- if(this.status.video) {
- this.internal.poster.jq.hide();
- this.internal.flash.jq.css({'width': this.status.width, 'height': this.status.height});
- }
- }
- },
- _flash_volume: function(v) {
- try {
- this._getMovie().fl_volume(v);
- } catch(err) { this._flashError(err); }
- },
- _flash_mute: function(m) {
- try {
- this._getMovie().fl_mute(m);
- } catch(err) { this._flashError(err); }
- },
- _getMovie: function() {
- return document[this.internal.flash.id];
- },
- _checkForFlash: function (version) {
- // Function checkForFlash adapted from FlashReplace by Robert Nyman
- // http://code.google.com/p/flashreplace/
- var flashIsInstalled = false;
- var flash;
- if(window.ActiveXObject){
- try{
- flash = new ActiveXObject(("ShockwaveFlash.ShockwaveFlash." + version));
- flashIsInstalled = true;
- }
- catch(e){
- // Throws an error if the version isn't available
- }
- }
- else if(navigator.plugins && navigator.mimeTypes.length > 0){
- flash = navigator.plugins["Shockwave Flash"];
- if(flash){
- var flashVersion = navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1");
- if(flashVersion >= version){
- flashIsInstalled = true;
- }
- }
- }
- return flashIsInstalled;
- },
- _validString: function(url) {
- return (url && typeof url === "string"); // Empty strings return false
- },
- _limitValue: function(value, min, max) {
- return (value < min) ? min : ((value > max) ? max : value);
- },
- _urlNotSetError: function(context) {
- this._error( {
- type: $.jPlayer.error.URL_NOT_SET,
- context: context,
- message: $.jPlayer.errorMsg.URL_NOT_SET,
- hint: $.jPlayer.errorHint.URL_NOT_SET
- });
- },
- _flashError: function(error) {
- var errorType;
- if(!this.internal.ready) {
- errorType = "FLASH";
- } else {
- errorType = "FLASH_DISABLED";
- }
- this._error( {
- type: $.jPlayer.error[errorType],
- context: this.internal.flash.swf,
- message: $.jPlayer.errorMsg[errorType] + error.message,
- hint: $.jPlayer.errorHint[errorType]
- });
- // Allow the audio player to recover if display:none and then shown again, or with position:fixed on Firefox.
- // This really only affects audio in a media player, as an audio player could easily move the jPlayer element away from such issues.
- this.internal.flash.jq.css({'width':'1px', 'height':'1px'});
- },
- _error: function(error) {
- this._trigger($.jPlayer.event.error, error);
- if(this.options.errorAlerts) {
- this._alert("Error!" + (error.message ? "\n\n" + error.message : "") + (error.hint ? "\n\n" + error.hint : "") + "\n\nContext: " + error.context);
- }
- },
- _warning: function(warning) {
- this._trigger($.jPlayer.event.warning, undefined, warning);
- if(this.options.warningAlerts) {
- this._alert("Warning!" + (warning.message ? "\n\n" + warning.message : "") + (warning.hint ? "\n\n" + warning.hint : "") + "\n\nContext: " + warning.context);
- }
- },
- _alert: function(message) {
- alert("jPlayer " + this.version.script + " : id='" + this.internal.self.id +"' : " + message);
- },
- _emulateHtmlBridge: function() {
- var self = this,
- methods = $.jPlayer.emulateMethods;
-
- // Emulate methods on jPlayer's DOM element.
- $.each( $.jPlayer.emulateMethods.split(/\s+/g), function(i, name) {
- self.internal.domNode[name] = function(arg) {
- self[name](arg);
- };
-
- });
-
- // Bubble jPlayer events to its DOM element.
- $.each($.jPlayer.event, function(eventName,eventType) {
- var nativeEvent = true;
- $.each( $.jPlayer.reservedEvent.split(/\s+/g), function(i, name) {
- if(name === eventName) {
- nativeEvent = false;
- return false;
- }
- });
- if(nativeEvent) {
- self.element.bind(eventType + ".jPlayer.jPlayerHtml", function() { // With .jPlayer & .jPlayerHtml namespaces.
- self._emulateHtmlUpdate();
- var domEvent = document.createEvent("Event");
- domEvent.initEvent(eventName, false, true);
- self.internal.domNode.dispatchEvent(domEvent);
- });
- }
- // The error event would require a special case
- });
-
- // IE9 has a readyState property on all elements. The document should have it, but all (except media) elements inherit it in IE9. This conflicts with Popcorn, which polls the readyState.
- },
- _emulateHtmlUpdate: function() {
- var self = this;
-
- $.each( $.jPlayer.emulateStatus.split(/\s+/g), function(i, name) {
- self.internal.domNode[name] = self.status[name];
- });
- $.each( $.jPlayer.emulateOptions.split(/\s+/g), function(i, name) {
- self.internal.domNode[name] = self.options[name];
- });
- },
- _destroyHtmlBridge: function() {
- var self = this;
-
- // Bridge event handlers are also removed by destroy() through .jPlayer namespace.
- this.element.unbind(".jPlayerHtml"); // Remove all event handlers created by the jPlayer bridge. So you can change the emulateHtml option.
-
- // Remove the methods and properties
- var emulated = $.jPlayer.emulateMethods + " " + $.jPlayer.emulateStatus + " " + $.jPlayer.emulateOptions;
- $.each( emulated.split(/\s+/g), function(i, name) {
- delete self.internal.domNode[name];
- });
- }
- };
-
- $.jPlayer.error = {
- FLASH: "e_flash",
- FLASH_DISABLED: "e_flash_disabled",
- NO_SOLUTION: "e_no_solution",
- NO_SUPPORT: "e_no_support",
- URL: "e_url",
- URL_NOT_SET: "e_url_not_set",
- VERSION: "e_version"
- };
-
- $.jPlayer.errorMsg = {
- FLASH: "jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ", // Used in: _flashError()
- FLASH_DISABLED: "jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ", // Used in: _flashError()
- NO_SOLUTION: "No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.", // Used in: _init()
- NO_SUPPORT: "It is not possible to play any media format provided in setMedia() on this browser using your current options.", // Used in: setMedia()
- URL: "Media URL could not be loaded.", // Used in: jPlayerFlashEvent() and _addHtmlEventListeners()
- URL_NOT_SET: "Attempt to issue media playback commands, while no media url is set.", // Used in: load(), play(), pause(), stop() and playHead()
- VERSION: "jPlayer " + $.jPlayer.prototype.version.script + " needs Jplayer.swf version " + $.jPlayer.prototype.version.needFlash + " but found " // Used in: jPlayerReady()
- };
-
- $.jPlayer.errorHint = {
- FLASH: "Check your swfPath option and that Jplayer.swf is there.",
- FLASH_DISABLED: "Check that you have not display:none; the jPlayer entity or any ancestor.",
- NO_SOLUTION: "Review the jPlayer options: support and supplied.",
- NO_SUPPORT: "Video or audio formats defined in the supplied option are missing.",
- URL: "Check media URL is valid.",
- URL_NOT_SET: "Use setMedia() to set the media URL.",
- VERSION: "Update jPlayer files."
- };
-
- $.jPlayer.warning = {
- CSS_SELECTOR_COUNT: "e_css_selector_count",
- CSS_SELECTOR_METHOD: "e_css_selector_method",
- CSS_SELECTOR_STRING: "e_css_selector_string",
- OPTION_KEY: "e_option_key"
- };
-
- $.jPlayer.warningMsg = {
- CSS_SELECTOR_COUNT: "The number of css selectors found did not equal one: ",
- CSS_SELECTOR_METHOD: "The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",
- CSS_SELECTOR_STRING: "The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",
- OPTION_KEY: "The option requested in jPlayer('option') is undefined."
- };
-
- $.jPlayer.warningHint = {
- CSS_SELECTOR_COUNT: "Check your css selector and the ancestor.",
- CSS_SELECTOR_METHOD: "Check your method name.",
- CSS_SELECTOR_STRING: "Check your css selector is a string.",
- OPTION_KEY: "Check your option name."
- };
-})(jQuery);
diff --git a/apps/media/js/jquery.jplayer.min.js b/apps/media/js/jquery.jplayer.min.js deleted file mode 100644 index 9ba8b0c45c7..00000000000 --- a/apps/media/js/jquery.jplayer.min.js +++ /dev/null @@ -1,2 +0,0 @@ - -(function($,undefined){$.fn.jPlayer=function(options){var name="jPlayer",isMethodCall=typeof options==="string",args=Array.prototype.slice.call(arguments,1),returnValue=this;options=!isMethodCall&&args.length?$.extend.apply(null,[true,options].concat(args)):options;if(isMethodCall&&options.charAt(0)==="_")return returnValue;if(isMethodCall){this.each(function(){var instance=$.data(this,name),methodValue=instance&&$.isFunction(instance[options])?instance[options].apply(instance,args):instance;if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue;return false}})}else this.each(function(){var instance=$.data(this,name);if(instance){instance.option(options||{})}else $.data(this,name,new $.jPlayer(options,this))});return returnValue};$.jPlayer=function(options,element){if(arguments.length){this.element=$(element);this.options=$.extend(true,{},this.options,options);var self=this;this.element.bind("remove.jPlayer",function(){self.destroy()});this._init()}};$.jPlayer.emulateMethods="load play pause";$.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";$.jPlayer.emulateOptions="muted volume";$.jPlayer.reservedEvent="ready flashreset resize repeat error warning";$.jPlayer.event={ready:"jPlayer_ready",flashreset:"jPlayer_flashreset",resize:"jPlayer_resize",repeat:"jPlayer_repeat",error:"jPlayer_error",warning:"jPlayer_warning",loadstart:"jPlayer_loadstart",progress:"jPlayer_progress",suspend:"jPlayer_suspend",abort:"jPlayer_abort",emptied:"jPlayer_emptied",stalled:"jPlayer_stalled",play:"jPlayer_play",pause:"jPlayer_pause",loadedmetadata:"jPlayer_loadedmetadata",loadeddata:"jPlayer_loadeddata",waiting:"jPlayer_waiting",playing:"jPlayer_playing",canplay:"jPlayer_canplay",canplaythrough:"jPlayer_canplaythrough",seeking:"jPlayer_seeking",seeked:"jPlayer_seeked",timeupdate:"jPlayer_timeupdate",ended:"jPlayer_ended",ratechange:"jPlayer_ratechange",durationchange:"jPlayer_durationchange",volumechange:"jPlayer_volumechange"};$.jPlayer.htmlEvent=["loadstart","abort","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","ratechange"];$.jPlayer.pause=function(){$.each($.jPlayer.prototype.instances,function(i,element){if(element.data("jPlayer").status.srcSet)element.jPlayer("pause")})};$.jPlayer.timeFormat={showHour:false,showMin:true,showSec:true,padHour:false,padMin:true,padSec:true,sepHour:":",sepMin:":",sepSec:""};$.jPlayer.convertTime=function(s){var myTime=new Date(s*1e3),hour=myTime.getUTCHours(),min=myTime.getUTCMinutes(),sec=myTime.getUTCSeconds(),strHour=($.jPlayer.timeFormat.padHour&&hour<10)?"0"+hour:hour,strMin=($.jPlayer.timeFormat.padMin&&min<10)?"0"+min:min,strSec=($.jPlayer.timeFormat.padSec&&sec<10)?"0"+sec:sec;return(($.jPlayer.timeFormat.showHour)?strHour+$.jPlayer.timeFormat.sepHour:"")+(($.jPlayer.timeFormat.showMin)?strMin+$.jPlayer.timeFormat.sepMin:"")+(($.jPlayer.timeFormat.showSec)?strSec+$.jPlayer.timeFormat.sepSec:"")};$.jPlayer.uaBrowser=function(userAgent){var ua=userAgent.toLowerCase(),rwebkit=/(webkit)[ \/]([\w.]+)/,ropera=/(opera)(?:.*version)?[ \/]([\w.]+)/,rmsie=/(msie) ([\w.]+)/,rmozilla=/(mozilla)(?:.*? rv:([\w.]+))?/,match=rwebkit.exec(ua)||ropera.exec(ua)||rmsie.exec(ua)||ua.indexOf("compatible")<0&&rmozilla.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"}};$.jPlayer.uaPlatform=function(userAgent){var ua=userAgent.toLowerCase(),rplatform=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/,rtablet=/(ipad|playbook)/,randroid=/(android)/,rmobile=/(mobile)/,platform=rplatform.exec(ua)||[],tablet=rtablet.exec(ua)||!rmobile.exec(ua)&&randroid.exec(ua)||[];return{platform:platform[1]||"",tablet:tablet[1]||""}};$.jPlayer.browser={};$.jPlayer.platform={};var browserMatch=$.jPlayer.uaBrowser(navigator.userAgent);if(browserMatch.browser){$.jPlayer.browser[browserMatch.browser]=true;$.jPlayer.browser.version=browserMatch.version};var platformMatch=$.jPlayer.uaPlatform(navigator.userAgent);if(platformMatch.platform){$.jPlayer.platform[platformMatch.platform]=true;$.jPlayer.platform.mobile=!platformMatch.tablet;$.jPlayer.platform.tablet=!!platformMatch.tablet};$.jPlayer.prototype={count:0,version:{script:"2.0.23",needFlash:"2.0.9",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",supplied:"mp3",preload:'metadata',volume:0.8,muted:false,wmode:"opaque",backgroundColor:"#000000",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen",repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui"},fullScreen:false,autohide:{restored:false,full:true,fadeIn:200,fadeOut:600,hold:1e3},loop:false,repeat:function(event){if(event.jPlayer.options.loop){$(this).unbind(".jPlayerRepeat").bind($.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){$(this).jPlayer("play")})}else $(this).unbind(".jPlayerRepeat")},idPrefix:"jp",noConflict:"jQuery",emulateHtml:false,errorAlerts:false,warningAlerts:false},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}},optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:true,format:{},formatType:"",waitForPlay:true,waitForLoad:true,srcSet:false,video:false,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,readyState:0,networkState:0,playbackRate:1,ended:0},internal:{ready:false},solution:{html:true,flash:true},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:true,media:'audio'},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:true,media:'audio'},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:false,media:'audio'},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:false,media:'audio'},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:false,media:'audio'},fla:{codec:'audio/x-flv',flashCanPlay:true,media:'audio'},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:true,media:'video'},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:false,media:'video'},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:false,media:'video'},flv:{codec:'video/x-flv',flashCanPlay:true,media:'video'}},_init:function(){var self=this;this.element.empty();this.status=$.extend({},this.status);this.internal=$.extend({},this.internal);this.internal.domNode=this.element.get(0);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css={};this.css.cs={};this.css.jq={};this.ancestorJq=[];this.options.volume=this._limitValue(this.options.volume,0,1);$.each(this.options.supplied.toLowerCase().split(","),function(index1,value1){var format=value1.replace(/^\s+|\s+$/g,"");if(self.format[format]){var dupFound=false;$.each(self.formats,function(index2,value2){if(format===value2){dupFound=true;return false}});if(!dupFound)self.formats.push(format)}});$.each(this.options.solution.toLowerCase().split(","),function(index1,value1){var solution=value1.replace(/^\s+|\s+$/g,"");if(self.solution[solution]){var dupFound=false;$.each(self.solutions,function(index2,value2){if(solution===value2){dupFound=true;return false}});if(!dupFound)self.solutions.push(solution)}});this.internal.instance="jp_"+this.count;this.instances[this.internal.instance]=this.element;if(!this.element.attr("id"))this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=$.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=$.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:undefined});this.internal.video=$.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:undefined});this.internal.flash=$.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:undefined,swf:this.options.swfPath+((this.options.swfPath!==""&&this.options.swfPath.slice(-1)!=="/")?"/":"")+"Jplayer.swf"});this.internal.poster=$.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:undefined});$.each($.jPlayer.event,function(eventName,eventType){if(self.options[eventName]!==undefined){self.element.bind(eventType+".jPlayer",self.options[eventName]);self.options[eventName]=undefined}});this.require.audio=false;this.require.video=false;$.each(this.formats,function(priority,format){self.require[self.format[format].media]=true});if(this.require.video){this.options=$.extend(true,{},this.optionsVideo,this.options)}else this.options=$.extend(true,{},this.optionsAudio,this.options);this._setSize();this.htmlElement.poster=document.createElement('img');this.htmlElement.poster.id=this.internal.poster.id;this.htmlElement.poster.onload=function(){if(!self.status.video||self.status.waitForPlay)self.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=$("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.html.audio.available=false;if(this.require.audio){this.htmlElement.audio=document.createElement('audio');this.htmlElement.audio.id=this.internal.audio.id;this.html.audio.available=!!this.htmlElement.audio.canPlayType};this.html.video.available=false;if(this.require.video){this.htmlElement.video=document.createElement('video');this.htmlElement.video.id=this.internal.video.id;this.html.video.available=!!this.htmlElement.video.canPlayType};this.flash.available=this._checkForFlash(10);this.html.canPlay={};this.flash.canPlay={};$.each(this.formats,function(priority,format){self.html.canPlay[format]=self.html[self.format[format].media].available&&""!==self.htmlElement[self.format[format].media].canPlayType(self.format[format].codec);self.flash.canPlay[format]=self.format[format].flashCanPlay&&self.flash.available});this.html.desired=false;this.flash.desired=false;$.each(this.solutions,function(solutionPriority,solution){if(solutionPriority===0){self[solution].desired=true}else{var audioCanPlay=false,videoCanPlay=false;$.each(self.formats,function(formatPriority,format){if(self[self.solutions[0]].canPlay[format])if(self.format[format].media==='video'){videoCanPlay=true}else audioCanPlay=true});self[solution].desired=(self.require.audio&&!audioCanPlay)||(self.require.video&&!videoCanPlay)}});this.html.support={};this.flash.support={};$.each(this.formats,function(priority,format){self.html.support[format]=self.html.canPlay[format]&&self.html.desired;self.flash.support[format]=self.flash.canPlay[format]&&self.flash.desired});this.html.used=false;this.flash.used=false;$.each(this.solutions,function(solutionPriority,solution){$.each(self.formats,function(formatPriority,format){if(self[solution].support[format]){self[solution].used=true;return false}})});this.html.active=false;this.html.audio.gate=false;this.html.video.gate=false;this.flash.active=false;this.flash.gate=false;this._cssSelectorAncestor(this.options.cssSelectorAncestor);if(!(this.html.used||this.flash.used))this._error({type:$.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:$.jPlayer.errorMsg.NO_SOLUTION,hint:$.jPlayer.errorHint.NO_SOLUTION});if(this.flash.used){var htmlObj,flashVars='jQuery='+encodeURI(this.options.noConflict)+'&id='+encodeURI(this.internal.self.id)+'&vol='+this.options.volume+'&muted='+this.options.muted;if($.browser.msie&&Number($.browser.version)<=8){var objStr='<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0"></object>',paramStr=['<param name="movie" value="'+this.internal.flash.swf+'" />','<param name="FlashVars" value="'+flashVars+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'];htmlObj=document.createElement(objStr);for(var i=0;i<paramStr.length;i++)htmlObj.appendChild(document.createElement(paramStr[i]))}else{var createParam=function(el,n,v){var p=document.createElement("param");p.setAttribute("name",n);p.setAttribute("value",v);el.appendChild(p)};htmlObj=document.createElement("object");htmlObj.setAttribute("id",this.internal.flash.id);htmlObj.setAttribute("data",this.internal.flash.swf);htmlObj.setAttribute("type","application/x-shockwave-flash");htmlObj.setAttribute("width","1");htmlObj.setAttribute("height","1");createParam(htmlObj,"flashvars",flashVars);createParam(htmlObj,"allowscriptaccess","always");createParam(htmlObj,"bgcolor",this.options.backgroundColor);createParam(htmlObj,"wmode",this.options.wmode)};this.element.append(htmlObj);this.internal.flash.jq=$(htmlObj)};if(this.html.used){if(this.html.audio.available){this._addHtmlEventListeners(this.htmlElement.audio,this.html.audio);this.element.append(this.htmlElement.audio);this.internal.audio.jq=$("#"+this.internal.audio.id)};if(this.html.video.available){this._addHtmlEventListeners(this.htmlElement.video,this.html.video);this.element.append(this.htmlElement.video);this.internal.video.jq=$("#"+this.internal.video.id);this.internal.video.jq.css({width:'0px',height:'0px'})}};if(this.options.emulateHtml)this._emulateHtmlBridge();if(this.html.used&&!this.flash.used)setTimeout(function(){self.internal.ready=true;self.version.flash="n/a";self._trigger($.jPlayer.event.repeat);self._trigger($.jPlayer.event.ready)},100);this._updateInterface();this._updateButtons(false);this._updateAutohide();this._updateVolume(this.options.volume);this._updateMute(this.options.muted);if(this.css.jq.videoPlay.length)this.css.jq.videoPlay.hide();$.jPlayer.prototype.count++},destroy:function(){this._resetStatus();this._updateInterface();this._seeked();if(this.css.jq.currentTime.length)this.css.jq.currentTime.text("");if(this.css.jq.duration.length)this.css.jq.duration.text("");if(this.status.srcSet)this.pause();$.each(this.css.jq,function(fn,jq){if(jq.length)jq.unbind(".jPlayer")});if(this.options.emulateHtml)this._destroyHtmlBridge();this.element.removeData("jPlayer");this.element.unbind(".jPlayer");this.element.empty();delete this.instances[this.internal.instance]},enable:function(){},disable:function(){},_addHtmlEventListeners:function(mediaElement,entity){var self=this;mediaElement.preload=this.options.preload;mediaElement.muted=this.options.muted;mediaElement.volume=this.options.volume;mediaElement.addEventListener("progress",function(){if(entity.gate&&!self.status.waitForLoad){self._getHtmlStatus(mediaElement);self._updateInterface();self._trigger($.jPlayer.event.progress)}},false);mediaElement.addEventListener("timeupdate",function(){if(entity.gate&&!self.status.waitForLoad){self._getHtmlStatus(mediaElement);self._updateInterface();self._trigger($.jPlayer.event.timeupdate)}},false);mediaElement.addEventListener("durationchange",function(){if(entity.gate&&!self.status.waitForLoad){self.status.duration=this.duration;self._getHtmlStatus(mediaElement);self._updateInterface();self._trigger($.jPlayer.event.durationchange)}},false);mediaElement.addEventListener("play",function(){if(entity.gate&&!self.status.waitForLoad){self._updateButtons(true);self._trigger($.jPlayer.event.play)}},false);mediaElement.addEventListener("playing",function(){if(entity.gate&&!self.status.waitForLoad){self._updateButtons(true);self._seeked();self._trigger($.jPlayer.event.playing)}},false);mediaElement.addEventListener("pause",function(){if(entity.gate&&!self.status.waitForLoad){self._updateButtons(false);self._trigger($.jPlayer.event.pause)}},false);mediaElement.addEventListener("waiting",function(){if(entity.gate&&!self.status.waitForLoad){self._seeking();self._trigger($.jPlayer.event.waiting)}},false);mediaElement.addEventListener("seeking",function(){if(entity.gate&&!self.status.waitForLoad){self._seeking();self._trigger($.jPlayer.event.seeking)}},false);mediaElement.addEventListener("seeked",function(){if(entity.gate&&!self.status.waitForLoad){self._seeked();self._trigger($.jPlayer.event.seeked)}},false);mediaElement.addEventListener("volumechange",function(){if(entity.gate&&!self.status.waitForLoad){self.options.volume=mediaElement.volume;self.options.muted=mediaElement.muted;self._updateMute();self._updateVolume();self._trigger($.jPlayer.event.volumechange)}},false);mediaElement.addEventListener("suspend",function(){if(entity.gate&&!self.status.waitForLoad){self._seeked();self._trigger($.jPlayer.event.suspend)}},false);mediaElement.addEventListener("ended",function(){if(entity.gate&&!self.status.waitForLoad){if(!$.jPlayer.browser.webkit)self.htmlElement.media.currentTime=0;self.htmlElement.media.pause();self._updateButtons(false);self._getHtmlStatus(mediaElement,true);self._updateInterface();self._trigger($.jPlayer.event.ended)}},false);mediaElement.addEventListener("error",function(){if(entity.gate&&!self.status.waitForLoad){self._updateButtons(false);self._seeked();if(self.status.srcSet){clearTimeout(self.internal.htmlDlyCmdId);self.status.waitForLoad=true;self.status.waitForPlay=true;if(self.status.video)self.internal.video.jq.css({width:'0px',height:'0px'});if(self._validString(self.status.media.poster))self.internal.poster.jq.show();if(self.css.jq.videoPlay.length)self.css.jq.videoPlay.show();self._error({type:$.jPlayer.error.URL,context:self.status.src,message:$.jPlayer.errorMsg.URL,hint:$.jPlayer.errorHint.URL})}}},false);$.each($.jPlayer.htmlEvent,function(i,eventType){mediaElement.addEventListener(this,function(){if(entity.gate&&!self.status.waitForLoad)self._trigger($.jPlayer.event[eventType])},false)})},_getHtmlStatus:function(media,override){var ct=0,d=0,cpa=0,sp=0,cpr=0;if(media.duration)this.status.duration=media.duration;ct=media.currentTime;cpa=(this.status.duration>0)?100*ct/this.status.duration:0;if((typeof media.seekable==="object")&&(media.seekable.length>0)){sp=(this.status.duration>0)?100*media.seekable.end(media.seekable.length-1)/this.status.duration:100;cpr=100*media.currentTime/media.seekable.end(media.seekable.length-1)}else{sp=100;cpr=cpa};if(override){ct=0;cpr=0;cpa=0};this.status.seekPercent=sp;this.status.currentPercentRelative=cpr;this.status.currentPercentAbsolute=cpa;this.status.currentTime=ct;this.status.readyState=media.readyState;this.status.networkState=media.networkState;this.status.playbackRate=media.playbackRate;this.status.ended=media.ended},_resetStatus:function(){this.status=$.extend({},this.status,$.jPlayer.prototype.status)},_trigger:function(eventType,error,warning){var event=$.Event(eventType);event.jPlayer={};event.jPlayer.version=$.extend({},this.version);event.jPlayer.options=$.extend(true,{},this.options);event.jPlayer.status=$.extend(true,{},this.status);event.jPlayer.html=$.extend(true,{},this.html);event.jPlayer.flash=$.extend(true,{},this.flash);if(error)event.jPlayer.error=$.extend({},error);if(warning)event.jPlayer.warning=$.extend({},warning);this.element.trigger(event)},jPlayerFlashEvent:function(eventType,status){if(eventType===$.jPlayer.event.ready)if(!this.internal.ready){this.internal.ready=true;this.internal.flash.jq.css({width:'0px',height:'0px'});this.version.flash=status.version;if(this.version.needFlash!==this.version.flash)this._error({type:$.jPlayer.error.VERSION,context:this.version.flash,message:$.jPlayer.errorMsg.VERSION+this.version.flash,hint:$.jPlayer.errorHint.VERSION});this._trigger($.jPlayer.event.repeat);this._trigger(eventType)}else if(this.flash.gate){if(this.status.srcSet){var currentTime=this.status.currentTime,paused=this.status.paused;this.setMedia(this.status.media);if(currentTime>0)if(paused){this.pause(currentTime)}else this.play(currentTime)};this._trigger($.jPlayer.event.flashreset)};if(this.flash.gate)switch(eventType){case $.jPlayer.event.progress:this._getFlashStatus(status);this._updateInterface();this._trigger(eventType);break;case $.jPlayer.event.timeupdate:this._getFlashStatus(status);this._updateInterface();this._trigger(eventType);break;case $.jPlayer.event.play:this._seeked();this._updateButtons(true);this._trigger(eventType);break;case $.jPlayer.event.pause:this._updateButtons(false);this._trigger(eventType);break;case $.jPlayer.event.ended:this._updateButtons(false);this._trigger(eventType);break;case $.jPlayer.event.error:this.status.waitForLoad=true;this.status.waitForPlay=true;if(this.status.video)this.internal.flash.jq.css({width:'0px',height:'0px'});if(this._validString(this.status.media.poster))this.internal.poster.jq.show();if(this.css.jq.videoPlay.length)this.css.jq.videoPlay.show();if(this.status.video){this._flash_setVideo(this.status.media)}else this._flash_setAudio(this.status.media);this._error({type:$.jPlayer.error.URL,context:status.src,message:$.jPlayer.errorMsg.URL,hint:$.jPlayer.errorHint.URL});break;case $.jPlayer.event.seeking:this._seeking();this._trigger(eventType);break;case $.jPlayer.event.seeked:this._seeked();this._trigger(eventType);break;case $.jPlayer.event.ready:break;default:this._trigger(eventType)};return false},_getFlashStatus:function(status){this.status.seekPercent=status.seekPercent;this.status.currentPercentRelative=status.currentPercentRelative;this.status.currentPercentAbsolute=status.currentPercentAbsolute;this.status.currentTime=status.currentTime;this.status.duration=status.duration;this.status.readyState=4;this.status.networkState=0;this.status.playbackRate=1;this.status.ended=false},_updateButtons:function(playing){if(playing!==undefined){this.status.paused=!playing;if(this.css.jq.play.length&&this.css.jq.pause.length)if(playing){this.css.jq.play.hide();this.css.jq.pause.show()}else{this.css.jq.play.show();this.css.jq.pause.hide()}};if(this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length)if(this.options.fullScreen){this.css.jq.fullScreen.hide();this.css.jq.restoreScreen.show()}else{this.css.jq.fullScreen.show();this.css.jq.restoreScreen.hide()};if(this.css.jq.repeat.length&&this.css.jq.repeatOff.length)if(this.options.loop){this.css.jq.repeat.hide();this.css.jq.repeatOff.show()}else{this.css.jq.repeat.show();this.css.jq.repeatOff.hide()}},_updateInterface:function(){if(this.css.jq.seekBar.length)this.css.jq.seekBar.width(this.status.seekPercent+"%");if(this.css.jq.playBar.length)this.css.jq.playBar.width(this.status.currentPercentRelative+"%");if(this.css.jq.currentTime.length)this.css.jq.currentTime.text($.jPlayer.convertTime(this.status.currentTime));if(this.css.jq.duration.length)this.css.jq.duration.text($.jPlayer.convertTime(this.status.duration))},_seeking:function(){if(this.css.jq.seekBar.length)this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){if(this.css.jq.seekBar.length)this.css.jq.seekBar.removeClass("jp-seeking-bg")},setMedia:function(media){var self=this;this._seeked();clearTimeout(this.internal.htmlDlyCmdId);var audioGate=this.html.audio.gate,videoGate=this.html.video.gate,supported=false;$.each(this.formats,function(formatPriority,format){var isVideo=self.format[format].media==='video';$.each(self.solutions,function(solutionPriority,solution){if(self[solution].support[format]&&self._validString(media[format])){var isHtml=solution==='html';if(isVideo){if(isHtml){self.html.audio.gate=false;self.html.video.gate=true;self.flash.gate=false}else{self.html.audio.gate=false;self.html.video.gate=false;self.flash.gate=true}}else if(isHtml){self.html.audio.gate=true;self.html.video.gate=false;self.flash.gate=false}else{self.html.audio.gate=false;self.html.video.gate=false;self.flash.gate=true};if(self.flash.active||(self.html.active&&self.flash.gate)||(audioGate===self.html.audio.gate&&videoGate===self.html.video.gate)){self.clearMedia()}else if(audioGate!==self.html.audio.gate&&videoGate!==self.html.video.gate){self._html_pause();if(self.status.video)self.internal.video.jq.css({width:'0px',height:'0px'});self._resetStatus()};if(isVideo){if(isHtml){self._html_setVideo(media);self.html.active=true;self.flash.active=false}else{self._flash_setVideo(media);self.html.active=false;self.flash.active=true};if(self.css.jq.videoPlay.length)self.css.jq.videoPlay.show();self.status.video=true}else{if(isHtml){self._html_setAudio(media);self.html.active=true;self.flash.active=false}else{self._flash_setAudio(media);self.html.active=false;self.flash.active=true};if(self.css.jq.videoPlay.length)self.css.jq.videoPlay.hide();self.status.video=false};supported=true;return false}});if(supported)return false});if(supported){if(this._validString(media.poster)){if(this.htmlElement.poster.src!==media.poster){this.htmlElement.poster.src=media.poster}else this.internal.poster.jq.show()}else this.internal.poster.jq.hide();this.status.srcSet=true;this.status.media=$.extend({},media);this._updateButtons(false);this._updateInterface()}else{if(this.status.srcSet&&!this.status.waitForPlay)this.pause();this.html.audio.gate=false;this.html.video.gate=false;this.flash.gate=false;this.html.active=false;this.flash.active=false;this._resetStatus();this._updateInterface();this._updateButtons(false);this.internal.poster.jq.hide();if(this.html.used&&this.require.video)this.internal.video.jq.css({width:'0px',height:'0px'});if(this.flash.used)this.internal.flash.jq.css({width:'0px',height:'0px'});this._error({type:$.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:$.jPlayer.errorMsg.NO_SUPPORT,hint:$.jPlayer.errorHint.NO_SUPPORT})}},clearMedia:function(){this._resetStatus();this._updateButtons(false);this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);if(this.html.active){this._html_clearMedia()}else if(this.flash.active)this._flash_clearMedia()},load:function(){if(this.status.srcSet){if(this.html.active){this._html_load()}else if(this.flash.active)this._flash_load()}else this._urlNotSetError("load")},play:function(time){time=(typeof time==="number")?time:NaN;if(this.status.srcSet){if(this.html.active){this._html_play(time)}else if(this.flash.active)this._flash_play(time)}else this._urlNotSetError("play")},videoPlay:function(e){this.play()},pause:function(time){time=(typeof time==="number")?time:NaN;if(this.status.srcSet){if(this.html.active){this._html_pause(time)}else if(this.flash.active)this._flash_pause(time)}else this._urlNotSetError("pause")},pauseOthers:function(){var self=this;$.each(this.instances,function(i,element){if(self.element!==element)if(element.data("jPlayer").status.srcSet)element.jPlayer("pause")})},stop:function(){if(this.status.srcSet){if(this.html.active){this._html_pause(0)}else if(this.flash.active)this._flash_pause(0)}else this._urlNotSetError("stop")},playHead:function(p){p=this._limitValue(p,0,100);if(this.status.srcSet){if(this.html.active){this._html_playHead(p)}else if(this.flash.active)this._flash_playHead(p)}else this._urlNotSetError("playHead")},_muted:function(muted){this.options.muted=muted;if(this.html.used)this._html_mute(muted);if(this.flash.used)this._flash_mute(muted);if(this.flash.gate){this._updateMute(muted);this._updateVolume(this.options.volume);this._trigger($.jPlayer.event.volumechange)}},mute:function(mute){mute=mute===undefined?true:!!mute;this._muted(mute)},unmute:function(unmute){unmute=unmute===undefined?true:!!unmute;this._muted(!unmute)},_updateMute:function(mute){if(mute===undefined)mute=this.options.muted;if(this.css.jq.mute.length&&this.css.jq.unmute.length)if(mute){this.css.jq.mute.hide();this.css.jq.unmute.show()}else{this.css.jq.mute.show();this.css.jq.unmute.hide()}},volume:function(v){v=this._limitValue(v,0,1);this.options.volume=v;if(this.html.used)this._html_volume(v);if(this.flash.used)this._flash_volume(v);if(this.flash.gate){this._updateVolume(v);this._trigger($.jPlayer.event.volumechange)}},volumeBar:function(e){if(this.css.jq.volumeBar.length){var offset=this.css.jq.volumeBar.offset(),x=e.pageX-offset.left,w=this.css.jq.volumeBar.width(),v=x/w;this.volume(v)};if(this.options.muted)this._muted(false)},volumeBarValue:function(e){this.volumeBar(e)},_updateVolume:function(v){if(v===undefined)v=this.options.volume;v=this.options.muted?0:v;if(this.css.jq.volumeBarValue.length)this.css.jq.volumeBarValue.width((v*100)+"%")},volumeMax:function(){this.volume(1);if(this.options.muted)this._muted(false)},_cssSelectorAncestor:function(ancestor){var self=this;this.options.cssSelectorAncestor=ancestor;this._removeUiClass();this.ancestorJq=ancestor?$(ancestor):[];if(ancestor&&this.ancestorJq.length!==1)this._warning({type:$.jPlayer.warning.CSS_SELECTOR_COUNT,context:ancestor,message:$.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:$.jPlayer.warningHint.CSS_SELECTOR_COUNT});this._addUiClass();$.each(this.options.cssSelector,function(fn,cssSel){self._cssSelector(fn,cssSel)})},_cssSelector:function(fn,cssSel){var self=this;if(typeof cssSel==='string'){if($.jPlayer.prototype.options.cssSelector[fn]){if(this.css.jq[fn]&&this.css.jq[fn].length)this.css.jq[fn].unbind(".jPlayer");this.options.cssSelector[fn]=cssSel;this.css.cs[fn]=this.options.cssSelectorAncestor+" "+cssSel;if(cssSel){this.css.jq[fn]=$(this.css.cs[fn])}else this.css.jq[fn]=[];if(this.css.jq[fn].length){var handler=function(e){self[fn](e);$(this).blur();return false};this.css.jq[fn].bind("click.jPlayer",handler)};if(cssSel&&this.css.jq[fn].length!==1)this._warning({type:$.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[fn],message:$.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[fn].length+" found for "+fn+" method.",hint:$.jPlayer.warningHint.CSS_SELECTOR_COUNT})}else this._warning({type:$.jPlayer.warning.CSS_SELECTOR_METHOD,context:fn,message:$.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:$.jPlayer.warningHint.CSS_SELECTOR_METHOD})}else this._warning({type:$.jPlayer.warning.CSS_SELECTOR_STRING,context:cssSel,message:$.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:$.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(e){if(this.css.jq.seekBar){var offset=this.css.jq.seekBar.offset(),x=e.pageX-offset.left,w=this.css.jq.seekBar.width(),p=100*x/w;this.playHead(p)}},playBar:function(e){this.seekBar(e)},repeat:function(){this._loop(true)},repeatOff:function(){this._loop(false)},_loop:function(loop){if(this.options.loop!==loop){this.options.loop=loop;this._updateButtons();this._trigger($.jPlayer.event.repeat)}},currentTime:function(e){},duration:function(e){},gui:function(e){},option:function(key,value){var options=key;if(arguments.length===0)return $.extend(true,{},this.options);if(typeof key==="string"){var keys=key.split(".");if(value===undefined){var opt=$.extend(true,{},this.options);for(var i=0;i<keys.length;i++)if(opt[keys[i]]!==undefined){opt=opt[keys[i]]}else{this._warning({type:$.jPlayer.warning.OPTION_KEY,context:key,message:$.jPlayer.warningMsg.OPTION_KEY,hint:$.jPlayer.warningHint.OPTION_KEY});return undefined};return opt};options={};var opts=options;for(var j=0;j<keys.length;j++)if(j<keys.length-1){opts[keys[j]]={};opts=opts[keys[j]]}else opts[keys[j]]=value};this._setOptions(options);return this},_setOptions:function(options){var self=this;$.each(options,function(key,value){self._setOption(key,value)});return this},_setOption:function(key,value){var self=this;switch(key){case"volume":this.volume(value);break;case"muted":this._muted(value);break;case"cssSelectorAncestor":this._cssSelectorAncestor(value);break;case"cssSelector":$.each(value,function(fn,cssSel){self._cssSelector(fn,cssSel)});break;case"fullScreen":if(this.options[key]!==value){this._removeUiClass();this.options[key]=value;this._refreshSize()};break;case"size":if(!this.options.fullScreen&&this.options[key].cssClass!==value.cssClass)this._removeUiClass();this.options[key]=$.extend({},this.options[key],value);this._refreshSize();break;case"sizeFull":if(this.options.fullScreen&&this.options[key].cssClass!==value.cssClass)this._removeUiClass();this.options[key]=$.extend({},this.options[key],value);this._refreshSize();break;case"autohide":this.options[key]=$.extend({},this.options[key],value);this._updateAutohide();break;case"loop":this._loop(value);break;case"emulateHtml":if(this.options[key]!==value){this.options[key]=value;if(value){this._emulateHtmlBridge()}else this._destroyHtmlBridge()};break};return this},_refreshSize:function(){this._setSize();this._addUiClass();this._updateSize();this._updateButtons();this._updateAutohide();this._trigger($.jPlayer.event.resize)},_setSize:function(){if(this.options.fullScreen){this.status.width=this.options.sizeFull.width;this.status.height=this.options.sizeFull.height;this.status.cssClass=this.options.sizeFull.cssClass}else{this.status.width=this.options.size.width;this.status.height=this.options.size.height;this.status.cssClass=this.options.size.cssClass};this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){if(this.ancestorJq.length)this.ancestorJq.addClass(this.status.cssClass)},_removeUiClass:function(){if(this.ancestorJq.length)this.ancestorJq.removeClass(this.status.cssClass)},_updateSize:function(){this.internal.poster.jq.css({width:this.status.width,height:this.status.height});if(!this.status.waitForPlay)if(this.html.active&&this.status.video){this.internal.video.jq.css({width:this.status.width,height:this.status.height})}else if(this.flash.active)this.internal.flash.jq.css({width:this.status.width,height:this.status.height})},_updateAutohide:function(){var self=this,event="mousemove.jPlayer",namespace=".jPlayerAutohide",eventType=event+namespace,handler=function(){self.css.jq.gui.fadeIn(self.options.autohide.fadeIn,function(){clearTimeout(self.internal.autohideId);self.internal.autohideId=setTimeout(function(){self.css.jq.gui.fadeOut(self.options.autohide.fadeOut)},self.options.autohide.hold)})};clearTimeout(this.internal.autohideId);this.element.unbind(namespace);if(this.css.jq.gui.length){this.css.jq.gui.unbind(namespace);if(this.options.fullScreen&&this.options.autohide.full||!this.options.fullScreen&&this.options.autohide.restored){this.element.bind(eventType,handler);this.css.jq.gui.bind(eventType,handler);this.css.jq.gui.hide()}else this.css.jq.gui.stop(true,true).show()}},fullScreen:function(){this._setOption("fullScreen",true)},restoreScreen:function(){this._setOption("fullScreen",false)},_html_initMedia:function(){if(this.status.srcSet&&!this.status.waitForPlay)this.htmlElement.media.pause();if(this.options.preload!=='none')this._html_load();this._trigger($.jPlayer.event.timeupdate)},_html_setAudio:function(media){var self=this;$.each(this.formats,function(priority,format){if(self.html.support[format]&&media[format]){self.status.src=media[format];self.status.format[format]=true;self.status.formatType=format;return false}});this.htmlElement.media=this.htmlElement.audio;this._html_initMedia()},_html_setVideo:function(media){var self=this;$.each(this.formats,function(priority,format){if(self.html.support[format]&&media[format]){self.status.src=media[format];self.status.format[format]=true;self.status.formatType=format;return false}});this.htmlElement.media=this.htmlElement.video;this._html_initMedia()},_html_clearMedia:function(){if(this.htmlElement.media){if(this.htmlElement.media.id===this.internal.video.id)this.internal.video.jq.css({width:'0px',height:'0px'});this.htmlElement.media.pause();this.htmlElement.media.src="";this.htmlElement.media.load()}},_html_load:function(){if(this.status.waitForLoad){this.status.waitForLoad=false;this.htmlElement.media.src=this.status.src;this.htmlElement.media.load()};clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(time){var self=this;this._html_load();this.htmlElement.media.play();if(!isNaN(time))try{this.htmlElement.media.currentTime=time}catch(err){this.internal.htmlDlyCmdId=setTimeout(function(){self.play(time)},100);return};this._html_checkWaitForPlay()},_html_pause:function(time){var self=this;if(time>0){this._html_load()}else clearTimeout(this.internal.htmlDlyCmdId);this.htmlElement.media.pause();if(!isNaN(time))try{this.htmlElement.media.currentTime=time}catch(err){this.internal.htmlDlyCmdId=setTimeout(function(){self.pause(time)},100);return};if(time>0)this._html_checkWaitForPlay()},_html_playHead:function(percent){var self=this;this._html_load();try{if((typeof this.htmlElement.media.seekable==="object")&&(this.htmlElement.media.seekable.length>0)){this.htmlElement.media.currentTime=percent*this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1)/100}else if(this.htmlElement.media.duration>0&&!isNaN(this.htmlElement.media.duration)){this.htmlElement.media.currentTime=percent*this.htmlElement.media.duration/100}else throw"e"}catch(err){this.internal.htmlDlyCmdId=setTimeout(function(){self.playHead(percent)},100);return};if(!this.status.waitForLoad)this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;if(this.css.jq.videoPlay.length)this.css.jq.videoPlay.hide();if(this.status.video){this.internal.poster.jq.hide();this.internal.video.jq.css({width:this.status.width,height:this.status.height})}}},_html_volume:function(v){if(this.html.audio.available)this.htmlElement.audio.volume=v;if(this.html.video.available)this.htmlElement.video.volume=v},_html_mute:function(m){if(this.html.audio.available)this.htmlElement.audio.muted=m;if(this.html.video.available)this.htmlElement.video.muted=m},_flash_setAudio:function(media){var self=this;try{$.each(this.formats,function(priority,format){if(self.flash.support[format]&&media[format]){switch(format){case"m4a":case"fla":self._getMovie().fl_setAudio_m4a(media[format]);break;case"mp3":self._getMovie().fl_setAudio_mp3(media[format]);break};self.status.src=media[format];self.status.format[format]=true;self.status.formatType=format;return false}});if(this.options.preload==='auto'){this._flash_load();this.status.waitForLoad=false}}catch(err){this._flashError(err)}},_flash_setVideo:function(media){var self=this;try{$.each(this.formats,function(priority,format){if(self.flash.support[format]&&media[format]){switch(format){case"m4v":case"flv":self._getMovie().fl_setVideo_m4v(media[format]);break};self.status.src=media[format];self.status.format[format]=true;self.status.formatType=format;return false}});if(this.options.preload==='auto'){this._flash_load();this.status.waitForLoad=false}}catch(err){this._flashError(err)}},_flash_clearMedia:function(){this.internal.flash.jq.css({width:'0px',height:'0px'});try{this._getMovie().fl_clearMedia()}catch(err){this._flashError(err)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(err){this._flashError(err)};this.status.waitForLoad=false},_flash_play:function(time){try{this._getMovie().fl_play(time)}catch(err){this._flashError(err)};this.status.waitForLoad=false;this._flash_checkWaitForPlay()},_flash_pause:function(time){try{this._getMovie().fl_pause(time)}catch(err){this._flashError(err)};if(time>0){this.status.waitForLoad=false;this._flash_checkWaitForPlay()}},_flash_playHead:function(p){try{this._getMovie().fl_play_head(p)}catch(err){this._flashError(err)};if(!this.status.waitForLoad)this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;if(this.css.jq.videoPlay.length)this.css.jq.videoPlay.hide();if(this.status.video){this.internal.poster.jq.hide();this.internal.flash.jq.css({width:this.status.width,height:this.status.height})}}},_flash_volume:function(v){try{this._getMovie().fl_volume(v)}catch(err){this._flashError(err)}},_flash_mute:function(m){try{this._getMovie().fl_mute(m)}catch(err){this._flashError(err)}},_getMovie:function(){return document[this.internal.flash.id]},_checkForFlash:function(version){var flashIsInstalled=false,flash;if(window.ActiveXObject){try{flash=new ActiveXObject(("ShockwaveFlash.ShockwaveFlash."+version));flashIsInstalled=true}catch(e){}}else if(navigator.plugins&&navigator.mimeTypes.length>0){flash=navigator.plugins["Shockwave Flash"];if(flash){var flashVersion=navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1");if(flashVersion>=version)flashIsInstalled=true}};return flashIsInstalled},_validString:function(url){return(url&&typeof url==="string")},_limitValue:function(value,min,max){return(value<min)?min:((value>max)?max:value)},_urlNotSetError:function(context){this._error({type:$.jPlayer.error.URL_NOT_SET,context:context,message:$.jPlayer.errorMsg.URL_NOT_SET,hint:$.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(error){var errorType;if(!this.internal.ready){errorType="FLASH"}else errorType="FLASH_DISABLED";this._error({type:$.jPlayer.error[errorType],context:this.internal.flash.swf,message:$.jPlayer.errorMsg[errorType]+error.message,hint:$.jPlayer.errorHint[errorType]})},_error:function(error){this._trigger($.jPlayer.event.error,error);if(this.options.errorAlerts)this._alert("Error!"+(error.message?"\n\n"+error.message:"")+(error.hint?"\n\n"+error.hint:"")+"\n\nContext: "+error.context)},_warning:function(warning){this._trigger($.jPlayer.event.warning,undefined,warning);if(this.options.warningAlerts)this._alert("Warning!"+(warning.message?"\n\n"+warning.message:"")+(warning.hint?"\n\n"+warning.hint:"")+"\n\nContext: "+warning.context)},_alert:function(message){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+message)},_emulateHtmlBridge:function(){var self=this,methods=$.jPlayer.emulateMethods;$.each($.jPlayer.emulateMethods.split(/\s+/g),function(i,name){self.internal.domNode[name]=function(arg){self[name](arg)}});$.each($.jPlayer.event,function(eventName,eventType){var nativeEvent=true;$.each($.jPlayer.reservedEvent.split(/\s+/g),function(i,name){if(name===eventName){nativeEvent=false;return false}});if(nativeEvent)self.element.bind(eventType+".jPlayer.jPlayerHtml",function(){self._emulateHtmlUpdate();var domEvent=document.createEvent("Event");domEvent.initEvent(eventName,false,true);self.internal.domNode.dispatchEvent(domEvent)})})},_emulateHtmlUpdate:function(){var self=this;$.each($.jPlayer.emulateStatus.split(/\s+/g),function(i,name){self.internal.domNode[name]=self.status[name]});$.each($.jPlayer.emulateOptions.split(/\s+/g),function(i,name){self.internal.domNode[name]=self.options[name]})},_destroyHtmlBridge:function(){var self=this;this.element.unbind(".jPlayerHtml");var emulated=$.jPlayer.emulateMethods+" "+$.jPlayer.emulateStatus+" "+$.jPlayer.emulateOptions;$.each(emulated.split(/\s+/g),function(i,name){delete self.internal.domNode[name]})}};$.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};$.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+$.jPlayer.prototype.version.script+" needs Jplayer.swf version "+$.jPlayer.prototype.version.needFlash+" but found "};$.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};$.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};$.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."};$.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}})(jQuery) diff --git a/apps/media/js/loader.js b/apps/media/js/loader.js deleted file mode 100644 index ffe9c1cdd61..00000000000 --- a/apps/media/js/loader.js +++ /dev/null @@ -1,59 +0,0 @@ -function musicTypeFromFile(file){ - var extension=file.substr(file.indexOf('.')+1).toLowerCase(); - if(extension=='ogg'){ - return 'oga'; - } - //TODO check for more specific cases - return extension; -} - -function playAudio(filename){ - loadPlayer(musicTypeFromFile(filename),function(){ - PlayList.add($('#dir').val()+'/'+filename); - PlayList.play(PlayList.items.length-1); - }); -} - -function addAudio(filename){ - loadPlayer(musicTypeFromFile(filename),function(){ - PlayList.add($('#dir').val()+'/'+filename); - }); -} - -function loadPlayer(type,ready){ - if(!loadPlayer.done){ - loadPlayer.done=true; - OC.addStyle('media','player'); - OC.addScript('media','jquery.jplayer.min',function(){ - OC.addScript('media','player',function(){ - var navItem=$('#apps a[href="'+OC.linkTo('media','index.php')+'"]'); - navItem.height(navItem.height()); - navItem.load(OC.filePath('media','templates','player.php'),function(){ - PlayList.init(type,ready); - }); - }); - }); - }else{ - ready(); - } -} - -$(document).ready(function() { - loadPlayer.done=false; - -// FileActions.register('audio','Add to playlist','',addAudio); -// FileActions.register('application/ogg','Add to playlist','',addAudio); - - if(typeof FileActions!=='undefined'){ - FileActions.register('audio','Play', FileActions.PERMISSION_READ, '',playAudio); - FileActions.register('application/ogg', FileActions.PERMISSION_READ, '','Play',playAudio); - FileActions.setDefault('audio','Play'); - FileActions.setDefault('application/ogg','Play'); - } - var oc_current_user=OC.currentUser; - if(typeof PlayList==='undefined'){ - if(OC.localStorage.getItem('playlist_items') && OC.localStorage.getItem('playlist_items').length && OC.localStorage.getItem('playlist_active')!=true){ - loadPlayer(); - } - } -}); diff --git a/apps/media/js/music.js b/apps/media/js/music.js deleted file mode 100644 index db129227626..00000000000 --- a/apps/media/js/music.js +++ /dev/null @@ -1,57 +0,0 @@ -$(document).ready(function(){ - OC.search.customResults.Music=function(row,item){ - var parts=item.link.substr(item.link.indexOf('#')+1).split('&'); - var data={}; - for(var i=0;i<parts.length;i++){ - var itemParts=parts[i].split('='); - data[itemParts[0]]=itemParts[1].replace(/\+/g,' '); - } - var media=Collection.find(data.artist,data.album,data.song); - var a=row.find('a'); - a.attr('href','#'); - a.click(function(){ - var oldSize=PlayList.items.length; - PlayList.add(media); - PlayList.play(oldSize); - PlayList.render(); - }); - var button=$('<input type="button" title="'+t('media','Add album to playlist')+'" class="add"></input>'); - button.css('background-image','url('+OC.imagePath('core','actions/play-add')+')'); - button.click(function(event){ - event.stopPropagation(); - PlayList.add(media); - PlayList.render(); - }); - row.find('div.name').append(button); - button.tipsy({gravity:'n', fade:true, delayIn: 400, live:true}); - }; - Collection.display(); - - Collection.load(function(){ - var urlVars=getUrlVars(); - if(urlVars.artist){ - var song=Collection.find(urlVars.artist,urlVars.album,urlVars.song); - PlayList.add(song); - PlayList.play(0); - } - }); -}); - -function getUrlVars(){ - var vars = {}, hash; - var hashes = window.location.hash.substr(1).split('&'); - for(var i = 0; i < hashes.length; i++){ - hash = hashes[i].split('='); - vars[hash[0]] = decodeURIComponent(hash[1]).replace(/\+/g,' '); - } - return vars; -} - -function musicTypeFromFile(file){ - var extension=file.split('.').pop().toLowerCase(); - if(extension=='ogg'){ - return 'oga'; - } - //TODO check for more specific cases - return extension; -} diff --git a/apps/media/js/player.js b/apps/media/js/player.js deleted file mode 100644 index 867ea802363..00000000000 --- a/apps/media/js/player.js +++ /dev/null @@ -1,214 +0,0 @@ -var PlayList={ - urlBase:OC.linkTo('media','ajax/api.php')+'?action=play&path=', - current:-1, - items:[], - player:null, - volume:0.8, - active:false, - next:function(){ - var items=PlayList.items; - var next=PlayList.current+1; - if(next>=items.length){ - next=0; - } - PlayList.play(next); - PlayList.render(); - }, - previous:function(){ - var items=PlayList.items; - var next=PlayList.current-1; - if(next<0){ - next=items.length-1; - } - PlayList.play(next); - PlayList.render(); - }, - play:function(index,time,ready){ - var items=PlayList.items; - if(index==null){ - index=PlayList.current; - } - PlayList.save(); - if(index>-1 && index<items.length){ - PlayList.current=index; - if(PlayList.player){ - if(PlayList.player.data('jPlayer').options.supplied!=items[index].type){//the the audio type changes we need to reinitialize jplayer - PlayList.player.jPlayer("play",time); - OC.localStorage.setItem('playlist_time',time); - PlayList.player.jPlayer("destroy"); -// PlayList.save(); // so that the init don't lose the playlist - PlayList.init(items[index].type,null); // init calls load that calls play - }else{ - PlayList.player.jPlayer("setMedia", items[PlayList.current]); - $(".jp-current-song").html(items[PlayList.current].name); - items[index].playcount++; - PlayList.player.jPlayer("play",time); - if(index>0){ - var previous=index-1; - }else{ - var previous=items.length-1; - } - if(index+1<items.length){ - var next=index+1; - }else{ - var next=0; - } - $('.jp-next').attr('title',items[next].name); - $('.jp-previous').attr('title',items[previous].name); - if (typeof Collection !== 'undefined') { - Collection.registerPlay(); - } - PlayList.render(); - if(ready){ - ready(); - } - } - }else{ - OC.localStorage.setItem('playlist_time',time); - OC.localStorage.setItem('playlist_playing',true); - PlayList.init(items[index].type,null); // init calls load that calls play - } - } - $(".song").removeClass("collection_playing"); - $(".jp-playlist-" + index).addClass("collection_playing"); - }, - init:function(type,ready){ - if(!PlayList.player){ - $(".jp-previous").click(function() { - PlayList.previous(); - $(this).blur(); - PlayList.render(); - return false; - }); - $(".jp-next").click(function() { - PlayList.next(); - $(this).blur(); - PlayList.render(); - return false; - }); - PlayList.player=$('#jp-player'); - } - $(PlayList.player).jPlayer({ - ended:PlayList.next, - pause:function(){ - OC.localStorage.setItem('playlist_playing',false); - document.title = "ownCloud"; - }, - play:function(event){ - OC.localStorage.setItem('playlist_playing',true); - document.title = "\u25b8 " + event.jPlayer.status.media.name + " - " + event.jPlayer.status.media.artist + " - ownCloud"; - }, - supplied:type, - ready:function(){ - PlayList.load(); - if(ready){ - ready(); - } - }, - volume:PlayList.volume, - cssSelectorAncestor:'.player-controls', - swfPath:OC.linkTo('media','js'), - }); - }, - add:function(song,dontReset){ - if(!dontReset){ - PlayList.items=[];//clear the playlist - } - if(!song){ - return; - } - if(song.substr){//we are passed a string, asume it's a url to a song - PlayList.addFile(song,true); - } - if(song.albums){//a artist object was passed, add all albums inside it - $.each(song.albums,function(index,album){ - PlayList.add(album,true); - }); - } else if(song.songs){//a album object was passed, add all songs inside it - $.each(song.songs,function(index,song){ - PlayList.add(song,true); - }); - } - if(song.path){ - var type=musicTypeFromFile(song.path); - var item={name:song.name,type:type,artist:song.artist,album:song.album,length:song.length,playcount:song.playCount}; - item[type]=PlayList.urlBase+encodeURIComponent(song.path); - PlayList.items.push(item); - } - }, - addFile:function(path){ - var type=musicTypeFromFile(path); - var item={name:'unknown',artist:'unknown',album:'unknwon',type:type}; - $.getJSON(OC.filePath('media','ajax','api.php')+'?action=get_path_info&path='+encodeURIComponent(path),function(song){ - item.name=song.song_name; - item.artist=song.artist; - item.album=song.album; - }); - item[type]=PlayList.urlBase+encodeURIComponent(path); - PlayList.items.push(item); - }, - remove:function(index){ - PlayList.items.splice(index,1); - PlayList.render(); - }, - render:function(){}, - playing:function(){ - if(!PlayList.player){ - return false; - }else{ - return !PlayList.player.data("jPlayer").status.paused; - } - }, - save:function(){ - OC.localStorage.setItem('playlist_items',PlayList.items); - OC.localStorage.setItem('playlist_current',PlayList.current); - if(PlayList.player) { - if(PlayList.player.data('jPlayer')) { - var time=Math.round(PlayList.player.data('jPlayer').status.currentTime); - OC.localStorage.setItem('playlist_time',time); - var volume=PlayList.player.data('jPlayer').options.volume*100; - OC.localStorage.setItem('playlist_volume',volume); - } - } - OC.localStorage.setItem('playlist_active',true); - }, - load:function(){ - PlayList.active=true; - OC.localStorage.setItem('playlist_active',true); - if(OC.localStorage.hasItem('playlist_items')){ - PlayList.items=OC.localStorage.getItem('playlist_items'); - if(PlayList.items && PlayList.items.length>0){ - PlayList.current=OC.localStorage.getItem('playlist_current'); - var time=OC.localStorage.getItem('playlist_time'); - if(OC.localStorage.hasItem('playlist_volume')){ - var volume=OC.localStorage.getItem('playlist_volume'); - PlayList.volume=volume/100; - $('.jp-volume-bar-value').css('width',volume+'%'); - if(PlayList.player.data('jPlayer')){ - PlayList.player.jPlayer("option",'volume',volume/100); - } - } - if(OC.localStorage.getItem('playlist_playing')){ - PlayList.play(null,time); - }else{ - PlayList.play(null,time,function(){ - PlayList.player.jPlayer("pause"); - }); - } - PlayList.render(); - } - } - } -} - -$(document).ready(function(){ - $(window).bind('beforeunload', function (){ - PlayList.save(); - if(PlayList.active){ - OC.localStorage.setItem('playlist_active',false); - } - }); - - $('jp-previous').tipsy({gravity:'n', fade:true, live:true}); - $('jp-next').tipsy({gravity:'n', fade:true, live:true}); -}) diff --git a/apps/media/js/playlist.js b/apps/media/js/playlist.js deleted file mode 100644 index 8e9e2a91537..00000000000 --- a/apps/media/js/playlist.js +++ /dev/null @@ -1,57 +0,0 @@ -PlayList.render=function(){ - $('#playlist').show(); - - /* - * We should not empty() PlayList.parent() but thorougly manage its - * elements instead because some code might be attached to those. - * JQuery tipsies are one of them. The following line make sure they - * are all removed before we delete the associated <li/>. - */ - $(".tipsy").remove(); - - PlayList.parent.empty(); - for(var i=0;i<PlayList.items.length;i++){ - var item=PlayList.items[i]; - var li=$('<li/>'); - li.attr('class', 'jp-playlist-' + i); - li.attr('title', item.artist + ' - ' + item.name + '<br/>(' + item.album + ')'); - var div = $('<div class="label">' + item.name + '</div>'); - li.append(div); - $('.jp-playlist-' + i).tipsy({gravity:'w', fade:true, live:true, html:true}); - var img=$('<img class="remove svg action" src="'+OC.imagePath('core','actions/delete')+'"/>'); - img.click(function(event){ - event.stopPropagation(); - PlayList.remove($(this).parent().data('index')); - }); - li.click(function(event){ - PlayList.play($(this).data('index')); - }); - li.append(img); - li.data('index',i); - li.addClass('song'); - PlayList.parent.append(li); - } - $(".jp-playlist-" + PlayList.current).addClass("collection_playing"); -}; -PlayList.getSelected=function(){ - return $('tbody td.name input:checkbox:checked').parent().parent(); -}; -PlayList.hide=function(){ - $('#playlist').hide(); -}; - -$(document).ready(function(){ - PlayList.parent=$('#leftcontent'); - PlayList.init(); - $('#selectAll').click(function(){ - if($(this).attr('checked')){ - // Check all - $('#leftcontent li.song input:checkbox').attr('checked', true); - $('#leftcontent li.song input:checkbox').parent().addClass('selected'); - }else{ - // Uncheck all - $('#leftcontent li.song input:checkbox').attr('checked', false); - $('#leftcontent li.song input:checkbox').parent().removeClass('selected'); - } - }); -}); diff --git a/apps/media/js/scanner.js b/apps/media/js/scanner.js deleted file mode 100644 index a9321f99964..00000000000 --- a/apps/media/js/scanner.js +++ /dev/null @@ -1,44 +0,0 @@ -Scanner={ - songsFound:0, - eventSource:null, - songsScanned:0, - findSongs:function(ready){ - $.getJSON(OC.linkTo('media','ajax/api.php')+'?action=find_music',function(songs){ - Scanner.songsFound=songs.length; - if(ready){ - ready(songs); - } - }); - }, - scanCollection:function(ready){ - $('#scanprogressbar').progressbar({ - value:0, - }); - $('#scanprogressbar').show(); - Scanner.songsScanned=0; - Scanner.eventSource=new OC.EventSource(OC.linkTo('media','ajax/api.php'),{action:'scan'}); - Scanner.eventSource.listen('count',function(total){ - Scanner.songsFound=total; - }); - Scanner.eventSource.listen('scanned',function(data){ - Scanner.songsScanned=data.count; - $('#scan span.songCount').text(Scanner.songsScanned); - var progress=(Scanner.songsScanned/Scanner.songsFound)*100; - $('#scanprogressbar').progressbar('value',progress); - }); - Scanner.eventSource.listen('done',function(count){ - $('#scan input.start').show(); - $('#scan input.stop').hide(); - $('#scanprogressbar').hide(); - Collection.load(Collection.display); - if(ready){ - ready(); - } - }); - $('#scancount').show(); - }, - stop:function(){ - Scanner.eventSource.close(); - }, - -}; diff --git a/apps/media/l10n/ar.php b/apps/media/l10n/ar.php deleted file mode 100644 index 655589df8aa..00000000000 --- a/apps/media/l10n/ar.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "الموسيقى", -"Add album to playlist" => "أضف الالبوم الى القائمه", -"Play" => "إلعب", -"Pause" => "تجميد", -"Previous" => "السابق", -"Next" => "التالي", -"Mute" => "إلغاء الصوت", -"Unmute" => "تشغيل الصوت", -"Rescan Collection" => "إعادة البحث عن ملفات الموسيقى", -"Artist" => "الفنان", -"Album" => "الألبوم", -"Title" => "العنوان" -); diff --git a/apps/media/l10n/bg_BG.php b/apps/media/l10n/bg_BG.php deleted file mode 100644 index e6c3c02d17f..00000000000 --- a/apps/media/l10n/bg_BG.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Музика", -"Add album to playlist" => "Добавяне на албума към списъка за изпълнение", -"Play" => "Пусни", -"Pause" => "Пауза", -"Previous" => "Предишна", -"Next" => "Следваща", -"Mute" => "Отнеми", -"Unmute" => "Върни", -"Rescan Collection" => "Повторно сканиране", -"Artist" => "Артист", -"Album" => "Албум", -"Title" => "Заглавие" -); diff --git a/apps/media/l10n/ca.php b/apps/media/l10n/ca.php deleted file mode 100644 index 6c0a1855f3d..00000000000 --- a/apps/media/l10n/ca.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Música", -"Play" => "Reprodueix", -"Pause" => "Pausa", -"Previous" => "Anterior", -"Next" => "Següent", -"Mute" => "Mut", -"Unmute" => "Activa el so", -"Rescan Collection" => "Explora de nou la col·lecció", -"Artist" => "Artista", -"Album" => "Àlbum", -"Title" => "Títol" -); diff --git a/apps/media/l10n/cs_CZ.php b/apps/media/l10n/cs_CZ.php deleted file mode 100644 index badec7b62f8..00000000000 --- a/apps/media/l10n/cs_CZ.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Hudba", -"Play" => "Přehrát", -"Pause" => "Pauza", -"Previous" => "Předchozí", -"Next" => "Další", -"Mute" => "Vypnout zvuk", -"Unmute" => "Zapnout zvuk", -"Rescan Collection" => "Znovu prohledat ", -"Artist" => "Umělec", -"Album" => "Album", -"Title" => "Název" -); diff --git a/apps/media/l10n/da.php b/apps/media/l10n/da.php deleted file mode 100644 index 776081842c3..00000000000 --- a/apps/media/l10n/da.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musik", -"Play" => "Afspil", -"Pause" => "Pause", -"Previous" => "Forrige", -"Next" => "Næste", -"Mute" => "Lydløs", -"Unmute" => "Lyd til", -"Rescan Collection" => "Genskan Samling", -"Artist" => "Kunstner", -"Album" => "Album", -"Title" => "Titel" -); diff --git a/apps/media/l10n/de.php b/apps/media/l10n/de.php deleted file mode 100644 index d3d288dc6fe..00000000000 --- a/apps/media/l10n/de.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musik", -"Play" => "Abspielen", -"Pause" => "Pause", -"Previous" => "Vorheriges", -"Next" => "Nächstes", -"Mute" => "Ton aus", -"Unmute" => "Ton an", -"Rescan Collection" => "Sammlung erneut scannen", -"Artist" => "Künstler", -"Album" => "Album", -"Title" => "Titel" -); diff --git a/apps/media/l10n/el.php b/apps/media/l10n/el.php deleted file mode 100644 index 9996180c03e..00000000000 --- a/apps/media/l10n/el.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Μουσική", -"Play" => "Αναπαραγωγή", -"Pause" => "Παύση", -"Previous" => "Προηγούμενο", -"Next" => "Επόμενο", -"Mute" => "Σίγαση", -"Unmute" => "Επαναφορά ήχου", -"Rescan Collection" => "Επανασάρωση συλλογής", -"Artist" => "Καλλιτέχνης", -"Album" => "Άλμπουμ", -"Title" => "Τίτλος" -); diff --git a/apps/media/l10n/eo.php b/apps/media/l10n/eo.php deleted file mode 100644 index 084dbaa480e..00000000000 --- a/apps/media/l10n/eo.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Muziko", -"Add album to playlist" => "Aldoni albumon al ludlisto", -"Play" => "Ludi", -"Pause" => "Paŭzigi", -"Previous" => "Maljena", -"Next" => "Jena", -"Mute" => "Silentigi", -"Unmute" => "Malsilentigi", -"Rescan Collection" => "Reskani la aron", -"Artist" => "Artisto", -"Album" => "Albumo", -"Title" => "Titolo" -); diff --git a/apps/media/l10n/es.php b/apps/media/l10n/es.php deleted file mode 100644 index 100ab6a7a73..00000000000 --- a/apps/media/l10n/es.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Música", -"Play" => "Reproducir", -"Pause" => "Pausa", -"Previous" => "Anterior", -"Next" => "Siguiente", -"Mute" => "Silenciar", -"Unmute" => "Quitar silencio", -"Rescan Collection" => "Buscar canciones nuevas", -"Artist" => "Artista", -"Album" => "Álbum", -"Title" => "Título" -); diff --git a/apps/media/l10n/et_EE.php b/apps/media/l10n/et_EE.php deleted file mode 100644 index 4133cb84a98..00000000000 --- a/apps/media/l10n/et_EE.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Muusika", -"Play" => "Esita", -"Pause" => "Paus", -"Previous" => "Eelmine", -"Next" => "Järgmine", -"Mute" => "Vaikseks", -"Unmute" => "Hääl tagasi", -"Rescan Collection" => "Skänni kollekttsiooni uuesti", -"Artist" => "Esitaja", -"Album" => "Album", -"Title" => "Pealkiri" -); diff --git a/apps/media/l10n/eu.php b/apps/media/l10n/eu.php deleted file mode 100644 index d30e3519161..00000000000 --- a/apps/media/l10n/eu.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musika", -"Play" => "Erreproduzitu", -"Pause" => "Pausarazi", -"Previous" => "Aurrekoa", -"Next" => "Hurrengoa", -"Mute" => "Mututu", -"Unmute" => "Ez Mututu", -"Rescan Collection" => "Bireskaneatu Bilduma", -"Artist" => "Artista", -"Album" => "Albuma", -"Title" => "Izenburua" -); diff --git a/apps/media/l10n/fa.php b/apps/media/l10n/fa.php deleted file mode 100644 index 3bccdb0c509..00000000000 --- a/apps/media/l10n/fa.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "موسیقی", -"Play" => "پخش کردن", -"Pause" => "توقف کوتاه", -"Previous" => "قبلی", -"Next" => "بعدی", -"Mute" => "خفه کردن", -"Unmute" => "باز گشایی صدا", -"Rescan Collection" => "دوباره بازرسی مجموعه ها", -"Artist" => "هنرمند", -"Album" => "آلبوم", -"Title" => "عنوان" -); diff --git a/apps/media/l10n/fi_FI.php b/apps/media/l10n/fi_FI.php deleted file mode 100644 index 2426f6a2200..00000000000 --- a/apps/media/l10n/fi_FI.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musiikki", -"Play" => "Toista", -"Pause" => "Tauko", -"Previous" => "Edellinen", -"Next" => "Seuraava", -"Mute" => "Mykistä", -"Unmute" => "Palauta äänet", -"Rescan Collection" => "Etsi uusia kappaleita", -"Artist" => "Esittäjä", -"Album" => "Albumi", -"Title" => "Nimi" -); diff --git a/apps/media/l10n/fr.php b/apps/media/l10n/fr.php deleted file mode 100644 index 313a918d021..00000000000 --- a/apps/media/l10n/fr.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musique", -"Add album to playlist" => "Ajouter l'album à la playlist", -"Play" => "Lire", -"Pause" => "Pause", -"Previous" => "Précédent", -"Next" => "Suivant", -"Mute" => "Muet", -"Unmute" => "Audible", -"Rescan Collection" => "Réanalyser la Collection", -"Artist" => "Artiste", -"Album" => "Album", -"Title" => "Titre" -); diff --git a/apps/media/l10n/gl.php b/apps/media/l10n/gl.php deleted file mode 100644 index 69037b7d1f7..00000000000 --- a/apps/media/l10n/gl.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Música", -"Play" => "Reproducir", -"Pause" => "Pausar", -"Previous" => "Anterior", -"Next" => "Seguinte", -"Mute" => "Silenciar", -"Unmute" => "Restaurar volume", -"Rescan Collection" => "Analizar a colección de novo", -"Artist" => "Artista", -"Album" => "Álbun", -"Title" => "Título" -); diff --git a/apps/media/l10n/he.php b/apps/media/l10n/he.php deleted file mode 100644 index 772bfb90281..00000000000 --- a/apps/media/l10n/he.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "מוזיקה", -"Play" => "נגן", -"Pause" => "השהה", -"Previous" => "קודם", -"Next" => "הבא", -"Mute" => "השתק", -"Unmute" => "בטל השתקה", -"Rescan Collection" => "סריקת אוסף מחדש", -"Artist" => "מבצע", -"Album" => "אלבום", -"Title" => "כותרת" -); diff --git a/apps/media/l10n/hr.php b/apps/media/l10n/hr.php deleted file mode 100644 index bab149743cf..00000000000 --- a/apps/media/l10n/hr.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Glazba", -"Play" => "Reprodukcija", -"Pause" => "Pauza", -"Previous" => "Prethodna", -"Next" => "Sljedeća", -"Mute" => "Utišaj zvuk", -"Unmute" => "Uključi zvuk", -"Rescan Collection" => "Ponovi skeniranje kolekcije", -"Artist" => "Izvođač", -"Album" => "Album", -"Title" => "Naslov" -); diff --git a/apps/media/l10n/hu_HU.php b/apps/media/l10n/hu_HU.php deleted file mode 100644 index 299e0af0287..00000000000 --- a/apps/media/l10n/hu_HU.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Zene", -"Play" => "Lejátszás", -"Pause" => "Szünet", -"Previous" => "Előző", -"Next" => "Következő", -"Mute" => "Némítás", -"Unmute" => "Némítás megszüntetése", -"Rescan Collection" => "Gyűjtemény újraolvasása", -"Artist" => "Előadó", -"Album" => "Album", -"Title" => "Cím" -); diff --git a/apps/media/l10n/ia.php b/apps/media/l10n/ia.php deleted file mode 100644 index 597b36e10fa..00000000000 --- a/apps/media/l10n/ia.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musica", -"Play" => "Reproducer", -"Pause" => "Pausa", -"Previous" => "Previe", -"Next" => "Proxime", -"Mute" => "Mute", -"Unmute" => "Con sono", -"Rescan Collection" => "Rescannar collection", -"Artist" => "Artista", -"Album" => "Album", -"Title" => "Titulo" -); diff --git a/apps/media/l10n/id.php b/apps/media/l10n/id.php deleted file mode 100644 index 52b0bae0eea..00000000000 --- a/apps/media/l10n/id.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musik", -"Play" => "Mainkan", -"Pause" => "Jeda", -"Previous" => "Sebelumnya", -"Next" => "Selanjutnya", -"Mute" => "Nonaktifkan suara", -"Unmute" => "Aktifkan suara", -"Rescan Collection" => "Pindai ulang Koleksi", -"Artist" => "Artis", -"Album" => "Album", -"Title" => "Judul" -); diff --git a/apps/media/l10n/it.php b/apps/media/l10n/it.php deleted file mode 100644 index 757392bcbd8..00000000000 --- a/apps/media/l10n/it.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musica", -"Play" => "Riproduci", -"Pause" => "Pausa", -"Previous" => "Precedente", -"Next" => "Successivo", -"Mute" => "Disattiva audio", -"Unmute" => "Riattiva audio", -"Rescan Collection" => "Nuova scansione collezione", -"Artist" => "Artista", -"Album" => "Album", -"Title" => "Titolo" -); diff --git a/apps/media/l10n/ja_JP.php b/apps/media/l10n/ja_JP.php deleted file mode 100644 index 7faa098250c..00000000000 --- a/apps/media/l10n/ja_JP.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "ミュージック", -"Play" => "再生", -"Pause" => "一時停止", -"Previous" => "前", -"Next" => "次", -"Mute" => "ミュート", -"Unmute" => "ミュート解除", -"Rescan Collection" => "コレクションの再スキャン", -"Artist" => "アーティスト", -"Album" => "アルバム", -"Title" => "曲名" -); diff --git a/apps/media/l10n/ko.php b/apps/media/l10n/ko.php deleted file mode 100644 index 844d9c3e082..00000000000 --- a/apps/media/l10n/ko.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "음악", -"Play" => "재생", -"Pause" => "일시 정지", -"Previous" => "이전", -"Next" => "다음", -"Mute" => "음소거", -"Unmute" => "음소거 해제", -"Rescan Collection" => "모음집 재검색", -"Artist" => "음악가", -"Album" => "앨범", -"Title" => "제목" -); diff --git a/apps/media/l10n/lb.php b/apps/media/l10n/lb.php deleted file mode 100644 index 4a2727fcb11..00000000000 --- a/apps/media/l10n/lb.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musek", -"Play" => "Ofspillen", -"Pause" => "Paus", -"Previous" => "Zeréck", -"Next" => "Weider", -"Mute" => "Toun ausmaachen", -"Unmute" => "Toun umaachen", -"Rescan Collection" => "Kollektioun nei scannen", -"Artist" => "Artist", -"Album" => "Album", -"Title" => "Titel" -); diff --git a/apps/media/l10n/lt_LT.php b/apps/media/l10n/lt_LT.php deleted file mode 100644 index 1761ffdc3b2..00000000000 --- a/apps/media/l10n/lt_LT.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Muzika", -"Play" => "Groti", -"Pause" => "Pristabdyti", -"Previous" => "Atgal", -"Next" => "Kitas", -"Mute" => "Nutildyti", -"Unmute" => "Įjungti garsą", -"Rescan Collection" => "Atnaujinti kolekciją", -"Artist" => "Atlikėjas", -"Album" => "Albumas", -"Title" => "Pavadinimas" -); diff --git a/apps/media/l10n/mk.php b/apps/media/l10n/mk.php deleted file mode 100644 index 17816be7516..00000000000 --- a/apps/media/l10n/mk.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Музика", -"Play" => "Пушти", -"Pause" => "Пауза", -"Previous" => "Претходно", -"Next" => "Следно", -"Mute" => "Занеми", -"Unmute" => "Пушти глас", -"Rescan Collection" => "Рескенирај ја колекцијата", -"Artist" => "Изведувач", -"Album" => "Албум", -"Title" => "Наслов" -); diff --git a/apps/media/l10n/ms_MY.php b/apps/media/l10n/ms_MY.php deleted file mode 100644 index aaa1c3edfb9..00000000000 --- a/apps/media/l10n/ms_MY.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Muzik", -"Play" => "Main", -"Pause" => "Jeda", -"Previous" => "Sebelum", -"Next" => "Seterus", -"Mute" => "Bisu", -"Unmute" => "Nyahbisu", -"Rescan Collection" => "Imbas semula koleksi", -"Artist" => "Artis", -"Album" => "Album", -"Title" => "Judul" -); diff --git a/apps/media/l10n/nb_NO.php b/apps/media/l10n/nb_NO.php deleted file mode 100644 index dbed1526b76..00000000000 --- a/apps/media/l10n/nb_NO.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musikk", -"Play" => "Spill", -"Pause" => "Pause", -"Previous" => "Forrige", -"Next" => "Neste", -"Mute" => "Demp", -"Unmute" => "Skru på lyd", -"Rescan Collection" => "Skan samling på nytt", -"Artist" => "Artist", -"Album" => "Album", -"Title" => "Tittel" -); diff --git a/apps/media/l10n/nl.php b/apps/media/l10n/nl.php deleted file mode 100644 index 705bf2a613c..00000000000 --- a/apps/media/l10n/nl.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Muziek", -"Play" => "Afspelen", -"Pause" => "Pauzeer", -"Previous" => "Vorige", -"Next" => "Volgende", -"Mute" => "Dempen", -"Unmute" => "Dempen uit", -"Rescan Collection" => "Collectie opnieuw scannen", -"Artist" => "Artiest", -"Album" => "Album", -"Title" => "Titel" -); diff --git a/apps/media/l10n/nn_NO.php b/apps/media/l10n/nn_NO.php deleted file mode 100644 index 2579c7b6ba0..00000000000 --- a/apps/media/l10n/nn_NO.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musikk", -"Play" => "Spel", -"Pause" => "Pause", -"Previous" => "Førre", -"Next" => "Neste", -"Mute" => "Demp", -"Unmute" => "Skru på lyd", -"Rescan Collection" => "Skann samlinga på nytt", -"Artist" => "Artist", -"Album" => "Album", -"Title" => "Tittel" -); diff --git a/apps/media/l10n/pl.php b/apps/media/l10n/pl.php deleted file mode 100644 index 15a1ceca6d0..00000000000 --- a/apps/media/l10n/pl.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Muzyka", -"Play" => "Odtwarzaj", -"Pause" => "Wstrzymaj", -"Previous" => "Poprzedni", -"Next" => "Następny", -"Mute" => "Wycisz", -"Unmute" => "Wyłącz wyciszenie", -"Rescan Collection" => "Przeszukaj kolekcję", -"Artist" => "Wykonawca", -"Album" => "Album", -"Title" => "Tytuł" -); diff --git a/apps/media/l10n/pt_BR.php b/apps/media/l10n/pt_BR.php deleted file mode 100644 index 6a1289cfa83..00000000000 --- a/apps/media/l10n/pt_BR.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Música", -"Play" => "Tocar", -"Pause" => "Pausa", -"Previous" => "Anterior", -"Next" => "Próximo", -"Mute" => "Mudo", -"Unmute" => "Não Mudo", -"Rescan Collection" => "Atualizar a Coleção", -"Artist" => "Artista", -"Album" => "Álbum", -"Title" => "Título" -); diff --git a/apps/media/l10n/pt_PT.php b/apps/media/l10n/pt_PT.php deleted file mode 100644 index e143c74d45d..00000000000 --- a/apps/media/l10n/pt_PT.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musica", -"Play" => "Reproduzir", -"Pause" => "Pausa", -"Previous" => "Anterior", -"Next" => "Próximo", -"Mute" => "Mudo", -"Unmute" => "Som", -"Rescan Collection" => "Reverificar coleção", -"Artist" => "Artista", -"Album" => "Álbum", -"Title" => "Título" -); diff --git a/apps/media/l10n/ro.php b/apps/media/l10n/ro.php deleted file mode 100644 index e356b376baf..00000000000 --- a/apps/media/l10n/ro.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Muzică", -"Play" => "Redă", -"Pause" => "Pauză", -"Previous" => "Precedent", -"Next" => "Următor", -"Mute" => "Fără sonor", -"Unmute" => "Cu sonor", -"Rescan Collection" => "Rescanează colecția", -"Artist" => "Artist", -"Album" => "Album", -"Title" => "Titlu" -); diff --git a/apps/media/l10n/ru.php b/apps/media/l10n/ru.php deleted file mode 100644 index 5426332a1b0..00000000000 --- a/apps/media/l10n/ru.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Музыка", -"Play" => "Проиграть", -"Pause" => "Пауза", -"Previous" => "Предыдущий", -"Next" => "Следующий", -"Mute" => "Отключить звук", -"Unmute" => "Включить звук", -"Rescan Collection" => "Пересканировать коллекцию", -"Artist" => "Исполнитель", -"Album" => "Альбом", -"Title" => "Название" -); diff --git a/apps/media/l10n/sk_SK.php b/apps/media/l10n/sk_SK.php deleted file mode 100644 index cf0b5319e95..00000000000 --- a/apps/media/l10n/sk_SK.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Hudba", -"Play" => "Prehrať", -"Pause" => "Pauza", -"Previous" => "Predchádzajúce", -"Next" => "Ďalšie", -"Mute" => "Stlmiť", -"Unmute" => "Nahlas", -"Rescan Collection" => "Znovu skenovať zbierku", -"Artist" => "Umelec", -"Album" => "Album", -"Title" => "Názov" -); diff --git a/apps/media/l10n/sl.php b/apps/media/l10n/sl.php deleted file mode 100644 index 38fc1f2a1e0..00000000000 --- a/apps/media/l10n/sl.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Glasba", -"Play" => "Predvajaj", -"Pause" => "Premor", -"Previous" => "Prejšnja", -"Next" => "Naslednja", -"Mute" => "Utišaj", -"Unmute" => "Povrni glasnost", -"Rescan Collection" => "Ponovno preišči zbirko", -"Artist" => "Izvajalec", -"Album" => "Album", -"Title" => "Naslov" -); diff --git a/apps/media/l10n/sr.php b/apps/media/l10n/sr.php deleted file mode 100644 index dff0daf4358..00000000000 --- a/apps/media/l10n/sr.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Музика", -"Play" => "Пусти", -"Pause" => "Паузирај", -"Previous" => "Претходна", -"Next" => "Следећа", -"Mute" => "Искључи звук", -"Unmute" => "Укључи звук", -"Rescan Collection" => "Поново претражи збирку", -"Artist" => "Извођач", -"Album" => "Албум", -"Title" => "Наслов" -); diff --git a/apps/media/l10n/sr@latin.php b/apps/media/l10n/sr@latin.php deleted file mode 100644 index 6476898387b..00000000000 --- a/apps/media/l10n/sr@latin.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Muzika", -"Play" => "Pusti", -"Pause" => "Pauziraj", -"Previous" => "Prethodna", -"Next" => "Sledeća", -"Mute" => "Isključi zvuk", -"Unmute" => "Uključi zvuk", -"Rescan Collection" => "Ponovo pretraži zbirku", -"Artist" => "Izvođač", -"Album" => "Album", -"Title" => "Naslov" -); diff --git a/apps/media/l10n/sv.php b/apps/media/l10n/sv.php deleted file mode 100644 index 1cf5497e7e2..00000000000 --- a/apps/media/l10n/sv.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Musik", -"Add album to playlist" => "Lägg till album till spellistan", -"Play" => "Spela", -"Pause" => "Paus", -"Previous" => "Föregående", -"Next" => "Nästa", -"Mute" => "Ljudlös", -"Unmute" => "Ljud på", -"Rescan Collection" => "Sök igenom samlingen", -"Artist" => "Artist", -"Album" => "Album", -"Title" => "Titel" -); diff --git a/apps/media/l10n/th_TH.php b/apps/media/l10n/th_TH.php deleted file mode 100644 index dc448b32681..00000000000 --- a/apps/media/l10n/th_TH.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "เพลง", -"Play" => "เล่น", -"Pause" => "หยุดชั่วคราว", -"Previous" => "ก่อนหน้า", -"Next" => "ถัดไป", -"Mute" => "ปิดเสียง", -"Unmute" => "เปิดเสียง", -"Rescan Collection" => "ตรวจสอบไฟล์ที่เก็บไว้อีกครั้ง", -"Artist" => "ศิลปิน", -"Album" => "อัลบั้ม", -"Title" => "ชื่อ" -); diff --git a/apps/media/l10n/tr.php b/apps/media/l10n/tr.php deleted file mode 100644 index 1eaf98145ac..00000000000 --- a/apps/media/l10n/tr.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Müzik", -"Play" => "Oynat", -"Pause" => "Beklet", -"Previous" => "Önceki", -"Next" => "Sonraki", -"Mute" => "Sesi kapat", -"Unmute" => "Sesi aç", -"Rescan Collection" => "Koleksiyonu Tara", -"Artist" => "Sanatç", -"Album" => "Albüm", -"Title" => "Başlık" -); diff --git a/apps/media/l10n/uk.php b/apps/media/l10n/uk.php deleted file mode 100644 index 4ac7abbf2b2..00000000000 --- a/apps/media/l10n/uk.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Музика", -"Add album to playlist" => "Додати альбом до плейлиста", -"Play" => "Грати", -"Pause" => "Пауза", -"Previous" => "Попередній", -"Next" => "Наступний", -"Mute" => "Звук вкл.", -"Unmute" => "Звук викл.", -"Rescan Collection" => "Повторне сканування колекції", -"Artist" => "Виконавець", -"Album" => "Альбом", -"Title" => "Заголовок" -); diff --git a/apps/media/l10n/vi.php b/apps/media/l10n/vi.php deleted file mode 100644 index 01942ba173f..00000000000 --- a/apps/media/l10n/vi.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "Âm nhạc", -"Add album to playlist" => "Thêm album vào playlist", -"Play" => "Play", -"Pause" => "Tạm dừng", -"Previous" => "Trang trước", -"Next" => "Tiếp theo", -"Mute" => "Tắt", -"Unmute" => "Bật", -"Rescan Collection" => "Quét lại bộ sưu tập", -"Artist" => "Nghệ sỹ", -"Album" => "Album", -"Title" => "Tiêu đề" -); diff --git a/apps/media/l10n/xgettextfiles b/apps/media/l10n/xgettextfiles deleted file mode 100644 index 39a310a4537..00000000000 --- a/apps/media/l10n/xgettextfiles +++ /dev/null @@ -1,6 +0,0 @@ -../appinfo/app.php -../templates/music.php -../js/scanner.js -../js/collection.js -../js/music.js -../js/playlist.js diff --git a/apps/media/l10n/zh_CN.GB2312.php b/apps/media/l10n/zh_CN.GB2312.php deleted file mode 100644 index de7e98acd9e..00000000000 --- a/apps/media/l10n/zh_CN.GB2312.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "音乐", -"Add album to playlist" => "添加专辑到播放列表", -"Play" => "播放", -"Pause" => "暂停", -"Previous" => "前面的", -"Next" => "下一个", -"Mute" => "静音", -"Unmute" => "取消静音", -"Rescan Collection" => "重新扫描收藏", -"Artist" => "艺术家", -"Album" => "专辑", -"Title" => "标题" -); diff --git a/apps/media/l10n/zh_CN.php b/apps/media/l10n/zh_CN.php deleted file mode 100644 index 0b24cf3fe0d..00000000000 --- a/apps/media/l10n/zh_CN.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "音乐", -"Play" => "播放", -"Pause" => "暂停", -"Previous" => "前一首", -"Next" => "后一首", -"Mute" => "静音", -"Unmute" => "取消静音", -"Rescan Collection" => "重新扫描收藏", -"Artist" => "艺术家", -"Album" => "专辑", -"Title" => "标题" -); diff --git a/apps/media/l10n/zh_TW.php b/apps/media/l10n/zh_TW.php deleted file mode 100644 index cd90300bb48..00000000000 --- a/apps/media/l10n/zh_TW.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php $TRANSLATIONS = array( -"Music" => "音樂", -"Play" => "播放", -"Pause" => "暫停", -"Previous" => "上一首", -"Next" => "下一首", -"Mute" => "靜音", -"Unmute" => "取消靜音", -"Rescan Collection" => "重新掃描收藏", -"Artist" => "藝人", -"Album" => "專輯", -"Title" => "標題" -); diff --git a/apps/media/lib/share/album.php b/apps/media/lib/share/album.php deleted file mode 100644 index e69de29bb2d..00000000000 --- a/apps/media/lib/share/album.php +++ /dev/null diff --git a/apps/media/lib/share/artist.php b/apps/media/lib/share/artist.php deleted file mode 100644 index d08a53da2a7..00000000000 --- a/apps/media/lib/share/artist.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php -/** -* ownCloud -* -* @author Michael Gapczynski -* @copyright 2012 Michael Gapczynski mtgap@owncloud.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -*/ - -class OC_Share_Backend_Artist extends OCP\Share_Backend { - - public function getSource($item, $uid) { - $query = OCP\DB::prepare('SELECT `artist_id` FROM `*PREFIX*media_artists` WHERE `artist_id` = ? AND `song_user` = ?'); - $result = $query->execute(array($item, $uid))->fetchRow(); - if (is_array($result)) { - return array('item' => $item, 'file' => $result['song_path']); - } - return false; - } - - public function generateTarget($item, $uid, $exclude = null) { - // TODO Make sure target path doesn't exist already - return '/Shared'.$item; - } - - public function formatItems($items, $format) { - $ids = array(); - foreach ($items as $id => $info) { - $ids[] = $id; - } - $ids = "'".implode("','", $ids)."'"; - switch ($format) { - case self::FORMAT_SOURCE_PATH: - $query = OCP\DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `id` IN ('.$ids.')'); - return $query->execute()->fetchAll(); - case self::FORMAT_FILE_APP: - $query = OCP\DB::prepare('SELECT `id`, `path`, `name`, `ctime`, `mtime`, `mimetype`, `size`, `encrypted`, `versioned`, `writable` FROM `*PREFIX*fscache` WHERE `id` IN ('.$ids.')'); - $result = $query->execute(); - $files = array(); - while ($file = $result->fetchRow()) { - // Set target path - $file['path'] = $items[$file['id']]['item_target']; - $file['name'] = basename($file['path']); - // TODO Set permissions: $file['writable'] - $files[] = $file; - } - return $files; - } - } - -} - -?>
\ No newline at end of file diff --git a/apps/media/lib/share/song.php b/apps/media/lib/share/song.php deleted file mode 100644 index 65948581738..00000000000 --- a/apps/media/lib/share/song.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php -/** -* ownCloud -* -* @author Michael Gapczynski -* @copyright 2012 Michael Gapczynski mtgap@owncloud.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -*/ - -class OC_Share_Backend_Song extends OCP\Share_Backend { - - public function getSource($item, $uid) { - $query = OCP\DB::prepare('SELECT `song_path` FROM `*PREFIX*media_songs` WHERE `song_id` = ? AND `song_user` = ?'); - $result = $query->execute(array($item, $uid))->fetchRow(); - if (is_array($result)) { - return array('item' => $item, 'file' => $result['song_path']); - } - return false; - } - - public function generateTarget($item, $uid, $exclude = null) { - // TODO Make sure target path doesn't exist already - return '/Shared'.$item; - } - - public function formatItems($items, $format) { - $ids = array(); - foreach ($items as $id => $info) { - $ids[] = $id; - } - $ids = "'".implode("','", $ids)."'"; - switch ($format) { - case self::FORMAT_SOURCE_PATH: - $query = OCP\DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `id` IN ('.$ids.')'); - return $query->execute()->fetchAll(); - case self::FORMAT_FILE_APP: - $query = OCP\DB::prepare('SELECT `id`, `path`, `name`, `ctime`, `mtime`, `mimetype`, `size`, `encrypted`, `versioned`, `writable` FROM `*PREFIX*fscache` WHERE `id` IN ('.$ids.')'); - $result = $query->execute(); - $files = array(); - while ($file = $result->fetchRow()) { - // Set target path - $file['path'] = $items[$file['id']]['item_target']; - $file['name'] = basename($file['path']); - // TODO Set permissions: $file['writable'] - $files[] = $file; - } - return $files; - } - } - -} - -?>
\ No newline at end of file diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php deleted file mode 100644 index 807d94bcdeb..00000000000 --- a/apps/media/lib_ampache.php +++ /dev/null @@ -1,421 +0,0 @@ -<?php - -/** -* ownCloud - media plugin -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -//implementation of ampache's xml api -class OC_MEDIA_AMPACHE{ - - /** - * fix the string to be XML compatible - * @param string name - * @return string - */ - - /* this is an ugly hack(tm), this should be: */ - /* htmlentities($name, ENT_XML1, 'UTF-8'); */ - /* with PHP 5.4 and later */ - public static function fixXmlString($name){ - $result=str_replace("&", "&", $name); - $result=str_replace("'", "'", $result); - $result=str_replace("<", "<", $result); - $result=str_replace(">", ">", $result); - $result=str_replace("\"", """, $result); - $result=str_replace("Ä", "Ä", $result); - $result=str_replace("Ö", "Ö", $result); - $result=str_replace("Ü", "Ü", $result); - $result=str_replace("ä", "ä", $result); - $result=str_replace("ö", "ö", $result); - $result=str_replace("ü", "ü", $result); - $result=str_replace("ß", "ß", $result); - return $result; - } - - /** - * do the initial handshake - * @param array params - */ - public static function handshake($params){ - $auth=(isset($params['auth']))?$params['auth']:false; - $user=(isset($params['user']))?$params['user']:false; - $time=(isset($params['timestamp']))?$params['timestamp']:false; - $now=time(); - if($now-$time>(10*60)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>timestamp is more then 10 minutes old</error> -</root>"); - } - if($auth and $user and $time){ - $query=OCP\DB::prepare("SELECT `user_id`, `user_password_sha256` FROM `*PREFIX*media_users` WHERE `user_id`=?"); - $users=$query->execute(array($user))->fetchAll(); - if(count($users)>0){ - $pass=$users[0]['user_password_sha256']; - $key=hash('sha256',$time.$pass); - if($key==$auth){ - $token=hash('sha256','oc_media_'.$key); - OC_MEDIA_COLLECTION::$uid=$users[0]['user_id']; - $date=date('c');//todo proper update/add/clean dates - $songs=OC_MEDIA_COLLECTION::getSongCount(); - $artists=OC_MEDIA_COLLECTION::getArtistCount(); - $albums=OC_MEDIA_COLLECTION::getAlbumCount(); - $query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_sessions` (`token`, `user_id`, `start`) VALUES (?, ?, now());"); - $query->execute(array($token,$user)); - $expire=date('c',time()+600); - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <auth>$token</auth> - <version>350001</version> - <update>$date</update> - <add>$date</add> - <clean>$date</clean> - <songs>$songs</songs> - <artists>$artists</artists> - <albums>$albums</albums>\ - <session_length>600</session_length> - <session_expire>$expire</session_expire> - <tags>0</tags> - <videos>0</videos> -</root>"); - return; - } - } - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - }else{ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Missing arguments</error> -</root>"); - } - } - - public static function ping($params){ - if(isset($params['auth'])){ - if(self::checkAuth($params['auth'])){ - self::updateAuth($params['auth']); - }else{ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - } - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - echo('<version>350001</version>'); - echo('</root>'); - } - - public static function checkAuth($auth){ - if(is_array($auth)){ - if(isset($auth['auth'])){ - $auth=$auth['auth']; - }else{ - return false; - } - } - $CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" ); - if($CONFIG_DBTYPE == 'psql'){ - $interval = ' \'600s\'::interval '; - }else { - $interval = '600'; - } - //remove old sessions - $query=OCP\DB::prepare("DELETE FROM `*PREFIX*media_sessions` WHERE `start`<(NOW() - ".$interval.")"); - $query->execute(); - - $query=OCP\DB::prepare("SELECT `user_id` FROM `*PREFIX*media_sessions` WHERE `token`=?"); - $users=$query->execute(array($auth))->fetchAll(); - if(count($users)>0){ - OC_MEDIA_COLLECTION::$uid=$users[0]['user_id']; - OC_User::setUserId($users[0]['user_id']); - return $users[0]['user_id']; - }else{ - return false; - } - } - - public static function updateAuth($auth){ - $query=OCP\DB::prepare("UPDATE `*PREFIX*media_sessions` SET `start`=CURRENT_TIMESTAMP WHERE `token`=?"); - $query->execute(array($auth)); - } - - private static function printArtist($artist){ - $albums=count(OC_MEDIA_COLLECTION::getAlbums($artist['artist_id'])); - $songs=count(OC_MEDIA_COLLECTION::getSongs($artist['artist_id'])); - $id=$artist['artist_id']; - $name=self::fixXmlString($artist['artist_name']); - echo("\t<artist id='$id'>\n"); - echo("\t\t<name>$name</name>\n"); - echo("\t\t<albums>$albums</albums>\n"); - echo("\t\t<songs>$songs</songs>\n"); - echo("\t\t<rating>0</rating>\n"); - echo("\t\t<preciserating>0</preciserating>\n"); - echo("\t</artist>\n"); - } - - private static function printAlbum($album,$artistName=false){ - if(!$artistName){ - $artistName=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']); - } - $artistName=self::fixXmlString($artistName); - $songs=count(OC_MEDIA_COLLECTION::getSongs($album['album_artist'],$album['album_id'])); - $id=$album['album_id']; - $name=self::fixXmlString($album['album_name']); - $artist=$album['album_artist']; - echo("\t<album id='$id'>\n"); - echo("\t\t<name>$name</name>\n"); - echo("\t\t<artist id='$artist'>$artistName</artist>\n"); - echo("\t\t<tracks>$songs</tracks>\n"); - echo("\t\t<rating>0</rating>\n"); - echo("\t\t<year>0</year>\n"); /* make Viridian happy */ - echo("\t\t<disk>1</disk>\n"); /* make Viridian happy */ - echo("\t\t<art> </art>\n"); /* single space to make quickplay happy enough */ - echo("\t\t<preciserating>0</preciserating>\n"); - echo("\t</album>\n"); - } - - private static function printSong($song,$artistName=false,$albumName=false){ - if(!$artistName){ - $artistName=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']); - } - if(!$albumName){ - $albumName=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']); - } - $artistName=self::fixXmlString($artistName); - $albumName=self::fixXmlString($albumName); - $id=$song['song_id']; - $name=self::fixXmlString($song['song_name']); - $artist=$song['song_artist']; - $album=$song['song_album']; - echo("\t<song id='$id'>\n"); - echo("\t\t<title>$name</title>\n"); - echo("\t\t<artist id='$artist'>$artistName</artist>\n"); - echo("\t\t<album id='$album'>$albumName</album>\n"); - $url=OCP\Util::linkToRemote('ampache')."server/xml.server.php/?action=play&song=$id&auth={$_GET['auth']}"; - $url=self::fixXmlString($url); - echo("\t\t<url>$url</url>\n"); - echo("\t\t<time>{$song['song_length']}</time>\n"); - echo("\t\t<track>{$song['song_track']}</track>\n"); - echo("\t\t<size>{$song['song_size']}</size>\n"); - echo("\t\t<art> </art>\n"); /* single space to make Viridian happy enough */ - echo("\t\t<rating>0</rating>\n"); - echo("\t\t<preciserating>0</preciserating>\n"); - echo("\t</song>\n"); - } - - public static function artists($params){ - if(!self::checkAuth($params)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - $filter=isset($params['filter'])?$params['filter']:''; - $exact=isset($params['exact'])?($params['exact']=='true'):false; - $artists=OC_MEDIA_COLLECTION::getArtists($filter,$exact); - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - foreach($artists as $artist){ - self::printArtist($artist); - } - echo('</root>'); - } - - public static function artist_songs($params){ - if(!self::checkAuth($params)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - $filter=isset($params['filter'])?$params['filter']:''; - $songs=OC_MEDIA_COLLECTION::getSongs($filter); - $artist=OC_MEDIA_COLLECTION::getArtistName($filter); - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - foreach($songs as $song){ - self::printSong($song,$artist); - } - echo('</root>'); - } - - public static function artist_albums($params){ - if(!self::checkAuth($params)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - $filter = isset($params['filter']) ? $params['filter'] : ''; - $albums=OC_MEDIA_COLLECTION::getAlbums($filter); - $artist=OC_MEDIA_COLLECTION::getArtistName($filter); - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - foreach($albums as $album){ - self::printAlbum($album,$artist); - } - echo('</root>'); - } - - public static function albums($params){ - if(!self::checkAuth($params)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - $filter=isset($params['filter'])?$params['filter']:''; - $exact=isset($params['exact'])?($params['exact']=='true'):false; - $albums=OC_MEDIA_COLLECTION::getAlbums(0,$filter,$exact); - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - foreach($albums as $album){ - self::printAlbum($album,false); - } - echo('</root>'); - } - - public static function album_songs($params){ - if(!self::checkAuth($params)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - $songs=OC_MEDIA_COLLECTION::getSongs(0,$params['filter']); - if(count($songs)>0){ - $artist=OC_MEDIA_COLLECTION::getArtistName($songs[0]['song_artist']); - } - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - foreach($songs as $song){ - self::printSong($song,$artist); - } - echo('</root>'); - } - - public static function songs($params){ - if(!self::checkAuth($params)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - $filter=isset($params['filter'])?$params['filter']:''; - $exact=isset($params['exact'])?($params['exact']=='true'):false; - $songs=OC_MEDIA_COLLECTION::getSongs(0,0,$filter,$exact); - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - foreach($songs as $song){ - self::printSong($song); - } - echo('</root>'); - } - - public static function song($params){ - if(!self::checkAuth($params)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - if($song=OC_MEDIA_COLLECTION::getSong($params['filter'])){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - self::printSong($song); - echo('</root>'); - } - } - - public static function play($params){ - $username=!self::checkAuth($params); - if($username){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - if($song=OC_MEDIA_COLLECTION::getSong($params['song'])){ - OC_Util::setupFS($song["song_user"]); - - header('Content-type: '.OC_Filesystem::getMimeType($song['song_path'])); - header('Content-Length: '.$song['song_size']); - OC_Filesystem::readfile($song['song_path']); - } - } - - public static function url_to_song($params){ - if(!self::checkAuth($params)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - $url=$params['url']; - $songId=substr($url,strrpos($url,'song=')+5); - if($song=OC_MEDIA_COLLECTION::getSong($songId)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - self::printSong($song); - echo('</root>'); - } - } - - public static function search_songs($params){ - if(!self::checkAuth($params)){ - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo("<root> - <error code='400'>Invalid login</error> -</root>"); - return; - } - $filter = isset($params['filter']) ? $params['filter'] : ''; - $artists=OC_MEDIA_COLLECTION::getArtists($filter); - $albums=OC_MEDIA_COLLECTION::getAlbums(0,$filter); - $songs=OC_MEDIA_COLLECTION::getSongs(0,0,$filter); - foreach($artists as $artist){ - $songs=array_merge($songs,OC_MEDIA_COLLECTION::getSongs($artist['artist_id'])); - } - foreach($albums as $album){ - $songs=array_merge($songs,OC_MEDIA_COLLECTION::getSongs($album['album_artist'],$album['album_id'])); - } - echo('<?xml version="1.0" encoding="UTF-8"?>'); - echo('<root>'); - foreach($songs as $song){ - self::printSong($song); - } - echo('</root>'); - } -} diff --git a/apps/media/lib_collection.php b/apps/media/lib_collection.php deleted file mode 100644 index c7265caaecb..00000000000 --- a/apps/media/lib_collection.php +++ /dev/null @@ -1,388 +0,0 @@ -<?php - -/** -* ownCloud - media plugin -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - - -//class for managing a music collection -class OC_MEDIA_COLLECTION{ - public static $uid; - private static $artistIdCache=array(); - private static $albumIdCache=array(); - private static $queries=array(); - - /** - * get the id of an artist (case-insensitive) - * @param string name - * @return int - */ - public static function getArtistId($name){ - if(empty($name)){ - return 0; - } - $name=strtolower($name); - if(isset(self::$artistIdCache[$name])){ - return self::$artistIdCache[$name]; - }else{ - $query=OCP\DB::prepare("SELECT `artist_id` FROM `*PREFIX*media_artists` WHERE lower(`artist_name`) LIKE ?"); - $artists=$query->execute(array($name))->fetchAll(); - if(is_array($artists) and isset($artists[0])){ - self::$artistIdCache[$name]=$artists[0]['artist_id']; - return $artists[0]['artist_id']; - }else{ - return 0; - } - } - } - - /** - * get the id of an album (case-insensitive) - * @param string name - * @param int artistId - * @return int - */ - public static function getAlbumId($name,$artistId){ - if(empty($name)){ - return 0; - } - $name=strtolower($name); - if(!isset(self::$albumIdCache[$artistId])){ - self::$albumIdCache[$artistId]=array(); - } - if(isset(self::$albumIdCache[$artistId][$name])){ - return self::$albumIdCache[$artistId][$name]; - }else{ - $query=OCP\DB::prepare("SELECT `album_id` FROM `*PREFIX*media_albums` WHERE lower(`album_name`) LIKE ? AND `album_artist`=?"); - $albums=$query->execute(array($name,$artistId))->fetchAll(); - if(is_array($albums) and isset($albums[0])){ - self::$albumIdCache[$artistId][$name]=$albums[0]['album_id']; - return $albums[0]['album_id']; - }else{ - return 0; - } - } - } - - /** - * get the id of an song (case-insensitive) - * @param string name - * @param int artistId - * @param int albumId - * @return int - */ - public static function getSongId($name,$artistId,$albumId){ - if(empty($name)){ - return 0; - } - $name=strtolower($name); - if(!isset(self::$albumIdCache[$artistId])){ - self::$albumIdCache[$artistId]=array(); - } - if(!isset(self::$albumIdCache[$artistId][$albumId])){ - self::$albumIdCache[$artistId][$albumId]=array(); - } - if(isset(self::$albumIdCache[$artistId][$albumId][$name])){ - return self::$albumIdCache[$artistId][$albumId][$name]; - }else{ - $uid=$_SESSION['user_id']; - $query=OCP\DB::prepare("SELECT `song_id` FROM `*PREFIX*media_songs` WHERE `song_user`=? AND lower(`song_name`) LIKE ? AND `song_artist`=? AND `song_album`=?"); - $songs=$query->execute(array($uid,$name,$artistId,$albumId))->fetchAll(); - if(is_array($songs) and isset($songs[0])){ - self::$albumIdCache[$artistId][$albumId][$name]=$songs[0]['song_id']; - return $songs[0]['song_id']; - }else{ - return 0; - } - } - } - - /** - * Get the list of artists that (optionally) match a search string - * @param string search optional - * @return array the list of artists found - */ - static public function getArtists($search='%',$exact=false){ - $uid=self::$uid; - if(empty($uid)){ - $uid=self::$uid=$_SESSION['user_id']; - } - if(!$exact and $search!='%'){ - $search="%$search%"; - }elseif($search==''){ - $search='%'; - } - $query=OCP\DB::prepare("SELECT DISTINCT `artist_name`, `artist_id` FROM `*PREFIX*media_artists` - INNER JOIN `*PREFIX*media_songs` ON `artist_id`=`song_artist` WHERE `artist_name` LIKE ? AND `song_user`=? ORDER BY `artist_name`"); - $result=$query->execute(array($search,self::$uid)); - return $result->fetchAll(); - } - - /** - * Add an artists to the database - * @param string name - * @return integer the artist_id of the added artist - */ - static public function addArtist($name){ - $name=trim($name); - if($name==''){ - return 0; - } - //check if the artist is already in the database - $artistId=self::getArtistId($name); - if($artistId!=0){ - return $artistId; - }else{ - $query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_artists` (`artist_name`) VALUES (?)"); - $query->execute(array($name)); - return self::getArtistId($name);; - } - } - - /** - * Get the list of albums that (optionally) match an artist and/or search string - * @param integer artist optional - * @param string search optional - * @return array the list of albums found - */ - static public function getAlbums($artist=0,$search='%',$exact=false){ - $uid=self::$uid; - if(empty($uid)){ - $uid=self::$uid=$_SESSION['user_id']; - } - $cmd="SELECT DISTINCT `album_name`, `album_artist`, `album_id` - FROM `*PREFIX*media_albums` INNER JOIN `*PREFIX*media_songs` ON `album_id`=`song_album` WHERE `song_user`=? "; - $params=array(self::$uid); - if($artist!=0){ - $cmd.="AND `album_artist` = ? "; - array_push($params,$artist); - } - if($search!='%'){ - $cmd.="AND `album_name` LIKE ? "; - if(!$exact){ - $search="%$search%"; - } - array_push($params,$search); - } - $cmd.=' ORDER BY `album_name`'; - $query=OCP\DB::prepare($cmd); - return $query->execute($params)->fetchAll(); - } - - /** - * Add an album to the database - * @param string name - * @param integer artist - * @return integer the album_id of the added artist - */ - static public function addAlbum($name,$artist){ - $name=trim($name); - if($name==''){ - return 0; - } - //check if the album is already in the database - $albumId=self::getAlbumId($name,$artist); - if($albumId!=0){ - return $albumId; - }else{ - $query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_albums` (`album_name` ,`album_artist`) VALUES ( ?, ?)"); - $query->execute(array($name,$artist)); - return self::getAlbumId($name,$artist); - } - } - - /** - * Get the list of songs that (optionally) match an artist and/or album and/or search string - * @param integer artist optional - * @param integer album optional - * @param string search optional - * @return array the list of songs found - */ - static public function getSongs($artist=0,$album=0,$search='',$exact=false){ - $uid=self::$uid; - if(empty($uid)){ - $uid=self::$uid=$_SESSION['user_id']; - } - $params=array($uid); - if($artist!=0){ - $artistString="AND `song_artist` = ?"; - array_push($params,$artist); - }else{ - $artistString=''; - } - if($album!=0){ - $albumString="AND `song_album` = ?"; - array_push($params,$album); - }else{ - $albumString=''; - } - if($search){ - if(!$exact){ - $search="%$search%"; - } - $searchString ="AND `song_name` LIKE ?"; - array_push($params,$search); - }else{ - $searchString=''; - } - $query=OCP\DB::prepare("SELECT * FROM `*PREFIX*media_songs` WHERE `song_user`=? $artistString $albumString $searchString ORDER BY `song_track`, `song_name`, `song_path`"); - return $query->execute($params)->fetchAll(); - } - - /** - * Add an song to the database - * @param string name - * @param string path - * @param integer artist - * @param integer album - * @return integer the song_id of the added artist - */ - static public function addSong($name,$path,$artist,$album,$length,$track,$size){ - $name=trim($name); - $path=trim($path); - if($name=='' or $path==''){ - return 0; - } - $uid=OCP\USER::getUser(); - //check if the song is already in the database - $songId=self::getSongId($name,$artist,$album); - if($songId!=0){ - $songInfo=self::getSong($songId); - self::moveSong($songInfo['song_path'],$path); - return $songId; - }else{ - if(!isset(self::$queries['addsong'])){ - $query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_songs` (`song_name` ,`song_artist` ,`song_album` ,`song_path` ,`song_user`,`song_length`,`song_track`,`song_size`,`song_playcount`,`song_lastplayed`) - VALUES (?, ?, ?, ?,?,?,?,?,0,0)"); - self::$queries['addsong']=$query; - }else{ - $query=self::$queries['addsong']; - } - $query->execute(array($name,$artist,$album,$path,$uid,$length,$track,$size)); - $songId=OCP\DB::insertid('*PREFIX*media_songs_song'); -// self::setLastUpdated(); - return self::getSongId($name,$artist,$album); - } - } - - public static function getSongCount(){ - $query=OCP\DB::prepare("SELECT COUNT(`song_id`) AS `count` FROM `*PREFIX*media_songs`"); - $result=$query->execute()->fetchAll(); - return $result[0]['count']; - } - - public static function getArtistCount(){ - $query=OCP\DB::prepare("SELECT COUNT(`artist_id`) AS `count` FROM `*PREFIX*media_artists`"); - $result=$query->execute()->fetchAll(); - return $result[0]['count']; - } - - public static function getAlbumCount(){ - $query=OCP\DB::prepare("SELECT COUNT(`album_id`) AS `count` FROM `*PREFIX*media_albums`"); - $result=$query->execute()->fetchAll(); - return $result[0]['count']; - } - - public static function getArtistName($artistId){ - $query=OCP\DB::prepare("SELECT `artist_name` FROM `*PREFIX*media_artists` WHERE `artist_id`=?"); - $artist=$query->execute(array($artistId))->fetchAll(); - if(count($artist)>0){ - return $artist[0]['artist_name']; - }else{ - return ''; - } - } - - public static function getAlbumName($albumId){ - $query=OCP\DB::prepare("SELECT `album_name` FROM `*PREFIX*media_albums` WHERE `album_id`=?"); - $album=$query->execute(array($albumId))->fetchAll(); - if(count($album)>0){ - return $album[0]['album_name']; - }else{ - return ''; - } - } - - public static function getSong($id){ - $query=OCP\DB::prepare("SELECT * FROM `*PREFIX*media_songs` WHERE `song_id`=?"); - $song=$query->execute(array($id))->fetchAll(); - if(count($song)>0){ - return $song[0]; - }else{ - return ''; - } - } - - /** - * get the number of songs in a directory - * @param string $path - */ - public static function getSongCountByPath($path){ - $query=OCP\DB::prepare("SELECT COUNT(`song_id`) AS `count` FROM `*PREFIX*media_songs` WHERE `song_path` LIKE ?"); - $result=$query->execute(array("$path%"))->fetchAll(); - return $result[0]['count']; - } - - /** - * remove a song from the database by path - * @param string $path the path of the song - * - * if a path of a folder is passed, all songs stored in the folder will be removed from the database - */ - public static function deleteSongByPath($path){ - $query=OCP\DB::prepare("DELETE FROM `*PREFIX*media_songs` WHERE `song_path` LIKE ?"); - $query->execute(array("$path%")); - } - - /** - * increase the play count of a song - * @param int songId - */ - public static function registerPlay($songId){ - $now=time(); - $query=OCP\DB::prepare('UPDATE `*PREFIX*media_songs` SET `song_playcount`=`song_playcount`+1, `song_lastplayed`=? WHERE `song_id`=? AND `song_lastplayed`<?'); - $query->execute(array($now,$songId,$now-60)); - } - - /** - * get the id of the song by path - * @param string $path - * @return int - */ - public static function getSongByPath($path){ - $query=OCP\DB::prepare("SELECT `song_id` FROM `*PREFIX*media_songs` WHERE `song_path` = ?"); - $result=$query->execute(array($path)); - if($row=$result->fetchRow()){ - return $row['song_id']; - }else{ - return 0; - } - } - - /** - * set the path of a song - * @param string $oldPath - * @param string $newPath - */ - public static function moveSong($oldPath,$newPath){ - $query=OCP\DB::prepare("UPDATE `*PREFIX*media_songs` SET `song_path` = ? WHERE `song_path` = ?"); - $query->execute(array($newPath,$oldPath)); - } -} diff --git a/apps/media/lib_media.php b/apps/media/lib_media.php deleted file mode 100644 index ff58e4e7350..00000000000 --- a/apps/media/lib_media.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -/** -* ownCloud - media plugin -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is diconnectstributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -class OC_MEDIA{ - /** - * get the sha256 hash of the password needed for ampache - * @param array $params, parameters passed from OC_Hook - */ - public static function loginListener($params){ - if(isset($params['uid']) and $params['password']){ - $name=$params['uid']; - $query=OCP\DB::prepare("SELECT `user_id` from `*PREFIX*media_users` WHERE `user_id` LIKE ?"); - $uid=$query->execute(array($name))->fetchAll(); - if(count($uid)==0){ - $password=hash('sha256',$_POST['password']); - $query=OCP\DB::prepare("INSERT INTO `*PREFIX*media_users` (`user_id`, `user_password_sha256`) VALUES (?, ?);"); - $query->execute(array($name,$password)); - } - } - } - - /** - * - */ - public static function updateFile($params){ - $path=$params['path']; - if(!$path) return; - require_once 'lib_scanner.php'; - require_once 'lib_collection.php'; - //fix a bug where there were multiply '/' in front of the path, it should only be one - while($path[0]=='/'){ - $path=substr($path,1); - } - $path='/'.$path; - OC_MEDIA_SCANNER::scanFile($path); - } - - /** - * - */ - public static function deleteFile($params){ - $path=$params['path']; - require_once 'lib_collection.php'; - OC_MEDIA_COLLECTION::deleteSongByPath($path); - } - - public static function moveFile($params){ - require_once 'lib_collection.php'; - OC_MEDIA_COLLECTION::moveSong($params['oldpath'],$params['newpath']); - } -} - -class OC_MediaSearchProvider extends OC_Search_Provider{ - function search($query){ - require_once('lib_collection.php'); - $artists=OC_MEDIA_COLLECTION::getArtists($query); - $albums=OC_MEDIA_COLLECTION::getAlbums(0,$query); - $songs=OC_MEDIA_COLLECTION::getSongs(0,0,$query); - $results=array(); - foreach($artists as $artist){ - $results[]=new OC_Search_Result($artist['artist_name'],'',OCP\Util::linkTo( 'media', 'index.php').'#artist='.urlencode($artist['artist_name']),'Music'); - } - foreach($albums as $album){ - $artist=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']); - $results[]=new OC_Search_Result($album['album_name'],'by '.$artist,OCP\Util::linkTo( 'media', 'index.php').'#artist='.urlencode($artist).'&album='.urlencode($album['album_name']),'Music'); - } - foreach($songs as $song){ - $minutes=floor($song['song_length']/60); - $secconds=$song['song_length']%60; - $artist=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']); - $album=OC_MEDIA_COLLECTION::getalbumName($song['song_album']); - $results[]=new OC_Search_Result($song['song_name'],"by $artist, in $album $minutes:$secconds",OCP\Util::linkTo( 'media', 'index.php').'#artist='.urlencode($artist).'&album='.urlencode($album).'&song='.urlencode($song['song_name']),'Music'); - } - return $results; - } -} - diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php deleted file mode 100644 index 3c32879eeeb..00000000000 --- a/apps/media/lib_scanner.php +++ /dev/null @@ -1,138 +0,0 @@ -<?php - -/** -* ownCloud - media plugin -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -require_once('getid3/getid3.php'); - -//class for scanning directories for music -class OC_MEDIA_SCANNER{ - static private $getID3=false; - - //these are used to store which artists and albums we found, it can save a lot of addArtist/addAlbum calls - static private $artists=array(); - static private $albums=array();//stored as "$artist/$album" to allow albums with the same name from different artists - - /** - * scan a folder for music - * @param OC_EventSource eventSource (optional) - * @return int the number of songs found - */ - public static function scanCollection($eventSource=null){ - $music=OC_FileCache::searchByMime('audio'); - $ogg=OC_FileCache::searchByMime('application','ogg'); - $music=array_merge($music,$ogg); - $eventSource->send('count',count($music)); - $songs=0; - foreach($music as $file){ - self::scanFile($file); - $songs++; - if($eventSource){ - $eventSource->send('scanned',array('file'=>$file,'count'=>$songs)); - } - } - if($eventSource){ - $eventSource->send('done',$songs); - } - return $songs; - } - - /** - * scan a file for music - * @param string $path - * @return boolean - */ - public static function scanFile($path){ - if(!self::isMusic($path)){ - return; - } - if(!self::$getID3){ - self::$getID3=@new getID3(); - self::$getID3->encoding='UTF-8'; - } - $file=OC_Filesystem::getLocalFile($path); - $data=@self::$getID3->analyze($file); - getid3_lib::CopyTagsToComments($data); - if(!isset($data['comments'])){ - OCP\Util::writeLog('media',"error reading id3 tags in '$file'",OCP\Util::WARN); - return; - } - if(!isset($data['comments']['artist'])){ - OCP\Util::writeLog('media',"error reading artist tag in '$file'",OCP\Util::WARN); - $artist='unknown'; - }else{ - $artist=OCP\Util::sanitizeHTML(stripslashes($data['comments']['artist'][0])); - } - if(!isset($data['comments']['album'])){ - OCP\Util::writeLog('media',"error reading album tag in '$file'",OCP\Util::WARN); - $album='unknown'; - }else{ - $album=OCP\Util::sanitizeHTML(stripslashes($data['comments']['album'][0])); - } - if(!isset($data['comments']['title'])){ - OCP\Util::writeLog('media',"error reading title tag in '$file'",OCP\Util::WARN); - $title='unknown'; - }else{ - $title=OCP\Util::sanitizeHTML(stripslashes($data['comments']['title'][0])); - } - $size=$data['filesize']; - if (isset($data['comments']['track'])) - { - $track = $data['comments']['track'][0]; - } - else if (isset($data['comments']['track_number'])) - { - $track = $data['comments']['track_number'][0]; - $track = explode('/',$track); - $track = $track[0]; - } - else - { - $track = 0; - } - $length=isset($data['playtime_seconds'])?round($data['playtime_seconds']):0; - - if(!isset(self::$artists[$artist])){ - $artistId=OC_MEDIA_COLLECTION::addArtist($artist); - self::$artists[$artist]=$artistId; - }else{ - $artistId=self::$artists[$artist]; - } - if(!isset(self::$albums[$artist.'/'.$album])){ - $albumId=OC_MEDIA_COLLECTION::addAlbum($album,$artistId); - self::$albums[$artist.'/'.$album]=$albumId; - }else{ - $albumId=self::$albums[$artist.'/'.$album]; - } - $songId=OC_MEDIA_COLLECTION::addSong($title,$path,$artistId,$albumId,$length,$track,$size); - return (!($title=='unkown' && $artist=='unkown' && $album=='unkown'))?$songId:0; - } - - /** - * quick check if a song is a music file by checking the extension, not as good as a proper mimetype check but way faster - * @param string $filename - * @return bool - */ - public static function isMusic($filename){ - $ext=strtolower(substr($filename,strrpos($filename,'.')+1)); - return $ext=='mp3' || $ext=='flac' || $ext=='m4a' || $ext=='ogg' || $ext=='oga'; - } -} diff --git a/apps/media/remote.php b/apps/media/remote.php deleted file mode 100644 index 0535077cef1..00000000000 --- a/apps/media/remote.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -// only need filesystem apps -$RUNTIME_APPTYPES=array('filesystem','authentication'); -OC_App::loadApps($RUNTIME_APPTYPES); - -if($path_info == '/ampache' || $path_info == '/ampache/'){ - require_once(OC_App::getAppPath('media').'/index.php'); -}else{ - require_once(OC_App::getAppPath('media').'/server/xml.server.php'); -} diff --git a/apps/media/server/xml.server.php b/apps/media/server/xml.server.php deleted file mode 100644 index 796da130a47..00000000000 --- a/apps/media/server/xml.server.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php - -/** -* ownCloud - media plugin -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -OCP\App::checkAppEnabled('media'); - require_once(OC_App::getAppPath('media').'/lib_collection.php'); - require_once(OC_App::getAppPath('media').'/lib_ampache.php'); - -$arguments=$_POST; -if(!isset($_POST['action']) and isset($_GET['action'])){ - $arguments=$_GET; -} - -foreach($arguments as &$argument){ - $argument=stripslashes($argument); -} -@ob_clean(); -if(isset($arguments['action'])){ - OCP\Util::writeLog('media','ampache '.$arguments['action'].' request', OCP\Util::DEBUG); - switch($arguments['action']){ - case 'songs': - OC_MEDIA_AMPACHE::songs($arguments); - break; - case 'url_to_song': - OC_MEDIA_AMPACHE::url_to_song($arguments); - break; - case 'play': - OC_MEDIA_AMPACHE::play($arguments); - break; - case 'handshake': - OC_MEDIA_AMPACHE::handshake($arguments); - break; - case 'ping': - OC_MEDIA_AMPACHE::ping($arguments); - break; - case 'artists': - OC_MEDIA_AMPACHE::artists($arguments); - break; - case 'artist_songs': - OC_MEDIA_AMPACHE::artist_songs($arguments); - break; - case 'artist_albums': - OC_MEDIA_AMPACHE::artist_albums($arguments); - break; - case 'albums': - OC_MEDIA_AMPACHE::albums($arguments); - break; - case 'album_songs': - OC_MEDIA_AMPACHE::album_songs($arguments); - break; - case 'search_songs': - OC_MEDIA_AMPACHE::search_songs($arguments); - break; - case 'song': - OC_MEDIA_AMPACHE::song($arguments); - break; - } -} - -?> diff --git a/apps/media/settings.php b/apps/media/settings.php deleted file mode 100644 index 53738f02f9f..00000000000 --- a/apps/media/settings.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -$tmpl = new OCP\Template( 'media', 'settings'); - -return $tmpl->fetchPage(); diff --git a/apps/media/templates/music.php b/apps/media/templates/music.php deleted file mode 100644 index 589d6b52475..00000000000 --- a/apps/media/templates/music.php +++ /dev/null @@ -1,52 +0,0 @@ -<div class='player-controls' id="controls"> - <ul class="jp-controls"> - <li><a href="#" class="jp-play action"><img class="svg" alt="<?php echo $l->t('Play');?>" src="<?php echo OCP\image_path('core', 'actions/play-big.svg'); ?>" /></a></li> - <li><a href="#" class="jp-pause action"><img class="svg" alt="<?php echo $l->t('Pause');?>" src="<?php echo OCP\image_path('core', 'actions/pause-big.svg'); ?>" /></a></li> - <li><a href="#" class="jp-previous action"><img class="svg" alt="<?php echo $l->t('Previous');?>" src="<?php echo OCP\image_path('core', 'actions/play-previous.svg'); ?>" /></a></li> - <li><a href="#" class="jp-next action"><img class="svg" alt="<?php echo $l->t('Next');?>" src="<?php echo OCP\image_path('core', 'actions/play-next.svg'); ?>" /></a></li> - <li><a href="#" class="jp-mute action"><img class="svg" alt="<?php echo $l->t('Mute');?>" src="<?php echo OCP\image_path('core', 'actions/sound.svg'); ?>" /></a></li> - <li><a href="#" class="jp-unmute action"><img class="svg" alt="<?php echo $l->t('Unmute');?>" src="<?php echo OCP\image_path('core', 'actions/sound-off.svg'); ?>" /></a></li> - </ul> - <div class="jp-progress"> - <div class="jp-seek-bar"> - <div class="jp-play-bar"></div> - </div> - </div> - <div class="jp-current-time"></div> - <div class="jp-duration"></div> - <div class="jp-volume-bar"> - <div class="jp-volume-bar-value"></div> - </div> - <div class="jp-current-song"></div> - - <div class="player" id="jp-player"></div> - - <div id="scan"> - <input type="button" class="start" value="<?php echo $l->t('Rescan Collection')?>" /> - <input type="button" class="stop" style="display:none" value="<?php echo $l->t('Pause')?>" /> - <div id="scanprogressbar"></div> - </div> -</div> - -<ul id="leftcontent"></ul> - -<div id="rightcontent"> -<table id="collection"> - <thead> - <tr> - <th><?php echo $l->t('Artist')?></th> - <th><?php echo $l->t('Album')?></th> - <th><?php echo $l->t('Title')?></th> - </tr> - </thead> - <tbody> - <tr class="template"> - <td class="artist"><a></a></td> - <td class="artist-expander"><a></a></td> - <td class="album"><a></a></td> - <td class="album-expander"><a></a></td> - <td class="title"><a></a></td> - </tr> - </tbody> -</table> -</div> diff --git a/apps/media/templates/player.php b/apps/media/templates/player.php deleted file mode 100644 index 6c14006f831..00000000000 --- a/apps/media/templates/player.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -if(!isset($_)){//allow the template to be loaded standalone - $tmpl = new OCP\Template( 'media', 'player'); - $tmpl->printPage(); - exit; -} -?> -<?php echo $l->t('Music');?> -<div class='player-controls' id="playercontrols"> - <div class="player" id="jp-player"></div> - <ul class="jp-controls"> - <li><a href="#" class="jp-play action"><img class="svg" alt="<?php echo $l->t('Play');?>" src="<?php echo OCP\image_path('core', 'actions/play.svg'); ?>" /></a></li> - <li><a href="#" class="jp-pause action"><img class="svg" alt="<?php echo $l->t('Pause');?>" src="<?php echo OCP\image_path('core', 'actions/pause.svg'); ?>" /></a></li> - <li><a href="#" class="jp-next action"><img class="svg" alt="<?php echo $l->t('Next');?>" src="<?php echo OCP\image_path('core', 'actions/play-next.svg'); ?>" /></a></li> - </ul> -</div>
\ No newline at end of file diff --git a/apps/media/templates/settings.php b/apps/media/templates/settings.php deleted file mode 100644 index a7dc0775c44..00000000000 --- a/apps/media/templates/settings.php +++ /dev/null @@ -1,7 +0,0 @@ -<form id="mediaform"> - <fieldset class="personalblock"> - <strong>Media</strong><br /> - Ampache address: - <code><?php echo OCP\Util::linkToRemote('ampache'); ?></code><br /> - </fieldset> -</form> |