Поправлена структура, разделы в подразделы до 3.3

This commit is contained in:
Юлия Болотина
2022-08-04 12:59:10 +03:00
parent c46d95f4cd
commit a014b62268
787 changed files with 162678 additions and 782 deletions

View File

@@ -0,0 +1,157 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Using concat to copy the source. In future, we plan to split the source up, making the concat more appropriate.
concat: {
jplayer: {
files: {
'dist/jplayer/jquery.jplayer.js': ['src/javascript/jplayer/jquery.jplayer.js']
}
},
playlist: {
files: {
'dist/add-on/jplayer.playlist.js': ['src/javascript/add-on/jplayer.playlist.js']
}
},
inspector: {
files: {
'dist/add-on/jquery.jplayer.inspector.js': ['src/javascript/add-on/jquery.jplayer.inspector.js']
}
},
popcorn: {
files: {
'dist/popcorn/popcorn.jplayer.js': ['src/javascript/popcorn/popcorn.jplayer.js']
}
}
},
uglify: {
options: {
// maxLineLen: 0 // Generates the output on a single line
},
jplayer: {
options: {
banner: '/*! jPlayer <%= pkg.version %> for jQuery ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n'
},
files: {
'dist/jplayer/jquery.jplayer.min.js': ['dist/jplayer/jquery.jplayer.js']
}
},
playlist: {
options: {
banner: '/*! jPlayerPlaylist for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n'
},
files: {
'dist/add-on/jplayer.playlist.min.js': ['dist/add-on/jplayer.playlist.js']
}
},
inspector: {
options: {
banner: '/*! jPlayerInspector for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n'
},
files: {
'dist/add-on/jquery.jplayer.inspector.min.js': ['dist/add-on/jquery.jplayer.inspector.js']
}
},
popcorn: {
options: {
banner: '/*! Popcorn Player for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n'
},
files: {
'dist/popcorn/popcorn.jplayer.min.js': ['dist/popcorn/popcorn.jplayer.js']
}
}
},
sass: {
options: {
sourcemap: 'none',
style: 'nested'
},
"blue.monday": {
options: {
banner: '/*! Blue Monday Skin for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n'
},
files: {
'dist/skin/blue.monday/css/jplayer.blue.monday.css': 'src/skin/blue.monday/scss/jplayer.blue.monday.scss'
}
},
"pink.flag": {
options: {
banner: '/*! Pink Flag Skin for jPlayer <%= pkg.version %> ~ (c) 2009-<%= grunt.template.today("yyyy") %> <%= pkg.organization %> ~ <%= pkg.license %> License */\n'
},
files: {
'dist/skin/pink.flag/css/jplayer.pink.flag.css': 'src/skin/pink.flag/scss/jplayer.pink.flag.scss'
}
}
},
cssmin: {
skins: {
files: {
'dist/skin/blue.monday/css/jplayer.blue.monday.min.css': ['dist/skin/blue.monday/css/jplayer.blue.monday.css'],
'dist/skin/pink.flag/css/jplayer.pink.flag.min.css': ['dist/skin/pink.flag/css/jplayer.pink.flag.css']
}
},
},
copy: {
skins: {
files: [
{expand: true, cwd: 'src/skin/blue.monday/', src: ['image/**', 'mustache/**'], dest: 'dist/skin/blue.monday/'},
{expand: true, cwd: 'src/skin/pink.flag/', src: ['image/**', 'mustache/**'], dest: 'dist/skin/pink.flag/'}
]
},
},
jshint: {
test: {
src: [
'Gruntfile.js',
'*.json',
'src/javascript/**/*.js',
'!**/jquery.jplayer.inspector.js' // The inspector does not pass jshint, and this will be addressed in due course.
]
},
// jQuery linting guide http://contribute.jquery.org/style-guide/js/#linting
// docs http://www/jshint.com/docs/
options: {
// Using .jshintrc files for the options.
jshintrc: true
}
},
mxmlc: {
options: {
rawConfig: '-static-link-runtime-shared-libraries=true'
},
jplayer: {
files: {
// Compile and give the SWF a filename like the JavaScript filenames. Important as it is the jPlayer code.
'dist/jplayer/jquery.jplayer.swf': ['src/actionscript/Jplayer.as']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-mxmlc');
grunt.registerTask('default', ['test', 'build']);
grunt.registerTask('test', ['jshint']);
grunt.registerTask('build', ['js', 'swf', 'css']);
grunt.registerTask('js', ['concat', 'uglify']);
grunt.registerTask('swf', ['mxmlc']);
grunt.registerTask('css', ['sass', 'cssmin', 'copy:skins']);
};

View File

@@ -0,0 +1,42 @@
{
"name": "jPlayer",
"version": "2.9.2",
"description": "The jQuery HTML5 Audio / Video Library. Allows you to create a media player with a consistent interface and experience across all browsers.",
"author": {
"name": "Mark J Panaghiston",
"email": "markp@happyworm.com",
"homepage": "http://happyworm.com/"
},
"homepage": "http://jplayer.org/",
"keywords": [
"jquery-plugin",
"audio",
"video",
"media",
"player",
"jplayer"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/happyworm/jPlayer.git"
},
"main": [
"./dist/jplayer/jquery.jplayer.js",
"./dist/jplayer/jquery.jplayer.swf",
"./dist/skin/pink.flag/jplayer.pink.flag.css",
"./dist/skin/pink.flag/mustache/jplayer.pink.flag.audio.single.html"
],
"ignore": [
"artwork",
"examples",
"lib",
"src",
"**/*.md",
"**/*.txt",
"Gruntfile.js"
],
"dependencies": {
"jquery": ">=1.7.2"
}
}

View File

@@ -0,0 +1,41 @@
{
"name": "happyworm/jplayer",
"description": "jPlayer allows you to create a media player with a consistent interface and experience across all browsers.",
"type": "component",
"homepage": "http://jplayer.org/",
"license": "MIT",
"keywords": [
"audio",
"video",
"media",
"player",
"jplayer",
"html5",
"streaming"
],
"authors": [
{
"name": "Mark J Panaghiston",
"email": "markp@happyworm.com"
}
],
"require": {
"robloach/component-installer": "*"
},
"suggest": {
"components/jquery": ">=1.7.2"
},
"extra": {
"component": {
"scripts": [
"dist/jplayer/jquery.jplayer.js"
],
"files": [
"dist"
],
"shim": {
"deps": ["jquery"]
}
}
}
}

View File

@@ -0,0 +1,496 @@
/*
* Playlist Object for the jPlayer Plugin
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://www.opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Version: 2.4.1
* Date: 19th November 2014
*
* Requires:
* - jQuery 1.7.0+
* - jPlayer 2.8.2+
*/
/*global jPlayerPlaylist:true */
(function($, undefined) {
jPlayerPlaylist = function(cssSelector, playlist, options) {
var self = this;
this.current = 0;
this.loop = false; // Flag used with the jPlayer repeat event
this.shuffled = false;
this.removing = false; // Flag is true during remove animation, disabling the remove() method until complete.
this.cssSelector = $.extend({}, this._cssSelector, cssSelector); // Object: Containing the css selectors for jPlayer and its cssSelectorAncestor
this.options = $.extend(true, {
keyBindings: {
next: {
key: 221, // ]
fn: function() {
self.next();
}
},
previous: {
key: 219, // [
fn: function() {
self.previous();
}
},
shuffle: {
key: 83, // s
fn: function() {
self.shuffle();
}
}
},
stateClass: {
shuffled: "jp-state-shuffled"
}
}, this._options, options); // Object: The jPlayer constructor options for this playlist and the playlist options
this.playlist = []; // Array of Objects: The current playlist displayed (Un-shuffled or Shuffled)
this.original = []; // Array of Objects: The original playlist
this._initPlaylist(playlist); // Copies playlist to this.original. Then mirrors this.original to this.playlist. Creating two arrays, where the element pointers match. (Enables pointer comparison.)
// Setup the css selectors for the extra interface items used by the playlist.
this.cssSelector.details = this.cssSelector.cssSelectorAncestor + " .jp-details"; // Note that jPlayer controls the text in the title element.
this.cssSelector.playlist = this.cssSelector.cssSelectorAncestor + " .jp-playlist";
this.cssSelector.next = this.cssSelector.cssSelectorAncestor + " .jp-next";
this.cssSelector.previous = this.cssSelector.cssSelectorAncestor + " .jp-previous";
this.cssSelector.shuffle = this.cssSelector.cssSelectorAncestor + " .jp-shuffle";
this.cssSelector.shuffleOff = this.cssSelector.cssSelectorAncestor + " .jp-shuffle-off";
// Override the cssSelectorAncestor given in options
this.options.cssSelectorAncestor = this.cssSelector.cssSelectorAncestor;
// Override the default repeat event handler
this.options.repeat = function(event) {
self.loop = event.jPlayer.options.loop;
};
// Create a ready event handler to initialize the playlist
$(this.cssSelector.jPlayer).bind($.jPlayer.event.ready, function() {
self._init();
});
// Create an ended event handler to move to the next item
$(this.cssSelector.jPlayer).bind($.jPlayer.event.ended, function() {
self.next();
});
// Create a play event handler to pause other instances
$(this.cssSelector.jPlayer).bind($.jPlayer.event.play, function() {
$(this).jPlayer("pauseOthers");
});
// Create a resize event handler to show the title in full screen mode.
$(this.cssSelector.jPlayer).bind($.jPlayer.event.resize, function(event) {
if(event.jPlayer.options.fullScreen) {
$(self.cssSelector.details).show();
} else {
$(self.cssSelector.details).hide();
}
});
// Create click handlers for the extra buttons that do playlist functions.
$(this.cssSelector.previous).click(function(e) {
e.preventDefault();
self.previous();
self.blur(this);
});
$(this.cssSelector.next).click(function(e) {
e.preventDefault();
self.next();
self.blur(this);
});
$(this.cssSelector.shuffle).click(function(e) {
e.preventDefault();
if(self.shuffled && $(self.cssSelector.jPlayer).jPlayer("option", "useStateClassSkin")) {
self.shuffle(false);
} else {
self.shuffle(true);
}
self.blur(this);
});
$(this.cssSelector.shuffleOff).click(function(e) {
e.preventDefault();
self.shuffle(false);
self.blur(this);
}).hide();
// Put the title in its initial display state
if(!this.options.fullScreen) {
$(this.cssSelector.details).hide();
}
// Remove the empty <li> from the page HTML. Allows page to be valid HTML, while not interfereing with display animations
$(this.cssSelector.playlist + " ul").empty();
// Create .on() handlers for the playlist items along with the free media and remove controls.
this._createItemHandlers();
// Instance jPlayer
$(this.cssSelector.jPlayer).jPlayer(this.options);
};
jPlayerPlaylist.prototype = {
_cssSelector: { // static object, instanced in constructor
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
},
_options: { // static object, instanced in constructor
playlistOptions: {
autoPlay: false,
loopOnPrevious: false,
shuffleOnLoop: true,
enableRemoveControls: false,
displayTime: 'slow',
addTime: 'fast',
removeTime: 'fast',
shuffleTime: 'slow',
itemClass: "jp-playlist-item",
freeGroupClass: "jp-free-media",
freeItemClass: "jp-playlist-item-free",
removeItemClass: "jp-playlist-item-remove"
}
},
option: function(option, value) { // For changing playlist options only
if(value === undefined) {
return this.options.playlistOptions[option];
}
this.options.playlistOptions[option] = value;
switch(option) {
case "enableRemoveControls":
this._updateControls();
break;
case "itemClass":
case "freeGroupClass":
case "freeItemClass":
case "removeItemClass":
this._refresh(true); // Instant
this._createItemHandlers();
break;
}
return this;
},
_init: function() {
var self = this;
this._refresh(function() {
if(self.options.playlistOptions.autoPlay) {
self.play(self.current);
} else {
self.select(self.current);
}
});
},
_initPlaylist: function(playlist) {
this.current = 0;
this.shuffled = false;
this.removing = false;
this.original = $.extend(true, [], playlist); // Copy the Array of Objects
this._originalPlaylist();
},
_originalPlaylist: function() {
var self = this;
this.playlist = [];
// Make both arrays point to the same object elements. Gives us 2 different arrays, each pointing to the same actual object. ie., Not copies of the object.
$.each(this.original, function(i) {
self.playlist[i] = self.original[i];
});
},
_refresh: function(instant) {
/* instant: Can be undefined, true or a function.
* undefined -> use animation timings
* true -> no animation
* function -> use animation timings and excute function at half way point.
*/
var self = this;
if(instant && !$.isFunction(instant)) {
$(this.cssSelector.playlist + " ul").empty();
$.each(this.playlist, function(i) {
$(self.cssSelector.playlist + " ul").append(self._createListItem(self.playlist[i]));
});
this._updateControls();
} else {
var displayTime = $(this.cssSelector.playlist + " ul").children().length ? this.options.playlistOptions.displayTime : 0;
$(this.cssSelector.playlist + " ul").slideUp(displayTime, function() {
var $this = $(this);
$(this).empty();
$.each(self.playlist, function(i) {
$this.append(self._createListItem(self.playlist[i]));
});
self._updateControls();
if($.isFunction(instant)) {
instant();
}
if(self.playlist.length) {
$(this).slideDown(self.options.playlistOptions.displayTime);
} else {
$(this).show();
}
});
}
},
_createListItem: function(media) {
var self = this;
// Wrap the <li> contents in a <div>
var listItem = "<li><div>";
// Create remove control
listItem += "<a href='javascript:;' class='" + this.options.playlistOptions.removeItemClass + "'>&times;</a>";
// Create links to free media
if(media.free) {
var first = true;
listItem += "<span class='" + this.options.playlistOptions.freeGroupClass + "'>(";
$.each(media, function(property,value) {
if($.jPlayer.prototype.format[property]) { // Check property is a media format.
if(first) {
first = false;
} else {
listItem += " | ";
}
listItem += "<a class='" + self.options.playlistOptions.freeItemClass + "' href='" + value + "' tabindex='-1'>" + property + "</a>";
}
});
listItem += ")</span>";
}
// The title is given next in the HTML otherwise the float:right on the free media corrupts in IE6/7
listItem += "<a href='javascript:;' class='" + this.options.playlistOptions.itemClass + "' tabindex='0'>" + media.title + (media.artist ? " <span class='jp-artist'>by " + media.artist + "</span>" : "") + "</a>";
listItem += "</div></li>";
return listItem;
},
_createItemHandlers: function() {
var self = this;
// Create live handlers for the playlist items
$(this.cssSelector.playlist).off("click", "a." + this.options.playlistOptions.itemClass).on("click", "a." + this.options.playlistOptions.itemClass, function(e) {
e.preventDefault();
var index = $(this).parent().parent().index();
if(self.current !== index) {
self.play(index);
} else {
$(self.cssSelector.jPlayer).jPlayer("play");
}
self.blur(this);
});
// Create live handlers that disable free media links to force access via right click
$(this.cssSelector.playlist).off("click", "a." + this.options.playlistOptions.freeItemClass).on("click", "a." + this.options.playlistOptions.freeItemClass, function(e) {
e.preventDefault();
$(this).parent().parent().find("." + self.options.playlistOptions.itemClass).click();
self.blur(this);
});
// Create live handlers for the remove controls
$(this.cssSelector.playlist).off("click", "a." + this.options.playlistOptions.removeItemClass).on("click", "a." + this.options.playlistOptions.removeItemClass, function(e) {
e.preventDefault();
var index = $(this).parent().parent().index();
self.remove(index);
self.blur(this);
});
},
_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.jPlayer).jPlayer("addStateClass", "shuffled");
} else {
$(this.cssSelector.jPlayer).jPlayer("removeStateClass", "shuffled");
}
if($(this.cssSelector.shuffle).length && $(this.cssSelector.shuffleOff).length) {
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.details + " li").html("<span class='jp-title'>" + this.playlist[index].title + "</span>" + (this.playlist[index].artist ? " <span class='jp-artist'>by " + this.playlist[index].artist + "</span>" : ""));
}
},
setPlaylist: function(playlist) {
this._initPlaylist(playlist);
this._init();
},
add: function(media, playNow) {
$(this.cssSelector.playlist + " ul").append(this._createListItem(media)).find("li:last-child").hide().slideDown(this.options.playlistOptions.addTime);
this._updateControls();
this.original.push(media);
this.playlist.push(media); // Both array elements share the same object pointer. Comforms with _initPlaylist(p) system.
if(playNow) {
this.play(this.playlist.length - 1);
} else {
if(this.original.length === 1) {
this.select(0);
}
}
},
remove: function(index) {
var self = this;
if(index === undefined) {
this._initPlaylist([]);
this._refresh(function() {
$(self.cssSelector.jPlayer).jPlayer("clearMedia");
});
return true;
} else {
if(this.removing) {
return false;
} else {
index = (index < 0) ? self.original.length + index : index; // Negative index relates to end of array.
if(0 <= index && index < this.playlist.length) {
this.removing = true;
$(this.cssSelector.playlist + " li:nth-child(" + (index + 1) + ")").slideUp(this.options.playlistOptions.removeTime, function() {
$(this).remove();
if(self.shuffled) {
var item = self.playlist[index];
$.each(self.original, function(i) {
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);
});
}
},
blur: function(that) {
if($(this.cssSelector.jPlayer).jPlayer("option", "autoBlur")) {
$(that).blur();
}
}
};
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,338 @@
/*
* jPlayerInspector Plugin for jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://www.opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Version: 1.0.5
* Date: 1st April 2014
*
* For use with jPlayer Version: 2.6.0+
*
* Note: Declare inspector instances after jPlayer instances. ie., Otherwise the jPlayer instance is nonsense.
*/
(function($, undefined) {
$.jPlayerInspector = {};
$.jPlayerInspector.i = 0;
$.jPlayerInspector.defaults = {
jPlayer: undefined, // The jQuery selector of the jPlayer instance to inspect.
idPrefix: "jplayer_inspector_",
visible: false
};
var methods = {
init: function(options) {
var self = this;
var $this = $(this);
var config = $.extend({}, $.jPlayerInspector.defaults, options);
$(this).data("jPlayerInspector", config);
config.id = $(this).attr("id");
config.jPlayerId = config.jPlayer.attr("id");
config.windowId = config.idPrefix + "window_" + $.jPlayerInspector.i;
config.statusId = config.idPrefix + "status_" + $.jPlayerInspector.i;
config.configId = config.idPrefix + "config_" + $.jPlayerInspector.i;
config.toggleId = config.idPrefix + "toggle_" + $.jPlayerInspector.i;
config.eventResetId = config.idPrefix + "event_reset_" + $.jPlayerInspector.i;
config.updateId = config.idPrefix + "update_" + $.jPlayerInspector.i;
config.eventWindowId = config.idPrefix + "event_window_" + $.jPlayerInspector.i;
config.eventId = {};
config.eventJq = {};
config.eventTimeout = {};
config.eventOccurrence = {};
$.each($.jPlayer.event, function(eventName,eventType) {
config.eventId[eventType] = config.idPrefix + "event_" + eventName + "_" + $.jPlayerInspector.i;
config.eventOccurrence[eventType] = 0;
});
var structure =
'<p><a href="#" id="' + config.toggleId + '">' + (config.visible ? "Hide" : "Show") + '</a> jPlayer Inspector</p>'
+ '<div id="' + config.windowId + '">'
+ '<div id="' + config.statusId + '"></div>'
+ '<div id="' + config.eventWindowId + '" style="padding:5px 5px 0 5px;background-color:#eee;border:1px dotted #000;">'
+ '<p style="margin:0 0 10px 0;"><strong>jPlayer events that have occurred over the past 1 second:</strong>'
+ '<br />(Backgrounds: <span style="padding:0 5px;background-color:#eee;border:1px dotted #000;">Never occurred</span> <span style="padding:0 5px;background-color:#fff;border:1px dotted #000;">Occurred before</span> <span style="padding:0 5px;background-color:#9f9;border:1px dotted #000;">Occurred</span> <span style="padding:0 5px;background-color:#ff9;border:1px dotted #000;">Multiple occurrences</span> <a href="#" id="' + config.eventResetId + '">reset</a>)</p>';
// MJP: Would use the next 3 lines for ease, but the events are just slapped on the page.
// $.each($.jPlayer.event, function(eventName,eventType) {
// structure += '<div id="' + config.eventId[eventType] + '" style="float:left;">' + eventName + '</div>';
// });
var eventStyle = "float:left;margin:0 5px 5px 0;padding:0 5px;border:1px dotted #000;";
// MJP: Doing it longhand so order and layout easier to control.
structure +=
'<div id="' + config.eventId[$.jPlayer.event.ready] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.setmedia] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.flashreset] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.resize] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.repeat] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.click] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.warning] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.loadstart] + '" style="clear:left;' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.progress] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.timeupdate] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.volumechange] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.error] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.play] + '" style="clear:left;' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.pause] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.waiting] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.playing] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.seeking] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.seeked] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.ended] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.loadeddata] + '" style="clear:left;' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.loadedmetadata] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.canplay] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.canplaythrough] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.suspend] + '" style="clear:left;' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.abort] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.emptied] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.stalled] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.ratechange] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.durationchange] + '" style="' + eventStyle + '"></div>'
+ '<div style="clear:both"></div>';
// MJP: Would like a check here in case we missed an event.
// MJP: Check fails, since it is not on the page yet.
/* $.each($.jPlayer.event, function(eventName,eventType) {
if($("#" + config.eventId[eventType])[0] === undefined) {
structure += '<div id="' + config.eventId[eventType] + '" style="clear:left;' + eventStyle + '">' + eventName + '</div>';
}
});
*/
structure +=
'</div>'
+ '<p><a href="#" id="' + config.updateId + '">Update</a> jPlayer Inspector</p>'
+ '<div id="' + config.configId + '"></div>'
+ '</div>';
$(this).html(structure);
config.windowJq = $("#" + config.windowId);
config.statusJq = $("#" + config.statusId);
config.configJq = $("#" + config.configId);
config.toggleJq = $("#" + config.toggleId);
config.eventResetJq = $("#" + config.eventResetId);
config.updateJq = $("#" + config.updateId);
$.each($.jPlayer.event, function(eventName,eventType) {
config.eventJq[eventType] = $("#" + config.eventId[eventType]);
config.eventJq[eventType].text(eventName + " (" + config.eventOccurrence[eventType] + ")"); // Sets the text to the event name and (0);
config.jPlayer.bind(eventType + ".jPlayerInspector", function(e) {
config.eventOccurrence[e.type]++;
if(config.eventOccurrence[e.type] > 1) {
config.eventJq[e.type].css("background-color","#ff9");
} else {
config.eventJq[e.type].css("background-color","#9f9");
}
config.eventJq[e.type].text(eventName + " (" + config.eventOccurrence[e.type] + ")");
// The timer to handle the color
clearTimeout(config.eventTimeout[e.type]);
config.eventTimeout[e.type] = setTimeout(function() {
config.eventJq[e.type].css("background-color","#fff");
}, 1000);
// The timer to handle the occurences.
setTimeout(function() {
config.eventOccurrence[e.type]--;
config.eventJq[e.type].text(eventName + " (" + config.eventOccurrence[e.type] + ")");
}, 1000);
if(config.visible) { // Update the status, if inspector open.
$this.jPlayerInspector("updateStatus");
}
});
});
config.jPlayer.bind($.jPlayer.event.ready + ".jPlayerInspector", function(e) {
$this.jPlayerInspector("updateConfig");
});
config.toggleJq.click(function() {
if(config.visible) {
$(this).text("Show");
config.windowJq.hide();
config.statusJq.empty();
config.configJq.empty();
} else {
$(this).text("Hide");
config.windowJq.show();
config.updateJq.click();
}
config.visible = !config.visible;
$(this).blur();
return false;
});
config.eventResetJq.click(function() {
$.each($.jPlayer.event, function(eventName,eventType) {
config.eventJq[eventType].css("background-color","#eee");
});
$(this).blur();
return false;
});
config.updateJq.click(function() {
$this.jPlayerInspector("updateStatus");
$this.jPlayerInspector("updateConfig");
return false;
});
if(!config.visible) {
config.windowJq.hide();
} else {
// config.updateJq.click();
}
$.jPlayerInspector.i++;
return this;
},
destroy: function() {
$(this).data("jPlayerInspector") && $(this).data("jPlayerInspector").jPlayer.unbind(".jPlayerInspector");
$(this).empty();
},
updateConfig: function() { // This displays information about jPlayer's configuration in inspector
var jPlayerInfo = "<p>This jPlayer instance is running in your browser where:<br />"
for(i = 0; i < $(this).data("jPlayerInspector").jPlayer.data("jPlayer").solutions.length; i++) {
var solution = $(this).data("jPlayerInspector").jPlayer.data("jPlayer").solutions[i];
jPlayerInfo += "&nbsp;jPlayer's <strong>" + solution + "</strong> solution is";
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].used) {
jPlayerInfo += " being <strong>used</strong> and will support:<strong>";
for(format in $(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].support) {
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].support[format]) {
jPlayerInfo += " " + format;
}
}
jPlayerInfo += "</strong><br />";
} else {
jPlayerInfo += " <strong>not required</strong><br />";
}
}
jPlayerInfo += "</p>";
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.active) {
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").flash.active) {
jPlayerInfo += "<strong>Problem with jPlayer since both HTML5 and Flash are active.</strong>";
} else {
jPlayerInfo += "The <strong>HTML5 is active</strong>.";
}
} else {
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").flash.active) {
jPlayerInfo += "The <strong>Flash is active</strong>.";
} else {
jPlayerInfo += "No solution is currently active. jPlayer needs a setMedia().";
}
}
jPlayerInfo += "</p>";
var formatType = $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.formatType;
jPlayerInfo += "<p><code>status.formatType = '" + formatType + "'</code><br />";
if(formatType) {
jPlayerInfo += "<code>Browser canPlay('" + $.jPlayer.prototype.format[formatType].codec + "')</code>";
} else {
jPlayerInfo += "</p>";
}
jPlayerInfo += "<p><code>status.src = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.src + "'</code></p>";
jPlayerInfo += "<p><code>status.media = {<br />";
for(prop in $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.media) {
jPlayerInfo += "&nbsp;" + prop + ": " + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.media[prop] + "<br />"; // Some are strings
}
jPlayerInfo += "};</code></p>"
jPlayerInfo += "<p>";
jPlayerInfo += "<code>status.videoWidth = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.videoWidth + "'</code>";
jPlayerInfo += " | <code>status.videoHeight = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.videoHeight + "'</code>";
jPlayerInfo += "<br /><code>status.width = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.width + "'</code>";
jPlayerInfo += " | <code>status.height = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.height + "'</code>";
jPlayerInfo += "</p>";
+ "<p>Raw browser test for HTML5 support. Should equal a function if HTML5 is available.<br />";
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.audio.available) {
jPlayerInfo += "<code>htmlElement.audio.canPlayType = " + (typeof $(this).data("jPlayerInspector").jPlayer.data("jPlayer").htmlElement.audio.canPlayType) +"</code><br />"
}
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.video.available) {
jPlayerInfo += "<code>htmlElement.video.canPlayType = " + (typeof $(this).data("jPlayerInspector").jPlayer.data("jPlayer").htmlElement.video.canPlayType) +"</code>";
}
jPlayerInfo += "</p>";
jPlayerInfo += "<p>This instance is using the constructor options:<br />"
+ "<code>$('#" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").internal.self.id + "').jPlayer({<br />"
+ "&nbsp;swfPath: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "swfPath") + "',<br />"
+ "&nbsp;solution: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "solution") + "',<br />"
+ "&nbsp;supplied: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "supplied") + "',<br />"
+ "&nbsp;preload: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "preload") + "',<br />"
+ "&nbsp;volume: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "volume") + ",<br />"
+ "&nbsp;muted: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "muted") + ",<br />"
+ "&nbsp;backgroundColor: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "backgroundColor") + "',<br />"
+ "&nbsp;cssSelectorAncestor: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelectorAncestor") + "',<br />"
+ "&nbsp;cssSelector: {";
var cssSelector = $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelector");
for(prop in cssSelector) {
// jPlayerInfo += "<br />&nbsp;&nbsp;" + prop + ": '" + cssSelector[prop] + "'," // This works too of course, but want to use option method for deep keys.
jPlayerInfo += "<br />&nbsp;&nbsp;" + prop + ": '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelector." + prop) + "',"
}
jPlayerInfo = jPlayerInfo.slice(0, -1); // Because the sloppy comma was bugging me.
jPlayerInfo += "<br />&nbsp;},<br />"
+ "&nbsp;errorAlerts: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "errorAlerts") + ",<br />"
+ "&nbsp;warningAlerts: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "warningAlerts") + "<br />"
+ "});</code></p>";
$(this).data("jPlayerInspector").configJq.html(jPlayerInfo);
return this;
},
updateStatus: function() { // This displays information about jPlayer's status in the inspector
$(this).data("jPlayerInspector").statusJq.html(
"<p>jPlayer is " +
($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.paused ? "paused" : "playing") +
" at time: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentTime*10)/10 + "s." +
" (d: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.duration*10)/10 + "s" +
", sp: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.seekPercent) + "%" +
", cpr: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentPercentRelative) + "%" +
", cpa: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentPercentAbsolute) + "%)</p>"
);
return this;
}
};
$.fn.jPlayerInspector = function( method ) {
// Method calling logic
if ( methods[method] ) {
return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
return methods.init.apply( this, arguments );
} else {
$.error( 'Method ' + method + ' does not exist on jQuery.jPlayerInspector' );
}
};
})(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,579 @@
/*
* jPlayer Player Plugin for Popcorn JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2012 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Version: 1.1.6
* Date: 27th November 2014
*
* For Popcorn Version: 1.3
* For jPlayer Version: 2.9.0
* Requires: jQuery 1.7+
* Note: jQuery dependancy cannot be removed since jPlayer 2 is a jQuery plugin. Use of jQuery will be kept to a minimum.
*/
(function(Popcorn) {
var JQUERY_SCRIPT = '//code.jquery.com/jquery-1.11.1.min.js', // Used if jQuery not already present.
JPLAYER_SCRIPT = '//code.jplayer.org/2.9.0/jplayer/jquery.jplayer.min.js', // Used if jPlayer not already present.
JPLAYER_SWFPATH = '//code.jplayer.org/2.9.0/jplayer/jquery.jplayer.swf', // Used if not specified in jPlayer options via SRC Object.
SOLUTION = 'html,flash', // The default solution option.
DEBUG = false, // Decided to leave the debugging option and console output in for the time being. Overhead is trivial.
jQueryDownloading = false, // Flag to stop multiple instances from each pulling in jQuery, thus corrupting it.
jPlayerDownloading = false, // Flag to stop multiple instances from each pulling in jPlayer, thus corrupting it.
format = { // Duplicate of jPlayer 2.5.0 object, to avoid always requiring jQuery and jPlayer to be loaded before performing the _canPlayType() test.
mp3: {
codec: 'audio/mpeg',
flashCanPlay: true,
media: 'audio'
},
m4a: { // AAC / MP4
codec: 'audio/mp4; codecs="mp4a.40.2"',
flashCanPlay: true,
media: 'audio'
},
m3u8a: { // AAC / MP4 / Apple HLS
codec: 'application/vnd.apple.mpegurl; codecs="mp4a.40.2"',
flashCanPlay: false,
media: 'audio'
},
m3ua: { // M3U
codec: 'audio/mpegurl',
flashCanPlay: false,
media: 'audio'
},
oga: { // OGG
codec: 'audio/ogg; codecs="vorbis, opus"',
flashCanPlay: false,
media: 'audio'
},
flac: { // FLAC
codec: 'audio/x-flac',
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'
},
rtmpa: { // RTMP AUDIO
codec: 'audio/rtmp; codecs="rtmp"',
flashCanPlay: true,
media: 'audio'
},
m4v: { // H.264 / MP4
codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
flashCanPlay: true,
media: 'video'
},
m3u8v: { // H.264 / AAC / MP4 / Apple HLS
codec: 'application/vnd.apple.mpegurl; codecs="avc1.42E01E, mp4a.40.2"',
flashCanPlay: false,
media: 'video'
},
m3uv: { // M3U
codec: 'audio/mpegurl',
flashCanPlay: false,
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'
},
rtmpv: { // RTMP VIDEO
codec: 'video/rtmp; codecs="rtmp"',
flashCanPlay: true,
media: 'video'
}
},
isObject = function(val) { // Basic check for Object
if(val && typeof val === 'object' && val.hasOwnProperty) {
return true;
} else {
return false;
}
},
getMediaType = function(url) { // Function to gleam the media type from the URL
var mediaType = false;
if(/\.mp3$/i.test(url)) {
mediaType = 'mp3';
} else if(/\.mp4$/i.test(url) || /\.m4v$/i.test(url)) {
mediaType = 'm4v';
} else if(/\.m4a$/i.test(url)) {
mediaType = 'm4a';
} else if(/\.ogg$/i.test(url) || /\.oga$/i.test(url)) {
mediaType = 'oga';
} else if(/\.ogv$/i.test(url)) {
mediaType = 'ogv';
} else if(/\.webm$/i.test(url)) {
mediaType = 'webmv';
}
return mediaType;
},
getSupplied = function(url) { // Function to generate a supplied option from an src object. ie., When supplied not specified.
var supplied = '',
separator = '';
if(isObject(url)) {
// Generate supplied option from object's properties. Non-format properties would be ignored by jPlayer. Order is unpredictable.
for(var prop in url) {
if(url.hasOwnProperty(prop)) {
supplied += separator + prop;
separator = ',';
}
}
}
if(DEBUG) console.log('getSupplied(): Generated: supplied = "' + supplied + '"');
return supplied;
};
Popcorn.player( 'jplayer', {
_canPlayType: function( containerType, url ) {
// url : Either a String or an Object structured similar a jPlayer media object. ie., As used by setMedia in jPlayer.
// The url object may also contain a solution and supplied property.
// Define the src object structure here!
var cType = containerType.toLowerCase(),
srcObj = {
media:{},
options:{}
},
rVal = false, // Only a boolean false means it is not supported.
mediaType;
if(cType !== 'video' && cType !== 'audio') {
if(typeof url === 'string') {
// Check it starts with http, so the URL is absolute... Well, it is not a perfect check.
if(/^http.*/i.test(url)) {
mediaType = getMediaType(url);
if(mediaType) {
srcObj.media[mediaType] = url;
srcObj.options.solution = SOLUTION;
srcObj.options.supplied = mediaType;
}
}
} else {
srcObj = url; // Assume the url is an src object.
}
// Check for Object and appropriate minimum data structure.
if(isObject(srcObj) && isObject(srcObj.media)) {
if(!isObject(srcObj.options)) {
srcObj.options = {};
}
if(!srcObj.options.solution) {
srcObj.options.solution = SOLUTION;
}
if(!srcObj.options.supplied) {
srcObj.options.supplied = getSupplied(srcObj.media);
}
// Figure out how jPlayer will play it.
// This may not work properly when both audio and video is supplied. ie., A media player. But it should return truethy and jPlayer can figure it out.
var solution = srcObj.options.solution.toLowerCase().split(","), // Create the solution array, with prority based on the order of the solution string.
supplied = srcObj.options.supplied.toLowerCase().split(","); // Create the supplied formats array, with prority based on the order of the supplied formats string.
for(var sol = 0; sol < solution.length; sol++) {
var solutionType = solution[sol].replace(/^\s+|\s+$/g, ""), //trim
checkingHtml = solutionType === 'html',
checkingFlash = solutionType === 'flash',
mediaElem;
for(var fmt = 0; fmt < supplied.length; fmt++) {
mediaType = supplied[fmt].replace(/^\s+|\s+$/g, ""); //trim
if(format[mediaType]) { // Check format is valid.
// Create an HTML5 media element for the type of media.
if(!mediaElem && checkingHtml) {
mediaElem = document.createElement(format[mediaType].media);
}
// See if the HTML5 media element can play the MIME / Codec type.
// Flash also returns the object if the format is playable, so it is truethy, but that html property is false.
// This assumes Flash is available, but that should be dealt with by jPlayer if that happens.
var htmlCanPlay = !!(mediaElem && mediaElem.canPlayType && mediaElem.canPlayType(format[mediaType].codec)),
htmlWillPlay = htmlCanPlay && checkingHtml,
flashWillPlay = format[mediaType].flashCanPlay && checkingFlash;
// The first one found will match what jPlayer uses.
if(htmlWillPlay || flashWillPlay) {
rVal = {
html: htmlWillPlay,
type: mediaType
};
sol = solution.length; // Exit solution loop
fmt = supplied.length; // Exit supplied loop
}
}
}
}
}
}
return rVal;
},
// _setup: function( options ) { // Warning: options is deprecated.
_setup: function() {
var media = this,
myPlayer, // The jQuery selector of the jPlayer element. Usually a <div>
jPlayerObj, // The jPlayer data instance. For performance and DRY code.
mediaType = 'unknown',
jpMedia = {},
jpOptions = {},
ready = false, // Used during init to override the annoying duration dependance in the track event padding during Popcorn's isReady(). ie., We is ready after loadeddata and duration can then be set real value at leisure.
duration = 0, // For the durationchange event with both HTML5 and Flash solutions. Used with 'ready' to keep control during the Popcorn isReady() via loadeddata event. (Duration=0 is bad.)
durationchangeId = null, // A timeout ID used with delayed durationchange event. (Because of the duration=NaN fudge to avoid Popcorn track event corruption.)
canplaythrough = false,
error = null, // The MediaError object.
dispatchDurationChange = function() {
if(ready) {
if(DEBUG) console.log('Dispatched event : durationchange : ' + duration);
media.dispatchEvent('durationchange');
} else {
if(DEBUG) console.log('DELAYED EVENT (!ready) : durationchange : ' + duration);
clearTimeout(durationchangeId); // Stop multiple triggers causing multiple timeouts running in parallel.
durationchangeId = setTimeout(dispatchDurationChange, 250);
}
},
jPlayerFlashEventsPatch = function() {
/* Events already supported by jPlayer Flash:
* loadstart
* loadedmetadata (M4A, M4V)
* progress
* play
* pause
* seeking
* seeked
* timeupdate
* ended
* volumechange
* error <- See the custom handler in jPlayerInit()
*/
/* Events patched:
* loadeddata
* durationchange
* canplaythrough
* playing
*/
/* Events NOT patched:
* suspend
* abort
* emptied
* stalled
* loadedmetadata (MP3)
* waiting
* canplay
* ratechange
*/
// Triggering patched events through the jPlayer Object so the events are homogeneous. ie., The contain the event.jPlayer data structure.
var checkDuration = function(event) {
if(event.jPlayer.status.duration !== duration) {
duration = event.jPlayer.status.duration;
dispatchDurationChange();
}
},
checkCanPlayThrough = function(event) {
if(!canplaythrough && event.jPlayer.status.seekPercent === 100) {
canplaythrough = true;
setTimeout(function() {
if(DEBUG) console.log('Trigger : canplaythrough');
jPlayerObj._trigger($.jPlayer.event.canplaythrough);
}, 0);
}
};
myPlayer.bind($.jPlayer.event.loadstart, function() {
setTimeout(function() {
if(DEBUG) console.log('Trigger : loadeddata');
jPlayerObj._trigger($.jPlayer.event.loadeddata);
}, 0);
})
.bind($.jPlayer.event.progress, function(event) {
checkDuration(event);
checkCanPlayThrough(event);
})
.bind($.jPlayer.event.timeupdate, function(event) {
checkDuration(event);
checkCanPlayThrough(event);
})
.bind($.jPlayer.event.play, function() {
setTimeout(function() {
if(DEBUG) console.log('Trigger : playing');
jPlayerObj._trigger($.jPlayer.event.playing);
}, 0);
});
if(DEBUG) console.log('Created CUSTOM event handlers for FLASH');
},
jPlayerInit = function() {
(function($) {
myPlayer = $('#' + media.id);
if(typeof media.src === 'string') {
mediaType = getMediaType(media.src);
jpMedia[mediaType] = media.src;
jpOptions.supplied = mediaType;
jpOptions.solution = SOLUTION;
} else if(isObject(media.src)) {
jpMedia = isObject(media.src.media) ? media.src.media : {};
jpOptions = isObject(media.src.options) ? media.src.options : {};
jpOptions.solution = jpOptions.solution || SOLUTION;
jpOptions.supplied = jpOptions.supplied || getSupplied(media.src.media);
}
// Allow the swfPath to be set to local server. ie., If the jPlayer Plugin is local and already on the page, then you can also use the local SWF.
jpOptions.swfPath = jpOptions.swfPath || JPLAYER_SWFPATH;
myPlayer.bind($.jPlayer.event.ready, function(event) {
if(event.jPlayer.flash.used) {
jPlayerFlashEventsPatch();
}
// Set the media andd load it, so that the Flash solution behaves similar to HTML5 solution.
// This also allows the loadstart event to be used to know jPlayer is ready.
$(this).jPlayer('setMedia', jpMedia).jPlayer('load');
});
// Do not auto-bubble the reserved events, nor the loadeddata and durationchange event, since the duration must be carefully handled when loadeddata event occurs.
// See the duration property code for more details. (Ranting.)
var reservedEvents = $.jPlayer.reservedEvent + ' loadeddata durationchange',
reservedEvent = reservedEvents.split(/\s+/g);
// Generate event handlers for all the standard HTML5 media events. (Except durationchange)
var bindEvent = function(name) {
myPlayer.bind($.jPlayer.event[name], function(event) {
if(DEBUG) console.log('Dispatched event: ' + name + (event && event.jPlayer ? ' (' + event.jPlayer.status.currentTime + 's)' : '')); // Must be after dispatch for some reason on Firefox/Opera
media.dispatchEvent(name);
});
if(DEBUG) console.log('Created event handler for: ' + name);
};
for(var eventName in $.jPlayer.event) {
if($.jPlayer.event.hasOwnProperty(eventName)) {
var nativeEvent = true;
for(var iRes in reservedEvent) {
if(reservedEvent.hasOwnProperty(iRes)) {
if(reservedEvent[iRes] === eventName) {
nativeEvent = false;
break;
}
}
}
if(nativeEvent) {
bindEvent(eventName);
} else {
if(DEBUG) console.log('Skipped auto event handler creation for: ' + eventName);
}
}
}
myPlayer.bind($.jPlayer.event.loadeddata, function(event) {
if(DEBUG) console.log('Dispatched event: loadeddata' + (event && event.jPlayer ? ' (' + event.jPlayer.status.currentTime + 's)' : ''));
media.dispatchEvent('loadeddata');
ready = true;
});
if(DEBUG) console.log('Created CUSTOM event handler for: loadeddata');
myPlayer.bind($.jPlayer.event.durationchange, function(event) {
duration = event.jPlayer.status.duration;
dispatchDurationChange();
});
if(DEBUG) console.log('Created CUSTOM event handler for: durationchange');
// The error event is a special case. Plus jPlayer error event assumes it is a broken URL. (It could also be a decoder error... Or aborted or a Network error.)
myPlayer.bind($.jPlayer.event.error, function(event) {
// Not sure how to handle the error situation. Popcorn does not appear to have the error or error.code property documented here: http://popcornjs.org/popcorn-docs/media-methods/
// If any error event happens, then something has gone pear shaped.
error = event.jPlayer.error; // Saving object pointer, not a copy of the object. Possible garbage collection issue... But the player is dead anyway, so don't care.
if(error.type === $.jPlayer.error.URL) {
error.code = 4; // MEDIA_ERR_SRC_NOT_SUPPORTED since jPlayer makes this assumption. It is the most common error, then the decode error. Never seen either of the other 2 error types occur.
} else {
error.code = 0; // It was a jPlayer error, not an HTML5 media error.
}
if(DEBUG) console.log('Dispatched event: error');
if(DEBUG) console.dir(error);
media.dispatchEvent('error');
});
if(DEBUG) console.log('Created CUSTOM event handler for: error');
Popcorn.player.defineProperty( media, 'error', {
set: function() {
// Read-only property
return error;
},
get: function() {
return error;
}
});
Popcorn.player.defineProperty( media, 'currentTime', {
set: function( val ) {
if(jPlayerObj.status.paused) {
myPlayer.jPlayer('pause', val);
} else {
myPlayer.jPlayer('play', val);
}
return val;
},
get: function() {
return jPlayerObj.status.currentTime;
}
});
/* The joy of duration and the loadeddata event isReady() handler
* The duration is assumed to be a NaN or a valid duration.
* jPlayer uses zero instead of a NaN and this screws up the Popcorn track event start/end arrays padding.
* This line here:
* videoDurationPlus = duration != duration ? Number.MAX_VALUE : duration + 1;
* Not sure why it is not simply:
* videoDurationPlus = Number.MAX_VALUE; // Who cares if the padding is close to the real duration?
* So if you trigger loadeddata before the duration is correct, the track event padding is screwed up. (It pads the start, not the end... Well, duration+1 = 0+1 = 1s)
* That line makes the MP3 Flash fallback difficult to setup. The whole MP3 will need to load before the duration is known.
* Planning on using a NaN for duration until a >0 value is found... Except with MP3, where seekPercent must be 100% before setting the duration.
* Why not just use a NaN during init... And then correct the duration later?
*/
Popcorn.player.defineProperty( media, 'duration', {
set: function() {
// Read-only property
if(ready) {
return duration;
} else {
return NaN;
}
},
get: function() {
if(ready) {
return duration; // Popcorn has initialized, we can now use duration zero or whatever without fear.
} else {
return NaN; // Keep the duration a NaN until after loadeddata event has occurred. Otherwise Popcorn track event padding is corrupted.
}
}
});
Popcorn.player.defineProperty( media, 'muted', {
set: function( val ) {
myPlayer.jPlayer('mute', val);
return jPlayerObj.options.muted;
},
get: function() {
return jPlayerObj.options.muted;
}
});
Popcorn.player.defineProperty( media, 'volume', {
set: function( val ) {
myPlayer.jPlayer('volume', val);
return jPlayerObj.options.volume;
},
get: function() {
return jPlayerObj.options.volume;
}
});
Popcorn.player.defineProperty( media, 'paused', {
set: function() {
// Read-only property
return jPlayerObj.status.paused;
},
get: function() {
return jPlayerObj.status.paused;
}
});
media.play = function() {
myPlayer.jPlayer('play');
};
media.pause = function() {
myPlayer.jPlayer('pause');
};
myPlayer.jPlayer(jpOptions); // Instance jPlayer. Note that the options should not have a ready event defined... Kill it by default?
jPlayerObj = myPlayer.data('jPlayer');
}(jQuery));
},
jPlayerCheck = function() {
if (!jQuery.jPlayer) {
if (!jPlayerDownloading) {
jPlayerDownloading = true;
Popcorn.getScript(JPLAYER_SCRIPT, function() {
jPlayerDownloading = false;
jPlayerInit();
});
} else {
setTimeout(jPlayerCheck, 250);
}
} else {
jPlayerInit();
}
},
jQueryCheck = function() {
if (!window.jQuery) {
if (!jQueryDownloading) {
jQueryDownloading = true;
Popcorn.getScript(JQUERY_SCRIPT, function() {
jQueryDownloading = false;
jPlayerCheck();
});
} else {
setTimeout(jQueryCheck, 250);
}
} else {
jPlayerCheck();
}
};
jQueryCheck();
},
_teardown: function() {
jQuery('#' + this.id).jPlayer('destroy');
}
});
}(Popcorn));

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,662 @@
/*! Blue Monday Skin for jPlayer 2.9.2 ~ (c) 2009-2014 Happyworm Ltd ~ MIT License */
/*
* Skin for jPlayer Plugin (jQuery JavaScript Library)
* http://www.jplayer.org
*
* Skin Name: Blue Monday
*
* Copyright (c) 2010 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* - http://www.opensource.org/licenses/mit-license.php
*
* Author: Silvia Benvenuti
* Skin Version: 5.1 (jPlayer 2.8.0)
* Date: 13th November 2014
*/
.jp-audio *:focus,
.jp-audio-stream *:focus,
.jp-video *:focus {
/* Disable the browser focus highlighting. */
outline: none; }
.jp-audio button::-moz-focus-inner,
.jp-audio-stream button::-moz-focus-inner,
.jp-video button::-moz-focus-inner {
/* Disable the browser CSS3 focus highlighting. */
border: 0; }
.jp-audio,
.jp-audio-stream,
.jp-video {
font-size: 16px;
font-family:'RobotoRegular', Arial, sans-serif;
line-height: 1.6;
color: #666;
border: 1px solid #ececec;
/*background-color: #eee; */
position: relative;}
.jp-video video{
min-height: 240px;
width: 100% !important;
height: auto !important;
}
.jp-audio {
width: 100%; }
.jp-audio video{
display: none;
}
.jp-audio-stream {
width: 182px; }
.jp-video-270p {
width: 100%; }
.jp-video-360p {
width: 100%; }
.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; }
/* The z-index rule is defined in this manner to enable Popcorn plugins that add overlays to video area. EG. Subtitles. */
.jp-video-full div div {
z-index: 1000; }
.jp-video-full .jp-jplayer {
top: 0;
left: 0;
position: fixed !important;
position: relative;
/* Rules for IE6 (full-screen) */
overflow: hidden; }
.jp-video-full .jp-gui {
position: fixed !important;
position: static;
/* Rules for IE6 (full-screen) */
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1001;
/* 1 layer above the others. */ }
.jp-video-full .jp-interface {
position: absolute !important;
position: relative;
/* Rules for IE6 (full-screen) */
bottom: 0;
left: 0; }
.jp-interface {
position: relative;
background-color: transparent;
width: 100%; }
.jp-audio .jp-interface {
height: 80px; }
.jp-audio-stream .jp-interface {
height: 80px; }
.jp-video .jp-interface {
border-top: 1px solid #ececec; }
/* @group CONTROLS */
.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 */ }
.jp-interface .jp-controls {
margin: 0;
padding: 0;
overflow: hidden; }
.jp-audio .jp-controls {
width: 380px;
padding: 20px 20px 0 20px; }
.jp-audio-stream .jp-controls {
position: absolute;
top: 20px;
left: 20px;
width: 142px; }
.jp-video .jp-type-single .jp-controls {
width: 78px;
margin-left: 200px; }
.jp-video .jp-type-playlist .jp-controls {
width: 134px;
margin-left: 172px; }
.jp-video .jp-controls {
float: left; }
.jp-controls button {
display: block;
float: left;
overflow: hidden;
text-indent: -9999px;
border: none;
cursor: pointer;
padding: 0;
margin: 0;
}
.jp-video button:hover, .jp-audio button:hover {
background-color: transparent;
}
.jp-play {
width: 40px;
height: 40px; }
.jp-play, .jp-play:hover {
background: url("../image/player3_72.png") 0 0 no-repeat; }
.jp-play:focus {
background: url("../image/player3_72.png") -41px 0 no-repeat; }
.jp-state-playing .jp-play, .jp-state-playing .jp-play:hover {
background: url("../image/player3_72.png") 0 -42px no-repeat; }
.jp-state-playing .jp-play:focus {
background: url("../image/player3_72.png") -41px -42px no-repeat; }
.jp-stop, .jp-previous, .jp-next {
width: 28px;
height: 28px;
margin-top: 6px; }
.jp-stop, .jp-stop:hover {
background: url("../image/player3_72.png") 0 -83px no-repeat;
}
.jp-stop:focus {
background: url("../image/player3_72.png") -29px -83px no-repeat; }
.jp-previous, .jp-previous:hover {
background: url("../image/player3_72.png") 0 -112px no-repeat; }
.jp-previous:focus {
background: url("../image/player3_72.png") -29px -112px no-repeat; }
.jp-next, .jp-next:hover {
background: url("../image/player3_72.png") 0 -141px no-repeat; }
.jp-next:focus {
background: url("../image/player3_72.png") -29px -141px no-repeat; }
/* @end */
/* @group progress bar */
.jp-progress {
overflow: hidden;
background-color: #ddd; }
.jp-audio .jp-progress {
position: absolute;
top: 32px;
height: 15px; }
.jp-audio .jp-type-single .jp-progress {
left: 110px;
width: 186px; }
.jp-audio .jp-type-playlist .jp-progress {
left: 166px;
width: 130px; }
.jp-video .jp-progress {
top: 0px;
left: 0px;
width: 100%;
height: 10px; }
.jp-seek-bar,.jp-seek-bar:hover {
background: url("../image/player3_72.png") 0 -206px repeat-x;
width: 0px;
height: 100%;
cursor: pointer; }
.jp-play-bar,.jp-play-bar:hover {
background: url("../image/player3_72.png") 0 -222px repeat-x;
width: 0px;
height: 100%; }
/* The seeking class is added/removed inside jPlayer */
.jp-seeking-bg,.jp-seeking-bg:hover {
background: url("../image/jplayer.blue.monday.seeking.gif"); }
/* @end */
/* @group volume controls */
.jp-state-no-volume .jp-volume-controls {
display: none; }
.jp-volume-controls {
position: absolute;
top: 32px;
left: 308px;
width: 200px; }
.jp-audio-stream .jp-volume-controls {
left: 70px; }
.jp-video .jp-volume-controls {
top: 12px;
left: 50px; }
.jp-volume-controls button {
display: block;
position: absolute;
overflow: hidden;
text-indent: -9999px;
border: none;
cursor: pointer;
padding: 0;
margin: 0;
}
.jp-mute,
.jp-volume-max {
width: 21px;
height: 17px; }
.jp-volume-max {
left: 74px; }
.jp-mute, .jp-mute:hover {
background: url("../image/player3_72.png") 0 -170px no-repeat; }
.jp-mute:focus {
background: url("../image/player3_72.png") -19px -170px no-repeat; }
.jp-state-muted .jp-mute, .jp-state-muted .jp-mute:hover {
background: url("../image/player3_72.png") -60px -170px no-repeat; }
.jp-state-muted .jp-mute:focus {
background: url("../image/player3_72.png") -81px -170px no-repeat; }
.jp-volume-max, .jp-volume-max:hover {
background: url("../image/player3_72.png") 0 -187px no-repeat; }
.jp-volume-max:focus {
background: url("../image/player3_72.png") -22px -187px no-repeat; }
.jp-volume-bar, .jp-volume-bar:hover {
position: absolute;
overflow: hidden;
background: url("../image/player3_72.png") 0 -251px repeat-x;
top: 5px;
left: 22px;
width: 46px;
height: 5px;
cursor: pointer; }
.jp-volume-bar-value, .jp-volume-bar-value:hover {
background: url("../image/player3_72.png") 0 -259px repeat-x;
width: 0px;
height: 5px; }
/* @end */
/* @group current time and duration */
.jp-audio .jp-time-holder {
position: absolute;
top: 50px; }
.jp-audio .jp-type-single .jp-time-holder {
left: 110px;
width: 186px; }
.jp-audio .jp-type-playlist .jp-time-holder {
left: 166px;
width: 130px; }
.jp-current-time,
.jp-duration {
width: 60px;
font-size: .64em;
}
.jp-current-time {
float: left;
display: inline;
cursor: default; }
.jp-duration {
float: right;
display: inline;
text-align: right;
cursor: default; }
.jp-video .jp-current-time {
margin-left: 20px; }
.jp-video .jp-duration {
margin-right: 20px; }
/* @end */
/* @group playlist */
.jp-details {
font-weight: bold;
text-align: center;
cursor: default; }
.jp-details,
.jp-playlist {
width: 100%;
/*background-color: #ccc;*/
border-top: 1px solid #ececec; }
.jp-video .jp-playlist{
/* width: 20%; */
/* position: absolute;
top: 0;
right: 0; */
max-height: 420px;
overflow: auto;
background-color: #fff;
border: none;
}
.jp-type-single .jp-details,
.jp-type-playlist .jp-details {
border-top: none; }
.jp-details .jp-title {
margin: 0;
padding: 5px 20px;
font-size: .72em;
font-weight: bold; }
.container .container_text .jp-playlist ul, .jp-playlist ul {
list-style-type: none;
margin: 0;
padding: 0 20px;
font-size: .72em; }
.container .container_text .jp-playlist ul li{
padding-left: 0;
margin-bottom: 0;;
}
.container .container_text .jp-playlist ul li:before{
display: none;
padding-left: 0;
}
.jp-playlist li {
/*padding: 5px 0 4px 20px;*/
padding: 5px 0 4px 0;
border-bottom: 1px solid #eee; }
.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;*/
padding: 5px 0 5px 0;
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: none !important;/*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 */
.jp-video-play {
width: 100%;
overflow: hidden;
/* Important for nested negative margins to work in modern browsers */
cursor: pointer;
background-color: transparent;
/* Makes IE9 work with the active area over the whole video area. IE6/7/8 only have the button as active area. */ }
.jp-video-270p .jp-video-play {
margin-top: -270px;
height: 270px; }
.jp-video-360p .jp-video-play {
margin-top: -360px;
height: 360px; }
.jp-video-full .jp-video-play {
height: 100%; }
.jp-video-play-icon {
position: relative;
display: none;
width: 112px;
height: 100px;
margin-left: -56px;
margin-top: -50px;
left: 50%;
top: 40%;
background-color: none;
background: url("../image/jplayer.blue.monday.video.play_2.png") 0 0 no-repeat;
text-indent: -9999px;
border: none;
cursor: pointer; }
.jp-video-play-icon:hover {
background-color: none;
background: url("../image/jplayer.blue.monday.video.play_2.png") 0 -99px no-repeat;
}
.jp-video-play-icon:focus {
background: url("../image/jplayer.blue.monday.video.play_2.png") 0 -99px no-repeat; }
.jp-jplayer audio,
.jp-jplayer {
width: 0px;
height: 0px; }
.jp-jplayer {
background-color: #000000;
width: 100% !important;
height: auto !important;
}
.jp-jplayer video{
display: block;
}
.jp-video .jp-jplayer video{
min-height: 420px;
}
.jp-video div.jp-type-playlist div.jp-playlist li, .jp-video div.jp-type-playlist div.jp-playlist li.jp-playlist-current{
list-style: none;
width: 20%;
text-align: center;
height: 26px;
position: relative;
color: #fff;
background: rgb(124,37,41);
margin: 3px 0;
border: none;
margin-left: 10px;
margin-bottom: 10px;
}
.jp-video div.jp-type-playlist div.jp-playlist li a:before{
content: "Фрагмент ";
display: inline;
}
/*.jp-video div.jp-type-playlist div.jp-playlist li:before{
content: "";
display: block;
width: 60px;
height: 36px;
top: 50%;
left: 50%;
margin-top: -18px;
margin-left: -30px;
border-radius: 2px;
background: #1976D4 url(../image/jplayer.blue.monday.video.play_2.png) 0 0px no-repeat;
background-size: 60px auto;
opacity: 0.7;
}*/
.jp-video .jp-playlist li div{
display: block;
width: 100%;
height: 100%;
position: relative;
}
.jp-video div.jp-type-playlist div.jp-playlist li.jp-playlist-current{
opacity: 0.7;
}
.jp-video div.jp-type-playlist div.jp-playlist ul{
display: flex;
flex-wrap: wrap;
padding: 0;
}
.jp-video div.jp-type-playlist div.jp-playlist a{
z-index: 3;
display: block;
width: 100%;
height: 100%;
color: #fff;
font-weight: 500;
/* opacity: 0; */
}
.jp-video div.jp-type-playlist div.jp-playlist a.jp-playlist-current{
color: #fff;
font-weight: 700;
}
/* @group TOGGLES */
/* The audio toggles are nested inside jp-time-holder */
.jp-toggles {
padding: 0;
margin: 0 auto;
overflow: hidden; }
.jp-audio .jp-type-single .jp-toggles {
width: 25px; }
.jp-audio .jp-type-playlist .jp-toggles {
width: 70px;
margin: 0;
position: absolute;
left: 325px;
top: 50px; }
.jp-video .jp-toggles {
position: absolute;
right: 16px;
margin: 0;
margin-top: 10px;
width: 100px; }
.jp-toggles button {
display: block;
float: left;
width: 25px;
height: 18px;
text-indent: -9999px;
line-height: 100%;
border: none;
cursor: pointer;
padding: 0;
margin: 0;
margin-left: 10px;
}
button.jp-full-screen, button.jp-full-screen:hover {
background: url("../image/player3_72.png") 0 -314px no-repeat;
}
.jp-full-screen:focus {
background: url("../image/player3_72.png") -30px -314px no-repeat; }
.jp-state-full-screen .jp-full-screen, .jp-state-full-screen .jp-full-screen:hover {
background: url("../image/player3_72.png") -60px -314px no-repeat; }
.jp-state-full-screen .jp-full-screen:focus {
background: url("../image/player3_72.png") -90px -314px no-repeat; }
button.jp-repeat, button.jp-repeat:hover {
padding: 0;
margin: 0;
background: url("../image/player3_72.png") 0 -292px no-repeat; }
.jp-repeat:focus {
background: url("../image/player3_72.png") -30px -292px no-repeat; }
.jp-state-looped .jp-repeat, .jp-state-looped .jp-repeat:hover {
background: url("../image/player3_72.png") -60px -292px no-repeat; }
.jp-state-looped .jp-repeat:focus {
background: url("../image/player3_72.png") -90px -292px no-repeat; }
.jp-shuffle, .jp-shuffle:hover {
background: url("../image/player3_72.png") 0 -272px no-repeat;
margin-left: 10px; }
.jp-shuffle:focus {
background: url("../image/player3_72.png") -30px -272px no-repeat; }
.jp-state-shuffled .jp-shuffle, .jp-state-shuffled .jp-shuffle:hover {
background: url("../image/player3_72.png") -60px -272px no-repeat; }
.jp-state-shuffled .jp-shuffle:focus {
background: url("../image/player3_72.png") -90px -272px no-repeat; }
/* @end */
/* @group NO SOLUTION error feedback */
.jp-no-solution {
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 */

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,42 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio" role="application" aria-label="media player">
<div class="jp-type-playlist">
<div class="jp-gui jp-interface">
<div class="jp-controls">
<button class="jp-previous" role="button" tabindex="0">previous</button>
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-next" role="button" tabindex="0">next</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-time-holder">
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-shuffle" role="button" tabindex="0">shuffle</button>
</div>
</div>
<div class="jp-playlist">
<ul>
<li>&nbsp;</li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,37 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio" role="application" aria-label="media player">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-time-holder">
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
</div>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio-stream" role="application" aria-label="media player">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,52 @@
<div id="{{WRAPPER}}" class="jp-video " role="application" aria-label="media player">
<div class="jp-type-playlist">
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-controls-holder">
<div class="jp-controls">
<button class="jp-previous" role="button" tabindex="0">previous</button>
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-next" role="button" tabindex="0">next</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-shuffle" role="button" tabindex="0">shuffle</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
</div>
</div>
<div class="jp-playlist">
<ul>
<!-- The method Playlist.displayPlaylist() uses this unordered list -->
<li>&nbsp;</li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,43 @@
<div id="{{WRAPPER}}" class="jp-video " role="application" aria-label="media player">
<div class="jp-type-single">
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-controls-holder">
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,572 @@
/*! Pink Flag Skin for jPlayer 2.9.2 ~ (c) 2009-2014 Happyworm Ltd ~ MIT License */
/*
* Skin for jPlayer Plugin (jQuery JavaScript Library)
* http://www.jplayer.org
*
* Skin Name: Pink Flag
*
* Copyright (c) 2012 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* - http://www.opensource.org/licenses/mit-license.php
*
* Author: Silvia Benvenuti
* Skin Version: 2.1 (jPlayer 2.8.0)
* Date: 13th November 2014
*/
.jp-audio *:focus,
.jp-audio-stream *:focus,
.jp-video *:focus {
/* Disable the browser focus highlighting. */
outline: none; }
.jp-audio button::-moz-focus-inner,
.jp-audio-stream button::-moz-focus-inner,
.jp-video button::-moz-focus-inner {
/* Disable the browser CSS3 focus highlighting. */
border: 0; }
.jp-audio,
.jp-audio-stream,
.jp-video {
font-size: 16px;
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; }
.jp-audio {
width: 201px;
padding: 20px; }
.jp-audio-stream {
width: 101px;
padding: 20px 20px 10px 20px; }
.jp-video-270p {
width: 480px; }
.jp-video-360p {
width: 640px; }
.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; }
/* The z-index rule is defined in this manner to enable Popcorn plugins that add overlays to video area. EG. Subtitles. */
.jp-video-full div div {
z-index: 1000; }
.jp-video-full .jp-jplayer {
top: 0;
left: 0;
position: fixed !important;
position: relative;
/* Rules for IE6 (full-screen) */
overflow: hidden; }
.jp-video-full .jp-gui {
position: fixed !important;
position: static;
/* Rules for IE6 (full-screen) */
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1001;
/* 1 layer above the others. */ }
.jp-video-full .jp-interface {
position: absolute !important;
position: relative;
/* Rules for IE6 (full-screen) */
bottom: 0;
left: 0; }
.jp-interface {
position: relative;
width: 100%;
background-color: #3a2a45;
/* Required for the full screen */ }
/* @group CONTROLS */
.jp-video .jp-controls-holder {
clear: both;
width: 440px;
margin: 0 auto 10px auto;
position: relative;
overflow: hidden; }
.jp-audio .jp-controls-holder {
height: 80px; }
.jp-audio-stream .jp-controls-holder {
height: 50px; }
.jp-controls {
background: url("../image/jplayer.pink.flag.jpg") 0 0 no-repeat;
padding: 1px 0 2px 1px;
overflow: hidden;
width: 201px;
height: 34px; }
.jp-audio .jp-controls,
.jp-audio-stream .jp-controls {
margin: 0 auto; }
.jp-audio-stream .jp-controls {
width: 100px; }
.jp-video .jp-controls {
margin: 0 0 0 115px;
float: left;
display: inline;
/* need this to fix IE6 double margin */ }
.jp-controls button {
display: block;
float: left;
overflow: hidden;
text-indent: -9999px;
height: 34px;
margin: 0 1px 2px 0;
padding: 0;
border: none;
cursor: pointer; }
/* @group single player controls */
.jp-type-single .jp-controls button {
width: 99px; }
.jp-type-single .jp-play {
background: url("../image/jplayer.pink.flag.jpg") 0px -40px no-repeat; }
.jp-type-single .jp-play:focus {
background: url("../image/jplayer.pink.flag.jpg") -100px -40px no-repeat; }
.jp-state-playing .jp-type-single .jp-play {
background: url("../image/jplayer.pink.flag.jpg") 0px -120px no-repeat; }
.jp-state-playing .jp-type-single .jp-play:focus {
background: url("../image/jplayer.pink.flag.jpg") -100px -120px no-repeat; }
/* The right border is normally in the ul background image. */
.jp-audio-stream .jp-play,
.jp-audio-stream .jp-pause {
border-right: 1px solid #180920; }
.jp-type-single .jp-stop {
background: url("../image/jplayer.pink.flag.jpg") 0px -80px no-repeat; }
.jp-type-single .jp-stop:focus {
background: url("../image/jplayer.pink.flag.jpg") -100px -80px no-repeat; }
/* @end */
/* @group playlist player controls */
.jp-type-playlist .jp-controls button {
width: 49px; }
.jp-type-playlist .jp-play {
background: url("../image/jplayer.pink.flag.jpg") -24px -40px no-repeat; }
.jp-type-playlist .jp-play:focus {
background: url("../image/jplayer.pink.flag.jpg") -124px -40px no-repeat; }
.jp-state-playing div.jp-type-playlist .jp-play {
background: url("../image/jplayer.pink.flag.jpg") -24px -120px no-repeat; }
.jp-state-playing div.jp-type-playlist .jp-play:focus {
background: url("../image/jplayer.pink.flag.jpg") -124px -120px no-repeat; }
.jp-type-playlist .jp-stop {
background: url("../image/jplayer.pink.flag.jpg") -24px -80px no-repeat; }
.jp-type-playlist .jp-stop:focus {
background: url("../image/jplayer.pink.flag.jpg") -124px -80px no-repeat; }
.jp-type-playlist .jp-previous {
background: url("../image/jplayer.pink.flag.jpg") -24px -200px no-repeat; }
.jp-type-playlist .jp-previous:focus {
background: url("../image/jplayer.pink.flag.jpg") -124px -200px no-repeat; }
.jp-type-playlist .jp-next {
background: url("../image/jplayer.pink.flag.jpg") -24px -160px no-repeat; }
.jp-type-playlist .jp-next:focus {
background: url("../image/jplayer.pink.flag.jpg") -124px -160px no-repeat; }
/* @end */
/* @group TOGGLES */
.jp-toggles {
padding: 0;
margin: 0 auto;
overflow: hidden; }
.jp-audio .jp-toggles {
width: 55px; }
.jp-audio .jp-type-single .jp-toggles {
width: 25px; }
.jp-video .jp-toggles {
float: left;
width: 105px;
margin: 10px 0 0 15px; }
.jp-toggles button {
display: block;
float: left;
width: 25px;
height: 18px;
text-indent: -9999px;
line-height: 100%;
/* need this for IE6 */
border: none;
cursor: pointer; }
.jp-full-screen {
background: url("../image/jplayer.pink.flag.jpg") 0 -420px no-repeat;
margin-left: 15px; }
.jp-full-screen:focus {
background: url("../image/jplayer.pink.flag.jpg") -30px -420px no-repeat; }
.jp-state-full-screen .jp-full-screen {
background: url("../image/jplayer.pink.flag.jpg") -60px -420px no-repeat; }
.jp-state-full-screen .jp-full-screen:focus {
background: url("../image/jplayer.pink.flag.jpg") -90px -420px no-repeat; }
.jp-repeat {
background: url("../image/jplayer.pink.flag.jpg") 0 -440px no-repeat;
margin-left: 0; }
.jp-repeat:focus {
background: url("../image/jplayer.pink.flag.jpg") -30px -440px no-repeat; }
.jp-state-looped .jp-repeat {
background: url("../image/jplayer.pink.flag.jpg") -60px -440px no-repeat; }
.jp-state-looped .jp-repeat:focus {
background: url("../image/jplayer.pink.flag.jpg") -90px -440px no-repeat; }
.jp-shuffle {
background: url("../image/jplayer.pink.flag.jpg") 0 -460px no-repeat;
margin-left: 15px; }
.jp-shuffle:focus {
background: url("../image/jplayer.pink.flag.jpg") -30px -460px no-repeat; }
.jp-state-shuffled .jp-shuffle {
background: url("../image/jplayer.pink.flag.jpg") -60px -460px no-repeat; }
.jp-state-shuffled .jp-shuffle:focus {
background: url("../image/jplayer.pink.flag.jpg") -90px -460px no-repeat; }
.jp-audio .jp-shuffle {
margin-left: 5px; }
/* @end */
/* @group progress bar */
/* The seeking class is added/removed inside jPlayer */
div.jp-seeking-bg {
background: url("../image/jplayer.pink.flag.seeking.gif"); }
.jp-progress {
background: url("../image/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("../image/jplayer.pink.flag.jpg") 0px -260px repeat-x;
width: 0px;
height: 100%;
overflow: hidden;
cursor: pointer; }
.jp-play-bar {
background: url("../image/jplayer.pink.flag.jpg") 0px -280px repeat-x;
width: 0px;
height: 100%;
overflow: hidden; }
/* @end */
/* @group volume controls */
.jp-state-no-volume .jp-volume-controls {
display: none; }
.jp-audio .jp-volume-controls,
.jp-audio-stream .jp-volume-controls {
height: 30px; }
.jp-volume-controls button {
position: absolute;
display: block;
overflow: hidden;
text-indent: -9999px;
margin: 0;
padding: 0;
width: 16px;
height: 11px;
border: none;
cursor: pointer; }
.jp-audio .jp-volume-controls .jp-mute,
.jp-audio-stream .jp-volume-controls .jp-mute {
top: -6px;
left: 0; }
.jp-audio .jp-volume-controls .jp-volume-max,
.jp-audio-stream .jp-volume-controls .jp-volume-max {
top: -6px;
right: 0; }
.jp-video .jp-volume-controls .jp-mute,
.jp-video .jp-volume-controls .jp-unmute {
left: 0;
top: 14px; }
.jp-video .jp-volume-controls .jp-volume-max {
left: 84px;
top: 14px; }
.jp-volume-controls .jp-mute {
background: url("../image/jplayer.pink.flag.jpg") 0px -330px no-repeat; }
.jp-volume-controls .jp-mute:focus {
background: url("../image/jplayer.pink.flag.jpg") -25px -330px no-repeat; }
.jp-state-muted .jp-volume-controls .jp-mute {
background: url("../image/jplayer.pink.flag.jpg") -60px -330px no-repeat; }
.jp-state-muted .jp-volume-controls .jp-mute:focus {
background: url("../image/jplayer.pink.flag.jpg") -85px -330px no-repeat; }
.jp-volume-controls .jp-volume-max {
background: url("../image/jplayer.pink.flag.jpg") 0px -350px no-repeat; }
.jp-volume-controls .jp-volume-max:focus {
background: url("../image/jplayer.pink.flag.jpg") -25px -350px no-repeat; }
.jp-volume-bar {
background: url("../image/jplayer.pink.flag.jpg") 0px -300px repeat-x;
position: absolute;
width: 197px;
height: 4px;
padding: 2px 2px 1px 2px;
overflow: hidden;
cursor: pointer; }
.jp-audio .jp-interface .jp-volume-bar,
.jp-audio-stream .jp-interface .jp-volume-bar {
top: 10px;
left: 0; }
.jp-audio-stream .jp-interface .jp-volume-bar {
width: 97px;
border-right: 1px solid #180920;
padding-right: 1px; }
.jp-video .jp-volume-bar {
top: 0;
left: 0;
width: 95px;
border-right: 1px solid #180920;
padding-right: 1px;
margin-top: 30px; }
.jp-volume-bar-value {
background: url("../image/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;
cursor: default; }
.jp-duration {
float: right;
text-align: right;
cursor: pointer; }
.jp-video .jp-current-time {
padding-left: 20px; }
.jp-video .jp-duration {
padding-right: 20px; }
/* @end */
/* @group playlist */
.jp-details {
font-size: .7em;
margin: 0;
padding: 0; }
.jp-details .jp-title {
padding: 0;
margin: 0;
overflow: hidden;
text-align: center;
cursor: default; }
.jp-video .jp-details {
margin: 0 90px 10px; }
.jp-playlist ul {
list-style-type: none;
font-size: .7em;
margin: 0;
padding: 0; }
.jp-video .jp-playlist ul {
margin: 0 20px; }
.jp-playlist li {
position: relative;
padding: 2px 0;
border-top: 1px solid #554461;
border-bottom: 1px solid #180a1f;
overflow: hidden; }
/* 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 */
.jp-video .jp-video-play {
width: 100%;
overflow: hidden;
/* Important for nested negative margins to work in modern browsers */ }
.jp-video-270p .jp-video-play {
margin-top: -270px;
height: 270px; }
.jp-video-360p .jp-video-play {
margin-top: -360px;
height: 360px; }
.jp-video-full .jp-video-play {
height: 100%; }
.jp-video-play-icon {
position: relative;
display: block;
width: 112px;
height: 100px;
margin-left: -56px;
margin-top: -50px;
left: 50%;
top: 50%;
border: none;
cursor: pointer;
background: url("../image/jplayer.pink.flag.video.play.png") 0 0 no-repeat;
text-indent: -9999px; }
.jp-video-play-icon:focus {
background: url("../image/jplayer.pink.flag.video.play.png") 0 -100px no-repeat; }
.jp-jplayer audio,
.jp-jplayer {
width: 0px;
height: 0px; }
.jp-jplayer {
background-color: #000000; }
/* @group NO SOLUTION error feedback */
.jp-no-solution {
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; }
/* @end */

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,42 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio" role="application" aria-label="media player">
<div class="jp-type-playlist">
<div class="jp-gui jp-interface">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls-holder">
<div class="jp-controls">
<button class="jp-previous" role="button" tabindex="0">previous</button>
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
<button class="jp-next" role="button" tabindex="0">next</button>
</div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-shuffle" role="button" tabindex="0">shuffle</button>
</div>
</div>
</div>
<div class="jp-playlist">
<ul>
<li>&nbsp;</li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,37 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio" role="application" aria-label="media player">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls-holder">
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
</div>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio-stream" role="application" aria-label="media player">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,52 @@
<div id="{{WRAPPER}}" class="jp-video " role="application" aria-label="media player">
<div class="jp-type-playlist">
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-controls-holder">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls">
<button class="jp-previous" role="button" tabindex="0">previous</button>
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
<button class="jp-next" role="button" tabindex="0">next</button>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-shuffle" role="button" tabindex="0">shuffle</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
</div>
</div>
<div class="jp-playlist">
<ul>
<!-- The method Playlist.displayPlaylist() uses this unordered list -->
<li></li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,43 @@
<div id="{{WRAPPER}}" class="jp-video " role="application" aria-label="media player">
<div class="jp-type-single">
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-controls-holder">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,16 @@
# Library
This folder holds copies of external libraries.
The purpose of having static copies of external libraries is so that the examples work after simply cloning or downloading the repository.
## Aurora Solution
To enable the [Aurora](https://github.com/audiocogs) solution inside jPlayer, the following files were added to the library.
- [aurora.js](https://github.com/audiocogs/aurora.js)
- [aac.js](https://github.com/audiocogs/aac.js)
- [flac.js](https://github.com/audiocogs/flac.js)
- [mp3.js](https://github.com/audiocogs/mp3.js)
- [ogg.js](https://github.com/audiocogs/ogg.js)
- [opus.js](https://github.com/audiocogs/opus.js)
- [vorbis.js](https://github.com/audiocogs/vorbis.js)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,793 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
exports.FLACDemuxer = require('./src/demuxer');
exports.FLACDecoder = require('./src/decoder');
require('./src/ogg');
},{"./src/decoder":2,"./src/demuxer":3,"./src/ogg":4}],2:[function(require,module,exports){
/*
* FLAC.js - Free Lossless Audio Codec decoder in JavaScript
* Original C version from FFmpeg (c) 2003 Alex Beregszaszi
* JavaScript port by Devon Govett and Jens Nockert of Official.fm Labs
*
* Licensed under the same terms as the original. The original
* license follows.
*
* FLAC.js is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FLAC.js is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
var AV = (window.AV);
var FLACDecoder = AV.Decoder.extend(function() {
AV.Decoder.register('flac', this);
this.prototype.setCookie = function(cookie) {
this.cookie = cookie;
// initialize arrays
this.decoded = [];
for (var i = 0; i < this.format.channelsPerFrame; i++) {
this.decoded[i] = new Int32Array(cookie.maxBlockSize);
}
// for 24 bit lpc frames, this is used to simulate a 64 bit int
this.lpc_total = new Int32Array(2);
};
const BLOCK_SIZES = new Int16Array([
0, 192, 576 << 0, 576 << 1, 576 << 2, 576 << 3, 0, 0,
256 << 0, 256 << 1, 256 << 2, 256 << 3, 256 << 4, 256 << 5, 256 << 6, 256 << 7
]);
const SAMPLE_RATES = new Int32Array([
0, 88200, 176400, 192000,
8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000,
0, 0, 0, 0
]);
const SAMPLE_SIZES = new Int8Array([
0, 8, 12, 0, 16, 20, 24, 0
]);
const MAX_CHANNELS = 8,
CHMODE_INDEPENDENT = 0,
CHMODE_LEFT_SIDE = 8,
CHMODE_RIGHT_SIDE = 9,
CHMODE_MID_SIDE = 10;
this.prototype.readChunk = function() {
var stream = this.bitstream;
if (!stream.available(32))
return;
// frame sync code
if ((stream.read(15) & 0x7FFF) !== 0x7FFC)
throw new Error('Invalid sync code');
var isVarSize = stream.read(1), // variable block size stream code
bsCode = stream.read(4), // block size
srCode = stream.read(4), // sample rate code
chMode = stream.read(4), // channel mode
bpsCode = stream.read(3); // bits per sample
stream.advance(1); // reserved bit
// channels
this.chMode = chMode;
var channels;
if (chMode < MAX_CHANNELS) {
channels = chMode + 1;
this.chMode = CHMODE_INDEPENDENT;
} else if (chMode <= CHMODE_MID_SIDE) {
channels = 2;
} else {
throw new Error('Invalid channel mode');
}
if (channels !== this.format.channelsPerFrame)
throw new Error('Switching channel layout mid-stream not supported.');
// bits per sample
if (bpsCode === 3 || bpsCode === 7)
throw new Error('Invalid sample size code');
this.bps = SAMPLE_SIZES[bpsCode];
if (this.bps !== this.format.bitsPerChannel)
throw new Error('Switching bits per sample mid-stream not supported.');
// sample number or frame number
// see http://www.hydrogenaudio.org/forums/index.php?s=ea7085ffe6d57132c36e6105c0d434c9&showtopic=88390&pid=754269&st=0&#entry754269
var ones = 0;
while (stream.read(1) === 1)
ones++;
var frame_or_sample_num = stream.read(7 - ones);
for (; ones > 1; ones--) {
stream.advance(2); // == 2
frame_or_sample_num = (frame_or_sample_num << 6) | stream.read(6);
}
// block size
if (bsCode === 0)
throw new Error('Reserved blocksize code');
else if (bsCode === 6)
this.blockSize = stream.read(8) + 1;
else if (bsCode === 7)
this.blockSize = stream.read(16) + 1;
else
this.blockSize = BLOCK_SIZES[bsCode];
// sample rate
var sampleRate;
if (srCode < 12)
sampleRate = SAMPLE_RATES[srCode];
else if (srCode === 12)
sampleRate = stream.read(8) * 1000;
else if (srCode === 13)
sampleRate = stream.read(16);
else if (srCode === 14)
sampleRate = stream.read(16) * 10;
else
throw new Error('Invalid sample rate code');
stream.advance(8); // skip CRC check
// subframes
for (var i = 0; i < channels; i++)
this.decodeSubframe(i);
stream.align();
stream.advance(16); // skip CRC frame footer
var is32 = this.bps > 16,
output = new ArrayBuffer(this.blockSize * channels * (is32 ? 4 : 2)),
buf = is32 ? new Int32Array(output) : new Int16Array(output),
blockSize = this.blockSize,
decoded = this.decoded,
j = 0;
switch (this.chMode) {
case CHMODE_INDEPENDENT:
for (var k = 0; k < blockSize; k++) {
for (var i = 0; i < channels; i++) {
buf[j++] = decoded[i][k];
}
}
break;
case CHMODE_LEFT_SIDE:
for (var i = 0; i < blockSize; i++) {
var left = decoded[0][i],
right = decoded[1][i];
buf[j++] = left;
buf[j++] = (left - right);
}
break;
case CHMODE_RIGHT_SIDE:
for (var i = 0; i < blockSize; i++) {
var left = decoded[0][i],
right = decoded[1][i];
buf[j++] = (left + right);
buf[j++] = right;
}
break;
case CHMODE_MID_SIDE:
for (var i = 0; i < blockSize; i++) {
var left = decoded[0][i],
right = decoded[1][i];
left -= right >> 1;
buf[j++] = (left + right);
buf[j++] = left;
}
break;
}
return buf;
};
this.prototype.decodeSubframe = function(channel) {
var wasted = 0,
stream = this.bitstream,
blockSize = this.blockSize,
decoded = this.decoded;
this.curr_bps = this.bps;
if (channel === 0) {
if (this.chMode === CHMODE_RIGHT_SIDE)
this.curr_bps++;
} else {
if (this.chMode === CHMODE_LEFT_SIDE || this.chMode === CHMODE_MID_SIDE)
this.curr_bps++;
}
if (stream.read(1))
throw new Error("Invalid subframe padding");
var type = stream.read(6);
if (stream.read(1)) {
wasted = 1;
while (!stream.read(1))
wasted++;
this.curr_bps -= wasted;
}
if (this.curr_bps > 32)
throw new Error("decorrelated bit depth > 32 (" + this.curr_bps + ")");
if (type === 0) {
var tmp = stream.read(this.curr_bps, true);
for (var i = 0; i < blockSize; i++)
decoded[channel][i] = tmp;
} else if (type === 1) {
var bps = this.curr_bps;
for (var i = 0; i < blockSize; i++)
decoded[channel][i] = stream.read(bps, true);
} else if ((type >= 8) && (type <= 12)) {
this.decode_subframe_fixed(channel, type & ~0x8);
} else if (type >= 32) {
this.decode_subframe_lpc(channel, (type & ~0x20) + 1);
} else {
throw new Error("Invalid coding type");
}
if (wasted) {
for (var i = 0; i < blockSize; i++)
decoded[channel][i] <<= wasted;
}
};
this.prototype.decode_subframe_fixed = function(channel, predictor_order) {
var decoded = this.decoded[channel],
stream = this.bitstream,
bps = this.curr_bps;
// warm up samples
for (var i = 0; i < predictor_order; i++)
decoded[i] = stream.read(bps, true);
this.decode_residuals(channel, predictor_order);
var a = 0, b = 0, c = 0, d = 0;
if (predictor_order > 0)
a = decoded[predictor_order - 1];
if (predictor_order > 1)
b = a - decoded[predictor_order - 2];
if (predictor_order > 2)
c = b - decoded[predictor_order - 2] + decoded[predictor_order - 3];
if (predictor_order > 3)
d = c - decoded[predictor_order - 2] + 2 * decoded[predictor_order - 3] - decoded[predictor_order - 4];
switch (predictor_order) {
case 0:
break;
case 1:
case 2:
case 3:
case 4:
var abcd = new Int32Array([a, b, c, d]),
blockSize = this.blockSize;
for (var i = predictor_order; i < blockSize; i++) {
abcd[predictor_order - 1] += decoded[i];
for (var j = predictor_order - 2; j >= 0; j--) {
abcd[j] += abcd[j + 1];
}
decoded[i] = abcd[0];
}
break;
default:
throw new Error("Invalid Predictor Order " + predictor_order);
}
};
this.prototype.decode_subframe_lpc = function(channel, predictor_order) {
var stream = this.bitstream,
decoded = this.decoded[channel],
bps = this.curr_bps,
blockSize = this.blockSize;
// warm up samples
for (var i = 0; i < predictor_order; i++) {
decoded[i] = stream.read(bps, true);
}
var coeff_prec = stream.read(4) + 1;
if (coeff_prec === 16)
throw new Error("Invalid coefficient precision");
var qlevel = stream.read(5, true);
if (qlevel < 0)
throw new Error("Negative qlevel, maybe buggy stream");
var coeffs = new Int32Array(32);
for (var i = 0; i < predictor_order; i++) {
coeffs[i] = stream.read(coeff_prec, true);
}
this.decode_residuals(channel, predictor_order);
if (this.bps <= 16) {
for (var i = predictor_order; i < blockSize - 1; i += 2) {
var d = decoded[i - predictor_order],
s0 = 0, s1 = 0, c = 0;
for (var j = predictor_order - 1; j > 0; j--) {
c = coeffs[j];
s0 += c * d;
d = decoded[i - j];
s1 += c * d;
}
c = coeffs[0];
s0 += c * d;
d = decoded[i] += (s0 >> qlevel);
s1 += c * d;
decoded[i + 1] += (s1 >> qlevel);
}
if (i < blockSize) {
var sum = 0;
for (var j = 0; j < predictor_order; j++)
sum += coeffs[j] * decoded[i - j - 1];
decoded[i] += (sum >> qlevel);
}
} else {
// simulate 64 bit integer using an array of two 32 bit ints
var total = this.lpc_total;
for (var i = predictor_order; i < blockSize; i++) {
// reset total to 0
total[0] = 0;
total[1] = 0;
for (j = 0; j < predictor_order; j++) {
// simulate `total += coeffs[j] * decoded[i - j - 1]`
multiply_add(total, coeffs[j], decoded[i - j - 1]);
}
// simulate `decoded[i] += total >> qlevel`
// we know that qlevel < 32 since it is a 5 bit field (see above)
decoded[i] += (total[0] >>> qlevel) | (total[1] << (32 - qlevel));
}
}
};
const TWO_PWR_32_DBL = Math.pow(2, 32);
// performs `total += a * b` on a simulated 64 bit int
// total is an Int32Array(2)
// a and b are JS numbers (32 bit ints)
function multiply_add(total, a, b) {
// multiply a * b (we can use normal JS multiplication for this)
var r = a * b;
var n = r < 0;
if (n)
r = -r;
var r_low = (r % TWO_PWR_32_DBL) | 0;
var r_high = (r / TWO_PWR_32_DBL) | 0;
if (n) {
r_low = ~r_low + 1;
r_high = ~r_high;
}
// add result to total
var a48 = total[1] >>> 16;
var a32 = total[1] & 0xFFFF;
var a16 = total[0] >>> 16;
var a00 = total[0] & 0xFFFF;
var b48 = r_high >>> 16;
var b32 = r_high & 0xFFFF;
var b16 = r_low >>> 16;
var b00 = r_low & 0xFFFF;
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
c00 += a00 + b00;
c16 += c00 >>> 16;
c00 &= 0xFFFF;
c16 += a16 + b16;
c32 += c16 >>> 16;
c16 &= 0xFFFF;
c32 += a32 + b32;
c48 += c32 >>> 16;
c32 &= 0xFFFF;
c48 += a48 + b48;
c48 &= 0xFFFF;
// store result back in total
total[0] = (c16 << 16) | c00;
total[1] = (c48 << 16) | c32;
}
const INT_MAX = 32767;
this.prototype.decode_residuals = function(channel, predictor_order) {
var stream = this.bitstream,
method_type = stream.read(2);
if (method_type > 1)
throw new Error('Illegal residual coding method ' + method_type);
var rice_order = stream.read(4),
samples = (this.blockSize >>> rice_order);
if (predictor_order > samples)
throw new Error('Invalid predictor order ' + predictor_order + ' > ' + samples);
var decoded = this.decoded[channel],
sample = predictor_order,
i = predictor_order;
for (var partition = 0; partition < (1 << rice_order); partition++) {
var tmp = stream.read(method_type === 0 ? 4 : 5);
if (tmp === (method_type === 0 ? 15 : 31)) {
tmp = stream.read(5);
for (; i < samples; i++)
decoded[sample++] = stream.read(tmp, true);
} else {
for (; i < samples; i++)
decoded[sample++] = this.golomb(tmp, INT_MAX, 0);
}
i = 0;
}
};
const MIN_CACHE_BITS = 25;
this.prototype.golomb = function(k, limit, esc_len) {
var data = this.bitstream,
offset = data.bitPosition,
buf = data.peek(32 - offset) << offset,
v = 0;
var log = 31 - clz(buf | 1); // log2(buf)
if (log - k >= 32 - MIN_CACHE_BITS && 32 - log < limit) {
buf >>>= log - k;
buf += (30 - log) << k;
data.advance(32 + k - log);
v = buf;
} else {
for (var i = 0; data.read(1) === 0; i++)
buf = data.peek(32 - offset) << offset;
if (i < limit - 1) {
if (k)
buf = data.read(k);
else
buf = 0;
v = buf + (i << k);
} else if (i === limit - 1) {
buf = data.read(esc_len);
v = buf + 1;
} else {
v = -1;
}
}
return (v >> 1) ^ -(v & 1);
};
// Should be in the damned standard library...
function clz(input) {
var output = 0,
curbyte = 0;
while(true) { // emulate goto in JS using the break statement :D
curbyte = input >>> 24;
if (curbyte) break;
output += 8;
curbyte = input >>> 16;
if (curbyte & 0xff) break;
output += 8;
curbyte = input >>> 8;
if (curbyte & 0xff) break;
output += 8;
curbyte = input;
if (curbyte & 0xff) break;
output += 8;
return output;
}
if (!(curbyte & 0xf0))
output += 4;
else
curbyte >>>= 4;
if (curbyte & 0x8)
return output;
if (curbyte & 0x4)
return output + 1;
if (curbyte & 0x2)
return output + 2;
if (curbyte & 0x1)
return output + 3;
// shouldn't get here
return output + 4;
}
});
module.exports = FLACDecoder;
},{}],3:[function(require,module,exports){
/*
* FLAC.js - Free Lossless Audio Codec decoder in JavaScript
* By Devon Govett and Jens Nockert of Official.fm Labs
*
* FLAC.js is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FLAC.js is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
var AV = (window.AV);
var FLACDemuxer = AV.Demuxer.extend(function() {
AV.Demuxer.register(this);
this.probe = function(buffer) {
return buffer.peekString(0, 4) === 'fLaC';
}
const STREAMINFO = 0,
PADDING = 1,
APPLICATION = 2,
SEEKTABLE = 3,
VORBIS_COMMENT = 4,
CUESHEET = 5,
PICTURE = 6,
INVALID = 127,
STREAMINFO_SIZE = 34;
this.prototype.readChunk = function() {
var stream = this.stream;
if (!this.readHeader && stream.available(4)) {
if (stream.readString(4) !== 'fLaC')
return this.emit('error', 'Invalid FLAC file.');
this.readHeader = true;
}
while (stream.available(1) && !this.last) {
if (!this.readBlockHeaders) {
var tmp = stream.readUInt8();
this.last = (tmp & 0x80) === 0x80,
this.type = tmp & 0x7F,
this.size = stream.readUInt24();
}
if (!this.foundStreamInfo && this.type !== STREAMINFO)
return this.emit('error', 'STREAMINFO must be the first block');
if (!stream.available(this.size))
return;
switch (this.type) {
case STREAMINFO:
if (this.foundStreamInfo)
return this.emit('error', 'STREAMINFO can only occur once.');
if (this.size !== STREAMINFO_SIZE)
return this.emit('error', 'STREAMINFO size is wrong.');
this.foundStreamInfo = true;
var bitstream = new AV.Bitstream(stream);
var cookie = {
minBlockSize: bitstream.read(16),
maxBlockSize: bitstream.read(16),
minFrameSize: bitstream.read(24),
maxFrameSize: bitstream.read(24)
};
this.format = {
formatID: 'flac',
sampleRate: bitstream.read(20),
channelsPerFrame: bitstream.read(3) + 1,
bitsPerChannel: bitstream.read(5) + 1
};
this.emit('format', this.format);
this.emit('cookie', cookie);
var sampleCount = bitstream.read(36);
this.emit('duration', sampleCount / this.format.sampleRate * 1000 | 0);
stream.advance(16); // skip MD5 hashes
this.readBlockHeaders = false;
break;
/*
I am only looking at the least significant 32 bits of sample number and offset data
This is more than sufficient for the longest flac file I have (~50 mins 2-channel 16-bit 44.1k which uses about 7.5% of the UInt32 space for the largest offset)
Can certainly be improved by storing sample numbers and offests as doubles, but would require additional overriding of the searchTimestamp and seek functions (possibly more?)
Also the flac faq suggests it would be possible to find frame lengths and thus create seek points on the fly via decoding but I assume this would be slow
I may look into these thigns though as my project progresses
*/
case SEEKTABLE:
for(var s=0; s<this.size/18; s++)
{
if(stream.peekUInt32(0) == 0xFFFFFFFF && stream.peekUInt32(1) == 0xFFFFFFFF)
{
//placeholder, ignore
stream.advance(18);
} else {
if(stream.readUInt32() > 0)
{
this.emit('error', 'Seek points with sample number >UInt32 not supported');
}
var samplenum = stream.readUInt32();
if(stream.readUInt32() > 0)
{
this.emit('error', 'Seek points with stream offset >UInt32 not supported');
}
var offset = stream.readUInt32();
stream.advance(2);
this.addSeekPoint(offset, samplenum);
}
}
break;
case VORBIS_COMMENT:
// see http://www.xiph.org/vorbis/doc/v-comment.html
this.metadata || (this.metadata = {});
var len = stream.readUInt32(true);
this.metadata.vendor = stream.readString(len);
var length = stream.readUInt32(true);
for (var i = 0; i < length; i++) {
len = stream.readUInt32(true);
var str = stream.readString(len, 'utf8'),
idx = str.indexOf('=');
this.metadata[str.slice(0, idx).toLowerCase()] = str.slice(idx + 1);
}
// TODO: standardize field names across formats
break;
case PICTURE:
var type = stream.readUInt32();
if (type !== 3) { // make sure this is album art (type 3)
stream.advance(this.size - 4);
} else {
var mimeLen = stream.readUInt32(),
mime = stream.readString(mimeLen),
descLen = stream.readUInt32(),
description = stream.readString(descLen),
width = stream.readUInt32(),
height = stream.readUInt32(),
depth = stream.readUInt32(),
colors = stream.readUInt32(),
length = stream.readUInt32(),
picture = stream.readBuffer(length);
this.metadata || (this.metadata = {});
this.metadata.coverArt = picture;
}
// does anyone want the rest of the info?
break;
default:
stream.advance(this.size);
this.readBlockHeaders = false;
}
if (this.last && this.metadata)
this.emit('metadata', this.metadata);
}
while (stream.available(1) && this.last) {
var buffer = stream.readSingleBuffer(stream.remainingBytes());
this.emit('data', buffer);
}
}
});
module.exports = FLACDemuxer;
},{}],4:[function(require,module,exports){
var AV = (window.AV);
// if ogg.js exists, register a plugin
try {
var OggDemuxer = (window.AV.OggDemuxer);
} catch (e) {};
if (!OggDemuxer) return;
OggDemuxer.plugins.push({
magic: "\177FLAC",
init: function() {
this.list = new AV.BufferList();
this.stream = new AV.Stream(this.list);
},
readHeaders: function(packet) {
var stream = this.stream;
this.list.append(new AV.Buffer(packet));
stream.advance(5); // magic
if (stream.readUInt8() != 1)
throw new Error('Unsupported FLAC version');
stream.advance(3);
if (stream.peekString(0, 4) != 'fLaC')
throw new Error('Not flac');
this.flac = AV.Demuxer.find(stream.peekSingleBuffer(0, stream.remainingBytes()));
if (!this.flac)
throw new Error('Flac demuxer not found');
this.flac.prototype.readChunk.call(this);
return true;
},
readPacket: function(packet) {
this.list.append(new AV.Buffer(packet));
this.flac.prototype.readChunk.call(this);
}
});
},{}]},{},[1])
//# sourceMappingURL=flac.js.map

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,243 @@
/*
* CirclePlayer for the jPlayer Plugin (jQuery)
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2012 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
*
* Version: 1.0.1 (jPlayer 2.1.0+)
* Date: 30th May 2011
*
* Author: Mark J Panaghiston @thepag
*
* CirclePlayer prototype developed by:
* Mark Boas @maboa
* Silvia Benvenuti @aulentina
* Jussi Kalliokoski @quinirill
*
* Inspired by :
* Neway @imneway http://imneway.net/ http://forrst.com/posts/Untitled-CPt
* and
* Liam McKay @liammckay http://dribbble.com/shots/50882-Purple-Play-Pause
*
* Standing on the shoulders of :
* John Resig @jresig
* Mark Panaghiston @thepag
* Louis-Rémi Babé @Louis_Remi
*/
var CirclePlayer = function(jPlayerSelector, media, options) {
var self = this,
defaults = {
// solution: "flash, html", // For testing Flash with CSS3
supplied: "m4a, oga",
// Android 2.3 corrupts media element if preload:"none" is used.
// preload: "none", // No point preloading metadata since no times are displayed. It helps keep the buffer state correct too.
cssSelectorAncestor: "#cp_container_1",
cssSelector: {
play: ".cp-play",
pause: ".cp-pause"
}
},
cssSelector = {
bufferHolder: ".cp-buffer-holder",
buffer1: ".cp-buffer-1",
buffer2: ".cp-buffer-2",
progressHolder: ".cp-progress-holder",
progress1: ".cp-progress-1",
progress2: ".cp-progress-2",
circleControl: ".cp-circle-control"
};
this.cssClass = {
gt50: "cp-gt50",
fallback: "cp-fallback"
};
this.spritePitch = 104;
this.spriteRatio = 0.24; // Number of steps / 100
this.player = $(jPlayerSelector);
this.media = $.extend({}, media);
this.options = $.extend(true, {}, defaults, options); // Deep copy
this.cssTransforms = Modernizr.csstransforms;
this.audio = {};
this.dragging = false; // Indicates if the progressbar is being 'dragged'.
this.eventNamespace = ".CirclePlayer"; // So the events can easily be removed in destroy.
this.jq = {};
$.each(cssSelector, function(entity, cssSel) {
self.jq[entity] = $(self.options.cssSelectorAncestor + " " + cssSel);
});
this._initSolution();
this._initPlayer();
};
CirclePlayer.prototype = {
_createHtml: function() {
},
_initPlayer: function() {
var self = this;
this.player.jPlayer(this.options);
this.player.bind($.jPlayer.event.ready + this.eventNamespace, function(event) {
if(event.jPlayer.html.used && event.jPlayer.html.audio.available) {
self.audio = $(this).data("jPlayer").htmlElement.audio;
}
$(this).jPlayer("setMedia", self.media);
self._initCircleControl();
});
this.player.bind($.jPlayer.event.play + this.eventNamespace, function(event) {
$(this).jPlayer("pauseOthers");
});
// This event fired as play time increments
this.player.bind($.jPlayer.event.timeupdate + this.eventNamespace, function(event) {
if (!self.dragging) {
self._timeupdate(event.jPlayer.status.currentPercentAbsolute);
}
});
// This event fired as buffered time increments
this.player.bind($.jPlayer.event.progress + this.eventNamespace, function(event) {
var percent = 0;
if((typeof self.audio.buffered === "object") && (self.audio.buffered.length > 0)) {
if(self.audio.duration > 0) {
var bufferTime = 0;
for(var i = 0; i < self.audio.buffered.length; i++) {
bufferTime += self.audio.buffered.end(i) - self.audio.buffered.start(i);
// console.log(i + " | start = " + self.audio.buffered.start(i) + " | end = " + self.audio.buffered.end(i) + " | bufferTime = " + bufferTime + " | duration = " + self.audio.duration);
}
percent = 100 * bufferTime / self.audio.duration;
} // else the Metadata has not been read yet.
// console.log("percent = " + percent);
} else { // Fallback if buffered not supported
// percent = event.jPlayer.status.seekPercent;
percent = 0; // Cleans up the inital conditions on all browsers, since seekPercent defaults to 100 when object is undefined.
}
self._progress(percent); // Problem here at initial condition. Due to the Opera clause above of buffered.length > 0 above... Removing it means Opera's white buffer ring never shows like with polyfill.
// Firefox 4 does not always give the final progress event when buffered = 100%
});
this.player.bind($.jPlayer.event.ended + this.eventNamespace, function(event) {
self._resetSolution();
});
},
_initSolution: function() {
if (this.cssTransforms) {
this.jq.progressHolder.show();
this.jq.bufferHolder.show();
}
else {
this.jq.progressHolder.addClass(this.cssClass.gt50).show();
this.jq.progress1.addClass(this.cssClass.fallback);
this.jq.progress2.hide();
this.jq.bufferHolder.hide();
}
this._resetSolution();
},
_resetSolution: function() {
if (this.cssTransforms) {
this.jq.progressHolder.removeClass(this.cssClass.gt50);
this.jq.progress1.css({'transform': 'rotate(0deg)'});
this.jq.progress2.css({'transform': 'rotate(0deg)'}).hide();
}
else {
this.jq.progress1.css('background-position', '0 ' + this.spritePitch + 'px');
}
},
_initCircleControl: function() {
var self = this;
this.jq.circleControl.grab({
onstart: function(){
self.dragging = true;
}, onmove: function(event){
var pc = self._getArcPercent(event.position.x, event.position.y);
self.player.jPlayer("playHead", pc).jPlayer("play");
self._timeupdate(pc);
}, onfinish: function(event){
self.dragging = false;
var pc = self._getArcPercent(event.position.x, event.position.y);
self.player.jPlayer("playHead", pc).jPlayer("play");
}
});
},
_timeupdate: function(percent) {
var degs = percent * 3.6+"deg";
var spriteOffset = (Math.floor((Math.round(percent))*this.spriteRatio)-1)*-this.spritePitch;
if (percent <= 50) {
if (this.cssTransforms) {
this.jq.progressHolder.removeClass(this.cssClass.gt50);
this.jq.progress1.css({'transform': 'rotate(' + degs + ')'});
this.jq.progress2.hide();
} else { // fall back
this.jq.progress1.css('background-position', '0 '+spriteOffset+'px');
}
} else if (percent <= 100) {
if (this.cssTransforms) {
this.jq.progressHolder.addClass(this.cssClass.gt50);
this.jq.progress1.css({'transform': 'rotate(180deg)'});
this.jq.progress2.css({'transform': 'rotate(' + degs + ')'});
this.jq.progress2.show();
} else { // fall back
this.jq.progress1.css('background-position', '0 '+spriteOffset+'px');
}
}
},
_progress: function(percent) {
var degs = percent * 3.6+"deg";
if (this.cssTransforms) {
if (percent <= 50) {
this.jq.bufferHolder.removeClass(this.cssClass.gt50);
this.jq.buffer1.css({'transform': 'rotate(' + degs + ')'});
this.jq.buffer2.hide();
} else if (percent <= 100) {
this.jq.bufferHolder.addClass(this.cssClass.gt50);
this.jq.buffer1.css({'transform': 'rotate(180deg)'});
this.jq.buffer2.show();
this.jq.buffer2.css({'transform': 'rotate(' + degs + ')'});
}
}
},
_getArcPercent: function(pageX, pageY) {
var offset = this.jq.circleControl.offset(),
x = pageX - offset.left - this.jq.circleControl.width()/2,
y = pageY - offset.top - this.jq.circleControl.height()/2,
theta = Math.atan2(y,x);
if (theta > -1 * Math.PI && theta < -0.5 * Math.PI) {
theta = 2 * Math.PI + theta;
}
// theta is now value between -0.5PI and 1.5PI
// ready to be normalized and applied
return (theta + Math.PI / 2) / 2 * Math.PI * 10;
},
setMedia: function(media) {
this.media = $.extend({}, media);
this.player.jPlayer("setMedia", this.media);
},
play: function(time) {
this.player.jPlayer("play", time);
},
pause: function(time) {
this.player.jPlayer("pause", time);
},
destroy: function() {
this.player.unbind(this.eventNamespace);
this.player.jPlayer("destroy");
}
};

View File

@@ -0,0 +1,201 @@
/*
jQuery grab
https://github.com/jussi-kalliokoski/jQuery.grab
Ported from Jin.js::gestures
https://github.com/jussi-kalliokoski/jin.js/
Created by Jussi Kalliokoski
Licensed under MIT License.
Includes fix for IE
*/
(function($){
var extend = $.extend,
mousedown = 'mousedown',
mousemove = 'mousemove',
mouseup = 'mouseup',
touchstart = 'touchstart',
touchmove = 'touchmove',
touchend = 'touchend',
touchcancel = 'touchcancel';
function unbind(elem, type, func){
if (type.substr(0,5) !== 'touch'){ // A temporary fix for IE8 data passing problem in Jin.
return $(elem).unbind(type, func);
}
var fnc, i;
for (i=0; i<bind._binds.length; i++){
if (bind._binds[i].elem === elem && bind._binds[i].type === type && bind._binds[i].func === func){
if (document.addEventListener){
elem.removeEventListener(type, bind._binds[i].fnc, false);
} else {
elem.detachEvent('on'+type, bind._binds[i].fnc);
}
bind._binds.splice(i--, 1);
}
}
}
function bind(elem, type, func, pass){
if (type.substr(0,5) !== 'touch'){ // A temporary fix for IE8 data passing problem in Jin.
return $(elem).bind(type, pass, func);
}
var fnc, i;
if (bind[type]){
return bind[type].bind(elem, type, func, pass);
}
fnc = function(e){
if (!e){ // Fix some ie bugs...
e = window.event;
}
if (!e.stopPropagation){
e.stopPropagation = function(){ this.cancelBubble = true; };
}
e.data = pass;
func.call(elem, e);
};
if (document.addEventListener){
elem.addEventListener(type, fnc, false);
} else {
elem.attachEvent('on' + type, fnc);
}
bind._binds.push({elem: elem, type: type, func: func, fnc: fnc});
}
function grab(elem, options)
{
var data = {
move: {x: 0, y: 0},
offset: {x: 0, y: 0},
position: {x: 0, y: 0},
start: {x: 0, y: 0},
affects: document.documentElement,
stopPropagation: false,
preventDefault: true,
touch: true // Implementation unfinished, and doesn't support multitouch
};
extend(data, options);
data.element = elem;
bind(elem, mousedown, mouseDown, data);
if (data.touch){
bind(elem, touchstart, touchStart, data);
}
}
function ungrab(elem){
unbind(elem, mousedown, mousedown);
}
function mouseDown(e){
e.data.position.x = e.pageX;
e.data.position.y = e.pageY;
e.data.start.x = e.pageX;
e.data.start.y = e.pageY;
e.data.event = e;
if (e.data.onstart && e.data.onstart.call(e.data.element, e.data)){
return;
}
if (e.preventDefault && e.data.preventDefault){
e.preventDefault();
}
if (e.stopPropagation && e.data.stopPropagation){
e.stopPropagation();
}
bind(e.data.affects, mousemove, mouseMove, e.data);
bind(e.data.affects, mouseup, mouseUp, e.data);
}
function mouseMove(e){
if (e.preventDefault && e.data.preventDefault){
e.preventDefault();
}
if (e.stopPropagation && e.data.preventDefault){
e.stopPropagation();
}
e.data.move.x = e.pageX - e.data.position.x;
e.data.move.y = e.pageY - e.data.position.y;
e.data.position.x = e.pageX;
e.data.position.y = e.pageY;
e.data.offset.x = e.pageX - e.data.start.x;
e.data.offset.y = e.pageY - e.data.start.y;
e.data.event = e;
if (e.data.onmove){
e.data.onmove.call(e.data.element, e.data);
}
}
function mouseUp(e){
if (e.preventDefault && e.data.preventDefault){
e.preventDefault();
}
if (e.stopPropagation && e.data.stopPropagation){
e.stopPropagation();
}
unbind(e.data.affects, mousemove, mouseMove);
unbind(e.data.affects, mouseup, mouseUp);
e.data.event = e;
if (e.data.onfinish){
e.data.onfinish.call(e.data.element, e.data);
}
}
function touchStart(e){
e.data.position.x = e.touches[0].pageX;
e.data.position.y = e.touches[0].pageY;
e.data.start.x = e.touches[0].pageX;
e.data.start.y = e.touches[0].pageY;
e.data.event = e;
if (e.data.onstart && e.data.onstart.call(e.data.element, e.data)){
return;
}
if (e.preventDefault && e.data.preventDefault){
e.preventDefault();
}
if (e.stopPropagation && e.data.stopPropagation){
e.stopPropagation();
}
bind(e.data.affects, touchmove, touchMove, e.data);
bind(e.data.affects, touchend, touchEnd, e.data);
}
function touchMove(e){
if (e.preventDefault && e.data.preventDefault){
e.preventDefault();
}
if (e.stopPropagation && e.data.stopPropagation){
e.stopPropagation();
}
e.data.move.x = e.touches[0].pageX - e.data.position.x;
e.data.move.y = e.touches[0].pageY - e.data.position.y;
e.data.position.x = e.touches[0].pageX;
e.data.position.y = e.touches[0].pageY;
e.data.offset.x = e.touches[0].pageX - e.data.start.x;
e.data.offset.y = e.touches[0].pageY - e.data.start.y;
e.data.event = e;
if (e.data.onmove){
e.data.onmove.call(e.data.elem, e.data);
}
}
function touchEnd(e){
if (e.preventDefault && e.data.preventDefault){
e.preventDefault();
}
if (e.stopPropagation && e.data.stopPropagation){
e.stopPropagation();
}
unbind(e.data.affects, touchmove, touchMove);
unbind(e.data.affects, touchend, touchEnd);
e.data.event = e;
if (e.data.onfinish){
e.data.onfinish.call(e.data.element, e.data);
}
}
bind._binds = [];
$.fn.grab = function(a, b){
return this.each(function(){
return grab(this, a, b);
});
};
$.fn.ungrab = function(a){
return this.each(function(){
return ungrab(this, a);
});
};
})(jQuery);

View File

@@ -0,0 +1,551 @@
/*
* transform: A jQuery cssHooks adding cross-browser 2d transform capabilities to $.fn.css() and $.fn.animate()
*
* limitations:
* - requires jQuery 1.4.3+
* - Should you use the *translate* property, then your elements need to be absolutely positionned in a relatively positionned wrapper **or it will fail in IE678**.
* - transformOrigin is not accessible
*
* latest version and complete README available on Github:
* https://github.com/louisremi/jquery.transform.js
*
* Copyright 2011 @louis_remi
* Licensed under the MIT license.
*
* This saved you an hour of work?
* Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON
*
*/
(function( $, window, document, Math, undefined ) {
/*
* Feature tests and global variables
*/
var div = document.createElement("div"),
divStyle = div.style,
suffix = "Transform",
testProperties = [
"O" + suffix,
"ms" + suffix,
"Webkit" + suffix,
"Moz" + suffix
],
i = testProperties.length,
supportProperty,
supportMatrixFilter,
supportFloat32Array = "Float32Array" in window,
propertyHook,
propertyGet,
rMatrix = /Matrix([^)]*)/,
rAffine = /^\s*matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*(?:,\s*0(?:px)?\s*){2}\)\s*$/,
_transform = "transform",
_transformOrigin = "transformOrigin",
_translate = "translate",
_rotate = "rotate",
_scale = "scale",
_skew = "skew",
_matrix = "matrix";
// test different vendor prefixes of these properties
while ( i-- ) {
if ( testProperties[i] in divStyle ) {
$.support[_transform] = supportProperty = testProperties[i];
$.support[_transformOrigin] = supportProperty + "Origin";
continue;
}
}
// IE678 alternative
if ( !supportProperty ) {
$.support.matrixFilter = supportMatrixFilter = divStyle.filter === "";
}
// px isn't the default unit of these properties
$.cssNumber[_transform] = $.cssNumber[_transformOrigin] = true;
/*
* fn.css() hooks
*/
if ( supportProperty && supportProperty != _transform ) {
// Modern browsers can use jQuery.cssProps as a basic hook
$.cssProps[_transform] = supportProperty;
$.cssProps[_transformOrigin] = supportProperty + "Origin";
// Firefox needs a complete hook because it stuffs matrix with "px"
if ( supportProperty == "Moz" + suffix ) {
propertyHook = {
get: function( elem, computed ) {
return (computed ?
// remove "px" from the computed matrix
$.css( elem, supportProperty ).split("px").join(""):
elem.style[supportProperty]
);
},
set: function( elem, value ) {
// add "px" to matrices
elem.style[supportProperty] = /matrix\([^)p]*\)/.test(value) ?
value.replace(/matrix((?:[^,]*,){4})([^,]*),([^)]*)/, _matrix+"$1$2px,$3px"):
value;
}
};
/* Fix two jQuery bugs still present in 1.5.1
* - rupper is incompatible with IE9, see http://jqbug.com/8346
* - jQuery.css is not really jQuery.cssProps aware, see http://jqbug.com/8402
*/
} else if ( /^1\.[0-5](?:\.|$)/.test($.fn.jquery) ) {
propertyHook = {
get: function( elem, computed ) {
return (computed ?
$.css( elem, supportProperty.replace(/^ms/, "Ms") ):
elem.style[supportProperty]
);
}
};
}
/* TODO: leverage hardware acceleration of 3d transform in Webkit only
else if ( supportProperty == "Webkit" + suffix && support3dTransform ) {
propertyHook = {
set: function( elem, value ) {
elem.style[supportProperty] =
value.replace();
}
}
}*/
} else if ( supportMatrixFilter ) {
propertyHook = {
get: function( elem, computed, asArray ) {
var elemStyle = ( computed && elem.currentStyle ? elem.currentStyle : elem.style ),
matrix, data;
if ( elemStyle && rMatrix.test( elemStyle.filter ) ) {
matrix = RegExp.$1.split(",");
matrix = [
matrix[0].split("=")[1],
matrix[2].split("=")[1],
matrix[1].split("=")[1],
matrix[3].split("=")[1]
];
} else {
matrix = [1,0,0,1];
}
if ( ! $.cssHooks[_transformOrigin] ) {
matrix[4] = elemStyle ? parseInt(elemStyle.left, 10) || 0 : 0;
matrix[5] = elemStyle ? parseInt(elemStyle.top, 10) || 0 : 0;
} else {
data = $._data( elem, "transformTranslate", undefined );
matrix[4] = data ? data[0] : 0;
matrix[5] = data ? data[1] : 0;
}
return asArray ? matrix : _matrix+"(" + matrix + ")";
},
set: function( elem, value, animate ) {
var elemStyle = elem.style,
currentStyle,
Matrix,
filter,
centerOrigin;
if ( !animate ) {
elemStyle.zoom = 1;
}
value = matrix(value);
// rotate, scale and skew
Matrix = [
"Matrix("+
"M11="+value[0],
"M12="+value[2],
"M21="+value[1],
"M22="+value[3],
"SizingMethod='auto expand'"
].join();
filter = ( currentStyle = elem.currentStyle ) && currentStyle.filter || elemStyle.filter || "";
elemStyle.filter = rMatrix.test(filter) ?
filter.replace(rMatrix, Matrix) :
filter + " progid:DXImageTransform.Microsoft." + Matrix + ")";
if ( ! $.cssHooks[_transformOrigin] ) {
// center the transform origin, from pbakaus's Transformie http://github.com/pbakaus/transformie
if ( (centerOrigin = $.transform.centerOrigin) ) {
elemStyle[centerOrigin == "margin" ? "marginLeft" : "left"] = -(elem.offsetWidth/2) + (elem.clientWidth/2) + "px";
elemStyle[centerOrigin == "margin" ? "marginTop" : "top"] = -(elem.offsetHeight/2) + (elem.clientHeight/2) + "px";
}
// translate
// We assume that the elements are absolute positionned inside a relative positionned wrapper
elemStyle.left = value[4] + "px";
elemStyle.top = value[5] + "px";
} else {
$.cssHooks[_transformOrigin].set( elem, value );
}
}
};
}
// populate jQuery.cssHooks with the appropriate hook if necessary
if ( propertyHook ) {
$.cssHooks[_transform] = propertyHook;
}
// we need a unique setter for the animation logic
propertyGet = propertyHook && propertyHook.get || $.css;
/*
* fn.animate() hooks
*/
$.fx.step.transform = function( fx ) {
var elem = fx.elem,
start = fx.start,
end = fx.end,
pos = fx.pos,
transform = "",
precision = 1E5,
i, startVal, endVal, unit;
// fx.end and fx.start need to be converted to interpolation lists
if ( !start || typeof start === "string" ) {
// the following block can be commented out with jQuery 1.5.1+, see #7912
if ( !start ) {
start = propertyGet( elem, supportProperty );
}
// force layout only once per animation
if ( supportMatrixFilter ) {
elem.style.zoom = 1;
}
// replace "+=" in relative animations (-= is meaningless with transforms)
end = end.split("+=").join(start);
// parse both transform to generate interpolation list of same length
$.extend( fx, interpolationList( start, end ) );
start = fx.start;
end = fx.end;
}
i = start.length;
// interpolate functions of the list one by one
while ( i-- ) {
startVal = start[i];
endVal = end[i];
unit = +false;
switch ( startVal[0] ) {
case _translate:
unit = "px";
case _scale:
unit || ( unit = "");
transform = startVal[0] + "(" +
Math.round( (startVal[1][0] + (endVal[1][0] - startVal[1][0]) * pos) * precision ) / precision + unit +","+
Math.round( (startVal[1][1] + (endVal[1][1] - startVal[1][1]) * pos) * precision ) / precision + unit + ")"+
transform;
break;
case _skew + "X":
case _skew + "Y":
case _rotate:
transform = startVal[0] + "(" +
Math.round( (startVal[1] + (endVal[1] - startVal[1]) * pos) * precision ) / precision +"rad)"+
transform;
break;
}
}
fx.origin && ( transform = fx.origin + transform );
propertyHook && propertyHook.set ?
propertyHook.set( elem, transform, +true ):
elem.style[supportProperty] = transform;
};
/*
* Utility functions
*/
// turns a transform string into its "matrix(A,B,C,D,X,Y)" form (as an array, though)
function matrix( transform ) {
transform = transform.split(")");
var
trim = $.trim
, i = -1
// last element of the array is an empty string, get rid of it
, l = transform.length -1
, split, prop, val
, prev = supportFloat32Array ? new Float32Array(6) : []
, curr = supportFloat32Array ? new Float32Array(6) : []
, rslt = supportFloat32Array ? new Float32Array(6) : [1,0,0,1,0,0]
;
prev[0] = prev[3] = rslt[0] = rslt[3] = 1;
prev[1] = prev[2] = prev[4] = prev[5] = 0;
// Loop through the transform properties, parse and multiply them
while ( ++i < l ) {
split = transform[i].split("(");
prop = trim(split[0]);
val = split[1];
curr[0] = curr[3] = 1;
curr[1] = curr[2] = curr[4] = curr[5] = 0;
switch (prop) {
case _translate+"X":
curr[4] = parseInt(val, 10);
break;
case _translate+"Y":
curr[5] = parseInt(val, 10);
break;
case _translate:
val = val.split(",");
curr[4] = parseInt(val[0], 10);
curr[5] = parseInt(val[1] || 0, 10);
break;
case _rotate:
val = toRadian(val);
curr[0] = Math.cos(val);
curr[1] = Math.sin(val);
curr[2] = -Math.sin(val);
curr[3] = Math.cos(val);
break;
case _scale+"X":
curr[0] = +val;
break;
case _scale+"Y":
curr[3] = val;
break;
case _scale:
val = val.split(",");
curr[0] = val[0];
curr[3] = val.length>1 ? val[1] : val[0];
break;
case _skew+"X":
curr[2] = Math.tan(toRadian(val));
break;
case _skew+"Y":
curr[1] = Math.tan(toRadian(val));
break;
case _matrix:
val = val.split(",");
curr[0] = val[0];
curr[1] = val[1];
curr[2] = val[2];
curr[3] = val[3];
curr[4] = parseInt(val[4], 10);
curr[5] = parseInt(val[5], 10);
break;
}
// Matrix product (array in column-major order)
rslt[0] = prev[0] * curr[0] + prev[2] * curr[1];
rslt[1] = prev[1] * curr[0] + prev[3] * curr[1];
rslt[2] = prev[0] * curr[2] + prev[2] * curr[3];
rslt[3] = prev[1] * curr[2] + prev[3] * curr[3];
rslt[4] = prev[0] * curr[4] + prev[2] * curr[5] + prev[4];
rslt[5] = prev[1] * curr[4] + prev[3] * curr[5] + prev[5];
prev = [rslt[0],rslt[1],rslt[2],rslt[3],rslt[4],rslt[5]];
}
return rslt;
}
// turns a matrix into its rotate, scale and skew components
// algorithm from http://hg.mozilla.org/mozilla-central/file/7cb3e9795d04/layout/style/nsStyleAnimation.cpp
function unmatrix(matrix) {
var
scaleX
, scaleY
, skew
, A = matrix[0]
, B = matrix[1]
, C = matrix[2]
, D = matrix[3]
;
// Make sure matrix is not singular
if ( A * D - B * C ) {
// step (3)
scaleX = Math.sqrt( A * A + B * B );
A /= scaleX;
B /= scaleX;
// step (4)
skew = A * C + B * D;
C -= A * skew;
D -= B * skew;
// step (5)
scaleY = Math.sqrt( C * C + D * D );
C /= scaleY;
D /= scaleY;
skew /= scaleY;
// step (6)
if ( A * D < B * C ) {
A = -A;
B = -B;
skew = -skew;
scaleX = -scaleX;
}
// matrix is singular and cannot be interpolated
} else {
// In this case the elem shouldn't be rendered, hence scale == 0
scaleX = scaleY = skew = 0;
}
// The recomposition order is very important
// see http://hg.mozilla.org/mozilla-central/file/7cb3e9795d04/layout/style/nsStyleAnimation.cpp#l971
return [
[_translate, [+matrix[4], +matrix[5]]],
[_rotate, Math.atan2(B, A)],
[_skew + "X", Math.atan(skew)],
[_scale, [scaleX, scaleY]]
];
}
// build the list of transform functions to interpolate
// use the algorithm described at http://dev.w3.org/csswg/css3-2d-transforms/#animation
function interpolationList( start, end ) {
var list = {
start: [],
end: []
},
i = -1, l,
currStart, currEnd, currType;
// get rid of affine transform matrix
( start == "none" || isAffine( start ) ) && ( start = "" );
( end == "none" || isAffine( end ) ) && ( end = "" );
// if end starts with the current computed style, this is a relative animation
// store computed style as the origin, remove it from start and end
if ( start && end && !end.indexOf("matrix") && toArray( start ).join() == toArray( end.split(")")[0] ).join() ) {
list.origin = start;
start = "";
end = end.slice( end.indexOf(")") +1 );
}
if ( !start && !end ) { return; }
// start or end are affine, or list of transform functions are identical
// => functions will be interpolated individually
if ( !start || !end || functionList(start) == functionList(end) ) {
start && ( start = start.split(")") ) && ( l = start.length );
end && ( end = end.split(")") ) && ( l = end.length );
while ( ++i < l-1 ) {
start[i] && ( currStart = start[i].split("(") );
end[i] && ( currEnd = end[i].split("(") );
currType = $.trim( ( currStart || currEnd )[0] );
append( list.start, parseFunction( currType, currStart ? currStart[1] : 0 ) );
append( list.end, parseFunction( currType, currEnd ? currEnd[1] : 0 ) );
}
// otherwise, functions will be composed to a single matrix
} else {
list.start = unmatrix(matrix(start));
list.end = unmatrix(matrix(end))
}
return list;
}
function parseFunction( type, value ) {
var
// default value is 1 for scale, 0 otherwise
defaultValue = +(!type.indexOf(_scale)),
scaleX,
// remove X/Y from scaleX/Y & translateX/Y, not from skew
cat = type.replace( /e[XY]/, "e" );
switch ( type ) {
case _translate+"Y":
case _scale+"Y":
value = [
defaultValue,
value ?
parseFloat( value ):
defaultValue
];
break;
case _translate+"X":
case _translate:
case _scale+"X":
scaleX = 1;
case _scale:
value = value ?
( value = value.split(",") ) && [
parseFloat( value[0] ),
parseFloat( value.length>1 ? value[1] : type == _scale ? scaleX || value[0] : defaultValue+"" )
]:
[defaultValue, defaultValue];
break;
case _skew+"X":
case _skew+"Y":
case _rotate:
value = value ? toRadian( value ) : 0;
break;
case _matrix:
return unmatrix( value ? toArray(value) : [1,0,0,1,0,0] );
break;
}
return [[ cat, value ]];
}
function isAffine( matrix ) {
return rAffine.test(matrix);
}
function functionList( transform ) {
return transform.replace(/(?:\([^)]*\))|\s/g, "");
}
function append( arr1, arr2, value ) {
while ( value = arr2.shift() ) {
arr1.push( value );
}
}
// converts an angle string in any unit to a radian Float
function toRadian(value) {
return ~value.indexOf("deg") ?
parseInt(value,10) * (Math.PI * 2 / 360):
~value.indexOf("grad") ?
parseInt(value,10) * (Math.PI/200):
parseFloat(value);
}
// Converts "matrix(A,B,C,D,X,Y)" to [A,B,C,D,X,Y]
function toArray(matrix) {
// remove the unit of X and Y for Firefox
matrix = /([^,]*),([^,]*),([^,]*),([^,]*),([^,p]*)(?:px)?,([^)p]*)(?:px)?/.exec(matrix);
return [matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6]];
}
$.transform = {
centerOrigin: "margin"
};
})( jQuery, window, document, Math );

