+ var listItem = "
";
+
+ // Create remove control
+ listItem += "
×";
+
+ // Create links to free media
+ if(media.free) {
+ var first = true;
+ listItem += "
(";
+ $.each(media, function(property,value) {
+ if($.jPlayer.prototype.format[property]) { // Check property is a media format.
+ if(first) {
+ first = false;
+ } else {
+ listItem += " | ";
+ }
+ listItem += "" + property + "";
+ }
+ });
+ listItem += ")";
+ }
+
+ // The title is given next in the HTML otherwise the float:right on the free media corrupts in IE6/7
+ listItem += "
" + media.title + (media.artist ? " by " + media.artist + "" : "") + "";
+ listItem += "
";
+
+ 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 ? "
by " + this.playlist[index].artist + "" : ""));
+ }
+ },
+ 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/app/assets/javascripts/jquery/jplayer/jquery.jplayer/Jplayer.swf b/app/assets/javascripts/jquery/jplayer/jquery.jplayer/Jplayer.swf
new file mode 100644
index 0000000..4d50c86
Binary files /dev/null and b/app/assets/javascripts/jquery/jplayer/jquery.jplayer/Jplayer.swf differ
diff --git a/app/assets/javascripts/jquery/jplayer/jquery.jplayer/jquery.jplayer.js b/app/assets/javascripts/jquery/jplayer/jquery.jplayer/jquery.jplayer.js
new file mode 100644
index 0000000..c28fa0b
--- /dev/null
+++ b/app/assets/javascripts/jquery/jplayer/jquery.jplayer/jquery.jplayer.js
@@ -0,0 +1,2349 @@
+/*
+ * 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 = '
';
+
+ var paramStr = [
+ '
',
+ '
',
+ '
',
+ '
',
+ '
'
+ ];
+
+ 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/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.css b/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.css
new file mode 100644
index 0000000..7bb226e
--- /dev/null
+++ b/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.css
@@ -0,0 +1,623 @@
+/*
+ * Skin for jPlayer Plugin (jQuery JavaScript Library)
+ * http://www.happyworm.com/jquery/jplayer
+ *
+ * Skin Name: Blue Monday
+ *
+ * Copyright (c) 2010-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: Silvia Benvenuti
+ * Skin Version: 4.0 (jPlayer 2.1.0)
+ * Date: 1st September 2011
+ */
+
+div.jp-audio,
+div.jp-video {
+
+ /* Edit the font-size to counteract inherited font sizing.
+ * Eg. 1.25em = 1 / 0.8em
+ */
+
+ font-size:1.25em; /* 1.25em for testing in site pages */ /* No parent CSS that can effect the size in the demos ZIP */
+
+ font-family:Verdana, Arial, sans-serif;
+ line-height:1.6;
+ color: #666;
+ border:1px solid #009be3;
+ background-color:#eee;
+ position:relative;
+}
+div.jp-audio {
+ width:420px;
+}
+div.jp-video-270p {
+ width:480px;
+}
+div.jp-video-360p {
+ width:640px;
+}
+div.jp-video-full {
+ /* Rules for IE6 (full-screen) */
+ width:480px;
+ height:270px;
+ /* Rules for IE7 (full-screen) - Otherwise the relative container causes other page items that are not position:static (default) to appear over the video/gui. */
+ position:static !important; position:relative
+}
+
+div.jp-video-full div.jp-jplayer {
+ top: 0;
+ left: 0;
+ position: fixed !important; position: relative; /* Rules for IE6 (full-screen) */
+ overflow: hidden;
+ z-index:1000;
+}
+
+div.jp-video-full div.jp-gui {
+ position: fixed !important; position: static; /* Rules for IE6 (full-screen) */
+ top: 0;
+ left: 0;
+ width:100%;
+ height:100%;
+ z-index:1000;
+}
+
+div.jp-video-full div.jp-interface {
+ position: absolute !important; position: relative; /* Rules for IE6 (full-screen) */
+ bottom: 0;
+ left: 0;
+ z-index:1000;
+}
+
+div.jp-interface {
+ position: relative;
+ background-color:#eee;
+ width:100%;
+}
+
+div.jp-audio div.jp-type-single div.jp-interface {
+ height:80px;
+}
+div.jp-audio div.jp-type-playlist div.jp-interface {
+ height:80px;
+}
+
+div.jp-video div.jp-interface {
+ border-top:1px solid #009be3;
+}
+
+/* @group CONTROLS */
+
+div.jp-controls-holder {
+ clear: both;
+ width:440px;
+ margin:0 auto;
+ position: relative;
+ overflow:hidden;
+ top:-8px; /* This negative value depends on the size of the text in jp-currentTime and jp-duration */
+}
+
+div.jp-interface ul.jp-controls {
+ list-style-type:none;
+ margin:0;
+ padding: 0;
+ overflow:hidden;
+}
+
+div.jp-audio ul.jp-controls {
+ width: 380px;
+ padding:20px 20px 0 20px;
+}
+
+div.jp-video div.jp-type-single ul.jp-controls {
+ width: 78px;
+ margin-left: 200px;
+}
+
+div.jp-video div.jp-type-playlist ul.jp-controls {
+ width: 134px;
+ margin-left: 172px;
+}
+div.jp-video ul.jp-controls,
+div.jp-interface ul.jp-controls li {
+ display:inline;
+ float: left;
+}
+
+div.jp-interface ul.jp-controls a {
+ display:block;
+ overflow:hidden;
+ text-indent:-9999px;
+}
+a.jp-play,
+a.jp-pause {
+ width:40px;
+ height:40px;
+}
+
+a.jp-play {
+ background: url("jplayer.blue.monday.jpg") 0 0 no-repeat;
+}
+a.jp-play:hover {
+ background: url("jplayer.blue.monday.jpg") -41px 0 no-repeat;
+}
+a.jp-pause {
+ background: url("jplayer.blue.monday.jpg") 0 -42px no-repeat;
+ display: none;
+}
+a.jp-pause:hover {
+ background: url("jplayer.blue.monday.jpg") -41px -42px no-repeat;
+}
+
+a.jp-stop, a.jp-previous, a.jp-next {
+ width:28px;
+ height:28px;
+ margin-top:6px;
+}
+
+a.jp-stop {
+ background: url("jplayer.blue.monday.jpg") 0 -83px no-repeat;
+ margin-left:10px;
+}
+
+a.jp-stop:hover {
+ background: url("jplayer.blue.monday.jpg") -29px -83px no-repeat;
+}
+
+a.jp-previous {
+ background: url("jplayer.blue.monday.jpg") 0 -112px no-repeat;
+}
+a.jp-previous:hover {
+ background: url("jplayer.blue.monday.jpg") -29px -112px no-repeat;
+}
+
+a.jp-next {
+ background: url("jplayer.blue.monday.jpg") 0 -141px no-repeat;
+}
+a.jp-next:hover {
+ background: url("jplayer.blue.monday.jpg") -29px -141px no-repeat;
+}
+
+/* @end */
+
+/* @group progress bar */
+
+div.jp-progress {
+ overflow:hidden;
+ background-color: #ddd;
+}
+div.jp-audio div.jp-progress {
+ position: absolute;
+ top:32px;
+ height:15px;
+}
+div.jp-audio div.jp-type-single div.jp-progress {
+ left:110px;
+ width:186px;
+}
+div.jp-audio div.jp-type-playlist div.jp-progress {
+ left:166px;
+ width:130px;
+}
+div.jp-video div.jp-progress {
+ top:0px;
+ left:0px;
+ width:100%;
+ height:10px;
+}
+div.jp-seek-bar {
+ background: url("jplayer.blue.monday.jpg") 0 -202px repeat-x;
+ width:0px;
+ height:100%;
+ cursor: pointer;
+}
+div.jp-play-bar {
+ background: url("jplayer.blue.monday.jpg") 0 -218px repeat-x ;
+ width:0px;
+ height:100%;
+}
+
+/* The seeking class is added/removed inside jPlayer */
+div.jp-seeking-bg {
+ background: url("jplayer.blue.monday.seeking.gif");
+}
+
+/* @end */
+
+/* @group volume controls */
+
+
+a.jp-mute,
+a.jp-unmute,
+a.jp-volume-max {
+ width:18px;
+ height:15px;
+ margin-top:12px;
+}
+
+div.jp-audio div.jp-type-single a.jp-mute,
+div.jp-audio div.jp-type-single a.jp-unmute {
+ margin-left: 210px;
+}
+
+div.jp-audio div.jp-type-playlist a.jp-mute,
+div.jp-audio div.jp-type-playlist a.jp-unmute {
+ margin-left: 154px;
+}
+
+div.jp-audio a.jp-volume-max {
+ margin-left: 56px;
+}
+
+div.jp-video a.jp-mute,
+div.jp-video a.jp-unmute,
+div.jp-video a.jp-volume-max {
+ position: absolute;
+ top:12px;
+ margin-top:0;
+}
+
+div.jp-video a.jp-mute,
+div.jp-video a.jp-unmute {
+ left: 50px;
+}
+
+div.jp-video a.jp-volume-max {
+ left: 134px;
+}
+
+a.jp-mute {
+ background: url("jplayer.blue.monday.jpg") 0 -170px no-repeat;
+}
+a.jp-mute:hover {
+ background: url("jplayer.blue.monday.jpg") -19px -170px no-repeat;
+}
+a.jp-unmute {
+ background: url("jplayer.blue.monday.jpg") -60px -170px no-repeat;
+ display: none;
+}
+a.jp-unmute:hover {
+ background: url("jplayer.blue.monday.jpg") -79px -170px no-repeat;
+}
+
a.jp-volume-max {
+ background: url("jplayer.blue.monday.jpg") 0 -186px no-repeat;
+}
+a.jp-volume-max:hover {
+ background: url("jplayer.blue.monday.jpg") -19px -186px no-repeat;
+}
+
+div.jp-volume-bar {
+ position: absolute;
+ overflow:hidden;
+ background: url("jplayer.blue.monday.jpg") 0 -250px repeat-x;
+ width:46px;
+ height:5px;
+ cursor: pointer;
+}
+div.jp-audio div.jp-volume-bar {
+ top:37px;
+ left:330px;
+}
+div.jp-video div.jp-volume-bar {
+ top:17px;
+ left:72px;
+}
+div.jp-volume-bar-value {
+ background: url("jplayer.blue.monday.jpg") 0 -256px repeat-x;
+ width:0px;
+ height:5px;
+}
+
+/* @end */
+
+/* @group current time and duration */
+
+div.jp-audio div.jp-time-holder {
+ position:absolute;
+ top:50px;
+}
+div.jp-audio div.jp-type-single div.jp-time-holder {
+ left:110px;
+ width:186px;
+}
+div.jp-audio div.jp-type-playlist div.jp-time-holder {
+ left:166px;
+ width:130px;
+}
+
+div.jp-current-time,
+div.jp-duration {
+ width:60px;
+ font-size:.64em;
+ font-style:oblique;
+}
+div.jp-current-time {
+ float: left;
+ display:inline;
+}
+div.jp-duration {
+ float: right;
+ display:inline;
+ text-align: right;
+}
+
+div.jp-video div.jp-current-time {
+ margin-left:20px;
+}
+div.jp-video div.jp-duration {
+ margin-right:20px;
+}
+
+/* @end */
+
+/* @group playlist */
+
+div.jp-title {
+ font-weight:bold;
+ text-align:center;
+}
+
+div.jp-title,
+div.jp-playlist {
+ width:100%;
+ background-color:#ccc;
+ border-top:1px solid #009be3;
+}
+div.jp-type-single div.jp-title,
+div.jp-type-playlist div.jp-title,
+div.jp-type-single div.jp-playlist {
+ border-top:none;
+}
+div.jp-title ul,
+div.jp-playlist ul {
+ list-style-type:none;
+ margin:0;
+ padding:0 20px;
+ font-size:.72em;
+}
+
+div.jp-title li {
+ padding:5px 0;
+ font-weight:bold;
+}
+div.jp-playlist li {
+ padding:5px 0 4px 20px;
+ border-bottom:1px solid #eee;
+}
+
+div.jp-playlist li div {
+ display:inline;
+}
+
+/* Note that the first-child (IE6) and last-child (IE6/7/8) selectors do not work on IE */
+
+div.jp-type-playlist div.jp-playlist li:last-child {
+ padding:5px 0 5px 20px;
+ border-bottom:none;
+}
+div.jp-type-playlist div.jp-playlist li.jp-playlist-current {
+ list-style-type:square;
+ list-style-position:inside;
+ padding-left:7px;
+}
+div.jp-type-playlist div.jp-playlist a {
+ color: #333;
+ text-decoration: none;
+}
+div.jp-type-playlist div.jp-playlist a:hover {
+ color:#0d88c1;
+}
+div.jp-type-playlist div.jp-playlist a.jp-playlist-current {
+ color:#0d88c1;
+}
+
+div.jp-type-playlist div.jp-playlist a.jp-playlist-item-remove {
+ float:right;
+ display:inline;
+ text-align:right;
+ margin-right:10px;
+ font-weight:bold;
+ color:#666;
+}
+div.jp-type-playlist div.jp-playlist a.jp-playlist-item-remove:hover {
+ color:#0d88c1;
+}
+div.jp-type-playlist div.jp-playlist span.jp-free-media {
+ float:right;
+ display:inline;
+ text-align:right;
+ margin-right:10px;
+}
+div.jp-type-playlist div.jp-playlist span.jp-free-media a{
+ color:#666;
+}
+div.jp-type-playlist div.jp-playlist span.jp-free-media a:hover{
+ color:#0d88c1;
+}
+span.jp-artist {
+ font-size:.8em;
+ color:#666;
+}
+
+/* @end */
+
+div.jp-video-play {
+ position:absolute;
+ top:0;
+ left:0;
+ width:100%;
+ cursor:pointer;
+ background-color:rgba(0,0,0,0); /* Makes IE9 work with the active area over the whole video area. IE6/7/8 only have the button as active area. */
+}
+div.jp-video-270p div.jp-video-play {
+ height:270px;
+}
+div.jp-video-360p div.jp-video-play {
+ height:360px;
+}
+div.jp-video-full div.jp-video-play {
+ height:100%;
+ z-index:1000;
+}
+a.jp-video-play-icon {
+ position:relative;
+ display:block;
+ width: 112px;
+ height: 100px;
+
+ margin-left:-56px;
+ margin-top:-50px;
+ left:50%;
+ top:50%;
+
+ background: url("jplayer.blue.monday.video.play.png") 0 0 no-repeat;
+ text-indent:-9999px;
+}
+div.jp-video-play:hover a.jp-video-play-icon {
+ background: url("jplayer.blue.monday.video.play.png") 0 -100px no-repeat;
+}
+
+
+
+
+
+div.jp-jplayer audio,
+div.jp-jplayer {
+ width:0px;
+ height:0px;
+}
+
+div.jp-jplayer {
+ background-color: #000000;
+}
+
+
+
+
+
+/* @group TOGGLES */
+
+/* The audio toggles are nested inside jp-time-holder */
+
+ul.jp-toggles {
+ list-style-type:none;
+ padding:0;
+ margin:0 auto;
+ overflow:hidden;
+}
+
+div.jp-audio .jp-type-single ul.jp-toggles {
+ width:25px;
+}
+div.jp-audio .jp-type-playlist ul.jp-toggles {
+ width:55px;
+ margin: 0;
+ position: absolute;
+ left: 325px;
+ top: 50px;
+}
+
+div.jp-video ul.jp-toggles {
+ margin-top:10px;
+ width:100px;
+}
+
+ul.jp-toggles li {
+ display:block;
+ float:right;
+}
+
+ul.jp-toggles li a {
+ display:block;
+ width:25px;
+ height:18px;
+ text-indent:-9999px;
+ line-height:100%; /* need this for IE6 */
+}
+
+a.jp-full-screen {
+ background: url("jplayer.blue.monday.jpg") 0 -310px no-repeat;
+ margin-left: 20px;
+}
+
+a.jp-full-screen:hover {
+ background: url("jplayer.blue.monday.jpg") -30px -310px no-repeat;
+}
+
+a.jp-restore-screen {
+ background: url("jplayer.blue.monday.jpg") -60px -310px no-repeat;
+ margin-left: 20px;
+}
+
+a.jp-restore-screen:hover {
+ background: url("jplayer.blue.monday.jpg") -90px -310px no-repeat;
+}
+
+a.jp-repeat {
+ background: url("jplayer.blue.monday.jpg") 0 -290px no-repeat;
+}
+
+a.jp-repeat:hover {
+ background: url("jplayer.blue.monday.jpg") -30px -290px no-repeat;
+}
+
+a.jp-repeat-off {
+ background: url("jplayer.blue.monday.jpg") -60px -290px no-repeat;
+}
+
+a.jp-repeat-off:hover {
+ background: url("jplayer.blue.monday.jpg") -90px -290px no-repeat;
+}
+
+a.jp-shuffle {
+ background: url("jplayer.blue.monday.jpg") 0 -270px no-repeat;
+ margin-left: 5px;
+}
+
+a.jp-shuffle:hover {
+ background: url("jplayer.blue.monday.jpg") -30px -270px no-repeat;
+}
+
+a.jp-shuffle-off {
+ background: url("jplayer.blue.monday.jpg") -60px -270px no-repeat;
+ margin-left: 5px;
+}
+
+a.jp-shuffle-off:hover {
+ background: url("jplayer.blue.monday.jpg") -90px -270px no-repeat;
+}
+
+
+/* @end */
+
+/* @group NO SOLUTION error feedback */
+
+.jp-no-solution {
+ position:absolute;
+ width:390px;
+ margin-left:-202px;
+ left:50%;
+ top: 10px;
+
+ padding:5px;
+ font-size:.8em;
+ background-color:#eee;
+ border:2px solid #009be3;
+ color:#000;
+ display:none;
+}
+
+.jp-no-solution a {
+ color:#000;
+}
+
+.jp-no-solution span {
+ font-size:1em;
+ display:block;
+ text-align:center;
+ font-weight:bold;
+}
+
+/* @end */
diff --git a/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.jpg b/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.jpg
new file mode 100644
index 0000000..adab53f
Binary files /dev/null and b/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.jpg differ
diff --git a/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.seeking.gif b/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.seeking.gif
new file mode 100644
index 0000000..dbd2105
Binary files /dev/null and b/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.seeking.gif differ
diff --git a/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.video.play.png b/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.video.play.png
new file mode 100644
index 0000000..8e97df0
Binary files /dev/null and b/app/assets/javascripts/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.video.play.png differ
diff --git a/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.css b/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.css
new file mode 100644
index 0000000..1d6bca0
--- /dev/null
+++ b/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.css
@@ -0,0 +1,650 @@
+/*
+ * Skin for jPlayer Plugin (jQuery JavaScript Library)
+ * http://www.jplayer.org
+ *
+ * Skin Name: Pink Flag
+ *
+ * Copyright (c) 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: Silvia Benvenuti
+ * Skin Version: 1.0 (jPlayer 2.1.0)
+ * Date: 1st September 2011
+ */
+
+div.jp-audio,
+div.jp-video {
+
+ /* Edit the font-size to counteract inherited font sizing.
+ * Eg. 1.25em = 1 / 0.8em
+ */
+
+ font-size:1.25em; /* 1.25em for testing in site pages */ /* No parent CSS that can effect the size in the demos ZIP */
+
+ font-family:Verdana, Arial, sans-serif;
+ line-height:1.6;
+ color: #fff;
+ border-top:1px solid #554461;
+ border-left:1px solid #554461;
+ border-right:1px solid #180a1f;
+ border-bottom:1px solid #180a1f;
+ background-color:#3a2a45;
+ position:relative;
+}
+div.jp-audio {
+ width:201px;
+ padding:20px;
+}
+
+div.jp-video-270p {
+ width:480px;
+}
+div.jp-video-360p {
+ width:640px;
+}
+div.jp-video-full {
+ /* Rules for IE6 (full-screen) */
+ width:480px;
+ height:270px;
+ /* Rules for IE7 (full-screen) - Otherwise the relative container causes other page items that are not position:static (default) to appear over the video/gui. */
+ position:static !important; position:relative
+}
+
+div.jp-video-full div.jp-jplayer {
+ top: 0;
+ left: 0;
+ position: fixed !important; position: relative; /* Rules for IE6 (full-screen) */
+ overflow: hidden;
+ z-index:1000;
+}
+
+div.jp-video-full div.jp-gui {
+ position: fixed !important; position: static; /* Rules for IE6 (full-screen) */
+ top: 0;
+ left: 0;
+ width:100%;
+ height:100%;
+ z-index:1000;
+}
+div.jp-video-full div.jp-interface {
+ position: absolute !important; position: relative; /* Rules for IE6 (full-screen) */
+ bottom: 0;
+ left: 0;
+ z-index:1000;
+}
+
+div.jp-interface {
+ position: relative;
+ width:100%;
+ background-color:#3a2a45; /* Required for the full screen */
+}
+
+
+div.jp-audio .jp-interface {
+ height: 80px;
+ padding-top:30px;
+}
+
+/* @group CONTROLS */
+
+div.jp-controls-holder {
+ clear: both;
+ width:440px;
+ margin:0 auto 10px auto;
+ position: relative;
+ overflow:hidden;
+}
+
+div.jp-interface ul.jp-controls {
+ background: url("jplayer.pink.flag.jpg") 0 0 no-repeat;
+ list-style-type:none;
+ padding: 1px 0 2px 1px;
+ overflow:hidden;
+ width: 201px;
+ height: 34px;
+}
+
+div.jp-audio ul.jp-controls {
+ margin:0 auto;
+}
+
+div.jp-video ul.jp-controls {
+ margin:0 0 0 115px;
+ float:left;
+ display:inline; /* need this to fix IE6 double margin */
+}
+
+div.jp-interface ul.jp-controls li {
+ display:inline;
+ float: left;
+}
+div.jp-interface ul.jp-controls a {
+ display:block;
+ overflow:hidden;
+ text-indent:-9999px;
+ height: 34px;
+ margin: 0 1px 2px 0;
+ padding: 0;
+}
+
+
+/* @group single player controls */
+
+div.jp-type-single .jp-controls li a{
+ width: 99px;
+}
+
+div.jp-type-single .jp-play {
+ background: url("jplayer.pink.flag.jpg") 0px -40px no-repeat;
+}
+
+div.jp-type-single .jp-play:hover {
+ background: url("jplayer.pink.flag.jpg") -100px -40px no-repeat;
+}
+
+div.jp-type-single .jp-pause {
+ background: url("jplayer.pink.flag.jpg") 0px -120px no-repeat;
+}
+
+div.jp-type-single .jp-pause:hover {
+ background: url("jplayer.pink.flag.jpg") -100px -120px no-repeat;
+}
+
+div.jp-type-single .jp-stop {
+ background: url("jplayer.pink.flag.jpg") 0px -80px no-repeat;
+}
+
+div.jp-type-single .jp-stop:hover {
+ background: url("jplayer.pink.flag.jpg") -100px -80px no-repeat;
+}
+
+/* @end */
+
+/* @group playlist player controls */
+
+div.jp-type-playlist .jp-controls li a{
+ width: 49px;
+}
+
+div.jp-type-playlist .jp-play {
+ background: url("jplayer.pink.flag.jpg") -24px -40px no-repeat;
+}
+
+div.jp-type-playlist .jp-play:hover {
+ background: url("jplayer.pink.flag.jpg") -124px -40px no-repeat;
+}
+
+div.jp-type-playlist .jp-pause {
+ background: url("jplayer.pink.flag.jpg") -24px -120px no-repeat;
+}
+
+div.jp-type-playlist .jp-pause:hover {
+ background: url("jplayer.pink.flag.jpg") -124px -120px no-repeat;
+}
+
+div.jp-type-playlist .jp-stop {
+ background: url("jplayer.pink.flag.jpg") -24px -80px no-repeat;
+}
+
+div.jp-type-playlist .jp-stop:hover {
+ background: url("jplayer.pink.flag.jpg") -124px -80px no-repeat;
+}
+
+div.jp-type-playlist .jp-previous {
+ background: url("jplayer.pink.flag.jpg") -24px -200px no-repeat;
+}
+
+div.jp-type-playlist .jp-previous:hover {
+ background: url("jplayer.pink.flag.jpg") -124px -200px no-repeat;
+}
+
+div.jp-type-playlist .jp-next {
+ background: url("jplayer.pink.flag.jpg") -24px -160px no-repeat;
+}
+
+div.jp-type-playlist .jp-next:hover {
+ background: url("jplayer.pink.flag.jpg") -124px -160px no-repeat;
+}
+
+/* @end */
+
+/* @end */
+
+
+
+
+/* @group TOGGLES */
+
+ul.jp-toggles {
+ list-style-type:none;
+ padding:0;
+ margin:0 auto;
+ z-index:20;
+ overflow:hidden;
+}
+
+div.jp-audio ul.jp-toggles {
+ width:55px;
+}
+
+div.jp-audio .jp-type-single ul.jp-toggles {
+ width:25px;
+}
+
+div.jp-video ul.jp-toggles {
+ width:100px;
+ margin-top: 10px;
+}
+
+ul.jp-toggles li{
+ display:block;
+ float:right;
+}
+
+ul.jp-toggles li a{
+ display:block;
+ width:25px;
+ height:18px;
+ text-indent:-9999px;
+ line-height:100%; /* need this for IE6 */
+}
+
+.jp-full-screen {
+ background: url("jplayer.pink.flag.jpg") 0 -420px no-repeat;
+ margin-left: 20px;
+}
+
+.jp-full-screen:hover {
+ background: url("jplayer.pink.flag.jpg") -30px -420px no-repeat;
+}
+
+.jp-restore-screen {
+ background: url("jplayer.pink.flag.jpg") -60px -420px no-repeat;
+ margin-left: 20px;
+}
+
+.jp-restore-screen:hover {
+ background: url("jplayer.pink.flag.jpg") -90px -420px no-repeat;
+}
+
+.jp-repeat {
+ background: url("jplayer.pink.flag.jpg") 0 -440px no-repeat;
+}
+
+.jp-repeat:hover {
+ background: url("jplayer.pink.flag.jpg") -30px -440px no-repeat;
+}
+
+.jp-repeat-off {
+ background: url("jplayer.pink.flag.jpg") -60px -440px no-repeat;
+}
+
+.jp-repeat-off:hover {
+ background: url("jplayer.pink.flag.jpg") -90px -440px no-repeat;
+}
+
+.jp-shuffle {
+ background: url("jplayer.pink.flag.jpg") 0 -460px no-repeat;
+ margin-left: 5px;
+}
+
+.jp-shuffle:hover {
+ background: url("jplayer.pink.flag.jpg") -30px -460px no-repeat;
+}
+
+.jp-shuffle-off {
+ background: url("jplayer.pink.flag.jpg") -60px -460px no-repeat;
+ margin-left: 5px;
+}
+
+.jp-shuffle-off:hover {
+ background: url("jplayer.pink.flag.jpg") -90px -460px no-repeat;
+}
+
+
+/* @end */
+
+/* @group progress bar */
+
+/* The seeking class is added/removed inside jPlayer */
+div.jp-seeking-bg {
+ background: url("jplayer.pink.flag.seeking.gif");
+}
+
+.jp-progress {
+ background: url("jplayer.pink.flag.jpg") 0px -240px no-repeat;
+ width: 197px;
+ height: 13px;
+ padding: 0 2px 2px 2px;
+ margin-bottom: 4px;
+ overflow:hidden;
+}
+
+div.jp-video .jp-progress {
+ border-top:1px solid #180a1f;
+ border-bottom: 1px solid #554560;
+ width:100%;
+ background-image: none;
+ padding: 0;
+}
+
+.jp-seek-bar {
+ background: url("jplayer.pink.flag.jpg") 0px -260px repeat-x;
+ width:0px;
+ height: 100%;
+ overflow:hidden;
+ cursor:pointer;
+}
+
+.jp-play-bar {
+ background: url("jplayer.pink.flag.jpg") 0px -280px repeat-x;
+ width:0px;
+ height: 100%;
+ overflow:hidden;
+}
+
+
+/* @end */
+
+/* @group volume controls */
+
+div.jp-interface ul.jp-controls a.jp-mute,
+div.jp-interface ul.jp-controls a.jp-unmute,
+div.jp-interface ul.jp-controls a.jp-volume-max {
+ background: url("jplayer.pink.flag.jpg") 0px -330px no-repeat;
+ position: absolute;
+ width: 16px;
+ height: 11px;
+}
+
+div.jp-audio ul.jp-controls a.jp-mute,
+div.jp-audio ul.jp-controls a.jp-unmute {
+ top:-6px;
+ left: 0;
+}
+
+div.jp-audio ul.jp-controls a.jp-volume-max {
+ top:-6px;
+ right: 0;
+}
+
+
+div.jp-video ul.jp-controls a.jp-mute,
+div.jp-video ul.jp-controls a.jp-unmute {
+ left: 0;
+ top:14px;
+}
+
+div.jp-video ul.jp-controls a.jp-volume-max {
+ left: 84px;
+ top:14px;
+}
+
+div.jp-interface ul.jp-controls a.jp-mute:hover {
+ background: url("jplayer.pink.flag.jpg") -25px -330px no-repeat;
+}
+
+div.jp-interface ul.jp-controls a.jp-unmute {
+ background: url("jplayer.pink.flag.jpg") -60px -330px no-repeat;
+}
+
+div.jp-interface ul.jp-controls a.jp-unmute:hover {
+ background: url("jplayer.pink.flag.jpg") -85px -330px no-repeat;
+}
+
+div.jp-interface ul.jp-controls a.jp-volume-max {
+ background: url("jplayer.pink.flag.jpg") 0px -350px no-repeat;
+}
+
+div.jp-interface ul.jp-controls a.jp-volume-max:hover {
+ background: url("jplayer.pink.flag.jpg") -25px -350px no-repeat;
+}
+
+.jp-volume-bar {
+ background: url("jplayer.pink.flag.jpg") 0px -300px repeat-x;
+ position: absolute;
+ width: 197px;
+ height: 4px;
+ padding: 2px 2px 1px 2px;
+ overflow: hidden;
+}
+
+.jp-volume-bar:hover {
+ cursor: pointer;
+}
+
+
+div.jp-audio .jp-interface .jp-volume-bar {
+ top:10px;
+ left: 0;
+}
+
+div.jp-video .jp-volume-bar {
+ top: 0;
+ left: 0;
+ width:95px;
+ border-right:1px solid #000;
+ margin-top: 30px;
+}
+
+.jp-volume-bar-value {
+ background: url("jplayer.pink.flag.jpg") 0px -320px repeat-x;
+ height: 4px;
+}
+
+/* @end */
+
+/* @group current time and duration */
+
+.jp-current-time, .jp-duration {
+ width:70px;
+ font-size:.5em;
+ color: #8c7a99;
+}
+
+.jp-current-time {
+ float: left;
+}
+
+.jp-duration {
+ float: right;
+ text-align:right;
+}
+
+.jp-video .jp-current-time {
+ padding-left:20px;
+}
+
+.jp-video .jp-duration {
+ padding-right:20px;
+}
+
+/* @end */
+
+/* @group playlist */
+
+.jp-title ul,
+.jp-playlist ul {
+ list-style-type:none;
+ font-size:.7em;
+ margin: 0;
+ padding: 0;
+}
+
+.jp-video .jp-title ul {
+ margin: 0 20px 10px;
+}
+
+.jp-video .jp-playlist ul {
+ margin: 0 20px;
+}
+
+.jp-title li,
+.jp-playlist li {
+ position: relative;
+ padding: 2px 0;
+ border-top:1px solid #554461;
+ border-bottom:1px solid #180a1f;
+ overflow: hidden;
+}
+
+.jp-title li{
+ border-bottom:none;
+ border-top:none;
+ padding:0;
+ text-align:center;
+}
+
+/* Note that the first-child (IE6) and last-child (IE6/7/8) selectors do not work on IE */
+
+div.jp-type-playlist div.jp-playlist li:first-child {
+ border-top:none;
+ padding-top:3px;
+}
+
+div.jp-type-playlist div.jp-playlist li:last-child {
+ border-bottom:none;
+ padding-bottom:3px;
+}
+
+div.jp-type-playlist div.jp-playlist a {
+ color: #fff;
+ text-decoration:none;
+}
+
+div.jp-type-playlist div.jp-playlist a:hover {
+ color: #e892e9;
+}
+
+div.jp-type-playlist div.jp-playlist li.jp-playlist-current {
+ background-color: #26102e;
+ margin: 0 -20px;
+ padding: 2px 20px;
+ border-top: 1px solid #26102e;
+ border-bottom: 1px solid #26102e;
+}
+
+div.jp-type-playlist div.jp-playlist li.jp-playlist-current a{
+ color: #e892e9;
+}
+
+div.jp-type-playlist div.jp-playlist a.jp-playlist-item-remove {
+ float:right;
+ display:inline;
+ text-align:right;
+ margin-left:10px;
+ font-weight:bold;
+ color:#8C7A99;
+}
+div.jp-type-playlist div.jp-playlist a.jp-playlist-item-remove:hover {
+ color:#E892E9;
+}
+
+div.jp-type-playlist div.jp-playlist span.jp-free-media {
+ float: right;
+ display:inline;
+ text-align:right;
+ color:#8C7A99;
+}
+
+div.jp-type-playlist div.jp-playlist span.jp-free-media a{
+ color:#8C7A99;
+}
+
+div.jp-type-playlist div.jp-playlist span.jp-free-media a:hover{
+ color:#E892E9;
+}
+span.jp-artist {
+ font-size:.8em;
+ color:#8C7A99;
+}
+
+/* @end */
+
+
+div.jp-video div.jp-video-play {
+ position:absolute;
+ top:0;
+ left:0;
+ width:100%;
+ cursor:pointer;
+ background-color:rgba(0,0,0,0); /* Makes IE9 work with the active area over the whole video area. IE6/7/8 only have the button as active area. */
+}
+div.jp-video-270p div.jp-video-play {
+ height:270px;
+}
+div.jp-video-360p div.jp-video-play {
+ height:360px;
+}
+div.jp-video-full div.jp-video-play {
+ height:100%;
+ z-index:1000;
+}
+a.jp-video-play-icon {
+ position:relative;
+ display:block;
+ width: 112px;
+ height: 100px;
+
+ margin-left:-56px;
+ margin-top:-50px;
+ left:50%;
+ top:50%;
+
+ background: url("jplayer.pink.flag.video.play.png") 0 0 no-repeat;
+ text-indent:-9999px;
+}
+div.jp-video-play:hover a.jp-video-play-icon {
+ background: url("jplayer.pink.flag.video.play.png") 0 -100px no-repeat;
+}
+
+
+div.jp-jplayer audio,
+div.jp-jplayer {
+ width:0px;
+ height:0px;
+}
+
+div.jp-jplayer {
+ background-color: #000000;
+}
+
+/* @group NO SOLUTION error feedback */
+
+.jp-no-solution {
+ position:absolute;
+ width:390px;
+ margin-left:-202px;
+ left:50%;
+ top: 10px;
+
+ padding:5px;
+ font-size:.8em;
+ background-color:#3a2a45;
+ border-top:2px solid #554461;
+ border-left:2px solid #554461;
+ border-right:2px solid #180a1f;
+ border-bottom:2px solid #180a1f;
+ color:#FFF;
+ display:none;
+}
+
+.jp-no-solution a {
+ color:#FFF;
+}
+
+.jp-no-solution span {
+ font-size:1em;
+ display:block;
+ text-align:center;
+ font-weight:bold;
+}
+
+.jp-audio .jp-no-solution {
+ width:190px;
+ margin-left:-102px;
+}
+
+/* @end */
diff --git a/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.jpg b/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.jpg
new file mode 100644
index 0000000..0c084e2
Binary files /dev/null and b/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.jpg differ
diff --git a/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.seeking.gif b/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.seeking.gif
new file mode 100644
index 0000000..754ceb1
Binary files /dev/null and b/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.seeking.gif differ
diff --git a/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.video.play.png b/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.video.play.png
new file mode 100644
index 0000000..8e97df0
Binary files /dev/null and b/app/assets/javascripts/jquery/jplayer/skin/pink.flag/jplayer.pink.flag.video.play.png differ
diff --git a/app/assets/javascripts/vksearch/LICENCE b/app/assets/javascripts/vksearch/LICENCE
new file mode 100644
index 0000000..7e2519e
--- /dev/null
+++ b/app/assets/javascripts/vksearch/LICENCE
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Gregory Eremin
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/app/assets/javascripts/vksearch/README.md b/app/assets/javascripts/vksearch/README.md
new file mode 100644
index 0000000..45bd814
--- /dev/null
+++ b/app/assets/javascripts/vksearch/README.md
@@ -0,0 +1,28 @@
+# Vkontakte (VK.com) API music search tool
+
+Don't forget to log in to [vk.com API](http://vk.com/developers.php?oid=-17680044&p=Open_API)
+
+### CoffeeScript example
+```coffeescript
+vk_music = new VkontakteMusic
+vk_music.search "Kasabian", "L.S.F. (Lost Souls Forever)", "2:17", (url) ->
+ audio = document.createElement "audio"
+ audio.setAttribute "src", url
+ document.getElementsByTagName("body")[0].appendChild audio
+ audio.play()
+ false
+```
+
+### JavaScript example
+```javascript
+var vk_music;
+vk_music = new VkontakteMusic;
+vk_music.search("Kasabian", "L.S.F. (Lost Souls Forever)", "2:17", function(url) {
+ var audio;
+ audio = document.createElement("audio");
+ audio.setAttribute("src", url);
+ document.getElementsByTagName("body")[0].appendChild(audio);
+ audio.play();
+ return false;
+});
+```
\ No newline at end of file
diff --git a/app/assets/javascripts/vksearch/lib/vkontakte_music.min.js b/app/assets/javascripts/vksearch/lib/vkontakte_music.min.js
new file mode 100644
index 0000000..f4d4440
--- /dev/null
+++ b/app/assets/javascripts/vksearch/lib/vkontakte_music.min.js
@@ -0,0 +1,9 @@
+/*
+ * Vkontakte (VK.com) API music search tool
+ * https://github.com/magnolia-fan/vkontakte_music_search
+ *
+ * Copyright 2011, Gregory Eremin
+ * Licensed under the MIT license.
+ * https://raw.github.com/magnolia-fan/vkontakte_music_search/master/LICENSE
+ */
+var VkontakteMusic;VkontakteMusic=function(){function a(){}return a.prototype.query_results={},a.prototype.search=function(a,b,c,d,e){var f,g;return e==null&&(e=!1),f=this.prepareQuery(a,b),this.query_results[f]!=null&&!e&&d(this.query_results[f]),g=this,VK.Api.call("audio.search",{q:f},function(h){var i,j;return i=g.range(h.response,a,b,c),j=null,i.length>0&&(j=i[0].url),g.query_results[f]=i,d(e?i:j)})},a.prototype.range=function(a,b,c,d){var e,f,g,h,i;typeof d=="string"&&(d=d.split(":"),d=parseInt(d[0],10)*60+parseInt(d[1],10));for(f=0,i=a.length;f
0&&(g.artist===b?h+=10:g.artist.split(b).length===2?h+=5:g.title.split(b).length===2&&(h+=4)),g.artist.length>0&&(g.title===c?h+=10:g.title.split(c).length===2&&(h+=5)),parseInt(g.duration,10)===d?h+=15:(e=Math.abs(parseInt(g.duration,10)-d),e<10&&(h+=10-e)),a[f].score=h}return a.length>0&&typeof a[0]!="object"&&(a.splice(0,1),a.sort(function(a,b){return b.score-a.score})),a},a.prototype.prepareQuery=function(a,b){return a+" "+b.replace(/\(.*\)/i,"").split("/")[0]},a.prototype.trim=function(a){while(a.indexOf(" ")!==-1)a=a.replace(" "," ");return a.charAt(0)===" "&&(a=a.substring(1)),a.charAt(a.length-1)===" "&&(a=a.substring(0,a.length-1)),a},a}()
\ No newline at end of file
diff --git a/app/assets/javascripts/vksearch/src/vkontakte_music.coffee b/app/assets/javascripts/vksearch/src/vkontakte_music.coffee
new file mode 100644
index 0000000..14e4ec0
--- /dev/null
+++ b/app/assets/javascripts/vksearch/src/vkontakte_music.coffee
@@ -0,0 +1,70 @@
+###
+ * Vkontakte (VK.com) API music search tool
+ * https://github.com/magnolia-fan/vkontakte_music_search
+ *
+ * Copyright 2011, Gregory Eremin
+ * Licensed under the MIT license.
+ * https://raw.github.com/magnolia-fan/vkontakte_music_search/master/LICENSE
+ ###
+class window.VkontakteMusic
+ query_results: {}
+
+ search: (artist, track, duration, callback, return_all = false) ->
+ query = this.prepareQuery artist, track
+ if @query_results[query]? and not return_all
+ callback @query_results[query]
+ that = this
+ VK.Api.call 'audio.search', q: query, (r) ->
+ results = that.range r.response, artist, track, duration
+ top_result = null
+ if results.length > 0
+ top_result = results[0].url
+ that.query_results[query] = results
+ callback if return_all then results else top_result
+
+ range: (data, artist, track, duration) ->
+ if typeof duration is 'string'
+ duration = duration.split ':'
+ duration = parseInt(duration[0], 10) * 60 + parseInt(duration[1], 10)
+ for item, i in data
+ if typeof item isnt 'object'
+ continue
+ item.score = 0;
+ item.artist = this.trim(item.artist);
+ item.title = this.trim(item.title);
+ score = 0
+ if item.artist.length > 0
+ if item.artist == artist
+ score += 10
+ else if item.artist.split(artist).length is 2
+ score += 5
+ else if item.title.split(artist).length is 2
+ score += 4
+ if item.artist.length > 0
+ if item.title == track
+ score += 10
+ else if item.title.split(track).length is 2
+ score += 5
+ if parseInt(item.duration, 10) == duration
+ score += 15
+ else
+ delta = Math.abs parseInt(item.duration, 10) - duration
+ score += (10 - delta) if delta < 10
+ data[i].score = score
+ if data.length > 0 and typeof data[0] isnt 'object'
+ data.splice 0, 1
+ data.sort (a, b) ->
+ b.score - a.score
+ data
+
+ prepareQuery: (artist, track) ->
+ artist+" "+track.replace(/\(.*\)/i, '').split('/')[0]
+
+ trim: (str) ->
+ while str.indexOf(' ') isnt -1
+ str = str.replace ' ', ' '
+ if str.charAt(0) is ' '
+ str = str.substring 1
+ if str.charAt(str.length - 1) is ' '
+ str = str.substring 0, str.length - 1
+ str