View File

@@ -0,0 +1,2 @@
/* Modernizr custom build of 1.7pre: csstransforms */
window.Modernizr=function(a,b,c){function G(){}function F(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+p.join(c+" ")+c).split(" ");return!!E(d,b)}function E(a,b){for(var d in a)if(k[a[d]]!==c&&(!b||b(a[d],j)))return!0}function D(a,b){return(""+a).indexOf(b)!==-1}function C(a,b){return typeof a===b}function B(a,b){return A(o.join(a+";")+(b||""))}function A(a){k.cssText=a}var d="1.7pre",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l=b.createElement("input"),m=":)",n=Object.prototype.toString,o=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),p="Webkit Moz O ms Khtml".split(" "),q={svg:"http://www.w3.org/2000/svg"},r={},s={},t={},u=[],v,w=function(a){var c=b.createElement("style"),d=b.createElement("div"),e;c.textContent=a+"{#modernizr{height:3px}}",h.appendChild(c),d.id="modernizr",g.appendChild(d),e=d.offsetHeight===3,c.parentNode.removeChild(c),d.parentNode.removeChild(d);return!!e},x=function(){function d(d,e){e=e||b.createElement(a[d]||"div");var f=(d="on"+d)in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=C(e[d],"function"),C(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),y=({}).hasOwnProperty,z;C(y,c)||C(y.call,c)?z=function(a,b){return b in a&&C(a.constructor.prototype[b],c)}:z=function(a,b){return y.call(a,b)},r.csstransforms=function(){return!!E(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])};for(var H in r)z(r,H)&&(v=H.toLowerCase(),e[v]=r[H](),u.push((e[v]?"":"no-")+v));e.input||G(),e.crosswindowmessaging=e.postmessage,e.historymanagement=e.history,e.addTest=function(a,b){a=a.toLowerCase();if(!e[a]){b=!!b(),g.className+=" "+(b?"":"no-")+a,e[a]=b;return e}},A(""),j=l=null,e._enableHTML5=f,e._version=d,g.className=g.className.replace(/\bno-js\b/,"")+" js "+u.join(" ");return e}(this,this.document)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -0,0 +1,133 @@
/*
* Project: CirclePlayer
* http://www.jplayer.org
*
* Copyright (c) 2012 Happyworm Ltd
*
* Author: Silvia Benvenuti
* Edited by: Mark J Panaghiston
* Date: 2nd October 2012
* Artwork inspired by: http://forrst.com/posts/Untitled-CJz
*/
.cp-container {
position:relative;
width:104px; /* 200 - (2 * 48) */
height:104px;
background:url("bgr.jpg") 0 0 no-repeat;
padding:48px;
-webkit-tap-highlight-color:rgba(0,0,0,0);
}
.cp-container :focus {
border:none;
outline:0;
}
.cp-buffer-1,
.cp-buffer-2,
.cp-progress-1,
.cp-progress-2 {
position:absolute;
top:0;
left:0;
width:104px;
height:104px;
clip:rect(0px,52px,104px,0px);
-moz-border-radius:52px;
-webkit-border-radius:52px;
border-radius:52px;
}
.cp-buffer-1,
.cp-buffer-2 {
background:url("buffer.png") 0 0 no-repeat;
}
/* FALLBACK for .progress
* (24 steps starting from 1hr filled progress, Decrease second value by 104px for next step)
* (It needs the container selector to work. Or use div)
*/
.cp-container .cp-fallback {
background:url("progress_sprite.jpg") no-repeat;
background-position:0 104px;
}
.cp-progress-1,
.cp-progress-2 {
background:url("progress.png") 0 0 no-repeat;
}
.cp-buffer-holder,
.cp-progress-holder,
.cp-circle-control {
position:absolute;
width:104px;
height:104px;
}
.cp-circle-control {
cursor:pointer;
}
.cp-buffer-holder,
.cp-progress-holder {
clip:rect(0px,104px,104px,52px);
display:none;
}
/* This is needed when progress is greater than 50% or for fallback */
.cp-buffer-holder.cp-gt50,
.cp-progress-holder.cp-gt50,
.cp-progress-1.cp-fallback{
clip:rect(auto, auto, auto, auto);
}
.cp-controls {
margin:0;
padding:26px;
}
.cp-controls li{
list-style-type:none;
display:block;
/*IE Fix*/
position:absolute;
}
.cp-controls li a{
position:relative;
display:block;
width:50px;
height:50px;
text-indent:-9999px;
z-index:1;
cursor:pointer;
}
.cp-controls .cp-play {
background:url("controls.jpg") 0 0 no-repeat;
}
.cp-controls .cp-play:hover {
background:url("controls.jpg") -50px 0 no-repeat;
}
.cp-controls .cp-pause {
background:url("controls.jpg") 0 -50px no-repeat;
}
.cp-controls .cp-pause:hover {
background:url("controls.jpg") -50px -50px no-repeat;
}
.cp-jplayer {
width:0;
height:0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,450 @@
(function() {
if ( !document.addEventListener && !document.removeEventListener && !document.dispatchEvent ) {
var events = {};
var addEventListener = function( eventName, callBack ) {
eventName = ( eventName === "DOMContentLoaded" ) ? "readystatechange" : eventName;
if ( Event[ eventName.toUpperCase() ] || eventName === "readystatechange" ) {
document.attachEvent( "on" + eventName, callBack );
return;
}
if ( !events[ eventName ] ) {
events[ eventName ] = {
events: [],
queue: [],
active: false
};
}
if ( events[ eventName ].active ) {
events[ eventName ].queue.push( callBack );
} else {
events[ eventName ].events.push( callBack );
}
};
var removeEventListener = function( eventName, callBack ) {
eventName = ( eventName === "DOMContentLoaded" ) ? "readystatechange" : eventName;
var i = 0,
listeners = events[ eventName ];
if ( Event[ eventName.toUpperCase() ] || eventName === "readystatechange" ) {
document.detachEvent( "on" + eventName, callBack );
return;
}
if ( !listeners ) {
return;
}
for ( i = listeners.events.length - 1; i >= 0; i-- ) {
if ( callBack === listeners.events[ i ] ) {
delete listeners.events[ i ];
}
}
for ( i = listeners.queue.length - 1; i >= 0; i-- ) {
if ( callBack === listeners.queue[ i ] ) {
delete listeners.queue[ i ];
}
}
};
var dispatchEvent = function( eventObject ) {
var evt,
self = this,
eventInterface,
listeners,
eventName = eventObject.type,
queuedListener;
// A string was passed, create event object
if ( !eventName ) {
eventName = eventObject;
eventInterface = Popcorn.events.getInterface( eventName );
if ( eventInterface ) {
evt = document.createEvent( eventInterface );
evt.initCustomEvent( eventName, true, true, window, 1 );
}
}
listeners = events[ eventName ];
if ( listeners ) {
listeners.active = true;
for ( var i = 0; i < listeners.events.length; i++ ) {
if ( listeners.events[ i ] ) {
listeners.events[ i ].call( self, evt, self );
}
}
if ( listeners.queue.length ) {
while ( listeners.queue.length ) {
queuedListener = listeners.queue.shift();
if ( queuedListener ) {
listeners.events.push( queuedListener );
}
}
}
listeners.active = false;
listeners.events.forEach(function( listener ) {
if ( !listener ) {
listeners.events.splice( listeners.events.indexOf( listener ), 1 );
}
});
listeners.queue.forEach(function( listener ) {
if ( !listener ) {
listeners.queue.splice( listeners.queue.indexOf( listener ), 1 );
}
});
}
};
document.addEventListener = addEventListener;
document.removeEventListener = removeEventListener;
document.dispatchEvent = dispatchEvent;
}
if ( !Event.prototype.preventDefault ) {
Event.prototype.preventDefault = function() {
this.returnValue = false;
};
}
if ( !Event.prototype.stopPropagation ) {
Event.prototype.stopPropagation = function() {
this.cancelBubble = true;
};
}
window.addEventListener = window.addEventListener || function( event, callBack ) {
event = "on" + event;
window.attachEvent( event, callBack );
};
window.removeEventListener = window.removeEventListener || function( event, callBack ) {
event = "on" + event;
window.detachEvent( event, callBack );
};
HTMLScriptElement.prototype.addEventListener = HTMLScriptElement.prototype.addEventListener || function( event, callBack ) {
event = ( event === "load" ) ? "onreadystatechange" : "on" + event;
if( event === "onreadystatechange" ){
callBack.readyStateCheck = callBack.readyStateCheck || function( e ){
if( self.readyState === "loaded" ){
callBack( e );
}
};
}
this.attachEvent( event, ( callBack.readyStateCheck || callBack ) );
};
HTMLScriptElement.prototype.removeEventListener = HTMLScriptElement.prototype.removeEventListener || function( event, callBack ) {
event = ( event === "load" ) ? "onreadystatechange" : "on" + event;
this.detachEvent( event, ( callBack.readyStateCheck || callBack ) );
};
document.createEvent = document.createEvent || function ( type ) {
return {
type : null,
target : null,
currentTarget : null,
cancelable : false,
detail: false,
bubbles : false,
initEvent : function (type, bubbles, cancelable) {
this.type = type;
},
initCustomEvent: function(type, bubbles, cancelable, detail) {
this.type = type;
this.detail = detail;
},
stopPropagation : function () {},
stopImmediatePropagation : function () {}
}
};
Array.prototype.forEach = Array.prototype.forEach || function( fn, context ) {
var obj = this,
hasOwn = Object.prototype.hasOwnProperty;
if ( !obj || !fn ) {
return {};
}
context = context || this;
var key, len;
for ( key in obj ) {
if ( hasOwn.call( obj, key ) ) {
fn.call( context, obj[ key ], key, obj );
}
}
return obj;
};
// Production steps of ECMA-262, Edition 5, 15.4.4.19
// Reference: http://es5.github.com/#x15.4.4.19
if ( !Array.prototype.map ) {
Array.prototype.map = function( callback, thisArg ) {
var T, A, k;
if ( this == null ) {
throw new TypeError( "this is null or not defined" );
}
// 1. Let O be the result of calling ToObject passing the |this| value as the argument.
var O = Object( this );
// 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
// 3. Let len be ToUint32(lenValue).
var len = O.length >>> 0;
// 4. If IsCallable(callback) is false, throw a TypeError exception.
// See: http://es5.github.com/#x9.11
if ( {}.toString.call( callback ) != "[object Function]" ) {
throw new TypeError( callback + " is not a function" );
}
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
if ( thisArg ) {
T = thisArg;
}
// 6. Let A be a new array created as if by the expression new Array(len) where Array is
// the standard built-in constructor with that name and len is the value of len.
A = new Array( len );
// 7. Let k be 0
k = 0;
// 8. Repeat, while k < len
while( k < len ) {
var kValue, mappedValue;
// a. Let Pk be ToString(k).
// This is implicit for LHS operands of the in operator
// b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
// This step can be combined with c
// c. If kPresent is true, then
if ( k in O ) {
// i. Let kValue be the result of calling the Get internal method of O with argument Pk.
kValue = O[ k ];
// ii. Let mappedValue be the result of calling the Call internal method of callback
// with T as the this value and argument list containing kValue, k, and O.
mappedValue = callback.call( T, kValue, k, O );
// iii. Call the DefineOwnProperty internal method of A with arguments
// Pk, Property Descriptor {Value: mappedValue, Writable: true, Enumerable: true, Configurable: true},
// and false.
// In browsers that support Object.defineProperty, use the following:
// Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true });
// For best browser support, use the following:
A[ k ] = mappedValue;
}
// d. Increase k by 1.
k++;
}
// 9. return A
return A;
};
}
if ( !Array.prototype.indexOf ) {
Array.prototype.indexOf = function ( searchElement /*, fromIndex */ ) {
if ( this == null) {
throw new TypeError();
}
var t = Object( this ),
len = t.length >>> 0;
if ( len === 0 ) {
return -1;
}
var n = 0;
if ( arguments.length > 0 ) {
n = Number( arguments[ 1 ] );
if ( n != n ) { // shortcut for verifying if it's NaN
n = 0;
} else if ( n != 0 && n != Infinity && n != -Infinity ) {
n = ( n > 0 || -1 ) * Math.floor( Math.abs( n ) );
}
}
if ( n >= len ) {
return -1;
}
var k = n >= 0 ? n : Math.max( len - Math.abs( n ), 0 );
for (; k < len; k++ ) {
if ( k in t && t[ k ] === searchElement ) {
return k;
}
}
return -1;
}
}
if ( typeof String.prototype.trim !== "function" ) {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
};
}
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
if (!Object.keys) {
Object.keys = (function () {
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
],
dontEnumsLength = dontEnums.length;
return function (obj) {
if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
throw new TypeError('Object.keys called on non-object');
}
var result = [], prop, i;
for (prop in obj) {
if (hasOwnProperty.call(obj, prop)) {
result.push(prop);
}
}
if (hasDontEnumBug) {
for (i = 0; i < dontEnumsLength; i++) {
if (hasOwnProperty.call(obj, dontEnums[i])) {
result.push(dontEnums[i]);
}
}
}
return result;
};
}());
}
if ( !Object.defineProperties ) {
Object.defineProperties = function(obj, properties) {
function convertToDescriptor(desc) {
function hasProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
function isCallable(v) {
// NB: modify as necessary if other values than functions are callable.
return typeof v === "function";
}
if (typeof desc !== "object" || desc === null)
throw new TypeError("bad desc");
var d = {};
if (hasProperty(desc, "enumerable"))
d.enumerable = !!obj.enumerable;
if (hasProperty(desc, "configurable"))
d.configurable = !!desc.configurable;
if (hasProperty(desc, "value"))
d.value = obj.value;
if (hasProperty(desc, "writable"))
d.writable = !!desc.writable;
if ( hasProperty(desc, "get") ) {
var g = desc.get;
if (!isCallable(g) && g !== "undefined")
throw new TypeError("bad get");
d.get = g;
}
if ( hasProperty(desc, "set") ) {
var s = desc.set;
if (!isCallable(s) && s !== "undefined")
throw new TypeError("bad set");
d.set = s;
}
if (("get" in d || "set" in d) && ("value" in d || "writable" in d))
throw new TypeError("identity-confused descriptor");
return d;
}
if (typeof obj !== "object" || obj === null)
throw new TypeError("bad obj");
properties = Object(properties);
var keys = Object.keys(properties);
var descs = [];
for (var i = 0; i < keys.length; i++)
descs.push([keys[i], convertToDescriptor(properties[keys[i]])]);
for (var i = 0; i < descs.length; i++)
Object.defineProperty(obj, descs[i][0], descs[i][1]);
return obj;
};
}
})();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,437 @@
(function( Popcorn ) {
// combines calls of two function calls into one
var combineFn = function( first, second ) {
first = first || Popcorn.nop;
second = second || Popcorn.nop;
return function() {
first.apply( this, arguments );
second.apply( this, arguments );
};
};
// ID string matching
var rIdExp = /^(#([\w\-\_\.]+))$/;
Popcorn.player = function( name, player ) {
// return early if a player already exists under this name
if ( Popcorn[ name ] ) {
return;
}
player = player || {};
var playerFn = function( target, src, options ) {
options = options || {};
// List of events
var date = new Date() / 1000,
baselineTime = date,
currentTime = 0,
readyState = 0,
volume = 1,
muted = false,
events = {},
// The container div of the resource
container = typeof target === "string" ? Popcorn.dom.find( target ) : target,
basePlayer = {},
timeout,
popcorn;
if ( !Object.prototype.__defineGetter__ ) {
basePlayer = container || document.createElement( "div" );
}
// copies a div into the media object
for( var val in container ) {
// don't copy properties if using container as baseplayer
if ( val in basePlayer ) {
continue;
}
if ( typeof container[ val ] === "object" ) {
basePlayer[ val ] = container[ val ];
} else if ( typeof container[ val ] === "function" ) {
basePlayer[ val ] = (function( value ) {
// this is a stupid ugly kludgy hack in honour of Safari
// in Safari a NodeList is a function, not an object
if ( "length" in container[ value ] && !container[ value ].call ) {
return container[ value ];
} else {
return function() {
return container[ value ].apply( container, arguments );
};
}
}( val ));
} else {
Popcorn.player.defineProperty( basePlayer, val, {
get: (function( value ) {
return function() {
return container[ value ];
};
}( val )),
set: Popcorn.nop,
configurable: true
});
}
}
var timeupdate = function() {
date = new Date() / 1000;
if ( !basePlayer.paused ) {
basePlayer.currentTime = basePlayer.currentTime + ( date - baselineTime );
basePlayer.dispatchEvent( "timeupdate" );
timeout = setTimeout( timeupdate, 10 );
}
baselineTime = date;
};
basePlayer.play = function() {
this.paused = false;
if ( basePlayer.readyState >= 4 ) {
baselineTime = new Date() / 1000;
basePlayer.dispatchEvent( "play" );
timeupdate();
}
};
basePlayer.pause = function() {
this.paused = true;
basePlayer.dispatchEvent( "pause" );
};
Popcorn.player.defineProperty( basePlayer, "currentTime", {
get: function() {
return currentTime;
},
set: function( val ) {
// make sure val is a number
currentTime = +val;
basePlayer.dispatchEvent( "timeupdate" );
return currentTime;
},
configurable: true
});
Popcorn.player.defineProperty( basePlayer, "volume", {
get: function() {
return volume;
},
set: function( val ) {
// make sure val is a number
volume = +val;
basePlayer.dispatchEvent( "volumechange" );
return volume;
},
configurable: true
});
Popcorn.player.defineProperty( basePlayer, "muted", {
get: function() {
return muted;
},
set: function( val ) {
// make sure val is a number
muted = +val;
basePlayer.dispatchEvent( "volumechange" );
return muted;
},
configurable: true
});
Popcorn.player.defineProperty( basePlayer, "readyState", {
get: function() {
return readyState;
},
set: function( val ) {
readyState = val;
return readyState;
},
configurable: true
});
// Adds an event listener to the object
basePlayer.addEventListener = function( evtName, fn ) {
if ( !events[ evtName ] ) {
events[ evtName ] = [];
}
events[ evtName ].push( fn );
return fn;
};
// Removes an event listener from the object
basePlayer.removeEventListener = function( evtName, fn ) {
var i,
listeners = events[ evtName ];
if ( !listeners ){
return;
}
// walk backwards so we can safely splice
for ( i = events[ evtName ].length - 1; i >= 0; i-- ) {
if( fn === listeners[ i ] ) {
listeners.splice(i, 1);
}
}
return fn;
};
// Can take event object or simple string
basePlayer.dispatchEvent = function( oEvent ) {
var evt,
self = this,
eventInterface,
eventName = oEvent.type;
// A string was passed, create event object
if ( !eventName ) {
eventName = oEvent;
eventInterface = Popcorn.events.getInterface( eventName );
if ( eventInterface ) {
evt = document.createEvent( eventInterface );
evt.initEvent( eventName, true, true, window, 1 );
}
}
if ( events[ eventName ] ) {
for ( var i = events[ eventName ].length - 1; i >= 0; i-- ) {
events[ eventName ][ i ].call( self, evt, self );
}
}
};
// Attempt to get src from playerFn parameter
basePlayer.src = src || "";
basePlayer.duration = 0;
basePlayer.paused = true;
basePlayer.ended = 0;
options && options.events && Popcorn.forEach( options.events, function( val, key ) {
basePlayer.addEventListener( key, val, false );
});
// true and undefined returns on canPlayType means we should attempt to use it,
// false means we cannot play this type
if ( player._canPlayType( container.nodeName, src ) !== false ) {
if ( player._setup ) {
player._setup.call( basePlayer, options );
} else {
// there is no setup, which means there is nothing to load
basePlayer.readyState = 4;
basePlayer.dispatchEvent( "loadedmetadata" );
basePlayer.dispatchEvent( "loadeddata" );
basePlayer.dispatchEvent( "canplaythrough" );
}
} else {
// Asynchronous so that users can catch this event
setTimeout( function() {
basePlayer.dispatchEvent( "error" );
}, 0 );
}
popcorn = new Popcorn.p.init( basePlayer, options );
if ( player._teardown ) {
popcorn.destroy = combineFn( popcorn.destroy, function() {
player._teardown.call( basePlayer, options );
});
}
return popcorn;
};
playerFn.canPlayType = player._canPlayType = player._canPlayType || Popcorn.nop;
Popcorn[ name ] = Popcorn.player.registry[ name ] = playerFn;
};
Popcorn.player.registry = {};
Popcorn.player.defineProperty = Object.defineProperty || function( object, description, options ) {
object.__defineGetter__( description, options.get || Popcorn.nop );
object.__defineSetter__( description, options.set || Popcorn.nop );
};
// player queue is to help players queue things like play and pause
// HTML5 video's play and pause are asynch, but do fire in sequence
// play() should really mean "requestPlay()" or "queuePlay()" and
// stash a callback that will play the media resource when it's ready to be played
Popcorn.player.playerQueue = function() {
var _queue = [],
_running = false;
return {
next: function() {
_running = false;
_queue.shift();
_queue[ 0 ] && _queue[ 0 ]();
},
add: function( callback ) {
_queue.push(function() {
_running = true;
callback && callback();
});
// if there is only one item on the queue, start it
!_running && _queue[ 0 ]();
}
};
};
// Popcorn.smart will attempt to find you a wrapper or player. If it can't do that,
// it will default to using an HTML5 video in the target.
Popcorn.smart = function( target, src, options ) {
var node = typeof target === "string" ? Popcorn.dom.find( target ) : target,
i, srci, j, media, mediaWrapper, popcorn, srcLength,
// We leave HTMLVideoElement and HTMLAudioElement wrappers out
// of the mix, since we'll default to HTML5 video if nothing
// else works. Waiting on #1254 before we add YouTube to this.
wrappers = "HTMLYouTubeVideoElement HTMLVimeoVideoElement HTMLSoundCloudAudioElement HTMLNullVideoElement".split(" ");
if ( !node ) {
Popcorn.error( "Specified target `" + target + "` was not found." );
return;
}
// If our src is not an array, create an array of one.
src = typeof src === "string" ? [ src ] : src;
// Loop through each src, and find the first playable.
for ( i = 0, srcLength = src.length; i < srcLength; i++ ) {
srci = src[ i ];
// See if we can use a wrapper directly, if not, try players.
for ( j = 0; j < wrappers.length; j++ ) {
mediaWrapper = Popcorn[ wrappers[ j ] ];
if ( mediaWrapper && mediaWrapper._canPlaySrc( srci ) === "probably" ) {
media = mediaWrapper( node );
popcorn = Popcorn( media, options );
// Set src, but not until after we return the media so the caller
// can get error events, if any.
setTimeout( function() {
media.src = srci;
}, 0 );
return popcorn;
}
}
// No wrapper can play this, check players.
for ( var key in Popcorn.player.registry ) {
if ( Popcorn.player.registry.hasOwnProperty( key ) ) {
if ( Popcorn.player.registry[ key ].canPlayType( node.nodeName, srci ) ) {
// Popcorn.smart( player, src, /* options */ )
return Popcorn[ key ]( node, srci, options );
}
}
}
}
// If we don't have any players or wrappers that can handle this,
// Default to using HTML5 video. Similar to the HTMLVideoElement
// wrapper, we put a video in the div passed to us via:
// Popcorn.smart( div, src, options )
var videoHTML,
videoElement,
videoID = Popcorn.guid( "popcorn-video-" ),
videoHTMLContainer = document.createElement( "div" );
videoHTMLContainer.style.width = "100%";
videoHTMLContainer.style.height = "100%";
// If we only have one source, do not bother with source elements.
// This means we don't have the IE9 hack,
// and we can properly listen to error events.
// That way an error event can be told to backup to Flash if it fails.
if ( src.length === 1 ) {
videoElement = document.createElement( "video" );
videoElement.id = videoID;
node.appendChild( videoElement );
setTimeout( function() {
// Hack to decode html characters like &amp; to &
var decodeDiv = document.createElement( "div" );
decodeDiv.innerHTML = src[ 0 ];
videoElement.src = decodeDiv.firstChild.nodeValue;
}, 0 );
return Popcorn( '#' + videoID, options );
}
node.appendChild( videoHTMLContainer );
// IE9 doesn't like dynamic creation of source elements on <video>
// so we do it in one shot via innerHTML.
videoHTML = '<video id="' + videoID + '" preload=auto autobuffer>';
for ( i = 0, srcLength = src.length; i < srcLength; i++ ) {
videoHTML += '<source src="' + src[ i ] + '">';
}
videoHTML += "</video>";
videoHTMLContainer.innerHTML = videoHTML;
if ( options && options.events && options.events.error ) {
node.addEventListener( "error", options.events.error, false );
}
return Popcorn( '#' + videoID, options );
};
})( Popcorn );

View File

@@ -0,0 +1,143 @@
// PLUGIN: Subtitle
(function ( Popcorn ) {
var i = 0,
createDefaultContainer = function( context, id ) {
var ctxContainer = context.container = document.createElement( "div" ),
style = ctxContainer.style,
media = context.media;
var updatePosition = function() {
var position = context.position();
// the video element must have height and width defined
style.fontSize = "18px";
style.width = media.offsetWidth + "px";
style.top = position.top + media.offsetHeight - ctxContainer.offsetHeight - 40 + "px";
style.left = position.left + "px";
setTimeout( updatePosition, 10 );
};
ctxContainer.id = id || Popcorn.guid();
style.position = "absolute";
style.color = "white";
style.textShadow = "black 2px 2px 6px";
style.fontWeight = "bold";
style.textAlign = "center";
updatePosition();
context.media.parentNode.appendChild( ctxContainer );
return ctxContainer;
};
/**
* Subtitle popcorn plug-in
* Displays a subtitle over the video, or in the target div
* Options parameter will need a start, and end.
* Optional parameters are target and text.
* Start is the time that you want this plug-in to execute
* End is the time that you want this plug-in to stop executing
* Target is the id of the document element that the content is
* appended to, this target element must exist on the DOM
* Text is the text of the subtitle you want to display.
*
* @param {Object} options
*
* Example:
var p = Popcorn('#video')
.subtitle({
start: 5, // seconds, mandatory
end: 15, // seconds, mandatory
text: 'Hellow world', // optional
target: 'subtitlediv', // optional
} )
*
*/
Popcorn.plugin( "subtitle" , {
manifest: {
about: {
name: "Popcorn Subtitle Plugin",
version: "0.1",
author: "Scott Downe",
website: "http://scottdowne.wordpress.com/"
},
options: {
start: {
elem: "input",
type: "text",
label: "Start"
},
end: {
elem: "input",
type: "text",
label: "End"
},
target: "subtitle-container",
text: {
elem: "input",
type: "text",
label: "Text"
}
}
},
_setup: function( options ) {
var newdiv = document.createElement( "div" );
newdiv.id = "subtitle-" + i++;
newdiv.style.display = "none";
// Creates a div for all subtitles to use
( !this.container && ( !options.target || options.target === "subtitle-container" ) ) &&
createDefaultContainer( this );
// if a target is specified, use that
if ( options.target && options.target !== "subtitle-container" ) {
// In case the target doesn't exist in the DOM
options.container = document.getElementById( options.target ) || createDefaultContainer( this, options.target );
} else {
// use shared default container
options.container = this.container;
}
document.getElementById( options.container.id ) && document.getElementById( options.container.id ).appendChild( newdiv );
options.innerContainer = newdiv;
options.showSubtitle = function() {
options.innerContainer.innerHTML = options.text || "";
};
},
/**
* @member subtitle
* The start function will be executed when the currentTime
* of the video reaches the start time provided by the
* options variable
*/
start: function( event, options ){
options.innerContainer.style.display = "inline";
options.showSubtitle( options, options.text );
},
/**
* @member subtitle
* The end function will be executed when the currentTime
* of the video reaches the end time provided by the
* options variable
*/
end: function( event, options ) {
options.innerContainer.style.display = "none";
options.innerContainer.innerHTML = "";
},
_teardown: function ( options ) {
options.container.removeChild( options.innerContainer );
}
});
})( Popcorn );

View File

@@ -0,0 +1,45 @@
{
"name": "jplayer",
"version": "2.9.2",
"description": "The jQuery HTML5 Audio / Video Library. Allows you to create a media player with a consistent interface and experience across all browsers.",
"organization": "Happyworm Ltd",
"author": {
"name": "Mark J Panaghiston",
"email": "markp@happyworm.com",
"url": "http://happyworm.com/"
},
"homepage": "http://jplayer.org/",
"keywords": [
"jquery-plugin",
"audio",
"video",
"media",
"player",
"jplayer"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/happyworm/jPlayer.git"
},
"bugs": "https://github.com/happyworm/jPlayer/issues",
"github": "http://github.com/happyworm/jPlayer",
"main": "dist/jplayer/jquery.jplayer.js",
"files": [
"dist"
],
"dependencies": {
"jquery": ">1.7.0"
},
"devDependencies": {
"flex-sdk": "~4.6.0-0",
"grunt": "~0.4.5",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^0.10.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-sass": "^0.8.1",
"grunt-contrib-uglify": "~0.6.0",
"grunt-mxmlc": "~0.5.2"
}
}

View File

@@ -0,0 +1,629 @@
/*
* jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Version: 2.8.0
* Date: 11th November 2014
*
* FlashVars expected: (AS3 property of: loaderInfo.parameters)
* id: (URL Encoded: String) Id of jPlayer instance
* vol: (Number) Sets the initial volume
* muted: (Boolean in a String) Sets the initial muted state
* jQuery: (URL Encoded: String) Sets the jQuery var name. Used with: someVar = jQuery.noConflict(true); The someVar name must contain jQuery in it.
*
* Compiled using: Adobe Flex Compiler (mxmlc) Version 4.6
* mxmlc Jplayer.as -static-link-runtime-shared-libraries=true
*/
package {
import flash.system.Security;
import flash.external.ExternalInterface;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.events.KeyboardEvent;
import flash.display.Sprite;
import happyworm.jPlayer.*;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.net.LocalConnection;
import flash.events.StatusEvent;
import flash.events.MouseEvent;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
import flash.events.ContextMenuEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import flash.media.Video;
public class Jplayer extends Sprite {
private var jQuery:String;
private var sentNumberFractionDigits:uint = 2;
public var commonStatus:JplayerStatus = new JplayerStatus(); // Used for inital ready event so volume is correct.
private var myInitTimer:Timer = new Timer(100, 0);
private var myMp3Player:JplayerMp3;
private var myMp4Player:JplayerMp4;
private var myRtmpPlayer:JplayerRtmp;
private var isRtmp:Boolean = false;
private var isMp4:Boolean = false;
private var isMp3:Boolean = false;
private var isVideo:Boolean = false;
private var securityIssue:Boolean = false; // On direct access and when SWF parameters contain illegal characters
private var contextMenuFix:Sprite = new Sprite(); // A sprite that will be on top and fix the content menu over video bug. (A Flash plugin bug.)
private var txLog:TextField;
private var debug:Boolean = false; // Set debug to false for release compile!
public function Jplayer() {
flash.system.Security.allowDomain("*");
flash.system.Security.allowInsecureDomain("*");
// Fix to the security exploit reported by Jason Calvert http://appsec.ws/
checkFlashVars(loaderInfo.parameters);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
if(!securityIssue) {
// The jQuery param is the primary cause of security concerns.
jQuery = loaderInfo.parameters.jQuery + "('#" + loaderInfo.parameters.id + "').jPlayer";
commonStatus.volume = Number(loaderInfo.parameters.vol);
commonStatus.muted = loaderInfo.parameters.muted == "true";
stage.addEventListener(Event.RESIZE, resizeHandler);
stage.addEventListener(MouseEvent.CLICK, clickHandler);
var initialVolume:Number = commonStatus.volume;
if(commonStatus.muted) {
initialVolume = 0;
}
myMp3Player = new JplayerMp3(initialVolume);
addChild(myMp3Player);
myMp4Player = new JplayerMp4(initialVolume);
addChild(myMp4Player);
myRtmpPlayer = new JplayerRtmp(initialVolume);
addChild(myRtmpPlayer);
switchType("mp3"); // set default state to mp3
}
// The ContextMenu only partially works. The menu select events never occur.
// Investigated and it is something to do with the way jPlayer inserts the Flash on the page.
// A simple test inserting the Jplayer.swf on a page using: 1) SWFObject 2.2 works. 2) AC_FL_RunContent() works.
// jPlayer Flash insertion is based on SWFObject 2.2 and the resaon behind this failure is not clear. The Flash insertion HTML on the page looks similar.
var myContextMenu:ContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
var menuItem_jPlayer:ContextMenuItem = new ContextMenuItem("jPlayer " + JplayerStatus.VERSION);
var menuItem_happyworm:ContextMenuItem = new ContextMenuItem("© 2009-2014 Happyworm Ltd", true);
menuItem_jPlayer.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuSelectHandler_jPlayer);
menuItem_happyworm.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuSelectHandler_happyworm);
myContextMenu.customItems.push(menuItem_jPlayer, menuItem_happyworm);
contextMenu = myContextMenu;
// Log console for dev compile option: debug
if(debug || securityIssue) {
txLog = new TextField();
txLog.x = 5;
txLog.y = 5;
txLog.width = stage.stageWidth - 10;
txLog.height = stage.stageHeight - 10;
txLog.backgroundColor = 0xEEEEFF;
txLog.border = true;
txLog.background = true;
txLog.multiline = true;
txLog.text = "jPlayer " + JplayerStatus.VERSION;
if(securityIssue) {
txLog.visible = true;
} else if(debug) {
txLog.visible = false;
}
this.addChild(txLog);
if(debug && !securityIssue) {
this.stage.addEventListener(KeyboardEvent.KEY_UP, keyboardHandler);
myMp3Player.addEventListener(JplayerEvent.DEBUG_MSG, debugMsgHandler);
myMp4Player.addEventListener(JplayerEvent.DEBUG_MSG, debugMsgHandler);
myRtmpPlayer.addEventListener(JplayerEvent.DEBUG_MSG, debugMsgHandler);
}
}
// Known Flash problem with contextMenu over video player.
// Add a transparent rectangle into the sprite.
contextMenuFix.graphics.beginFill(0x000000, 0); // Transparent black
contextMenuFix.graphics.drawRect(0, 0, 10, 10); // Arbitary rectangle
contextMenuFix.graphics.endFill();
addChild(contextMenuFix); // Put the sprite on the top layer.
if(!securityIssue) {
// Delay init() because Firefox 3.5.7+ developed a bug with local testing in Firebug.
myInitTimer.addEventListener(TimerEvent.TIMER, init);
myInitTimer.start();
}
}
private function switchType(playType:String):void {
switch(playType) {
case "rtmpa":
isRtmp=true;
isMp3=false;
isMp4=false;
isVideo=false;
break;
case "rtmpv":
isRtmp=true;
isMp3=false;
isMp4=false;
isVideo=true;
break;
case "mp3":
isRtmp=false;
isMp3=true;
isMp4=false;
isVideo=false;
break;
case "mp4":
isRtmp=false;
isMp3=false;
isMp4=true;
isVideo=false;
break;
case "m4v":
isRtmp=false;
isMp3=false;
isMp4=true;
isVideo=true;
break;
}
listenToMp3(isMp3);
listenToMp4(isMp4);
listenToRtmp(isRtmp);
}
private function init(e:TimerEvent):void {
myInitTimer.stop();
if(ExternalInterface.available && !securityIssue) {
ExternalInterface.addCallback("fl_setAudio_mp3", fl_setAudio_mp3);
ExternalInterface.addCallback("fl_setAudio_m4a", fl_setAudio_m4a);
ExternalInterface.addCallback("fl_setVideo_m4v", fl_setVideo_m4v);
ExternalInterface.addCallback("fl_setAudio_rtmp", fl_setAudio_rtmp);
ExternalInterface.addCallback("fl_setVideo_rtmp", fl_setVideo_rtmp);
ExternalInterface.addCallback("fl_clearMedia", fl_clearMedia);
ExternalInterface.addCallback("fl_load", fl_load);
ExternalInterface.addCallback("fl_play", fl_play);
ExternalInterface.addCallback("fl_pause", fl_pause);
ExternalInterface.addCallback("fl_play_head", fl_play_head);
ExternalInterface.addCallback("fl_volume", fl_volume);
ExternalInterface.addCallback("fl_mute", fl_mute);
ExternalInterface.call(jQuery, "jPlayerFlashEvent", JplayerEvent.JPLAYER_READY, extractStatusData(commonStatus)); // See JplayerStatus() class for version number.
}
}
private function checkFlashVars(p:Object):void {
// Check for direct access. Inspired by mediaelement.js - Also added name to HTML object for non-IE browsers.
if(ExternalInterface.objectID != null && ExternalInterface.objectID.toString() != "") {
for each (var s:String in p) {
if(illegalChar(s)) {
securityIssue = true; // Found a security concern.
}
}
if(!securityIssue) {
if(jQueryIllegal(p.jQuery)) {
securityIssue = true; // Found a security concern.
}
}
} else {
securityIssue = true; // Direct access disables the callbacks, which were a security concern.
}
}
private function illegalChar(s:String):Boolean {
// A whitelist of accepted chars.
var validParam:RegExp = /^[-A-Za-z0-9_.]+$/;
return !validParam.test(s);
}
private function jQueryIllegal(s:String):Boolean {
// Check param contains the term jQuery.
var validParam:RegExp = /(jQuery)/;
return !validParam.test(s);
}
// switchType() here
private function listenToMp3(active:Boolean):void {
if(active) {
myMp3Player.addEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_WAITING, jPlayerFlashEvent); // only MP3 atm
myMp3Player.addEventListener(JplayerEvent.JPLAYER_PLAYING, jPlayerFlashEvent); // only MP3 atm
myMp3Player.addEventListener(JplayerEvent.JPLAYER_CANPLAY, jPlayerFlashEvent); // only MP3 atm
myMp3Player.addEventListener(JplayerEvent.JPLAYER_CANPLAYTHROUGH, jPlayerFlashEvent); // only MP3 atm
myMp3Player.addEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerFlashEvent);
myMp3Player.addEventListener(JplayerEvent.JPLAYER_DURATIONCHANGE, jPlayerFlashEvent); // only MP3 atm
} else {
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_WAITING, jPlayerFlashEvent); // only MP3 atm
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PLAYING, jPlayerFlashEvent); // only MP3 atm
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_CANPLAY, jPlayerFlashEvent); // only MP3 atm
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_CANPLAYTHROUGH, jPlayerFlashEvent); // only MP3 atm
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerFlashEvent);
myMp3Player.removeEventListener(JplayerEvent.JPLAYER_DURATIONCHANGE, jPlayerFlashEvent); // only MP3 atm
}
}
private function listenToMp4(active:Boolean):void {
if(active) {
myMp4Player.addEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
myMp4Player.addEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
myMp4Player.addEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
myMp4Player.addEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
myMp4Player.addEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
myMp4Player.addEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
myMp4Player.addEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
myMp4Player.addEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
myMp4Player.addEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
myMp4Player.addEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler
} else {
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
myMp4Player.removeEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler
}
}
private function listenToRtmp(active:Boolean):void {
if(active) {
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_CANPLAY, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler
} else {
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent);
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent);
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent);
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent);
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent);
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent);
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent);
myRtmpPlayer.addEventListener(JplayerEvent.JPLAYER_CANPLAY, jPlayerFlashEvent);
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent);
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent);
myRtmpPlayer.removeEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler
}
}
private function fl_setAudio_mp3(src:String):Boolean {
if (src != null) {
log("fl_setAudio_mp3: "+src);
switchType("mp3");
myMp4Player.clearFile();
myRtmpPlayer.clearFile();
myMp3Player.setFile(src);
return true;
} else {
log("fl_setAudio_mp3: null");
return false;
}
}
private function fl_setAudio_rtmp(src:String):Boolean {
if (src != null) {
log("fl_setAudio_rtmp: "+src);
switchType("rtmpa");
myMp4Player.clearFile();
myMp3Player.clearFile();
myRtmpPlayer.setFile(src,false);
return true;
} else {
log("fl_setAudio_rtmp: null");
return false;
}
}
private function fl_setVideo_rtmp(src:String):Boolean {
if (src != null) {
log("fl_setVideo_rtmp: "+src);
switchType("rtmpv");
myMp4Player.clearFile();
myMp3Player.clearFile();
myRtmpPlayer.setFile(src,true);
return true;
} else {
log("fl_setVideo_rtmp: null");
return false;
}
}
private function fl_setAudio_m4a(src:String):Boolean {
if (src != null) {
log("fl_setAudio_m4a: "+src);
switchType("mp4")
myMp3Player.clearFile();
myRtmpPlayer.clearFile();
myMp4Player.setFile(src);
return true;
} else {
log("fl_setAudio_m4a: null");
return false;
}
}
private function fl_setVideo_m4v(src:String):Boolean {
if (src != null) {
log("fl_setVideo_m4v: "+src);
switchType("m4v");
myMp3Player.clearFile();
myRtmpPlayer.clearFile();
myMp4Player.setFile(src);
return true;
} else {
log("fl_setVideo_m4v: null");
return false;
}
}
private function fl_clearMedia():void {
log("clearMedia.");
myMp3Player.clearFile();
myMp4Player.clearFile();
myRtmpPlayer.clearFile();
}
private function getType():Object {
var returnType:Object;
if(isMp3) {
returnType=myMp3Player;
}
if(isRtmp) {
returnType=myRtmpPlayer;
}
if(isMp4) {
returnType=myMp4Player;
}
return returnType;
}
private function fl_load():Boolean {
log("load.");
var returnType:Object = getType();
return returnType.load();
}
private function fl_play(time:Number = NaN):Boolean {
log("play: time = " + time);
var returnType:Object = getType();
return returnType.play(time * 1000); // Flash uses milliseconds
}
private function fl_pause(time:Number = NaN):Boolean {
log("pause: time = " + time);
var returnType:Object = getType();
return returnType.pause(time * 1000); // Flash uses milliseconds
}
private function fl_play_head(percent:Number):Boolean {
log("play_head: "+percent+"%");
var returnType:Object = getType();
return returnType.playHead(percent);
}
private function fl_volume(v:Number):void {
log("volume: "+v);
commonStatus.volume = v;
if(!commonStatus.muted) {
myMp3Player.setVolume(v);
myMp4Player.setVolume(v);
myRtmpPlayer.setVolume(v);
}
}
private function fl_mute(mute:Boolean):void {
log("mute: "+mute);
commonStatus.muted = mute;
if(mute) {
myMp3Player.setVolume(0);
myMp4Player.setVolume(0);
myRtmpPlayer.setVolume(0);
} else {
myMp3Player.setVolume(commonStatus.volume);
myMp4Player.setVolume(commonStatus.volume);
myRtmpPlayer.setVolume(commonStatus.volume);
}
}
private function jPlayerFlashEvent(e:JplayerEvent):void {
log("jPlayer Flash Event: " + e.type + ": " + e.target);
if(ExternalInterface.available && !securityIssue) {
ExternalInterface.call(jQuery, "jPlayerFlashEvent", e.type, extractStatusData(e.data));
}
}
private function extractStatusData(data:JplayerStatus):Object {
var myStatus:Object = {
version: JplayerStatus.VERSION,
src: data.src,
paused: !data.isPlaying, // Changing this name requires inverting all assignments and conditional statements.
srcSet: data.srcSet,
seekPercent: data.seekPercent,
currentPercentRelative: data.currentPercentRelative,
currentPercentAbsolute: data.currentPercentAbsolute,
currentTime: data.currentTime / 1000, // JavaScript uses seconds
duration: data.duration / 1000, // JavaScript uses seconds
videoWidth: data.videoWidth,
videoHeight: data.videoHeight,
volume: commonStatus.volume,
muted: commonStatus.muted
};
log("extractStatusData: sp="+myStatus.seekPercent+" cpr="+myStatus.currentPercentRelative+" cpa="+myStatus.currentPercentAbsolute+" ct="+myStatus.currentTime+" d="+myStatus.duration);
return myStatus;
}
private function jPlayerMetaDataHandler(e:JplayerEvent):void {
log("jPlayerMetaDataHandler:" + e.target);
if(ExternalInterface.available && !securityIssue) {
resizeHandler(new Event(Event.RESIZE));
ExternalInterface.call(jQuery, "jPlayerFlashEvent", e.type, extractStatusData(e.data));
}
}
private function resizeHandler(e:Event):void {
log("resizeHandler: stageWidth = " + stage.stageWidth + " | stageHeight = " + stage.stageHeight);
var mediaX:Number = 0;
var mediaY:Number = 0;
var mediaWidth:Number = 0;
var mediaHeight:Number = 0;
var aspectRatioStage:Number = 0;
var aspectRatioVideo:Number = 0;
var videoItem:*;
if(isRtmp) {
videoItem = myRtmpPlayer;
}
if(isMp4) {
videoItem = myMp4Player;
}
if(videoItem) {
if(stage.stageWidth > 0 && stage.stageHeight > 0 && videoItem.myVideo.width > 0 && videoItem.myVideo.height > 0) {
aspectRatioStage = stage.stageWidth / stage.stageHeight;
aspectRatioVideo = videoItem.myVideo.width / videoItem.myVideo.height;
if(aspectRatioStage < aspectRatioVideo) {
mediaWidth = stage.stageWidth;
mediaHeight = stage.stageWidth / aspectRatioVideo;
mediaX = 0;
mediaY = (stage.stageHeight - mediaHeight) / 2;
} else {
mediaWidth = stage.stageHeight * aspectRatioVideo;
mediaHeight = stage.stageHeight;
mediaX = (stage.stageWidth - mediaWidth) / 2;
mediaY = 0;
}
resizeEntity(videoItem, mediaX, mediaY, mediaWidth, mediaHeight);
}
}
if((debug || securityIssue) && stage.stageWidth > 20 && stage.stageHeight > 20) {
txLog.width = stage.stageWidth - 10;
txLog.height = stage.stageHeight - 10;
}
// Resize the sprite so it covers the entire stage area
contextMenuFix.x = 0;
contextMenuFix.y = 0;
contextMenuFix.width = stage.stageWidth;
contextMenuFix.height = stage.stageHeight;
}
private function resizeEntity(entity:Sprite, mediaX:Number, mediaY:Number, mediaWidth:Number, mediaHeight:Number):void {
entity.x = mediaX;
entity.y = mediaY;
entity.width = mediaWidth;
entity.height = mediaHeight;
}
private function clickHandler(e:MouseEvent):void {
// This needs to work with RTMP format too!
if(isMp3) {
jPlayerFlashEvent(new JplayerEvent(JplayerEvent.JPLAYER_CLICK, myMp3Player.myStatus, "click"))
} else {
jPlayerFlashEvent(new JplayerEvent(JplayerEvent.JPLAYER_CLICK, myMp4Player.myStatus, "click"))
}
}
// Handlers for context menu
private function menuSelectHandler_jPlayer(e:ContextMenuEvent):void {
navigateToURL(new URLRequest("http://jplayer.org/"), "_blank");
}
private function menuSelectHandler_happyworm(e:ContextMenuEvent):void {
navigateToURL(new URLRequest("http://happyworm.com/"), "_blank");
}
private function log(t:String):void {
if(debug) {
txLog.text = t + "\n" + txLog.text;
if(ExternalInterface.available && !securityIssue) {
ExternalInterface.call("console.log", t);
}
}
}
private function debugMsgHandler(e:JplayerEvent):void {
log(e.msg);
}
private function keyboardHandler(e:KeyboardEvent):void {
log("keyboardHandler: e.keyCode = " + e.keyCode);
switch(e.keyCode) {
case 68 : // d
txLog.visible = !txLog.visible;
log("Toggled log display: " + txLog.visible);
break;
case 76 : // l
if(e.ctrlKey && e.shiftKey) {
txLog.text = "Cleared log.";
}
break;
}
}
}
}

View File

@@ -0,0 +1,295 @@
/*
* jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Robert M. Hall
* Date: 7th August 2012
* Custom NetConnection Manager for more robust RTMP support
* Based in part on work by Will Law for the old Akamai NCManager.as
* and some of Will's new work in the OVP base classes (Open Video Player)
* as well as similar approaches by many other NetConnection managers
*
*/
/*
TODO LIST 08/18/2011:
1. Wired up errors to dispatch events to Jplayer events to allow them to bubble up to JS
2. Rework event dispatch to handoff netconnection instead of a passed in reference
3. Allow a customizeable list of protocols and ports to be used instead of entire list
4. Allow a specific port/protocol (1 connect type) to be used first, and then optionally fallback on a custom list or the default list
5. Remove some traces and check a few other items below where I've made notes
*/
package happyworm.jPlayer {
import flash.events.*;
import flash.net.*;
import flash.utils.Timer;
import flash.utils.getTimer;
import flash.utils.clearInterval;
import flash.utils.setInterval;
public class ConnectManager extends Object {
private var protocols_arr:Array = new Array("rtmp","rtmpt","rtmpe","rtmpte","rtmps");
private var ports_arr:Array = new Array("",":1935",":80",":443");
private const protCount:Number = 5;
private const portCount:Number = 4;
private var _ncRef:Object;
private var _aNC:Array;
private var k_TIMEOUT:Number = 30000;
private var k_startConns:Number;
private var m_connList:Array = [];
private var m_serverName:String;
private var m_appName:String;
private var m_streamName:String;
private var m_connListCounter:Number;
private var m_flashComConnectTimeOut:Number;
private var m_validNetConnection:NetConnection;
private var connectSuccess:Boolean=false;
private var negotiating:Boolean=false;
private var idleTimeOut:Boolean=false;
public function ConnectManager() {
trace ("ConnectManager Initialized Version: 1.00 DT");
createPortsProtocolsArray();
}
private function createPortsProtocolsArray():void {
var outerLoop:Number=0;
var innerLoop:Number=0;
for (outerLoop=0; outerLoop<protocols_arr.length; outerLoop++) {
for (innerLoop=0; innerLoop<ports_arr.length; innerLoop++) {
m_connList.push( { protocol: protocols_arr[outerLoop], port: ports_arr[innerLoop] } );
}
}
}
public function negotiateConnect(ncRef:Object,p_serverName:String,p_appName:String):void
{
negotiating=true;
_ncRef=ncRef;
trace("*** SERVER NAME: "+p_serverName);
trace("*** APP NAME: "+p_serverName);
k_startConns = getTimer();
m_serverName = p_serverName;
m_appName = p_appName;
// Set a timeout function, just in case we never connect successfully
clearInterval(m_flashComConnectTimeOut);
m_flashComConnectTimeOut = setInterval(onFlashComConnectTimeOut,k_TIMEOUT,k_TIMEOUT);
// Createe a NetConnection for each of the protocols/ports listed in the m_connList list.
// Connection attempts occur at intervals of 1.5 seconds.
// The first connection to succeed will be used, all the others will be closed.
_aNC = new Array();
for (var i:uint = 0; i < m_connList.length; i++)
{
_aNC[i] = new NetConnection();
_aNC[i].addEventListener(NetStatusEvent.NET_STATUS,netStatus);
_aNC[i].addEventListener(SecurityErrorEvent.SECURITY_ERROR,netSecurityError);
_aNC[i].addEventListener(AsyncErrorEvent.ASYNC_ERROR,asyncError);
_aNC[i].client = new Object;
_aNC[i].client.owner = this;
_aNC[i].client.connIndex = i;
_aNC[i].client.id = i;
_aNC[i].client.pending = true;
/* Revisit this chunk - not needed at the moment as NC is handed off and this
// is handled elsewhere
// Need to put in some event dispatching as a more elegant solution and leave it here
_aNC[i].client.onBWDone = function (p_bw, deltaDown, deltaTime, latency) {
//this.owner.dispatchEvent ({type:"ncBandWidth", kbps:p_bw, latency:latency});
};
_aNC[i].client.onBWCheck = function (counter) {
return ++counter;
};
_aNC[i].client.onStatus = function (info) {
//
};
*/
}
m_connListCounter = 0;
nextConnect ();
}
private function nextConnect():void
{
trace("*** Connection: "+ m_connListCounter + ": "+m_connList[m_connListCounter].protocol + "://" + m_serverName + m_connList[m_connListCounter].port + "/" + m_appName);
try {
_aNC[m_connListCounter].connect(m_connList[m_connListCounter].protocol + "://" + m_serverName + m_connList[m_connListCounter].port + "/" + m_appName);
} catch (error:Error) {
// statements
trace("*** Caught an error condition: "+error);
m_connListCounter = m_connList.length+1;
}
// statements
clearInterval(_aNC["ncInt" + m_connListCounter]);
if ((m_connListCounter < m_connList.length - 1))
{
m_connListCounter++;
_aNC["ncInt" + m_connListCounter] = setInterval(nextConnect,1500);
}
}
// Cleans up all connections if none have succeeded by the timeout interval
private function onFlashComConnectTimeOut(timeout:Number):void
{
stopAll();
}
private function handleGoodConnect(_nc:NetConnection):void {
negotiating=false;
trace("Handing OFF NetConnection");
clearInterval(m_flashComConnectTimeOut);
_ncRef.connectStream();
_ncRef.onBWDone(null,_nc);
//dispatchEvent(event);
// Need to enable and pass to Jplayer event system- revisit
// right now handing back a hardcoded reference that is passed in
// Should come up with a more loosely coupled way via event dispatch
}
public function getNegotiating():Boolean {
return negotiating;
}
public function setNegotiating(bool:Boolean):void {
negotiating=bool;
}
public function stopAll(bool:Boolean=false):void {
//this.dispatchEvent ({type:"ncFailedToConnect", timeout:timeout});
// Need to enable and pass to Jplayer event system- revisit
// trace(_aNC+":"+m_flashComConnectTimeOut+":"+m_connList.length)
if(_aNC!=null && !isNaN(m_flashComConnectTimeOut) ) {
clearInterval(m_flashComConnectTimeOut);
for (var i:uint = 0; i < m_connList.length; i++)
{
if (_aNC[i]!=null)
{
clearInterval(_aNC["ncInt" + i]);
_aNC[i].close();
if(bool==false) {
_aNC[i].client = null;
}
_aNC[i] = null;
delete _aNC[i];
}
}
}
}
private function netStatus(event:NetStatusEvent):void {
trace(event.info.code);
if(event.info.description != undefined) {
trace(event.info.description);
}
_aNC[event.target.client.id].client.pending = true;
// this.owner.m_validNetConnection = this.client.owner[this.client.connIndex];
// if (info.description == "[ License.Limit.Exceeded ]") {
switch (event.info.code) {
case "NetConnection.Connect.IdleTimeOut":
trace("IDLE TIMEOUT OCCURRED!")
negotiating=true;
idleTimeOut=true;
_ncRef.shutDownNcNs();
break;
case "NetConnection.Connect.Closed":
if(!negotiating && !idleTimeOut) {
idleTimeOut = false;
_ncRef.doneYet();
}
break;
case "NetConnection.Connect.InvalidApp":
case "NetConnection.Connect.Rejected":
//handleRejectedOrInvalid(event)
break;
case "NetConnection.Call.Failed":
/*
if (event.info.description.indexOf("_checkbw") != -1) {
event.target.expectBWDone = true;
event.target.call("checkBandwidth",null);
}
*/
break;
case "NetConnection.Connect.Success":
var i:uint=0;
for ( i = 0; i<_aNC.length; i++) {
if (_aNC[i] && (i != event.target.client.id)) {
_aNC[i].close();
_aNC[i] = null;
}
}
var _nc:NetConnection = NetConnection(event.target);
var connID:Number = event.target.client.id;
var _actualPort:String = m_connList[m_connListCounter].port;
var _actualProtocol:String = m_connList[m_connListCounter].protocol;
// See if we have version info
var _serverVersion:String = "UNKNOWN";
if (event.info.data && event.info.data.version) {
_serverVersion = event.info.data.version;
}
trace("Connect ID: "+connID+" - PORT: "+_actualPort+" - PROTOCOL: "+_actualProtocol+" - FMS Version: "+_serverVersion);
clearInterval(_aNC["ncInt" + connID]);
clearInterval(_aNC["ncInt" + m_connListCounter]);
handleGoodConnect(_nc);
break;
}
}
/** Catches any netconnection net security errors
* @private
*/
private function netSecurityError(event:SecurityErrorEvent):void {
trace("SECURITY ERROR:"+event);
//dispatchEvent(event);
// Need to enable and pass to Jplayer event system- revisit
}
/** Catches any async errors
* @private
*/
private function asyncError(event:AsyncErrorEvent):void {
trace("ASYNC ERROR:"+event.error);
//dispatchEvent(event);
// Need to enable and pass to Jplayer event system- revisit
}
}// class
} //package

View File

@@ -0,0 +1,68 @@
/*
* jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Date: 15th December 2013
*/
package happyworm.jPlayer {
import flash.events.Event;
public class JplayerEvent extends Event {
// The event strings must match those in the JavaScript's $.jPlayer.event object
public static const JPLAYER_READY:String = "jPlayer_ready";
public static const JPLAYER_FLASHRESET:String = "jPlayer_flashreset"; // Handled in JavaScript
public static const JPLAYER_RESIZE:String = "jPlayer_resize"; // Handled in JavaScript
public static const JPLAYER_REPEAT:String = "jPlayer_repeat"; // Handled in JavaScript
public static const JPLAYER_CLICK:String = "jPlayer_click";
public static const JPLAYER_ERROR:String = "jPlayer_error";
public static const JPLAYER_WARNING:String = "jPlayer_warning"; // Currently not used by the flash solution
public static const JPLAYER_LOADSTART:String = "jPlayer_loadstart";
public static const JPLAYER_PROGRESS:String = "jPlayer_progress";
public static const JPLAYER_SUSPEND:String = "jPlayer_suspend"; // Not implemented
public static const JPLAYER_ABORT:String = "jPlayer_abort"; // Not implemented
public static const JPLAYER_EMPTIED:String = "jPlayer_emptied"; // Not implemented
public static const JPLAYER_STALLED:String = "jPlayer_stalled"; // Not implemented
public static const JPLAYER_PLAY:String = "jPlayer_play";
public static const JPLAYER_PAUSE:String = "jPlayer_pause";
public static const JPLAYER_LOADEDMETADATA:String = "jPlayer_loadedmetadata";
public static const JPLAYER_LOADEDDATA:String = "jPlayer_loadeddata"; // Not implemented
public static const JPLAYER_WAITING:String = "jPlayer_waiting"; // Not implemented (Done in: MP3)
public static const JPLAYER_PLAYING:String = "jPlayer_playing"; // Not implemented (Done in: MP3)
public static const JPLAYER_CANPLAY:String = "jPlayer_canplay"; // Not implemented (Done in: MP3)
public static const JPLAYER_CANPLAYTHROUGH:String = "jPlayer_canplaythrough"; // Not implemented (Done in: MP3)
public static const JPLAYER_SEEKING:String = "jPlayer_seeking";
public static const JPLAYER_SEEKED:String = "jPlayer_seeked";
public static const JPLAYER_TIMEUPDATE:String = "jPlayer_timeupdate";
public static const JPLAYER_ENDED:String = "jPlayer_ended";
public static const JPLAYER_RATECHANGE:String = "jPlayer_ratechange"; // Not implemented
public static const JPLAYER_DURATIONCHANGE:String = "jPlayer_durationchange"; // Not implemented (Done in: MP3)
public static const JPLAYER_VOLUMECHANGE:String = "jPlayer_volumechange"; // See JavaScript
// Events used internal to jPlayer's Flash.
public static const DEBUG_MSG:String = "debug_msg";
public var data:JplayerStatus;
public var msg:String = "";
public function JplayerEvent(type:String, data:JplayerStatus, msg:String = "", bubbles:Boolean = false, cancelable:Boolean = false) {
super(type, bubbles, cancelable);
this.data = data;
this.msg = msg;
}
public override function clone():Event {
return new JplayerEvent(type, data, msg, bubbles, cancelable);
}
public override function toString():String {
return formatToString("JplayerEvent", "type", "bubbles", "cancelable", "eventPhase", "data", "msg");
}
}
}

View File

@@ -0,0 +1,371 @@
/*
* jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Date: 15th December 2013
*/
package happyworm.jPlayer {
import flash.display.Sprite;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundLoaderContext;
import flash.media.SoundTransform;
import flash.net.URLRequest;
import flash.utils.Timer;
import flash.errors.IOError;
import flash.events.*;
public class JplayerMp3 extends Sprite {
private var mySound:Sound = new Sound();
private var myChannel:SoundChannel = new SoundChannel();
private var myContext:SoundLoaderContext = new SoundLoaderContext(3000, false);
private var myTransform:SoundTransform = new SoundTransform();
private var myRequest:URLRequest = new URLRequest();
private var timeUpdateTimer:Timer = new Timer(250, 0); // Matched to HTML event freq
private var progressTimer:Timer = new Timer(250, 0); // Matched to HTML event freq
private var seekingTimer:Timer = new Timer(100, 0); // Internal: How often seeking is checked to see if it is over.
private var playingTimer:Timer = new Timer(100, 0); // Internal: How often waiting/playing is checked.
private var waitingTimer:Timer = new Timer(3000, 0); // Internal: Check from loadstart to loadOpen. Generates a waiting event.
public var myStatus:JplayerStatus = new JplayerStatus();
public function JplayerMp3(volume:Number) {
timeUpdateTimer.addEventListener(TimerEvent.TIMER, timeUpdateHandler);
progressTimer.addEventListener(TimerEvent.TIMER, progressHandler);
seekingTimer.addEventListener(TimerEvent.TIMER, seekingHandler);
playingTimer.addEventListener(TimerEvent.TIMER, playingHandler);
waitingTimer.addEventListener(TimerEvent.TIMER, waitingHandler);
setVolume(volume);
}
public function setFile(src:String):void {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "setFile: " + src));
if(myStatus.isPlaying) {
myChannel.stop();
}
progressUpdates(false);
timeUpdates(false);
waitingTimer.stop();
try {
mySound.close();
} catch (err:IOError) {
// Occurs if the file is either yet to be opened or has finished downloading.
}
mySound = null;
mySound = new Sound();
mySound.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
mySound.addEventListener(Event.OPEN, loadOpen);
mySound.addEventListener(Event.COMPLETE, loadComplete);
myRequest = new URLRequest(src);
myStatus.reset();
myStatus.src = src;
myStatus.srcSet = true;
timeUpdateEvent();
}
public function clearFile():void {
setFile("");
myStatus.srcSet = false;
}
private function errorHandler(err:IOErrorEvent):void {
// MP3 player needs to stop progress and timeupdate events as they are started before the error occurs.
// NB: The MP4 player works differently and the error occurs before they are started.
progressUpdates(false);
timeUpdates(false);
myStatus.error(); // Resets status except the src, and it sets srcError property.
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ERROR, myStatus));
}
private function loadOpen(e:Event):void {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "loadOpen:"));
waitingTimer.stop();
myStatus.loading();
if(myStatus.playOnLoad) {
myStatus.playOnLoad = false; // Capture the flag
// this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus)); // So loadstart event happens before play event occurs.
play();
} else {
// this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus));
pause();
}
progressUpdates(true);
}
private function loadComplete(e:Event):void {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "loadComplete:"));
myStatus.loaded();
progressUpdates(false);
progressEvent();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADEDMETADATA, myStatus));
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_DURATIONCHANGE, myStatus));
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_CANPLAYTHROUGH, myStatus));
}
private function soundCompleteHandler(e:Event):void {
myStatus.pausePosition = 0;
myStatus.isPlaying = false;
timeUpdates(false);
timeUpdateEvent();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED, myStatus));
}
private function progressUpdates(active:Boolean):void {
// Using a timer rather than Flash's load progress event, because that event gave data at about 200Hz. The 10Hz timer is closer to HTML5 norm.
if(active) {
progressTimer.start();
} else {
progressTimer.stop();
}
}
private function progressHandler(e:TimerEvent):void {
progressEvent();
}
private function progressEvent():void {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressEvent:"));
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PROGRESS, myStatus));
}
private function timeUpdates(active:Boolean):void {
if(active) {
timeUpdateTimer.start();
playingTimer.start();
} else {
timeUpdateTimer.stop();
playingTimer.stop();
}
}
private function timeUpdateHandler(e:TimerEvent):void {
timeUpdateEvent();
}
private function timeUpdateEvent():void {
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_TIMEUPDATE, myStatus));
}
private function seeking(active:Boolean):void {
if(active) {
seekingEvent();
waitingEvent();
seekingTimer.start();
} else {
seekingTimer.stop();
}
}
private function seekingHandler(e:TimerEvent):void {
if(myStatus.pausePosition <= getDuration()) {
seekedEvent();
seeking(false);
if(myStatus.playOnSeek) {
myStatus.playOnSeek = false; // Capture the flag.
play();
}
} else if(myStatus.isLoaded && (myStatus.pausePosition > getDuration())) {
// Illegal seek time
seeking(false);
seekedEvent();
pause(0);
}
}
private function seekingEvent():void {
myStatus.isSeeking = true;
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKING, myStatus));
}
private function seekedEvent():void {
myStatus.isSeeking = false;
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKED, myStatus));
}
private function playingHandler(e:TimerEvent):void {
checkPlaying(false); // Without forcing playing event.
}
private function checkPlaying(force:Boolean):void {
if(mySound.isBuffering) {
if(!myStatus.isWaiting) {
waitingEvent();
}
} else {
if(myStatus.isWaiting || force) {
playingEvent();
}
}
}
private function waitingEvent():void {
myStatus.isWaiting = true;
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_WAITING, myStatus));
}
private function playingEvent():void {
myStatus.isWaiting = false;
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_CANPLAY, myStatus));
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAYING, myStatus));
}
private function waitingHandler(e:TimerEvent):void {
waitingTimer.stop();
if(myStatus.playOnLoad) {
waitingEvent();
}
}
public function load():Boolean {
if(myStatus.loadRequired()) {
myStatus.startingDownload();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus));
waitingTimer.start();
mySound.load(myRequest, myContext);
return true;
} else {
return false;
}
}
public function play(time:Number = NaN):Boolean {
var wasPlaying:Boolean = myStatus.isPlaying;
if(!isNaN(time) && myStatus.srcSet) {
if(myStatus.isPlaying) {
myChannel.stop();
myStatus.isPlaying = false;
}
myStatus.pausePosition = time;
}
if(myStatus.isStartingDownload) {
myStatus.playOnLoad = true; // Raise flag, captured in loadOpen()
return true;
} else if(myStatus.loadRequired()) {
myStatus.playOnLoad = true; // Raise flag, captured in loadOpen()
return load();
} else if((myStatus.isLoading || myStatus.isLoaded) && !myStatus.isPlaying) {
if(myStatus.isLoaded && myStatus.pausePosition > getDuration()) { // The time is invalid, ie., past the end.
myStatus.pausePosition = 0;
timeUpdates(false);
timeUpdateEvent();
if(wasPlaying) { // For when playing and then get a play(huge)
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus));
}
} else if(myStatus.pausePosition > getDuration()) {
myStatus.playOnSeek = true;
seeking(true);
} else {
myStatus.isPlaying = true; // Set immediately before playing. Could affects events.
myChannel = mySound.play(myStatus.pausePosition);
myChannel.soundTransform = myTransform;
myChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
timeUpdates(true);
if(!wasPlaying) {
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY, myStatus));
}
checkPlaying(true); // Force the playing event unless waiting, which will be dealt with in the playingTimer.
}
return true;
} else {
return false;
}
}
public function pause(time:Number = NaN):Boolean {
myStatus.playOnLoad = false; // Reset flag in case load/play issued immediately before this command, ie., before loadOpen() event.
myStatus.playOnSeek = false; // Reset flag in case play(time) issued before the command and is still seeking to time set.
var wasPlaying:Boolean = myStatus.isPlaying;
// To avoid possible loops with timeupdate and pause(time). A pause() does not have the problem.
var alreadyPausedAtTime:Boolean = false;
if(!isNaN(time) && myStatus.pausePosition == time) {
alreadyPausedAtTime = true;
}
if(myStatus.isPlaying) {
myStatus.isPlaying = false;
myChannel.stop();
if(myChannel.position > 0) { // Required otherwise a fast play then pause causes myChannel.position to equal zero and not the correct value. ie., When it happens leave pausePosition alone.
myStatus.pausePosition = myChannel.position;
}
}
if(!isNaN(time) && myStatus.srcSet) {
myStatus.pausePosition = time;
}
if(wasPlaying) {
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus));
}
if(myStatus.isStartingDownload) {
return true;
} else if(myStatus.loadRequired()) {
if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation.
return load();
} else {
return true; // Technically the pause(0) succeeded. ie., It did nothing, since nothing was required.
}
} else if(myStatus.isLoading || myStatus.isLoaded) {
if(myStatus.isLoaded && myStatus.pausePosition > getDuration()) { // The time is invalid, ie., past the end.
myStatus.pausePosition = 0;
} else if(myStatus.pausePosition > getDuration()) {
seeking(true);
}
timeUpdates(false);
// Need to be careful with timeupdate event, otherwise a pause in a timeupdate event can cause a loop.
// Neither pause() nor pause(time) will cause a timeupdate loop.
if(wasPlaying || !isNaN(time) && !alreadyPausedAtTime) {
timeUpdateEvent();
}
return true;
} else {
return false;
}
}
public function playHead(percent:Number):Boolean {
var time:Number = percent * getDuration() / 100;
if(myStatus.isPlaying || myStatus.playOnLoad || myStatus.playOnSeek) {
return play(time);
} else {
return pause(time);
}
}
public function setVolume(v:Number):void {
myStatus.volume = v;
myTransform.volume = v;
myChannel.soundTransform = myTransform;
}
private function updateStatusValues():void {
myStatus.seekPercent = 100 * getLoadRatio();
myStatus.currentTime = getCurrentTime();
myStatus.currentPercentRelative = 100 * getCurrentRatioRel();
myStatus.currentPercentAbsolute = 100 * getCurrentRatioAbs();
myStatus.duration = getDuration();
}
public function getLoadRatio():Number {
if((myStatus.isLoading || myStatus.isLoaded) && mySound.bytesTotal > 0) {
return mySound.bytesLoaded / mySound.bytesTotal;
} else if (myStatus.isLoaded && mySound.bytesLoaded > 0) {
return 1;
} else {
return 0;
}
}
public function getDuration():Number {
if(mySound.length > 0) {
return mySound.length;
} else {
return 0;
}
}
public function getCurrentTime():Number {
if(myStatus.isPlaying) {
return myChannel.position;
} else {
return myStatus.pausePosition;
}
}
public function getCurrentRatioRel():Number {
if((getDuration() > 0) && (getCurrentTime() <= getDuration())) {
return getCurrentTime() / getDuration();
} else {
return 0;
}
}
public function getCurrentRatioAbs():Number {
return getCurrentRatioRel() * getLoadRatio();
}
}
}

View File

@@ -0,0 +1,414 @@
/*
* jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Date: 29th January 2013
*/
package happyworm.jPlayer {
import flash.display.Sprite;
import flash.media.Video;
import flash.media.SoundTransform;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.utils.Timer;
import flash.events.NetStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.events.TimerEvent;
public class JplayerMp4 extends Sprite {
public var myVideo:Video = new Video();
private var myConnection:NetConnection;
private var myStream:NetStream;
private var myTransform:SoundTransform = new SoundTransform();
public var myStatus:JplayerStatus = new JplayerStatus();
private var timeUpdateTimer:Timer = new Timer(250, 0); // Matched to HTML event freq
private var progressTimer:Timer = new Timer(250, 0); // Matched to HTML event freq
private var seekingTimer:Timer = new Timer(100, 0); // Internal: How often seeking is checked to see if it is over.
public function JplayerMp4(volume:Number) {
myConnection = new NetConnection();
myConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
myConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
myVideo.smoothing = true;
this.addChild(myVideo);
timeUpdateTimer.addEventListener(TimerEvent.TIMER, timeUpdateHandler);
progressTimer.addEventListener(TimerEvent.TIMER, progressHandler);
seekingTimer.addEventListener(TimerEvent.TIMER, seekingHandler);
myStatus.volume = volume;
}
private function progressUpdates(active:Boolean):void {
if(active) {
progressTimer.start();
} else {
progressTimer.stop();
}
}
private function progressHandler(e:TimerEvent):void {
if(myStatus.isLoading) {
if(getLoadRatio() == 1) { // Close as can get to a loadComplete event since client.onPlayStatus only works with FMS
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressHandler: loadComplete"));
myStatus.loaded();
progressUpdates(false);
}
}
progressEvent();
}
private function progressEvent():void {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressEvent:"));
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PROGRESS, myStatus));
}
private function timeUpdates(active:Boolean):void {
if(active) {
timeUpdateTimer.start();
} else {
timeUpdateTimer.stop();
}
}
private function timeUpdateHandler(e:TimerEvent):void {
timeUpdateEvent();
}
private function timeUpdateEvent():void {
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_TIMEUPDATE, myStatus));
}
private function seeking(active:Boolean):void {
if(active) {
if(!myStatus.isSeeking) {
seekingEvent();
}
seekingTimer.start();
} else {
if(myStatus.isSeeking) {
seekedEvent();
}
seekingTimer.stop();
}
}
private function seekingHandler(e:TimerEvent):void {
if(getSeekTimeRatio() <= getLoadRatio()) {
seeking(false);
if(myStatus.playOnSeek) {
myStatus.playOnSeek = false; // Capture the flag.
play(myStatus.pausePosition); // Must pass time or the seek time is never set.
} else {
pause(myStatus.pausePosition); // Must pass time or the stream.time is read.
}
} else if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) {
// Illegal seek time
seeking(false);
pause(0);
}
}
private function seekingEvent():void {
myStatus.isSeeking = true;
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKING, myStatus));
}
private function seekedEvent():void {
myStatus.isSeeking = false;
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKED, myStatus));
}
private function netStatusHandler(e:NetStatusEvent):void {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "netStatusHandler: '" + e.info.code + "'"));
switch(e.info.code) {
case "NetConnection.Connect.Success":
connectStream();
break;
case "NetStream.Play.Start":
// This event code occurs once, when the media is opened. Equiv to loadOpen() in mp3 player.
myStatus.loading();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus));
progressUpdates(true);
// See onMetaDataHandler() for other condition, since duration is vital.
break;
case "NetStream.Play.Stop":
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "NetStream.Play.Stop: getDuration() - getCurrentTime() = " + (getDuration() - getCurrentTime())));
// Check if media is at the end (or close) otherwise this was due to download bandwidth stopping playback. ie., Download is not fast enough.
if(Math.abs(getDuration() - getCurrentTime()) < 150) { // Testing found 150ms worked best for M4A files, where playHead(99.9) caused a stuck state due to firing with ~116ms left to play.
endedEvent();
}
break;
case "NetStream.Seek.InvalidTime":
// Used for capturing invalid set times and clicks on the end of the progress bar.
endedEvent();
break;
case "NetStream.Play.StreamNotFound":
myStatus.error(); // Resets status except the src, and it sets srcError property.
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ERROR, myStatus));
break;
}
// "NetStream.Seek.Notify" event code is not very useful. It occurs after every seek(t) command issued and does not appear to wait for the media to be ready.
}
private function endedEvent():void {
var wasPlaying:Boolean = myStatus.isPlaying;
pause(0);
timeUpdates(false);
timeUpdateEvent();
if(wasPlaying) {
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED, myStatus));
}
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "securityErrorHandler."));
}
private function connectStream():void {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "connectStream."));
var customClient:Object = new Object();
customClient.onMetaData = onMetaDataHandler;
// customClient.onPlayStatus = onPlayStatusHandler; // According to the forums and my tests, onPlayStatus only works with FMS (Flash Media Server).
myStream = null;
myStream = new NetStream(myConnection);
myStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
myStream.client = customClient;
myVideo.attachNetStream(myStream);
setVolume(myStatus.volume);
myStream.play(myStatus.src);
}
public function setFile(src:String):void {
if(myStream != null) {
myStream.close();
}
myVideo.clear();
progressUpdates(false);
timeUpdates(false);
myStatus.reset();
myStatus.src = src;
myStatus.srcSet = true;
timeUpdateEvent();
}
public function clearFile():void {
setFile("");
myStatus.srcSet = false;
}
public function load():Boolean {
if(myStatus.loadRequired()) {
myStatus.startingDownload();
myConnection.connect(null);
return true;
} else {
return false;
}
}
public function play(time:Number = NaN):Boolean {
var wasPlaying:Boolean = myStatus.isPlaying;
if(!isNaN(time) && myStatus.srcSet) {
if(myStatus.isPlaying) {
myStream.pause();
myStatus.isPlaying = false;
}
myStatus.pausePosition = time;
}
if(myStatus.isStartingDownload) {
myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler()
return true;
} else if(myStatus.loadRequired()) {
myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler()
return load();
} else if((myStatus.isLoading || myStatus.isLoaded) && !myStatus.isPlaying) {
if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { // The time is invalid, ie., past the end.
myStream.pause(); // Since it is playing by default at this point.
myStatus.pausePosition = 0;
myStream.seek(0);
timeUpdates(false);
timeUpdateEvent();
if(wasPlaying) { // For when playing and then get a play(huge)
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus));
}
} else if(getSeekTimeRatio() > getLoadRatio()) { // Use an estimate based on the downloaded amount
myStatus.playOnSeek = true;
seeking(true);
myStream.pause(); // Since it is playing by default at this point.
} else {
if(!isNaN(time)) { // Avoid using seek() when it is already correct.
myStream.seek(myStatus.pausePosition/1000); // Since time is in ms and seek() takes seconds
}
myStatus.isPlaying = true; // Set immediately before playing. Could affects events.
myStream.resume();
timeUpdates(true);
if(!wasPlaying) {
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY, myStatus));
}
}
return true;
} else {
return false;
}
}
public function pause(time:Number = NaN):Boolean {
myStatus.playOnLoad = false; // Reset flag in case load/play issued immediately before this command, ie., before onMetadata() event.
myStatus.playOnSeek = false; // Reset flag in case play(time) issued before the command and is still seeking to time set.
var wasPlaying:Boolean = myStatus.isPlaying;
// To avoid possible loops with timeupdate and pause(time). A pause() does not have the problem.
var alreadyPausedAtTime:Boolean = false;
if(!isNaN(time) && myStatus.pausePosition == time) {
alreadyPausedAtTime = true;
}
// Need to wait for metadata to load before ever issuing a pause. The metadata handler will call this function if needed, when ready.
if(myStream != null && myStatus.metaDataReady) { // myStream is a null until the 1st media is loaded. ie., The 1st ever setMedia being followed by a pause() or pause(t).
myStream.pause();
}
if(myStatus.isPlaying) {
myStatus.isPlaying = false;
myStatus.pausePosition = myStream.time * 1000;
}
if(!isNaN(time) && myStatus.srcSet) {
myStatus.pausePosition = time;
}
if(wasPlaying) {
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus));
}
if(myStatus.isStartingDownload) {
return true;
} else if(myStatus.loadRequired()) {
if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation.
return load();
} else {
return true; // Technically the pause(0) succeeded. ie., It did nothing, since nothing was required.
}
} else if(myStatus.isLoading || myStatus.isLoaded) {
if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { // The time is invalid, ie., past the end.
myStatus.pausePosition = 0;
myStream.seek(0);
seekedEvent(); // Deals with seeking effect when using setMedia() then pause(huge). NB: There is no preceeding seeking event.
} else if(!isNaN(time)) {
if(getSeekTimeRatio() > getLoadRatio()) { // Use an estimate based on the downloaded amount
seeking(true);
} else {
if(myStatus.metaDataReady) { // Otherwise seek(0) will stop the metadata loading.
myStream.seek(myStatus.pausePosition/1000);
}
}
}
timeUpdates(false);
// Need to be careful with timeupdate event, otherwise a pause in a timeupdate event can cause a loop.
// Neither pause() nor pause(time) will cause a timeupdate loop.
if(wasPlaying || !isNaN(time) && !alreadyPausedAtTime) {
timeUpdateEvent();
}
return true;
} else {
return false;
}
}
public function playHead(percent:Number):Boolean {
var time:Number = percent * getDuration() * getLoadRatio() / 100;
if(myStatus.isPlaying || myStatus.playOnLoad || myStatus.playOnSeek) {
return play(time);
} else {
return pause(time);
}
}
public function setVolume(v:Number):void {
myStatus.volume = v;
myTransform.volume = v;
if(myStream != null) {
myStream.soundTransform = myTransform;
}
}
private function updateStatusValues():void {
myStatus.seekPercent = 100 * getLoadRatio();
myStatus.currentTime = getCurrentTime();
myStatus.currentPercentRelative = 100 * getCurrentRatioRel();
myStatus.currentPercentAbsolute = 100 * getCurrentRatioAbs();
myStatus.duration = getDuration();
}
public function getLoadRatio():Number {
if((myStatus.isLoading || myStatus.isLoaded) && myStream.bytesTotal > 0) {
return myStream.bytesLoaded / myStream.bytesTotal;
} else if (myStatus.isLoaded && myStream.bytesLoaded > 0) {
return 1;
} else {
return 0;
}
}
public function getDuration():Number {
return myStatus.duration; // Set from meta data.
}
public function getCurrentTime():Number {
if(myStatus.isPlaying) {
return myStream.time * 1000;
} else {
return myStatus.pausePosition;
}
}
public function getCurrentRatioRel():Number {
if((getLoadRatio() > 0) && (getCurrentRatioAbs() <= getLoadRatio())) {
return getCurrentRatioAbs() / getLoadRatio();
} else {
return 0;
}
}
public function getCurrentRatioAbs():Number {
if(getDuration() > 0) {
return getCurrentTime() / getDuration();
} else {
return 0;
}
}
public function getSeekTimeRatio():Number {
if(getDuration() > 0) {
return myStatus.pausePosition / getDuration();
} else {
return 1;
}
}
public function onMetaDataHandler(info:Object):void { // Used in connectStream() in myStream.client object.
// This event occurs when jumping to the start of static files! ie., seek(0) will cause this event to occur.
if(!myStatus.metaDataReady) {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "onMetaDataHandler: " + info.duration + " | " + info.width + "x" + info.height));
myStatus.metaDataReady = true; // Set flag so that this event only effects jPlayer the 1st time.
myStatus.metaData = info;
myStatus.duration = info.duration * 1000; // Only available via Meta Data.
if(info.width != undefined) {
myVideo.width = myStatus.videoWidth = info.width;
}
if(info.height != undefined) {
myVideo.height = myStatus.videoHeight = info.height;
}
if(myStatus.playOnLoad) {
myStatus.playOnLoad = false; // Capture the flag
if(myStatus.pausePosition > 0 ) { // Important for setMedia followed by play(time).
play(myStatus.pausePosition);
} else {
play(); // Not always sending pausePosition avoids the extra seek(0) for a normal play() command.
}
} else {
pause(myStatus.pausePosition); // Always send the pausePosition. Important for setMedia() followed by pause(time). Deals with not reading stream.time with setMedia() and play() immediately followed by stop() or pause(0)
}
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADEDMETADATA, myStatus));
} else {
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "onMetaDataHandler: Already read (NO EFFECT)"));
}
}
}
}

View File

@@ -0,0 +1,992 @@
/*
* jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Robert M. Hall
* Date: 20th November 2014
* Based on JplayerMp4.as with modifications for rtmp
*/
package happyworm.jPlayer
{
import flash.display.Sprite;
import flash.media.Video;
import flash.media.SoundTransform;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.net.Responder;
import flash.utils.Timer;
import flash.utils.getTimer;
import flash.events.NetStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.events.TimerEvent;
import flash.events.ErrorEvent;
import flash.events.UncaughtErrorEvent;
import flash.utils.clearInterval;
import flash.utils.setInterval;
import happyworm.jPlayer.ConnectManager;
public class JplayerRtmp extends Sprite
{
public var myVideo:Video = new Video;
private var myConnection:NetConnection;
private var myStream:NetStream;
public var responder:Responder;
private var streamName:String;
private var connectString:Object;
private var firstTime:Boolean = true;
private var myTransform:SoundTransform = new SoundTransform ;
public var myStatus:JplayerStatus = new JplayerStatus ;
private var ConnMgr:ConnectManager=new ConnectManager();
private var timeUpdateTimer:Timer = new Timer(250,0);// Matched to HTML event freq
private var progressTimer:Timer = new Timer(250,0);// Matched to HTML event freq
private var seekingTimer:Timer = new Timer(100,0);// Internal: How often seeking is checked to see if it is over.
private var startBuffer:Number = 3;
private var maxBuffer:Number = 12;
public function JplayerRtmp(volume:Number)
{
myConnection = new NetConnection ;
myConnection.client = this;
// Moved the netconnection negotiation into the ConnectManager.as class - not needed for initial connection
// may need to add eventHandler back in for errors only or just dispatch from the ConnectManager..revisit...
// myConnection.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);
// myConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR,securityErrorHandler);
myVideo.smoothing = true;
this.addChild(myVideo);
timeUpdateTimer.addEventListener(TimerEvent.TIMER,timeUpdateHandler);
progressTimer.addEventListener(TimerEvent.TIMER,progressHandler);
seekingTimer.addEventListener(TimerEvent.TIMER,seekingHandler);
myStatus.volume = volume;
addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);
}
private function uncaughtErrorHandler(event:UncaughtErrorEvent):void
{
trace("UNCAUGHT ERROR - try loading again");
if (event.error is Error)
{
var error:Error = event.error as Error;
trace(error);
// do something with the error
}
else if (event.error is ErrorEvent)
{
var errorEvent:ErrorEvent = event.error as ErrorEvent;
// do something with the error
trace(errorEvent);
}
else
{
// a non-Error, non-ErrorEvent type was thrown and uncaught
}
load();
}
private function progressUpdates(active:Boolean):void
{
if (active)
{
progressTimer.start();
}
else
{
progressTimer.stop();
}
}
private function progressHandler(e:TimerEvent):void
{
if (myStatus.isLoading)
{
if ((getLoadRatio() == 1))
{// Close as can get to a loadComplete event since client.onPlayStatus only works with FMS
this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"progressHandler: loadComplete"));
myStatus.loaded();
progressUpdates(false);
}
}
progressEvent();
}
private function progressEvent():void
{
// temporarily disabled progress event dispatching - not really needed for rtmp
//this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"progressEvent:"));
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PROGRESS,myStatus));
}
private function timeUpdates(active:Boolean):void
{
if (active)
{
timeUpdateTimer.start();
}
else
{
timeUpdateTimer.stop();
}
}
private function timeUpdateHandler(e:TimerEvent):void
{
timeUpdateEvent();
}
private function timeUpdateEvent():void
{
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_TIMEUPDATE,myStatus));
}
private function seeking(active:Boolean):void
{
if (active)
{
if (! myStatus.isSeeking)
{
seekingEvent();
}
seekingTimer.start();
}
else
{
if (myStatus.isSeeking)
{
seekedEvent();
}
seekingTimer.stop();
}
}
private function seekingHandler(e:TimerEvent):void
{
if ((getSeekTimeRatio() <= getLoadRatio()))
{
seeking(false);
if (myStatus.playOnSeek)
{
myStatus.playOnSeek = false;// Capture the flag.
play(myStatus.pausePosition);// Must pass time or the seek time is never set.
}
else
{
pause(myStatus.pausePosition);// Must pass time or the stream.time is read.
}
}
else if (myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration)
{
// Illegal seek time
seeking(false);
pause(0);
}
}
private function seekingEvent():void
{
myStatus.isSeeking = true;
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKING,myStatus));
}
private function seekedEvent():void
{
myStatus.isSeeking = false;
updateStatusValues();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKED,myStatus));
}
private function netStatusHandler(e:NetStatusEvent):void
{
trace(("netStatusHandler: " + e.info.code));
//this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"netStatusHandler: '" + e.info.code + "'"));
//trace("BEFORE: bufferTime: "+myStream.bufferTime+" - bufferTimeMax: "+myStream.bufferTimeMax);
switch (e.info.code)
{
case "NetConnection.Connect.Success" :
// connectStream(); // This method did not do anything sensible anyway.
// Do not think this case occurs. This was for the static file connection.
// Which now seems to be handled by the Connection Manager.
break;
case "NetStream.Buffer.Full":
if(connectString.streamTYPE == "LIVE") {
myStream.bufferTime = startBuffer;
} else {
myStream.bufferTime = maxBuffer;
}
break;
case "NetStream.Buffer.Flush":
myStream.bufferTime = startBuffer;
break;
case "NetStream.Buffer.Empty":
myStream.bufferTime = startBuffer;
break;
case "NetStream.Seek.Notify":
myStream.bufferTime = startBuffer;
break;
case "NetStream.Play.Start" :
if (firstTime) {
firstTime = false; // Capture flag
myStatus.loading();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART,myStatus));
// NB: With MP4 player both audio and video types get connected to myVideo.
// NB: Had believed it was important for the audio too, otherwise what plays it?
if(videoBinding) {
myVideo.attachNetStream(myStream);
}
setVolume(myStatus.volume);
// Really the progress event just needs to be generated once, and should probably happen before now.
progressUpdates(true);
// This is an ASSUMPTION! Made it so that the default GUI worked.
// Hence why this part should be refactored.
// Lots of commands sequences after setMedia would be corrupted by this assumption.
// Bascally, we assume that after a setMedia, you will play it.
// Doing setMedia and pause(15) cause the flag to be set incorrectly and the GUI locks up.
myStatus.isPlaying = true; // Should be handled elsewhere.
}
// Under RTMP, this event code occurs every time the media starts playing and when a new position is seeked to, even when paused.
// Since under RTMP the event behaviour is quite different, believe a refactor is best here.
// ie., Under RTMP we should be able to know a lot more info about the stream.
// See onMetaDataHandler() for other condition, since duration is vital.
// See onResult() response handler too.
// Appears to be some duplication between onMetaDataHandler() and onResult(), along with a race between them occuring.
break;
case "NetStream.Play.UnpublishNotify":
myStream.bufferTime = startBuffer; // was 3
case "NetStream.Play.Stop" :
myStream.bufferTime = startBuffer; // was 3
//this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"NetStream.Play.Stop: getDuration() - getCurrentTime() = " + (getDuration() - getCurrentTime())));
// Check if media is at the end (or close) otherwise this was due to download bandwidth stopping playback. ie., Download is not fast enough.
if (Math.abs((getDuration() - getCurrentTime())) < 150)
{// Testing found 150ms worked best for M4A files, where playHead(99.9) caused a stuck state due to firing with ~116ms left to play.
//endedEvent();
}
break;
case "NetStream.Seek.InvalidTime" :
// Used for capturing invalid set times and clicks on the end of the progress bar.
endedEvent();
break;
case "NetStream.Play.StreamNotFound" :
myStatus.error();
// Resets status except the src, and it sets srcError property.;
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ERROR,myStatus));
break;
}
//trace("AFTER: bufferTime: "+myStream.bufferTime+" - bufferTimeMax: "+myStream.bufferTimeMax);
// "NetStream.Seek.Notify" event code is not very useful. It occurs after every seek(t) command issued and does not appear to wait for the media to be ready.
}
private function endedEvent():void
{
trace("ENDED STREAM EVENT");
var wasPlaying:Boolean = myStatus.isPlaying;
// timeUpdates(false);
// timeUpdateEvent();
pause(0);
if (wasPlaying)
{
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED,myStatus));
}
}
private function securityErrorHandler(event:SecurityErrorEvent):void
{
//this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"securityErrorHandler."));
}
public function connectStream():void
{
trace("CONNECTING");
//this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"connectStream."));
//this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_CANPLAY,myStatus));
timeUpdates(true);
progressUpdates(true);
//myVideo.attachNetStream(myStream);
//setVolume(myStatus.volume);
}
private function onResult(result:Object):void
{
trace("OnResult EVENT FIRED!");
myStatus.duration = parseFloat(result.toString()) * 1000;
trace((("The stream length is " + result) + " seconds"));
if(!myConnection.connected) {
load();
} else {
//this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_CANPLAY,myStatus,"Rockit!"));
//myStatus.loaded();
//myStatus.isPlaying=true;
if (! myStatus.metaDataReady)
{
//this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"onMetaDataHandler: " + myStatus.duration));
// Allow multiple onResult Handlers to affect size. As per PR #131 and #98.
// myStatus.metaDataReady = true;
/*var info:Object = new Object();
info.duration=myStatus.duration
info.width=undefined;
info.height=undefined;
myStatus.metaData = info;
*/
if (myStatus.playOnLoad)
{
myStatus.playOnLoad = false;// Capture the flag
if (myStatus.pausePosition > 0)
{// Important for setMedia followed by play(time).
play(myStatus.pausePosition);
}
else
{
play();// Not always sending pausePosition avoids the extra seek(0) for a normal play() command.
}
}
else
{
pause(myStatus.pausePosition);// Always send the pausePosition. Important for setMedia() followed by pause(time). Deals with not reading stream.time with setMedia() and play() immediately followed by stop() or pause(0)
}
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADEDMETADATA,myStatus));
}
else
{
//this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"onMetaDataHandler: Already read (NO EFFECT)"));
}
myStream.play(streamName);
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY,myStatus));
// timeUpdates(false);
}
}
private var overRideConnect:Boolean=false;
public function doneYet():void {
if(!myConnection.connected) {
// try again
ConnMgr.stopAll(true);
overRideConnect=true;
trace("Connected: "+myConnection.connected+" - "+myStatus.loadRequired());
load();
}
}
private var videoBinding:Boolean=false;
public function setFile(src:String,videoSupport:Boolean=false):void
{
// videoSupport turns on/off video - by default no video, audio only
videoBinding=videoSupport;
/* Dont close the stream or netconnection here anymore so we can recycle if host/appname are the same
if ((myStream != null))
{
myStream.close();
myConnection.close();
}
*/
if(ConnMgr.getNegotiating() == true) {
//ConnMgr.stopAll();
ConnMgr.setNegotiating(false);
}
myVideo.clear();
progressUpdates(false);
timeUpdates(false);
myStatus.reset();
myStatus.src = src;
myStatus.srcSet = true;
firstTime = true;
//myStatus.loaded();
if(src != "") {
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_CANPLAY,myStatus));
}
//timeUpdateEvent();
}
public function shutDownNcNs():void {
trace("Connections Closed");
timeUpdates(false);
progressUpdates(false);
myStream.close();
myConnection.close();
myStatus.reset();
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED,myStatus));
}
public function clearFile():void
{
if (myStream != null)
{
myStream.close();
// Dont close the netConnection here any longer, as we may recycle it later
// may need an extra way to close manually if switching media types after an rtmp session - revisit
// myConnection.close();
myStatus.reset();
}
setFile("");
myStatus.srcSet = false;
}
public function parseRTMPsrcConnect(rtmpSrc:String):Object
{
// rtmp://cp76372.live.edgefcs.net/live/Flash1Office@60204
var appName:String = "";
var streamFileName:String = "";
var startIndex:uint = 2 + rtmpSrc.indexOf("//");
var streamTYPE:String = "recorded";
var host:String = rtmpSrc.substr(startIndex);
var port:String = "";
host = host.substr(0,host.indexOf("/"));
var endHost:Number = startIndex + host.length + 1;
// See if there is a host port specified
if(host.indexOf(":") != -1) {
port = host.substr(host.indexOf(":")+1);
host = host.substr(0,host.indexOf(":"));
}
// Akamai specific live streams
if (rtmpSrc.lastIndexOf("/live/") != -1)
{
trace("LIVE!");
appName = rtmpSrc.substring(endHost,rtmpSrc.lastIndexOf("/live/") + 6);
streamFileName = rtmpSrc.substr(rtmpSrc.lastIndexOf("/live/") + 6);
streamTYPE="LIVE";
} else {
streamTYPE="RECORDED";
}
// Mp3 streams with standard appname/no instance name, mp3: prefix
if (rtmpSrc.indexOf("mp3:") != -1) {
appName = rtmpSrc.substring(endHost,rtmpSrc.indexOf("mp3:"));
streamFileName = rtmpSrc.substr(rtmpSrc.indexOf("mp3:"));
if ( streamFileName.indexOf("?") != -1 ) {
var tmp:String = streamFileName.substring(streamFileName.indexOf("?")) ;
streamFileName = streamFileName.substr(0,streamFileName.indexOf("?")) + encodeURI(tmp) ;
} else {
streamFileName = streamFileName.substr(0,streamFileName.length - 4);
}
}
// rtmp://cp83813.edgefcs.net/ondemand/rob_hall/bruce_campbell_oldspice.flv
// Mp4 streams with standard appname/no instance name, mp4: prefix
if (rtmpSrc.indexOf("mp4:") != -1) {
appName = rtmpSrc.substring(endHost,rtmpSrc.indexOf("mp4:"));
streamFileName = rtmpSrc.substr(rtmpSrc.indexOf("mp4:"));
if ( streamFileName.indexOf("?") != -1 ) {
var tmpV:String = streamFileName.substring(streamFileName.indexOf("?")) ;
streamFileName = streamFileName.substr(0,streamFileName.indexOf("?")) + encodeURI(tmpV) ;
} else {
streamFileName = streamFileName.substr(0,streamFileName.length - 4);
}
}
// .f4v streams with standard appname/no instance name, .flv extension
if (rtmpSrc.indexOf(".flv") != -1)
{
// allow use of ^ in rtmp string to indicate break point for an appname or instance name that
// contains a / in it where it would require multiple connection attempts or manual configuratiom
// of the appname/instancename
var endApp:Number=0;
if(rtmpSrc.indexOf("^") != -1) {
endApp=rtmpSrc.indexOf("^");
rtmpSrc.replace("^", "/");
} else {
endApp = rtmpSrc.indexOf("/",endHost);
}
appName = rtmpSrc.substring(endHost,endApp) + "/";
streamFileName = rtmpSrc.substr(endApp+1);
}
if(port=="") {
port="MULTI";
}
//rtmp, rtmpt, rtmps, rtmpe, rtmpte
trace(("\n\n*** HOST: " + host));
trace(("*** PORT: " + port));
trace(("*** APPNAME: " + appName));
trace(("*** StreamName: " + streamFileName));
var streamParts:Object = new Object;
streamParts.streamTYPE=streamTYPE;
streamParts.appName = appName;
streamParts.streamFileName = streamFileName;
streamParts.hostName = host;
streamName = streamFileName;
return streamParts;
}
public function load():Boolean
{
//trace("LOAD: "+myStatus.src);
if (myStatus.loadRequired() || overRideConnect==true)
{
overRideConnect=false;
myStatus.startingDownload();
var lastAppName:String;
var lastHostName:String;
try{
// we do a try, as these properties might not exist yet
if(connectString.appName != "" && connectString.appName != undefined) {
trace("PREVIOUS APP/HOST INFO AVAILABLE");
lastAppName = connectString.appName;
lastHostName = connectString.hostName;
trace("LAST: "+lastAppName,lastHostName);
}
} catch (error:Error) {
//trace("*** Caught an error condition: "+error);
}
connectString = parseRTMPsrcConnect(myStatus.src);
trace("**** LOAD :: CONNECT SOURCE: " +connectString.hostName +" "+ connectString.appName);
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_WAITING, myStatus));
if((connectString.appName == lastAppName && connectString.hostName == lastHostName) && (myConnection.connected)) {
// recycle the netConnection
trace("RECYCLING NETCONNECTION");
if ((myStream != null))
{
myStream.close();
}
connectStream();
onBWDone(null,myConnection);
} else {
// myConnection.connect(connectString.appName);
trace("NEW NetConnection Negotiation");
if ((myStream != null))
{
myStream.close();
myConnection.close();
}
ConnMgr.stopAll(true);
ConnMgr.negotiateConnect(this,connectString.hostName,connectString.appName);
}
trace("**** LOAD2 :: CONNECT SOURCE: " +connectString.hostName +" "+ connectString.appName);
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_WAITING, myStatus));
return true;
}
else
{
return false;
}
}
public function onFCUnsubscribe(info:Object):void
{
trace(("onFCUnSubscribe worked" + info));
}
public function onFCSubscribe(info:Object):void
{
trace(("onFCSubscribe worked" + info));
}
public function onBWDone(info:Object,nc:NetConnection):void
{
if(nc.connected) {
myConnection=nc;
trace(((("onBWDone " + info) + " :: ") + myStatus.src));
var customClient:Object = new Object ;
customClient.onMetaData = onMetaDataHandler;
customClient.onPlayStatus = onPlayStatusHandler;// According to the forums and my tests, onPlayStatus only works with FMS (Flash Media Server).
myStream = null;
myStream = new NetStream(myConnection);
myStream.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);
myStream.client = customClient;
if(connectString.streamTYPE == "LIVE") {
myStream.bufferTime = 3; // was 3
myStream.bufferTimeMax = 24;
startBuffer = 3;
maxBuffer = 12;
} else {
myStream.bufferTime = .2; // was 3
myStream.bufferTimeMax = 0;
startBuffer = .2;
maxBuffer = 12;
}
//streamName="";
//var connectString:Object = parseRTMPsrcConnect(myStatus.src);
//streamName=connectString.streamFileName;
responder = new Responder(onResult);
myConnection.call("getStreamLength",responder,streamName);
} else {
connectStream();
}
trace("PLAY SOURCE: "+connectString);
}
public function play(time:Number = NaN):Boolean {
//trace("PLAY: "+time+" - isPlaying: "+myStatus.isPlaying +" - myStatus.isStartingDownload:"+myStatus.isStartingDownload);
var wasPlaying:Boolean = myStatus.isPlaying;
if(!isNaN(time) && myStatus.srcSet) {
if(myStatus.isPlaying) {
myStream.pause();
myStatus.isPlaying = false;
}
myStatus.pausePosition = time;
}
if(myStatus.isStartingDownload) {
myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler()
return true;
} else if(myStatus.loadRequired()) {
myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler()
return load();
} else if((myStatus.isLoading || myStatus.isLoaded) && !myStatus.isPlaying) {
if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration && connectString.streamTYPE != "LIVE") { // The time is invalid, ie., past the end.
myStream.pause(); // Since it is playing by default at this point.
myStatus.pausePosition = 0;
trace("SEEKER!");
myStream.seek(0);
timeUpdates(false);
timeUpdateEvent();
if(wasPlaying) { // For when playing and then get a play(huge)
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus));
}
} else if(getSeekTimeRatio() > getLoadRatio()) { // Use an estimate based on the downloaded amount
myStatus.playOnSeek = true;
seeking(true);
trace("SEEKER PAUSE!");
myStream.pause(); // Since it is playing by default at this point.
} else {
if(!isNaN(time)) { // Avoid using seek() when it is already correct.
trace("SEEKER3");
myStream.seek(myStatus.pausePosition/1000); // Since time is in ms and seek() takes seconds
}
myStatus.isPlaying = true; // Set immediately before playing. Could affects events.
trace("SHOULD GET RESUME!");
myStream.resume();
timeUpdates(true);
if(!wasPlaying) {
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY, myStatus));
}
}
return true;
} else {
return false;
}
}
public function pause(time:Number=NaN):Boolean
{
//trace("PAUSE: "+time);
myStatus.playOnLoad = false;// Reset flag in case load/play issued immediately before this command, ie., before onMetadata() event.
myStatus.playOnSeek = false;// Reset flag in case play(time) issued before the command and is still seeking to time set.
var wasPlaying:Boolean = myStatus.isPlaying;
// To avoid possible loops with timeupdate and pause(time). A pause() does not have the problem.
var alreadyPausedAtTime:Boolean = false;
if(!isNaN(time) && myStatus.pausePosition == time) {
alreadyPausedAtTime = true;
}
trace("!isNaN: "+!isNaN(time) +" isNaN: "+isNaN(time));
// Need to wait for metadata to load before ever issuing a pause. The metadata handler will call this function if needed, when ready.
if (((myStream != null) && myStatus.metaDataReady))
{// myStream is a null until the 1st media is loaded. ie., The 1st ever setMedia being followed by a pause() or pause(t).
if(connectString.streamTYPE == "LIVE") {
trace("PAUSING LIVE");
myStream.play(false)
} else {
trace("PAUSING RECORDED");
myStream.pause();
}
}
if (myStatus.isPlaying)
{
myStatus.isPlaying = false;
myStatus.pausePosition = myStream.time * 1000;
}
if (! isNaN(time) && myStatus.srcSet)
{
myStatus.pausePosition = time;
}
if (wasPlaying)
{
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE,myStatus));
}
if (myStatus.isStartingDownload)
{
return true;
}
else if (myStatus.loadRequired())
{
if ((time > 0))
{// We do not want the stop() command, which does pause(0), causing a load operation.
return load();
}
else
{
return true;// Technically the pause(0) succeeded. ie., It did nothing, since nothing was required.
}
}
else if (myStatus.isLoading || myStatus.isLoaded)
{
if (myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration && connectString.streamTYPE != "LIVE" )
{// The time is invalid, ie., past the end.
myStatus.pausePosition = 0;
trace("GOT HERE!");
myStream.seek(0);
seekedEvent();// Deals with seeking effect when using setMedia() then pause(huge). NB: There is no preceeding seeking event.
}
else if (! isNaN(time))
{
if ((getSeekTimeRatio() > getLoadRatio()))
{// Use an estimate based on the downloaded amount
seeking(true);
}
else
{
if (myStatus.metaDataReady && connectString.streamTYPE != "LIVE")
{// Otherwise seek(0) will stop the metadata loading.
trace("GOT HERE TOO!");
myStream.seek(myStatus.pausePosition / 1000);
}
}
}
timeUpdates(false);
// Need to be careful with timeupdate event, otherwise a pause in a timeupdate event can cause a loop.
// Neither pause() nor pause(time) will cause a timeupdate loop.
if(wasPlaying || !isNaN(time) && !alreadyPausedAtTime) {
timeUpdateEvent();
}
return true;
}
else
{
return false;
}
}
public function playHead(percent:Number):Boolean
{
var time:Number = percent * getDuration() * getLoadRatio() / 100;
if (myStatus.isPlaying || myStatus.playOnLoad || myStatus.playOnSeek)
{
return play(time);
}
else
{
return pause(time);
}
}
public function setVolume(v:Number):void
{
myStatus.volume = v;
myTransform.volume = v;
if ((myStream != null))
{
myStream.soundTransform = myTransform;
}
}
private function updateStatusValues():void
{
//myStatus.seekPercent = 100 * getLoadRatio();
myStatus.seekPercent = 100;
myStatus.currentTime = getCurrentTime();
myStatus.currentPercentRelative = 100 * getCurrentRatioRel();
myStatus.currentPercentAbsolute = 100 * getCurrentRatioAbs();
myStatus.duration = getDuration();
}
public function getLoadRatio():Number
{
return 1;
/*trace("LoadRatio:"+myStream.bytesLoaded, myStream.bytesTotal);
if((myStatus.isLoading || myStatus.isLoaded) && myStream.bytesTotal > 0) {
return myStream.bytesLoaded / myStream.bytesTotal;
} else if (myStatus.isLoaded && myStream.bytesLoaded > 0) {
return 1;
} else {
return 0;
}
*/
}
public function getDuration():Number
{
return myStatus.duration;// Set from meta data.
}
public function getCurrentTime():Number
{
if (myStatus.isPlaying)
{
//trace(myStream.time * 1000);
return myStream.time * 1000; // was +1000
}
else
{
return myStatus.pausePosition;
}
}
public function getCurrentRatioRel():Number
{
if ((getCurrentRatioAbs() <= getLoadRatio()))
{
//if((getLoadRatio() > 0) && (getCurrentRatioAbs() <= getLoadRatio())) {
return getCurrentRatioAbs() / getLoadRatio();
}
else
{
return 0;
}
}
public function getCurrentRatioAbs():Number
{
if ((getDuration() > 0))
{
return getCurrentTime() / getDuration();
}
else
{
return 0;
}
}
public function getSeekTimeRatio():Number
{
if ((getDuration() > 0))
{
return myStatus.pausePosition / getDuration();
}
else
{
return 1;
}
}
public function onPlayStatusHandler(infoObject:Object):void
{
trace((("OnPlayStatusHandler called: (" + getTimer()) + " ms)"));
for (var prop:* in infoObject)
{
trace(((("\t" + prop) + ":\t") + infoObject[prop]));
}
if (infoObject.code == "NetStream.Play.Complete")
{
endedEvent();
}
}
public function onMetaDataHandler(info:Object):void
{// Used in connectStream() in myStream.client object.
// This event occurs when jumping to the start of static files! ie., seek(0) will cause this event to occur.
if (! myStatus.metaDataReady)
{
trace("\n\n*** METADATA FIRED! ***\n\n");
//this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"onMetaDataHandler: " + info.duration + " | " + info.width + "x" + info.height));
myStatus.metaDataReady = true;// Set flag so that this event only effects jPlayer the 1st time.
myStatus.metaData = info;
myStatus.duration = info.duration * 1000;// Only available via Meta Data.
if (info.width != undefined)
{
myVideo.width = myStatus.videoWidth = info.width;
}
if (info.height != undefined)
{
myVideo.height = myStatus.videoHeight = info.height;
}
if (myStatus.playOnLoad)
{
myStatus.playOnLoad = false;// Capture the flag
if (myStatus.pausePosition > 0)
{// Important for setMedia followed by play(time).
play(myStatus.pausePosition);
}
else
{
play();// Not always sending pausePosition avoids the extra seek(0) for a normal play() command.
}
}
else
{
pause(myStatus.pausePosition);// Always send the pausePosition. Important for setMedia() followed by pause(time). Deals with not reading stream.time with setMedia() and play() immediately followed by stop() or pause(0)
}
this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADEDMETADATA,myStatus));
}
else
{
//this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG,myStatus,"onMetaDataHandler: Already read (NO EFFECT)"));
}
}
}
}

View File

@@ -0,0 +1,110 @@
/*
* jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Date: 27th November 2014
*/
package happyworm.jPlayer {
public class JplayerStatus {
public static const VERSION:String = "2.9.0"; // The version of the Flash jPlayer entity.
public var volume:Number = 0.5; // Not affected by reset()
public var muted:Boolean = false; // Not affected by reset()
public var src:String;
public var srcError:Boolean;
public var srcSet:Boolean;
public var isPlaying:Boolean;
public var isSeeking:Boolean;
public var isWaiting:Boolean;
public var playOnLoad:Boolean;
public var playOnSeek:Boolean;
public var isStartingDownload:Boolean;
public var isLoading:Boolean;
public var isLoaded:Boolean;
public var pausePosition:Number;
public var seekPercent:Number;
public var currentTime:Number;
public var currentPercentRelative:Number;
public var currentPercentAbsolute:Number;
public var duration:Number;
public var videoWidth:Number;
public var videoHeight:Number;
public var metaDataReady:Boolean;
public var metaData:Object;
public function JplayerStatus() {
reset();
}
public function reset():void {
src = "";
srcError = false;
srcSet = false;
isPlaying = false;
isSeeking = false;
isWaiting = false;
playOnLoad = false;
playOnSeek = false;
isStartingDownload = false;
isLoading = false;
isLoaded = false;
pausePosition = 0;
seekPercent = 0;
currentTime = 0;
currentPercentRelative = 0;
currentPercentAbsolute = 0;
duration = 0;
videoWidth = 0;
videoHeight = 0;
metaDataReady = false;
metaData = {};
}
public function error():void {
var srcSaved:String = src;
reset();
src = srcSaved;
srcError = true;
}
public function loadRequired():Boolean {
return (srcSet && !isStartingDownload && !isLoading && !isLoaded);
}
public function startingDownload():void {
isStartingDownload = true;
isLoading = false;
isLoaded = false;
}
public function loading():void {
isStartingDownload = false;
isLoading = true;
isLoaded = false;
}
public function loaded():void {
isStartingDownload = false;
isLoading = false;
isLoaded = true;
}
}
}

View File

@@ -0,0 +1,496 @@
/*
* Playlist Object for the jPlayer Plugin
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://www.opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Version: 2.4.1
* Date: 19th November 2014
*
* Requires:
* - jQuery 1.7.0+
* - jPlayer 2.8.2+
*/
/*global jPlayerPlaylist:true */
(function($, undefined) {
jPlayerPlaylist = function(cssSelector, playlist, options) {
var self = this;
this.current = 0;
this.loop = false; // Flag used with the jPlayer repeat event
this.shuffled = false;
this.removing = false; // Flag is true during remove animation, disabling the remove() method until complete.
this.cssSelector = $.extend({}, this._cssSelector, cssSelector); // Object: Containing the css selectors for jPlayer and its cssSelectorAncestor
this.options = $.extend(true, {
keyBindings: {
next: {
key: 221, // ]
fn: function() {
self.next();
}
},
previous: {
key: 219, // [
fn: function() {
self.previous();
}
},
shuffle: {
key: 83, // s
fn: function() {
self.shuffle();
}
}
},
stateClass: {
shuffled: "jp-state-shuffled"
}
}, this._options, options); // Object: The jPlayer constructor options for this playlist and the playlist options
this.playlist = []; // Array of Objects: The current playlist displayed (Un-shuffled or Shuffled)
this.original = []; // Array of Objects: The original playlist
this._initPlaylist(playlist); // Copies playlist to this.original. Then mirrors this.original to this.playlist. Creating two arrays, where the element pointers match. (Enables pointer comparison.)
// Setup the css selectors for the extra interface items used by the playlist.
this.cssSelector.details = this.cssSelector.cssSelectorAncestor + " .jp-details"; // Note that jPlayer controls the text in the title element.
this.cssSelector.playlist = this.cssSelector.cssSelectorAncestor + " .jp-playlist";
this.cssSelector.next = this.cssSelector.cssSelectorAncestor + " .jp-next";
this.cssSelector.previous = this.cssSelector.cssSelectorAncestor + " .jp-previous";
this.cssSelector.shuffle = this.cssSelector.cssSelectorAncestor + " .jp-shuffle";
this.cssSelector.shuffleOff = this.cssSelector.cssSelectorAncestor + " .jp-shuffle-off";
// Override the cssSelectorAncestor given in options
this.options.cssSelectorAncestor = this.cssSelector.cssSelectorAncestor;
// Override the default repeat event handler
this.options.repeat = function(event) {
self.loop = event.jPlayer.options.loop;
};
// Create a ready event handler to initialize the playlist
$(this.cssSelector.jPlayer).bind($.jPlayer.event.ready, function() {
self._init();
});
// Create an ended event handler to move to the next item
$(this.cssSelector.jPlayer).bind($.jPlayer.event.ended, function() {
self.next();
});
// Create a play event handler to pause other instances
$(this.cssSelector.jPlayer).bind($.jPlayer.event.play, function() {
$(this).jPlayer("pauseOthers");
});
// Create a resize event handler to show the title in full screen mode.
$(this.cssSelector.jPlayer).bind($.jPlayer.event.resize, function(event) {
if(event.jPlayer.options.fullScreen) {
$(self.cssSelector.details).show();
} else {
$(self.cssSelector.details).hide();
}
});
// Create click handlers for the extra buttons that do playlist functions.
$(this.cssSelector.previous).click(function(e) {
e.preventDefault();
self.previous();
self.blur(this);
});
$(this.cssSelector.next).click(function(e) {
e.preventDefault();
self.next();
self.blur(this);
});
$(this.cssSelector.shuffle).click(function(e) {
e.preventDefault();
if(self.shuffled && $(self.cssSelector.jPlayer).jPlayer("option", "useStateClassSkin")) {
self.shuffle(false);
} else {
self.shuffle(true);
}
self.blur(this);
});
$(this.cssSelector.shuffleOff).click(function(e) {
e.preventDefault();
self.shuffle(false);
self.blur(this);
}).hide();
// Put the title in its initial display state
if(!this.options.fullScreen) {
$(this.cssSelector.details).hide();
}
// Remove the empty <li> from the page HTML. Allows page to be valid HTML, while not interfereing with display animations
$(this.cssSelector.playlist + " ul").empty();
// Create .on() handlers for the playlist items along with the free media and remove controls.
this._createItemHandlers();
// Instance jPlayer
$(this.cssSelector.jPlayer).jPlayer(this.options);
};
jPlayerPlaylist.prototype = {
_cssSelector: { // static object, instanced in constructor
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
},
_options: { // static object, instanced in constructor
playlistOptions: {
autoPlay: false,
loopOnPrevious: false,
shuffleOnLoop: true,
enableRemoveControls: false,
displayTime: 'slow',
addTime: 'fast',
removeTime: 'fast',
shuffleTime: 'slow',
itemClass: "jp-playlist-item",
freeGroupClass: "jp-free-media",
freeItemClass: "jp-playlist-item-free",
removeItemClass: "jp-playlist-item-remove"
}
},
option: function(option, value) { // For changing playlist options only
if(value === undefined) {
return this.options.playlistOptions[option];
}
this.options.playlistOptions[option] = value;
switch(option) {
case "enableRemoveControls":
this._updateControls();
break;
case "itemClass":
case "freeGroupClass":
case "freeItemClass":
case "removeItemClass":
this._refresh(true); // Instant
this._createItemHandlers();
break;
}
return this;
},
_init: function() {
var self = this;
this._refresh(function() {
if(self.options.playlistOptions.autoPlay) {
self.play(self.current);
} else {
self.select(self.current);
}
});
},
_initPlaylist: function(playlist) {
this.current = 0;
this.shuffled = false;
this.removing = false;
this.original = $.extend(true, [], playlist); // Copy the Array of Objects
this._originalPlaylist();
},
_originalPlaylist: function() {
var self = this;
this.playlist = [];
// Make both arrays point to the same object elements. Gives us 2 different arrays, each pointing to the same actual object. ie., Not copies of the object.
$.each(this.original, function(i) {
self.playlist[i] = self.original[i];
});
},
_refresh: function(instant) {
/* instant: Can be undefined, true or a function.
* undefined -> use animation timings
* true -> no animation
* function -> use animation timings and excute function at half way point.
*/
var self = this;
if(instant && !$.isFunction(instant)) {
$(this.cssSelector.playlist + " ul").empty();
$.each(this.playlist, function(i) {
$(self.cssSelector.playlist + " ul").append(self._createListItem(self.playlist[i]));
});
this._updateControls();
} else {
var displayTime = $(this.cssSelector.playlist + " ul").children().length ? this.options.playlistOptions.displayTime : 0;
$(this.cssSelector.playlist + " ul").slideUp(displayTime, function() {
var $this = $(this);
$(this).empty();
$.each(self.playlist, function(i) {
$this.append(self._createListItem(self.playlist[i]));
});
self._updateControls();
if($.isFunction(instant)) {
instant();
}
if(self.playlist.length) {
$(this).slideDown(self.options.playlistOptions.displayTime);
} else {
$(this).show();
}
});
}
},
_createListItem: function(media) {
var self = this;
// Wrap the <li> contents in a <div>
var listItem = "<li><div>";
// Create remove control
listItem += "<a href='javascript:;' class='" + this.options.playlistOptions.removeItemClass + "'>&times;</a>";
// Create links to free media
if(media.free) {
var first = true;
listItem += "<span class='" + this.options.playlistOptions.freeGroupClass + "'>(";
$.each(media, function(property,value) {
if($.jPlayer.prototype.format[property]) { // Check property is a media format.
if(first) {
first = false;
} else {
listItem += " | ";
}
listItem += "<a class='" + self.options.playlistOptions.freeItemClass + "' href='" + value + "' tabindex='-1'>" + property + "</a>";
}
});
listItem += ")</span>";
}
// The title is given next in the HTML otherwise the float:right on the free media corrupts in IE6/7
listItem += "<a href='javascript:;' class='" + this.options.playlistOptions.itemClass + "' tabindex='0'>" + media.title + (media.artist ? " <span class='jp-artist'>by " + media.artist + "</span>" : "") + "</a>";
listItem += "</div></li>";
return listItem;
},
_createItemHandlers: function() {
var self = this;
// Create live handlers for the playlist items
$(this.cssSelector.playlist).off("click", "a." + this.options.playlistOptions.itemClass).on("click", "a." + this.options.playlistOptions.itemClass, function(e) {
e.preventDefault();
var index = $(this).parent().parent().index();
if(self.current !== index) {
self.play(index);
} else {
$(self.cssSelector.jPlayer).jPlayer("play");
}
self.blur(this);
});
// Create live handlers that disable free media links to force access via right click
$(this.cssSelector.playlist).off("click", "a." + this.options.playlistOptions.freeItemClass).on("click", "a." + this.options.playlistOptions.freeItemClass, function(e) {
e.preventDefault();
$(this).parent().parent().find("." + self.options.playlistOptions.itemClass).click();
self.blur(this);
});
// Create live handlers for the remove controls
$(this.cssSelector.playlist).off("click", "a." + this.options.playlistOptions.removeItemClass).on("click", "a." + this.options.playlistOptions.removeItemClass, function(e) {
e.preventDefault();
var index = $(this).parent().parent().index();
self.remove(index);
self.blur(this);
});
},
_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.jPlayer).jPlayer("addStateClass", "shuffled");
} else {
$(this.cssSelector.jPlayer).jPlayer("removeStateClass", "shuffled");
}
if($(this.cssSelector.shuffle).length && $(this.cssSelector.shuffleOff).length) {
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.details + " li").html("<span class='jp-title'>" + this.playlist[index].title + "</span>" + (this.playlist[index].artist ? " <span class='jp-artist'>by " + this.playlist[index].artist + "</span>" : ""));
}
},
setPlaylist: function(playlist) {
this._initPlaylist(playlist);
this._init();
},
add: function(media, playNow) {
$(this.cssSelector.playlist + " ul").append(this._createListItem(media)).find("li:last-child").hide().slideDown(this.options.playlistOptions.addTime);
this._updateControls();
this.original.push(media);
this.playlist.push(media); // Both array elements share the same object pointer. Comforms with _initPlaylist(p) system.
if(playNow) {
this.play(this.playlist.length - 1);
} else {
if(this.original.length === 1) {
this.select(0);
}
}
},
remove: function(index) {
var self = this;
if(index === undefined) {
this._initPlaylist([]);
this._refresh(function() {
$(self.cssSelector.jPlayer).jPlayer("clearMedia");
});
return true;
} else {
if(this.removing) {
return false;
} else {
index = (index < 0) ? self.original.length + index : index; // Negative index relates to end of array.
if(0 <= index && index < this.playlist.length) {
this.removing = true;
$(this.cssSelector.playlist + " li:nth-child(" + (index + 1) + ")").slideUp(this.options.playlistOptions.removeTime, function() {
$(this).remove();
if(self.shuffled) {
var item = self.playlist[index];
$.each(self.original, function(i) {
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);
});
}
},
blur: function(that) {
if($(this.cssSelector.jPlayer).jPlayer("option", "autoBlur")) {
$(that).blur();
}
}
};
})(jQuery);

View File

@@ -0,0 +1,338 @@
/*
* jPlayerInspector Plugin for jPlayer Plugin for jQuery JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2009 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://www.opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Version: 1.0.5
* Date: 1st April 2014
*
* For use with jPlayer Version: 2.6.0+
*
* Note: Declare inspector instances after jPlayer instances. ie., Otherwise the jPlayer instance is nonsense.
*/
(function($, undefined) {
$.jPlayerInspector = {};
$.jPlayerInspector.i = 0;
$.jPlayerInspector.defaults = {
jPlayer: undefined, // The jQuery selector of the jPlayer instance to inspect.
idPrefix: "jplayer_inspector_",
visible: false
};
var methods = {
init: function(options) {
var self = this;
var $this = $(this);
var config = $.extend({}, $.jPlayerInspector.defaults, options);
$(this).data("jPlayerInspector", config);
config.id = $(this).attr("id");
config.jPlayerId = config.jPlayer.attr("id");
config.windowId = config.idPrefix + "window_" + $.jPlayerInspector.i;
config.statusId = config.idPrefix + "status_" + $.jPlayerInspector.i;
config.configId = config.idPrefix + "config_" + $.jPlayerInspector.i;
config.toggleId = config.idPrefix + "toggle_" + $.jPlayerInspector.i;
config.eventResetId = config.idPrefix + "event_reset_" + $.jPlayerInspector.i;
config.updateId = config.idPrefix + "update_" + $.jPlayerInspector.i;
config.eventWindowId = config.idPrefix + "event_window_" + $.jPlayerInspector.i;
config.eventId = {};
config.eventJq = {};
config.eventTimeout = {};
config.eventOccurrence = {};
$.each($.jPlayer.event, function(eventName,eventType) {
config.eventId[eventType] = config.idPrefix + "event_" + eventName + "_" + $.jPlayerInspector.i;
config.eventOccurrence[eventType] = 0;
});
var structure =
'<p><a href="#" id="' + config.toggleId + '">' + (config.visible ? "Hide" : "Show") + '</a> jPlayer Inspector</p>'
+ '<div id="' + config.windowId + '">'
+ '<div id="' + config.statusId + '"></div>'
+ '<div id="' + config.eventWindowId + '" style="padding:5px 5px 0 5px;background-color:#eee;border:1px dotted #000;">'
+ '<p style="margin:0 0 10px 0;"><strong>jPlayer events that have occurred over the past 1 second:</strong>'
+ '<br />(Backgrounds: <span style="padding:0 5px;background-color:#eee;border:1px dotted #000;">Never occurred</span> <span style="padding:0 5px;background-color:#fff;border:1px dotted #000;">Occurred before</span> <span style="padding:0 5px;background-color:#9f9;border:1px dotted #000;">Occurred</span> <span style="padding:0 5px;background-color:#ff9;border:1px dotted #000;">Multiple occurrences</span> <a href="#" id="' + config.eventResetId + '">reset</a>)</p>';
// MJP: Would use the next 3 lines for ease, but the events are just slapped on the page.
// $.each($.jPlayer.event, function(eventName,eventType) {
// structure += '<div id="' + config.eventId[eventType] + '" style="float:left;">' + eventName + '</div>';
// });
var eventStyle = "float:left;margin:0 5px 5px 0;padding:0 5px;border:1px dotted #000;";
// MJP: Doing it longhand so order and layout easier to control.
structure +=
'<div id="' + config.eventId[$.jPlayer.event.ready] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.setmedia] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.flashreset] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.resize] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.repeat] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.click] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.warning] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.loadstart] + '" style="clear:left;' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.progress] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.timeupdate] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.volumechange] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.error] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.play] + '" style="clear:left;' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.pause] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.waiting] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.playing] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.seeking] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.seeked] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.ended] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.loadeddata] + '" style="clear:left;' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.loadedmetadata] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.canplay] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.canplaythrough] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.suspend] + '" style="clear:left;' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.abort] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.emptied] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.stalled] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.ratechange] + '" style="' + eventStyle + '"></div>'
+ '<div id="' + config.eventId[$.jPlayer.event.durationchange] + '" style="' + eventStyle + '"></div>'
+ '<div style="clear:both"></div>';
// MJP: Would like a check here in case we missed an event.
// MJP: Check fails, since it is not on the page yet.
/* $.each($.jPlayer.event, function(eventName,eventType) {
if($("#" + config.eventId[eventType])[0] === undefined) {
structure += '<div id="' + config.eventId[eventType] + '" style="clear:left;' + eventStyle + '">' + eventName + '</div>';
}
});
*/
structure +=
'</div>'
+ '<p><a href="#" id="' + config.updateId + '">Update</a> jPlayer Inspector</p>'
+ '<div id="' + config.configId + '"></div>'
+ '</div>';
$(this).html(structure);
config.windowJq = $("#" + config.windowId);
config.statusJq = $("#" + config.statusId);
config.configJq = $("#" + config.configId);
config.toggleJq = $("#" + config.toggleId);
config.eventResetJq = $("#" + config.eventResetId);
config.updateJq = $("#" + config.updateId);
$.each($.jPlayer.event, function(eventName,eventType) {
config.eventJq[eventType] = $("#" + config.eventId[eventType]);
config.eventJq[eventType].text(eventName + " (" + config.eventOccurrence[eventType] + ")"); // Sets the text to the event name and (0);
config.jPlayer.bind(eventType + ".jPlayerInspector", function(e) {
config.eventOccurrence[e.type]++;
if(config.eventOccurrence[e.type] > 1) {
config.eventJq[e.type].css("background-color","#ff9");
} else {
config.eventJq[e.type].css("background-color","#9f9");
}
config.eventJq[e.type].text(eventName + " (" + config.eventOccurrence[e.type] + ")");
// The timer to handle the color
clearTimeout(config.eventTimeout[e.type]);
config.eventTimeout[e.type] = setTimeout(function() {
config.eventJq[e.type].css("background-color","#fff");
}, 1000);
// The timer to handle the occurences.
setTimeout(function() {
config.eventOccurrence[e.type]--;
config.eventJq[e.type].text(eventName + " (" + config.eventOccurrence[e.type] + ")");
}, 1000);
if(config.visible) { // Update the status, if inspector open.
$this.jPlayerInspector("updateStatus");
}
});
});
config.jPlayer.bind($.jPlayer.event.ready + ".jPlayerInspector", function(e) {
$this.jPlayerInspector("updateConfig");
});
config.toggleJq.click(function() {
if(config.visible) {
$(this).text("Show");
config.windowJq.hide();
config.statusJq.empty();
config.configJq.empty();
} else {
$(this).text("Hide");
config.windowJq.show();
config.updateJq.click();
}
config.visible = !config.visible;
$(this).blur();
return false;
});
config.eventResetJq.click(function() {
$.each($.jPlayer.event, function(eventName,eventType) {
config.eventJq[eventType].css("background-color","#eee");
});
$(this).blur();
return false;
});
config.updateJq.click(function() {
$this.jPlayerInspector("updateStatus");
$this.jPlayerInspector("updateConfig");
return false;
});
if(!config.visible) {
config.windowJq.hide();
} else {
// config.updateJq.click();
}
$.jPlayerInspector.i++;
return this;
},
destroy: function() {
$(this).data("jPlayerInspector") && $(this).data("jPlayerInspector").jPlayer.unbind(".jPlayerInspector");
$(this).empty();
},
updateConfig: function() { // This displays information about jPlayer's configuration in inspector
var jPlayerInfo = "<p>This jPlayer instance is running in your browser where:<br />"
for(i = 0; i < $(this).data("jPlayerInspector").jPlayer.data("jPlayer").solutions.length; i++) {
var solution = $(this).data("jPlayerInspector").jPlayer.data("jPlayer").solutions[i];
jPlayerInfo += "&nbsp;jPlayer's <strong>" + solution + "</strong> solution is";
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].used) {
jPlayerInfo += " being <strong>used</strong> and will support:<strong>";
for(format in $(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].support) {
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].support[format]) {
jPlayerInfo += " " + format;
}
}
jPlayerInfo += "</strong><br />";
} else {
jPlayerInfo += " <strong>not required</strong><br />";
}
}
jPlayerInfo += "</p>";
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.active) {
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").flash.active) {
jPlayerInfo += "<strong>Problem with jPlayer since both HTML5 and Flash are active.</strong>";
} else {
jPlayerInfo += "The <strong>HTML5 is active</strong>.";
}
} else {
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").flash.active) {
jPlayerInfo += "The <strong>Flash is active</strong>.";
} else {
jPlayerInfo += "No solution is currently active. jPlayer needs a setMedia().";
}
}
jPlayerInfo += "</p>";
var formatType = $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.formatType;
jPlayerInfo += "<p><code>status.formatType = '" + formatType + "'</code><br />";
if(formatType) {
jPlayerInfo += "<code>Browser canPlay('" + $.jPlayer.prototype.format[formatType].codec + "')</code>";
} else {
jPlayerInfo += "</p>";
}
jPlayerInfo += "<p><code>status.src = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.src + "'</code></p>";
jPlayerInfo += "<p><code>status.media = {<br />";
for(prop in $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.media) {
jPlayerInfo += "&nbsp;" + prop + ": " + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.media[prop] + "<br />"; // Some are strings
}
jPlayerInfo += "};</code></p>"
jPlayerInfo += "<p>";
jPlayerInfo += "<code>status.videoWidth = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.videoWidth + "'</code>";
jPlayerInfo += " | <code>status.videoHeight = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.videoHeight + "'</code>";
jPlayerInfo += "<br /><code>status.width = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.width + "'</code>";
jPlayerInfo += " | <code>status.height = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.height + "'</code>";
jPlayerInfo += "</p>";
+ "<p>Raw browser test for HTML5 support. Should equal a function if HTML5 is available.<br />";
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.audio.available) {
jPlayerInfo += "<code>htmlElement.audio.canPlayType = " + (typeof $(this).data("jPlayerInspector").jPlayer.data("jPlayer").htmlElement.audio.canPlayType) +"</code><br />"
}
if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.video.available) {
jPlayerInfo += "<code>htmlElement.video.canPlayType = " + (typeof $(this).data("jPlayerInspector").jPlayer.data("jPlayer").htmlElement.video.canPlayType) +"</code>";
}
jPlayerInfo += "</p>";
jPlayerInfo += "<p>This instance is using the constructor options:<br />"
+ "<code>$('#" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").internal.self.id + "').jPlayer({<br />"
+ "&nbsp;swfPath: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "swfPath") + "',<br />"
+ "&nbsp;solution: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "solution") + "',<br />"
+ "&nbsp;supplied: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "supplied") + "',<br />"
+ "&nbsp;preload: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "preload") + "',<br />"
+ "&nbsp;volume: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "volume") + ",<br />"
+ "&nbsp;muted: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "muted") + ",<br />"
+ "&nbsp;backgroundColor: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "backgroundColor") + "',<br />"
+ "&nbsp;cssSelectorAncestor: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelectorAncestor") + "',<br />"
+ "&nbsp;cssSelector: {";
var cssSelector = $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelector");
for(prop in cssSelector) {
// jPlayerInfo += "<br />&nbsp;&nbsp;" + prop + ": '" + cssSelector[prop] + "'," // This works too of course, but want to use option method for deep keys.
jPlayerInfo += "<br />&nbsp;&nbsp;" + prop + ": '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelector." + prop) + "',"
}
jPlayerInfo = jPlayerInfo.slice(0, -1); // Because the sloppy comma was bugging me.
jPlayerInfo += "<br />&nbsp;},<br />"
+ "&nbsp;errorAlerts: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "errorAlerts") + ",<br />"
+ "&nbsp;warningAlerts: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "warningAlerts") + "<br />"
+ "});</code></p>";
$(this).data("jPlayerInspector").configJq.html(jPlayerInfo);
return this;
},
updateStatus: function() { // This displays information about jPlayer's status in the inspector
$(this).data("jPlayerInspector").statusJq.html(
"<p>jPlayer is " +
($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.paused ? "paused" : "playing") +
" at time: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentTime*10)/10 + "s." +
" (d: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.duration*10)/10 + "s" +
", sp: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.seekPercent) + "%" +
", cpr: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentPercentRelative) + "%" +
", cpa: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentPercentAbsolute) + "%)</p>"
);
return this;
}
};
$.fn.jPlayerInspector = function( method ) {
// Method calling logic
if ( methods[method] ) {
return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
return methods.init.apply( this, arguments );
} else {
$.error( 'Method ' + method + ' does not exist on jQuery.jPlayerInspector' );
}
};
})(jQuery);

View File

@@ -0,0 +1,579 @@
/*
* jPlayer Player Plugin for Popcorn JavaScript Library
* http://www.jplayer.org
*
* Copyright (c) 2012 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* http://opensource.org/licenses/MIT
*
* Author: Mark J Panaghiston
* Version: 1.1.6
* Date: 27th November 2014
*
* For Popcorn Version: 1.3
* For jPlayer Version: 2.9.0
* Requires: jQuery 1.7+
* Note: jQuery dependancy cannot be removed since jPlayer 2 is a jQuery plugin. Use of jQuery will be kept to a minimum.
*/
(function(Popcorn) {
var JQUERY_SCRIPT = '//code.jquery.com/jquery-1.11.1.min.js', // Used if jQuery not already present.
JPLAYER_SCRIPT = '//code.jplayer.org/2.9.0/jplayer/jquery.jplayer.min.js', // Used if jPlayer not already present.
JPLAYER_SWFPATH = '//code.jplayer.org/2.9.0/jplayer/jquery.jplayer.swf', // Used if not specified in jPlayer options via SRC Object.
SOLUTION = 'html,flash', // The default solution option.
DEBUG = false, // Decided to leave the debugging option and console output in for the time being. Overhead is trivial.
jQueryDownloading = false, // Flag to stop multiple instances from each pulling in jQuery, thus corrupting it.
jPlayerDownloading = false, // Flag to stop multiple instances from each pulling in jPlayer, thus corrupting it.
format = { // Duplicate of jPlayer 2.5.0 object, to avoid always requiring jQuery and jPlayer to be loaded before performing the _canPlayType() test.
mp3: {
codec: 'audio/mpeg',
flashCanPlay: true,
media: 'audio'
},
m4a: { // AAC / MP4
codec: 'audio/mp4; codecs="mp4a.40.2"',
flashCanPlay: true,
media: 'audio'
},
m3u8a: { // AAC / MP4 / Apple HLS
codec: 'application/vnd.apple.mpegurl; codecs="mp4a.40.2"',
flashCanPlay: false,
media: 'audio'
},
m3ua: { // M3U
codec: 'audio/mpegurl',
flashCanPlay: false,
media: 'audio'
},
oga: { // OGG
codec: 'audio/ogg; codecs="vorbis, opus"',
flashCanPlay: false,
media: 'audio'
},
flac: { // FLAC
codec: 'audio/x-flac',
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'
},
rtmpa: { // RTMP AUDIO
codec: 'audio/rtmp; codecs="rtmp"',
flashCanPlay: true,
media: 'audio'
},
m4v: { // H.264 / MP4
codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
flashCanPlay: true,
media: 'video'
},
m3u8v: { // H.264 / AAC / MP4 / Apple HLS
codec: 'application/vnd.apple.mpegurl; codecs="avc1.42E01E, mp4a.40.2"',
flashCanPlay: false,
media: 'video'
},
m3uv: { // M3U
codec: 'audio/mpegurl',
flashCanPlay: false,
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'
},
rtmpv: { // RTMP VIDEO
codec: 'video/rtmp; codecs="rtmp"',
flashCanPlay: true,
media: 'video'
}
},
isObject = function(val) { // Basic check for Object
if(val && typeof val === 'object' && val.hasOwnProperty) {
return true;
} else {
return false;
}
},
getMediaType = function(url) { // Function to gleam the media type from the URL
var mediaType = false;
if(/\.mp3$/i.test(url)) {
mediaType = 'mp3';
} else if(/\.mp4$/i.test(url) || /\.m4v$/i.test(url)) {
mediaType = 'm4v';
} else if(/\.m4a$/i.test(url)) {
mediaType = 'm4a';
} else if(/\.ogg$/i.test(url) || /\.oga$/i.test(url)) {
mediaType = 'oga';
} else if(/\.ogv$/i.test(url)) {
mediaType = 'ogv';
} else if(/\.webm$/i.test(url)) {
mediaType = 'webmv';
}
return mediaType;
},
getSupplied = function(url) { // Function to generate a supplied option from an src object. ie., When supplied not specified.
var supplied = '',
separator = '';
if(isObject(url)) {
// Generate supplied option from object's properties. Non-format properties would be ignored by jPlayer. Order is unpredictable.
for(var prop in url) {
if(url.hasOwnProperty(prop)) {
supplied += separator + prop;
separator = ',';
}
}
}
if(DEBUG) console.log('getSupplied(): Generated: supplied = "' + supplied + '"');
return supplied;
};
Popcorn.player( 'jplayer', {
_canPlayType: function( containerType, url ) {
// url : Either a String or an Object structured similar a jPlayer media object. ie., As used by setMedia in jPlayer.
// The url object may also contain a solution and supplied property.
// Define the src object structure here!
var cType = containerType.toLowerCase(),
srcObj = {
media:{},
options:{}
},
rVal = false, // Only a boolean false means it is not supported.
mediaType;
if(cType !== 'video' && cType !== 'audio') {
if(typeof url === 'string') {
// Check it starts with http, so the URL is absolute... Well, it is not a perfect check.
if(/^http.*/i.test(url)) {
mediaType = getMediaType(url);
if(mediaType) {
srcObj.media[mediaType] = url;
srcObj.options.solution = SOLUTION;
srcObj.options.supplied = mediaType;
}
}
} else {
srcObj = url; // Assume the url is an src object.
}
// Check for Object and appropriate minimum data structure.
if(isObject(srcObj) && isObject(srcObj.media)) {
if(!isObject(srcObj.options)) {
srcObj.options = {};
}
if(!srcObj.options.solution) {
srcObj.options.solution = SOLUTION;
}
if(!srcObj.options.supplied) {
srcObj.options.supplied = getSupplied(srcObj.media);
}
// Figure out how jPlayer will play it.
// This may not work properly when both audio and video is supplied. ie., A media player. But it should return truethy and jPlayer can figure it out.
var solution = srcObj.options.solution.toLowerCase().split(","), // Create the solution array, with prority based on the order of the solution string.
supplied = srcObj.options.supplied.toLowerCase().split(","); // Create the supplied formats array, with prority based on the order of the supplied formats string.
for(var sol = 0; sol < solution.length; sol++) {
var solutionType = solution[sol].replace(/^\s+|\s+$/g, ""), //trim
checkingHtml = solutionType === 'html',
checkingFlash = solutionType === 'flash',
mediaElem;
for(var fmt = 0; fmt < supplied.length; fmt++) {
mediaType = supplied[fmt].replace(/^\s+|\s+$/g, ""); //trim
if(format[mediaType]) { // Check format is valid.
// Create an HTML5 media element for the type of media.
if(!mediaElem && checkingHtml) {
mediaElem = document.createElement(format[mediaType].media);
}
// See if the HTML5 media element can play the MIME / Codec type.
// Flash also returns the object if the format is playable, so it is truethy, but that html property is false.
// This assumes Flash is available, but that should be dealt with by jPlayer if that happens.
var htmlCanPlay = !!(mediaElem && mediaElem.canPlayType && mediaElem.canPlayType(format[mediaType].codec)),
htmlWillPlay = htmlCanPlay && checkingHtml,
flashWillPlay = format[mediaType].flashCanPlay && checkingFlash;
// The first one found will match what jPlayer uses.
if(htmlWillPlay || flashWillPlay) {
rVal = {
html: htmlWillPlay,
type: mediaType
};
sol = solution.length; // Exit solution loop
fmt = supplied.length; // Exit supplied loop
}
}
}
}
}
}
return rVal;
},
// _setup: function( options ) { // Warning: options is deprecated.
_setup: function() {
var media = this,
myPlayer, // The jQuery selector of the jPlayer element. Usually a <div>
jPlayerObj, // The jPlayer data instance. For performance and DRY code.
mediaType = 'unknown',
jpMedia = {},
jpOptions = {},
ready = false, // Used during init to override the annoying duration dependance in the track event padding during Popcorn's isReady(). ie., We is ready after loadeddata and duration can then be set real value at leisure.
duration = 0, // For the durationchange event with both HTML5 and Flash solutions. Used with 'ready' to keep control during the Popcorn isReady() via loadeddata event. (Duration=0 is bad.)
durationchangeId = null, // A timeout ID used with delayed durationchange event. (Because of the duration=NaN fudge to avoid Popcorn track event corruption.)
canplaythrough = false,
error = null, // The MediaError object.
dispatchDurationChange = function() {
if(ready) {
if(DEBUG) console.log('Dispatched event : durationchange : ' + duration);
media.dispatchEvent('durationchange');
} else {
if(DEBUG) console.log('DELAYED EVENT (!ready) : durationchange : ' + duration);
clearTimeout(durationchangeId); // Stop multiple triggers causing multiple timeouts running in parallel.
durationchangeId = setTimeout(dispatchDurationChange, 250);
}
},
jPlayerFlashEventsPatch = function() {
/* Events already supported by jPlayer Flash:
* loadstart
* loadedmetadata (M4A, M4V)
* progress
* play
* pause
* seeking
* seeked
* timeupdate
* ended
* volumechange
* error <- See the custom handler in jPlayerInit()
*/
/* Events patched:
* loadeddata
* durationchange
* canplaythrough
* playing
*/
/* Events NOT patched:
* suspend
* abort
* emptied
* stalled
* loadedmetadata (MP3)
* waiting
* canplay
* ratechange
*/
// Triggering patched events through the jPlayer Object so the events are homogeneous. ie., The contain the event.jPlayer data structure.
var checkDuration = function(event) {
if(event.jPlayer.status.duration !== duration) {
duration = event.jPlayer.status.duration;
dispatchDurationChange();
}
},
checkCanPlayThrough = function(event) {
if(!canplaythrough && event.jPlayer.status.seekPercent === 100) {
canplaythrough = true;
setTimeout(function() {
if(DEBUG) console.log('Trigger : canplaythrough');
jPlayerObj._trigger($.jPlayer.event.canplaythrough);
}, 0);
}
};
myPlayer.bind($.jPlayer.event.loadstart, function() {
setTimeout(function() {
if(DEBUG) console.log('Trigger : loadeddata');
jPlayerObj._trigger($.jPlayer.event.loadeddata);
}, 0);
})
.bind($.jPlayer.event.progress, function(event) {
checkDuration(event);
checkCanPlayThrough(event);
})
.bind($.jPlayer.event.timeupdate, function(event) {
checkDuration(event);
checkCanPlayThrough(event);
})
.bind($.jPlayer.event.play, function() {
setTimeout(function() {
if(DEBUG) console.log('Trigger : playing');
jPlayerObj._trigger($.jPlayer.event.playing);
}, 0);
});
if(DEBUG) console.log('Created CUSTOM event handlers for FLASH');
},
jPlayerInit = function() {
(function($) {
myPlayer = $('#' + media.id);
if(typeof media.src === 'string') {
mediaType = getMediaType(media.src);
jpMedia[mediaType] = media.src;
jpOptions.supplied = mediaType;
jpOptions.solution = SOLUTION;
} else if(isObject(media.src)) {
jpMedia = isObject(media.src.media) ? media.src.media : {};
jpOptions = isObject(media.src.options) ? media.src.options : {};
jpOptions.solution = jpOptions.solution || SOLUTION;
jpOptions.supplied = jpOptions.supplied || getSupplied(media.src.media);
}
// Allow the swfPath to be set to local server. ie., If the jPlayer Plugin is local and already on the page, then you can also use the local SWF.
jpOptions.swfPath = jpOptions.swfPath || JPLAYER_SWFPATH;
myPlayer.bind($.jPlayer.event.ready, function(event) {
if(event.jPlayer.flash.used) {
jPlayerFlashEventsPatch();
}
// Set the media andd load it, so that the Flash solution behaves similar to HTML5 solution.
// This also allows the loadstart event to be used to know jPlayer is ready.
$(this).jPlayer('setMedia', jpMedia).jPlayer('load');
});
// Do not auto-bubble the reserved events, nor the loadeddata and durationchange event, since the duration must be carefully handled when loadeddata event occurs.
// See the duration property code for more details. (Ranting.)
var reservedEvents = $.jPlayer.reservedEvent + ' loadeddata durationchange',
reservedEvent = reservedEvents.split(/\s+/g);
// Generate event handlers for all the standard HTML5 media events. (Except durationchange)
var bindEvent = function(name) {
myPlayer.bind($.jPlayer.event[name], function(event) {
if(DEBUG) console.log('Dispatched event: ' + name + (event && event.jPlayer ? ' (' + event.jPlayer.status.currentTime + 's)' : '')); // Must be after dispatch for some reason on Firefox/Opera
media.dispatchEvent(name);
});
if(DEBUG) console.log('Created event handler for: ' + name);
};
for(var eventName in $.jPlayer.event) {
if($.jPlayer.event.hasOwnProperty(eventName)) {
var nativeEvent = true;
for(var iRes in reservedEvent) {
if(reservedEvent.hasOwnProperty(iRes)) {
if(reservedEvent[iRes] === eventName) {
nativeEvent = false;
break;
}
}
}
if(nativeEvent) {
bindEvent(eventName);
} else {
if(DEBUG) console.log('Skipped auto event handler creation for: ' + eventName);
}
}
}
myPlayer.bind($.jPlayer.event.loadeddata, function(event) {
if(DEBUG) console.log('Dispatched event: loadeddata' + (event && event.jPlayer ? ' (' + event.jPlayer.status.currentTime + 's)' : ''));
media.dispatchEvent('loadeddata');
ready = true;
});
if(DEBUG) console.log('Created CUSTOM event handler for: loadeddata');
myPlayer.bind($.jPlayer.event.durationchange, function(event) {
duration = event.jPlayer.status.duration;
dispatchDurationChange();
});
if(DEBUG) console.log('Created CUSTOM event handler for: durationchange');
// The error event is a special case. Plus jPlayer error event assumes it is a broken URL. (It could also be a decoder error... Or aborted or a Network error.)
myPlayer.bind($.jPlayer.event.error, function(event) {
// Not sure how to handle the error situation. Popcorn does not appear to have the error or error.code property documented here: http://popcornjs.org/popcorn-docs/media-methods/
// If any error event happens, then something has gone pear shaped.
error = event.jPlayer.error; // Saving object pointer, not a copy of the object. Possible garbage collection issue... But the player is dead anyway, so don't care.
if(error.type === $.jPlayer.error.URL) {
error.code = 4; // MEDIA_ERR_SRC_NOT_SUPPORTED since jPlayer makes this assumption. It is the most common error, then the decode error. Never seen either of the other 2 error types occur.
} else {
error.code = 0; // It was a jPlayer error, not an HTML5 media error.
}
if(DEBUG) console.log('Dispatched event: error');
if(DEBUG) console.dir(error);
media.dispatchEvent('error');
});
if(DEBUG) console.log('Created CUSTOM event handler for: error');
Popcorn.player.defineProperty( media, 'error', {
set: function() {
// Read-only property
return error;
},
get: function() {
return error;
}
});
Popcorn.player.defineProperty( media, 'currentTime', {
set: function( val ) {
if(jPlayerObj.status.paused) {
myPlayer.jPlayer('pause', val);
} else {
myPlayer.jPlayer('play', val);
}
return val;
},
get: function() {
return jPlayerObj.status.currentTime;
}
});
/* The joy of duration and the loadeddata event isReady() handler
* The duration is assumed to be a NaN or a valid duration.
* jPlayer uses zero instead of a NaN and this screws up the Popcorn track event start/end arrays padding.
* This line here:
* videoDurationPlus = duration != duration ? Number.MAX_VALUE : duration + 1;
* Not sure why it is not simply:
* videoDurationPlus = Number.MAX_VALUE; // Who cares if the padding is close to the real duration?
* So if you trigger loadeddata before the duration is correct, the track event padding is screwed up. (It pads the start, not the end... Well, duration+1 = 0+1 = 1s)
* That line makes the MP3 Flash fallback difficult to setup. The whole MP3 will need to load before the duration is known.
* Planning on using a NaN for duration until a >0 value is found... Except with MP3, where seekPercent must be 100% before setting the duration.
* Why not just use a NaN during init... And then correct the duration later?
*/
Popcorn.player.defineProperty( media, 'duration', {
set: function() {
// Read-only property
if(ready) {
return duration;
} else {
return NaN;
}
},
get: function() {
if(ready) {
return duration; // Popcorn has initialized, we can now use duration zero or whatever without fear.
} else {
return NaN; // Keep the duration a NaN until after loadeddata event has occurred. Otherwise Popcorn track event padding is corrupted.
}
}
});
Popcorn.player.defineProperty( media, 'muted', {
set: function( val ) {
myPlayer.jPlayer('mute', val);
return jPlayerObj.options.muted;
},
get: function() {
return jPlayerObj.options.muted;
}
});
Popcorn.player.defineProperty( media, 'volume', {
set: function( val ) {
myPlayer.jPlayer('volume', val);
return jPlayerObj.options.volume;
},
get: function() {
return jPlayerObj.options.volume;
}
});
Popcorn.player.defineProperty( media, 'paused', {
set: function() {
// Read-only property
return jPlayerObj.status.paused;
},
get: function() {
return jPlayerObj.status.paused;
}
});
media.play = function() {
myPlayer.jPlayer('play');
};
media.pause = function() {
myPlayer.jPlayer('pause');
};
myPlayer.jPlayer(jpOptions); // Instance jPlayer. Note that the options should not have a ready event defined... Kill it by default?
jPlayerObj = myPlayer.data('jPlayer');
}(jQuery));
},
jPlayerCheck = function() {
if (!jQuery.jPlayer) {
if (!jPlayerDownloading) {
jPlayerDownloading = true;
Popcorn.getScript(JPLAYER_SCRIPT, function() {
jPlayerDownloading = false;
jPlayerInit();
});
} else {
setTimeout(jPlayerCheck, 250);
}
} else {
jPlayerInit();
}
},
jQueryCheck = function() {
if (!window.jQuery) {
if (!jQueryDownloading) {
jQueryDownloading = true;
Popcorn.getScript(JQUERY_SCRIPT, function() {
jQueryDownloading = false;
jPlayerCheck();
});
} else {
setTimeout(jQueryCheck, 250);
}
} else {
jPlayerCheck();
}
};
jQueryCheck();
},
_teardown: function() {
jQuery('#' + this.id).jPlayer('destroy');
}
});
}(Popcorn));

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -0,0 +1,42 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio" role="application" aria-label="media player">
<div class="jp-type-playlist">
<div class="jp-gui jp-interface">
<div class="jp-controls">
<button class="jp-previous" role="button" tabindex="0">previous</button>
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-next" role="button" tabindex="0">next</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-time-holder">
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-shuffle" role="button" tabindex="0">shuffle</button>
</div>
</div>
<div class="jp-playlist">
<ul>
<li>&nbsp;</li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,37 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio" role="application" aria-label="media player">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-time-holder">
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
</div>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio-stream" role="application" aria-label="media player">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,52 @@
<div id="{{WRAPPER}}" class="jp-video " role="application" aria-label="media player">
<div class="jp-type-playlist">
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-controls-holder">
<div class="jp-controls">
<button class="jp-previous" role="button" tabindex="0">previous</button>
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-next" role="button" tabindex="0">next</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-shuffle" role="button" tabindex="0">shuffle</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
</div>
</div>
<div class="jp-playlist">
<ul>
<!-- The method Playlist.displayPlaylist() uses this unordered list -->
<li>&nbsp;</li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,43 @@
<div id="{{WRAPPER}}" class="jp-video " role="application" aria-label="media player">
<div class="jp-type-single">
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-controls-holder">
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,627 @@
/*
* Skin for jPlayer Plugin (jQuery JavaScript Library)
* http://www.jplayer.org
*
* Skin Name: Blue Monday
*
* Copyright (c) 2010 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* - http://www.opensource.org/licenses/mit-license.php
*
* Author: Silvia Benvenuti
* Skin Version: 5.1 (jPlayer 2.8.0)
* Date: 13th November 2014
*/
$jplayer-images-base-url: "../image/" !default;
.jp-audio *:focus,
.jp-audio-stream *:focus,
.jp-video *:focus {
/* Disable the browser focus highlighting. */
outline:none;
}
.jp-audio button::-moz-focus-inner,
.jp-audio-stream button::-moz-focus-inner,
.jp-video button::-moz-focus-inner {
/* Disable the browser CSS3 focus highlighting. */
border: 0;
}
.jp-audio,
.jp-audio-stream,
.jp-video {
font-size:16px;
font-family:Verdana, Arial, sans-serif;
line-height:1.6;
color: #666;
border:1px solid #009be3;
background-color:#eee;
}
.jp-audio {
width:420px;
}
.jp-audio-stream {
width:182px;
}
.jp-video-270p {
width:480px;
}
.jp-video-360p {
width:640px;
}
.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;
}
/* The z-index rule is defined in this manner to enable Popcorn plugins that add overlays to video area. EG. Subtitles. */
.jp-video-full div div {
z-index:1000;
}
.jp-video-full .jp-jplayer {
top: 0;
left: 0;
position: fixed !important; position: relative; /* Rules for IE6 (full-screen) */
overflow: hidden;
}
.jp-video-full .jp-gui {
position: fixed !important; position: static; /* Rules for IE6 (full-screen) */
top: 0;
left: 0;
width:100%;
height:100%;
z-index:1001; /* 1 layer above the others. */
}
.jp-video-full .jp-interface {
position: absolute !important; position: relative; /* Rules for IE6 (full-screen) */
bottom: 0;
left: 0;
}
.jp-interface {
position: relative;
background-color:#eee;
width:100%;
}
.jp-audio .jp-interface {
height:80px;
}
.jp-audio-stream .jp-interface {
height:80px;
}
.jp-video .jp-interface {
border-top:1px solid #009be3;
}
/* @group CONTROLS */
.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 */
}
.jp-interface .jp-controls {
margin:0;
padding: 0;
overflow:hidden;
}
.jp-audio .jp-controls {
width: 380px;
padding:20px 20px 0 20px;
}
.jp-audio-stream .jp-controls {
position:absolute;
top:20px;
left:20px;
width:142px;
}
.jp-video .jp-type-single .jp-controls {
width: 78px;
margin-left: 200px;
}
.jp-video .jp-type-playlist .jp-controls {
width: 134px;
margin-left: 172px;
}
.jp-video .jp-controls {
float: left;
}
.jp-controls button {
display:block;
float: left;
overflow:hidden;
text-indent:-9999px;
border:none;
cursor:pointer;
}
.jp-play {
width:40px;
height:40px;
}
.jp-play {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 0 no-repeat;
}
.jp-play:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -41px 0 no-repeat;
}
.jp-state-playing .jp-play {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -42px no-repeat;
}
.jp-state-playing .jp-play:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -41px -42px no-repeat;
}
.jp-stop, .jp-previous, .jp-next {
width:28px;
height:28px;
margin-top:6px;
}
.jp-stop {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -83px no-repeat;
margin-left:10px;
}
.jp-stop:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -29px -83px no-repeat;
}
.jp-previous {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -112px no-repeat;
}
.jp-previous:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -29px -112px no-repeat;
}
.jp-next {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -141px no-repeat;
}
.jp-next:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -29px -141px no-repeat;
}
/* @end */
/* @group progress bar */
.jp-progress {
overflow:hidden;
background-color: #ddd;
}
.jp-audio .jp-progress {
position: absolute;
top:32px;
height:15px;
}
.jp-audio .jp-type-single .jp-progress {
left:110px;
width:186px;
}
.jp-audio .jp-type-playlist .jp-progress {
left:166px;
width:130px;
}
.jp-video .jp-progress {
top:0px;
left:0px;
width:100%;
height:10px;
}
.jp-seek-bar {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -202px repeat-x;
width:0px;
height:100%;
cursor: pointer;
}
.jp-play-bar {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -218px repeat-x ;
width:0px;
height:100%;
}
/* The seeking class is added/removed inside jPlayer */
.jp-seeking-bg {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.seeking.gif");
}
/* @end */
/* @group volume controls */
.jp-state-no-volume .jp-volume-controls {
display:none;
}
.jp-volume-controls {
position:absolute;
top:32px;
left:308px;
width:200px;
}
.jp-audio-stream .jp-volume-controls {
left:70px;
}
.jp-video .jp-volume-controls {
top:12px;
left:50px;
}
.jp-volume-controls button {
display:block;
position: absolute;
overflow:hidden;
text-indent:-9999px;
border:none;
cursor:pointer;
}
.jp-mute,
.jp-volume-max {
width:18px;
height:15px;
}
.jp-volume-max {
left:74px;
}
.jp-mute {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -170px no-repeat;
}
.jp-mute:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -19px -170px no-repeat;
}
.jp-state-muted .jp-mute {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -60px -170px no-repeat;
}
.jp-state-muted .jp-mute:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -79px -170px no-repeat;
}
.jp-volume-max {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -186px no-repeat;
}
.jp-volume-max:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -19px -186px no-repeat;
}
.jp-volume-bar {
position: absolute;
overflow:hidden;
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -250px repeat-x;
top:5px;
left:22px;
width:46px;
height:5px;
cursor: pointer;
}
.jp-volume-bar-value {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -256px repeat-x;
width:0px;
height:5px;
}
/* @end */
/* @group current time and duration */
.jp-audio .jp-time-holder {
position:absolute;
top:50px;
}
.jp-audio .jp-type-single .jp-time-holder {
left:110px;
width:186px;
}
.jp-audio .jp-type-playlist .jp-time-holder {
left:166px;
width:130px;
}
.jp-current-time,
.jp-duration {
width:60px;
font-size:.64em;
font-style:oblique;
}
.jp-current-time {
float: left;
display:inline;
cursor:default;
}
.jp-duration {
float: right;
display:inline;
text-align: right;
cursor:pointer;
}
.jp-video .jp-current-time {
margin-left:20px;
}
.jp-video .jp-duration {
margin-right:20px;
}
/* @end */
/* @group playlist */
.jp-details {
font-weight:bold;
text-align:center;
cursor:default;
}
.jp-details,
.jp-playlist {
width:100%;
background-color:#ccc;
border-top:1px solid #009be3;
}
.jp-type-single .jp-details,
.jp-type-playlist .jp-details {
border-top:none;
}
.jp-details .jp-title {
margin:0;
padding:5px 20px;
font-size:.72em;
font-weight:bold;
}
.jp-playlist ul {
list-style-type:none;
margin:0;
padding:0 20px;
font-size:.72em;
}
.jp-playlist li {
padding:5px 0 4px 20px;
border-bottom:1px solid #eee;
}
.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 */
.jp-video-play {
width:100%;
overflow:hidden; /* Important for nested negative margins to work in modern browsers */
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. */
}
.jp-video-270p .jp-video-play {
margin-top:-270px;
height:270px;
}
.jp-video-360p .jp-video-play {
margin-top:-360px;
height:360px;
}
.jp-video-full .jp-video-play {
height:100%;
}
.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-images-base-url}jplayer.blue.monday.video.play.png") 0 0 no-repeat;
text-indent:-9999px;
border:none;
cursor:pointer;
}
.jp-video-play-icon:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.video.play.png") 0 -100px no-repeat;
}
.jp-jplayer audio,
.jp-jplayer {
width:0px;
height:0px;
}
.jp-jplayer {
background-color: #000000;
}
/* @group TOGGLES */
/* The audio toggles are nested inside jp-time-holder */
.jp-toggles {
padding:0;
margin:0 auto;
overflow:hidden;
}
.jp-audio .jp-type-single .jp-toggles {
width:25px;
}
.jp-audio .jp-type-playlist .jp-toggles {
width:55px;
margin: 0;
position: absolute;
left: 325px;
top: 50px;
}
.jp-video .jp-toggles {
position:absolute;
right:16px;
margin:0;
margin-top:10px;
width:100px;
}
.jp-toggles button {
display:block;
float:left;
width:25px;
height:18px;
text-indent:-9999px;
line-height:100%; /* need this for IE6 */
border:none;
cursor:pointer;
}
.jp-full-screen {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -310px no-repeat;
margin-left: 20px;
}
.jp-full-screen:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -30px -310px no-repeat;
}
.jp-state-full-screen .jp-full-screen {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -60px -310px no-repeat;
}
.jp-state-full-screen .jp-full-screen:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -90px -310px no-repeat;
}
.jp-repeat {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -290px no-repeat;
}
.jp-repeat:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -30px -290px no-repeat;
}
.jp-state-looped .jp-repeat {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -60px -290px no-repeat;
}
.jp-state-looped .jp-repeat:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -90px -290px no-repeat;
}
.jp-shuffle {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") 0 -270px no-repeat;
margin-left: 5px;
}
.jp-shuffle:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -30px -270px no-repeat;
}
.jp-state-shuffled .jp-shuffle {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -60px -270px no-repeat;
}
.jp-state-shuffled .jp-shuffle:focus {
background: url("#{$jplayer-images-base-url}jplayer.blue.monday.jpg") -90px -270px no-repeat;
}
/* @end */
/* @group NO SOLUTION error feedback */
.jp-no-solution {
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 */

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,42 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio" role="application" aria-label="media player">
<div class="jp-type-playlist">
<div class="jp-gui jp-interface">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls-holder">
<div class="jp-controls">
<button class="jp-previous" role="button" tabindex="0">previous</button>
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
<button class="jp-next" role="button" tabindex="0">next</button>
</div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-shuffle" role="button" tabindex="0">shuffle</button>
</div>
</div>
</div>
<div class="jp-playlist">
<ul>
<li>&nbsp;</li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,37 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio" role="application" aria-label="media player">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls-holder">
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
</div>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div id="{{WRAPPER}}" class="jp-audio-stream" role="application" aria-label="media player">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
</div>
</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,52 @@
<div id="{{WRAPPER}}" class="jp-video " role="application" aria-label="media player">
<div class="jp-type-playlist">
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-controls-holder">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls">
<button class="jp-previous" role="button" tabindex="0">previous</button>
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
<button class="jp-next" role="button" tabindex="0">next</button>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-shuffle" role="button" tabindex="0">shuffle</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
</div>
</div>
<div class="jp-playlist">
<ul>
<!-- The method Playlist.displayPlaylist() uses this unordered list -->
<li></li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,43 @@
<div id="{{WRAPPER}}" class="jp-video " role="application" aria-label="media player">
<div class="jp-type-single">
<div id="{{JPLAYER}}" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
<div class="jp-controls-holder">
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>

View File

@@ -0,0 +1,684 @@
/*
* Skin for jPlayer Plugin (jQuery JavaScript Library)
* http://www.jplayer.org
*
* Skin Name: Pink Flag
*
* Copyright (c) 2012 - 2014 Happyworm Ltd
* Licensed under the MIT license.
* - http://www.opensource.org/licenses/mit-license.php
*
* Author: Silvia Benvenuti
* Skin Version: 2.1 (jPlayer 2.8.0)
* Date: 13th November 2014
*/
$jplayer-images-base-url: "../image/" !default;
.jp-audio *:focus,
.jp-audio-stream *:focus,
.jp-video *:focus {
/* Disable the browser focus highlighting. */
outline:none;
}
.jp-audio button::-moz-focus-inner,
.jp-audio-stream button::-moz-focus-inner,
.jp-video button::-moz-focus-inner {
/* Disable the browser CSS3 focus highlighting. */
border: 0;
}
.jp-audio,
.jp-audio-stream,
.jp-video {
font-size:16px;
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;
}
.jp-audio {
width:201px;
padding:20px;
}
.jp-audio-stream {
width:101px;
padding:20px 20px 10px 20px;
}
.jp-video-270p {
width:480px;
}
.jp-video-360p {
width:640px;
}
.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;
}
/* The z-index rule is defined in this manner to enable Popcorn plugins that add overlays to video area. EG. Subtitles. */
.jp-video-full div div {
z-index:1000;
}
.jp-video-full .jp-jplayer {
top: 0;
left: 0;
position: fixed !important; position: relative; /* Rules for IE6 (full-screen) */
overflow: hidden;
}
.jp-video-full .jp-gui {
position: fixed !important; position: static; /* Rules for IE6 (full-screen) */
top: 0;
left: 0;
width:100%;
height:100%;
z-index:1001; /* 1 layer above the others. */
}
.jp-video-full .jp-interface {
position: absolute !important; position: relative; /* Rules for IE6 (full-screen) */
bottom: 0;
left: 0;
}
.jp-interface {
position: relative;
width:100%;
background-color:#3a2a45; /* Required for the full screen */
}
/* @group CONTROLS */
.jp-video .jp-controls-holder {
clear: both;
width:440px;
margin:0 auto 10px auto;
position: relative;
overflow:hidden;
}
.jp-audio .jp-controls-holder {
height: 80px;
}
.jp-audio-stream .jp-controls-holder {
height: 50px;
}
.jp-controls {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0 0 no-repeat;
padding: 1px 0 2px 1px;
overflow:hidden;
width: 201px;
height: 34px;
}
.jp-audio .jp-controls,
.jp-audio-stream .jp-controls {
margin:0 auto;
}
.jp-audio-stream .jp-controls {
width: 100px;
}
.jp-video .jp-controls {
margin:0 0 0 115px;
float:left;
display:inline; /* need this to fix IE6 double margin */
}
.jp-controls button {
display:block;
float:left;
overflow:hidden;
text-indent:-9999px;
height: 34px;
margin: 0 1px 2px 0;
padding: 0;
border:none;
cursor: pointer;
}
/* @group single player controls */
.jp-type-single .jp-controls button {
width: 99px;
}
.jp-type-single .jp-play {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0px -40px no-repeat;
}
.jp-type-single .jp-play:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -100px -40px no-repeat;
}
.jp-state-playing .jp-type-single .jp-play {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0px -120px no-repeat;
}
.jp-state-playing .jp-type-single .jp-play:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -100px -120px no-repeat;
}
/* The right border is normally in the ul background image. */
.jp-audio-stream .jp-play,
.jp-audio-stream .jp-pause {
border-right:1px solid #180920;
}
.jp-type-single .jp-stop {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0px -80px no-repeat;
}
.jp-type-single .jp-stop:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -100px -80px no-repeat;
}
/* @end */
/* @group playlist player controls */
.jp-type-playlist .jp-controls button {
width: 49px;
}
.jp-type-playlist .jp-play {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -24px -40px no-repeat;
}
.jp-type-playlist .jp-play:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -124px -40px no-repeat;
}
.jp-state-playing div.jp-type-playlist .jp-play {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -24px -120px no-repeat;
}
.jp-state-playing div.jp-type-playlist .jp-play:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -124px -120px no-repeat;
}
.jp-type-playlist .jp-stop {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -24px -80px no-repeat;
}
.jp-type-playlist .jp-stop:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -124px -80px no-repeat;
}
.jp-type-playlist .jp-previous {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -24px -200px no-repeat;
}
.jp-type-playlist .jp-previous:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -124px -200px no-repeat;
}
.jp-type-playlist .jp-next {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -24px -160px no-repeat;
}
.jp-type-playlist .jp-next:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -124px -160px no-repeat;
}
/* @end */
/* @group TOGGLES */
.jp-toggles {
padding:0;
margin:0 auto;
overflow:hidden;
}
.jp-audio .jp-toggles {
width:55px;
}
.jp-audio .jp-type-single .jp-toggles {
width:25px;
}
.jp-video .jp-toggles {
float:left;
width:105px;
margin: 10px 0 0 15px;
}
.jp-toggles button {
display:block;
float:left;
width:25px;
height:18px;
text-indent:-9999px;
line-height:100%; /* need this for IE6 */
border:none;
cursor: pointer;
}
.jp-full-screen {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0 -420px no-repeat;
margin-left: 15px;
}
.jp-full-screen:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -30px -420px no-repeat;
}
.jp-state-full-screen .jp-full-screen {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -60px -420px no-repeat;
}
.jp-state-full-screen .jp-full-screen:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -90px -420px no-repeat;
}
.jp-repeat {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0 -440px no-repeat;
margin-left: 0;
}
.jp-repeat:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -30px -440px no-repeat;
}
.jp-state-looped .jp-repeat {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -60px -440px no-repeat;
}
.jp-state-looped .jp-repeat:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -90px -440px no-repeat;
}
.jp-shuffle {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0 -460px no-repeat;
margin-left: 15px;
}
.jp-shuffle:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -30px -460px no-repeat;
}
.jp-state-shuffled .jp-shuffle {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -60px -460px no-repeat;
}
.jp-state-shuffled .jp-shuffle:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -90px -460px no-repeat;
}
.jp-audio .jp-shuffle {
margin-left: 5px;
}
/* @end */
/* @group progress bar */
/* The seeking class is added/removed inside jPlayer */
div.jp-seeking-bg {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.seeking.gif");
}
.jp-progress {
background: url("#{$jplayer-images-base-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-images-base-url}jplayer.pink.flag.jpg") 0px -260px repeat-x;
width:0px;
height: 100%;
overflow:hidden;
cursor:pointer;
}
.jp-play-bar {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0px -280px repeat-x;
width:0px;
height: 100%;
overflow:hidden;
}
/* @end */
/* @group volume controls */
.jp-state-no-volume .jp-volume-controls {
display:none;
}
.jp-audio .jp-volume-controls,
.jp-audio-stream .jp-volume-controls {
height:30px;
}
.jp-volume-controls button {
position: absolute;
display:block;
overflow:hidden;
text-indent:-9999px;
margin: 0;
padding: 0;
width: 16px;
height: 11px;
border:none;
cursor: pointer;
}
.jp-audio .jp-volume-controls .jp-mute,
.jp-audio-stream .jp-volume-controls .jp-mute {
top:-6px;
left: 0;
}
.jp-audio .jp-volume-controls .jp-volume-max,
.jp-audio-stream .jp-volume-controls .jp-volume-max {
top:-6px;
right: 0;
}
.jp-video .jp-volume-controls .jp-mute,
.jp-video .jp-volume-controls .jp-unmute {
left: 0;
top:14px;
}
.jp-video .jp-volume-controls .jp-volume-max {
left: 84px;
top:14px;
}
.jp-volume-controls .jp-mute {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0px -330px no-repeat;
}
.jp-volume-controls .jp-mute:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -25px -330px no-repeat;
}
.jp-state-muted .jp-volume-controls .jp-mute {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -60px -330px no-repeat;
}
.jp-state-muted .jp-volume-controls .jp-mute:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -85px -330px no-repeat;
}
.jp-volume-controls .jp-volume-max {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0px -350px no-repeat;
}
.jp-volume-controls .jp-volume-max:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") -25px -350px no-repeat;
}
.jp-volume-bar {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.jpg") 0px -300px repeat-x;
position: absolute;
width: 197px;
height: 4px;
padding: 2px 2px 1px 2px;
overflow: hidden;
cursor: pointer;
}
.jp-audio .jp-interface .jp-volume-bar,
.jp-audio-stream .jp-interface .jp-volume-bar {
top:10px;
left: 0;
}
.jp-audio-stream .jp-interface .jp-volume-bar {
width: 97px;
border-right:1px solid #180920;
padding-right:1px;
}
.jp-video .jp-volume-bar {
top: 0;
left: 0;
width:95px;
border-right:1px solid #180920;
padding-right:1px;
margin-top: 30px;
}
.jp-volume-bar-value {
background: url("#{$jplayer-images-base-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;
cursor: default;
}
.jp-duration {
float: right;
text-align:right;
cursor: pointer;
}
.jp-video .jp-current-time {
padding-left:20px;
}
.jp-video .jp-duration {
padding-right:20px;
}
/* @end */
/* @group playlist */
.jp-details {
font-size:.7em;
margin:0;
padding:0;
}
.jp-details .jp-title {
padding:0;
margin:0;
overflow:hidden;
text-align:center;
cursor: default;
}
.jp-video .jp-details {
margin: 0 90px 10px;
}
.jp-playlist ul {
list-style-type:none;
font-size:.7em;
margin: 0;
padding: 0;
}
.jp-video .jp-playlist ul {
margin: 0 20px;
}
.jp-playlist li {
position: relative;
padding: 2px 0;
border-top:1px solid #554461;
border-bottom:1px solid #180a1f;
overflow: hidden;
}
/* 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 */
.jp-video .jp-video-play {
width:100%;
overflow:hidden; /* Important for nested negative margins to work in modern browsers */
}
.jp-video-270p .jp-video-play {
margin-top:-270px;
height:270px;
}
.jp-video-360p .jp-video-play {
margin-top:-360px;
height:360px;
}
.jp-video-full .jp-video-play {
height:100%;
}
.jp-video-play-icon {
position:relative;
display:block;
width: 112px;
height: 100px;
margin-left:-56px;
margin-top:-50px;
left:50%;
top:50%;
border:none;
cursor:pointer;
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.video.play.png") 0 0 no-repeat;
text-indent:-9999px;
}
.jp-video-play-icon:focus {
background: url("#{$jplayer-images-base-url}jplayer.pink.flag.video.play.png") 0 -100px no-repeat;
}
.jp-jplayer audio,
.jp-jplayer {
width:0px;
height:0px;
}
.jp-jplayer {
background-color: #000000;
}
/* @group NO SOLUTION error feedback */
.jp-no-solution {
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;
}
/* @end */