|
495 | 495 | supplied: "mp3", // Defines which formats jPlayer will try and support and the priority by the order. 1st is highest,
|
496 | 496 | auroraFormats: "wav", // List the aurora.js codecs being loaded externally. Its core supports "wav". Specify format in jPlayer context. EG., The aac.js codec gives the "m4a" format.
|
497 | 497 | preload: 'metadata', // HTML5 Spec values: none, metadata, auto.
|
498 |
| - volume: 0.512, // The volume. Number 0 to 1. 0.512 (logarithmic) == 0.8 (percentile). |
| 498 | + volume: 0.8, // The volume. Number 0 to 1. |
499 | 499 | volumePower: 3, // The factor use for logarithmic volume control. Recommended = 3. Higher values create a sharper curve. See http://dr-lex.be/info-stuff/volumecontrols.html
|
500 | 500 | muted: false,
|
501 | 501 | remainingDuration: false, // When true, the remaining time is shown in the duration GUI element.
|
|
505 | 505 | defaultPlaybackRate: 1,
|
506 | 506 | minPlaybackRate: 0.5,
|
507 | 507 | maxPlaybackRate: 4,
|
508 |
| - wmode: "opaque", // Valid wmode: window, transparent, opaque, direct, gpu. |
| 508 | + wmode: "opaque", // Valid wmode: window, transparent, opaque, direct, gpu. |
509 | 509 | backgroundColor: "#000000", // To define the jPlayer div and Flash background color.
|
510 | 510 | cssSelectorAncestor: "#jp_container_1",
|
511 | 511 | cssSelector: { // * denotes properties that should only be required when video media type required. _cssSelector() would require changes to enable splitting these into Audio and Video defaults.
|
|
578 | 578 | iemobile: /iemobile/,
|
579 | 579 | webos: /webos/
|
580 | 580 | },
|
| 581 | + useLogarithmicVolume: false, // When set true, makes silent end of the volume bar less sensitive, and the loud end of the volume bar more sensitive |
581 | 582 | noVolume: {
|
582 | 583 | ipad: /ipad/,
|
583 | 584 | iphone: /iphone/,
|
|
815 | 816 | },
|
816 | 817 | _init: function() {
|
817 | 818 | var self = this;
|
818 |
| - |
| 819 | + |
819 | 820 | this.element.empty();
|
820 |
| - |
| 821 | + |
821 | 822 | this.status = $.extend({}, this.status); // Copy static to unique instance.
|
822 | 823 | this.internal = $.extend({}, this.internal); // Copy static to unique instance.
|
823 | 824 |
|
|
848 | 849 | this.formats = []; // Array based on supplied string option. Order defines priority.
|
849 | 850 | this.solutions = []; // Array based on solution string option. Order defines priority.
|
850 | 851 | this.require = {}; // Which media types are required: video, audio.
|
851 |
| - |
| 852 | + |
852 | 853 | this.htmlElement = {}; // DOM elements created by jPlayer
|
853 | 854 | this.html = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.
|
854 | 855 | this.html.audio = {};
|
|
857 | 858 | this.aurora.formats = [];
|
858 | 859 | this.aurora.properties = [];
|
859 | 860 | this.flash = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.
|
860 |
| - |
| 861 | + |
861 | 862 | this.css = {};
|
862 | 863 | this.css.cs = {}; // Holds the css selector strings
|
863 | 864 | this.css.jq = {}; // Holds jQuery selectors. ie., $(css.cs.method)
|
|
899 | 900 | }
|
900 | 901 | }
|
901 | 902 | });
|
902 |
| - |
| 903 | + |
903 | 904 | // Create Aurora.js formats array
|
904 | 905 | $.each(this.options.auroraFormats.toLowerCase().split(","), function(index1, value1) {
|
905 | 906 | var format = value1.replace(/^\s+|\s+$/g, ""); //trim
|
|
1004 | 1005 | this.internal.poster.jq.bind("click.jPlayer", function() {
|
1005 | 1006 | self._trigger($.jPlayer.event.click);
|
1006 | 1007 | });
|
1007 |
| - |
| 1008 | + |
1008 | 1009 | // Generate the required media elements
|
1009 | 1010 | this.html.audio.available = false;
|
1010 | 1011 | if(this.require.audio) { // If a supplied format is audio
|
|
1078 | 1079 |
|
1079 | 1080 | // Set up the css selectors for the control and feedback entities.
|
1080 | 1081 | this._cssSelectorAncestor(this.options.cssSelectorAncestor);
|
1081 |
| - |
| 1082 | + |
1082 | 1083 | // If neither html nor aurora nor flash are being used by this browser, then media playback is not possible. Trigger an error event.
|
1083 | 1084 | if(!(this.html.used || this.aurora.used || this.flash.used)) {
|
1084 | 1085 | this._error( {
|
1085 |
| - type: $.jPlayer.error.NO_SOLUTION, |
| 1086 | + type: $.jPlayer.error.NO_SOLUTION, |
1086 | 1087 | context: "{solution:'" + this.options.solution + "', supplied:'" + this.options.supplied + "'}",
|
1087 | 1088 | message: $.jPlayer.errorMsg.NO_SOLUTION,
|
1088 | 1089 | hint: $.jPlayer.errorHint.NO_SOLUTION
|
|
1102 | 1103 | flashVars = 'jQuery=' + encodeURI(this.options.noConflict) + '&id=' + encodeURI(this.internal.self.id) + '&vol=' + this.options.volume + '&muted=' + this.options.muted;
|
1103 | 1104 |
|
1104 | 1105 | // Code influenced by SWFObject 2.2: http://code.google.com/p/swfobject/
|
1105 |
| - // Non IE browsers have an initial Flash size of 1 by 1 otherwise the wmode affected the Flash ready event. |
| 1106 | + // Non IE browsers have an initial Flash size of 1 by 1 otherwise the wmode affected the Flash ready event. |
1106 | 1107 |
|
1107 | 1108 | if($.jPlayer.browser.msie && (Number($.jPlayer.browser.version) < 9 || $.jPlayer.browser.documentMode < 9)) {
|
1108 | 1109 | var objStr = '<object id="' + this.internal.flash.id + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" tabindex="-1"></object>';
|
|
1122 | 1123 | } else {
|
1123 | 1124 | var createParam = function(el, n, v) {
|
1124 | 1125 | var p = document.createElement("param");
|
1125 |
| - p.setAttribute("name", n); |
| 1126 | + p.setAttribute("name", n); |
1126 | 1127 | p.setAttribute("value", v);
|
1127 | 1128 | el.appendChild(p);
|
1128 | 1129 | };
|
|
1180 | 1181 | });
|
1181 | 1182 | }
|
1182 | 1183 | }
|
1183 |
| - |
| 1184 | + |
1184 | 1185 | // Add the Aurora.js solution if being used.
|
1185 | 1186 | if(this.aurora.used) {
|
1186 | 1187 | // Aurora.js player need to be created for each media, see setMedia function.
|
|
1249 | 1250 | this.element.removeData("jPlayer"); // Remove jPlayer data
|
1250 | 1251 | this.element.unbind(".jPlayer"); // Remove all event handlers created by the jPlayer constructor
|
1251 | 1252 | this.element.empty(); // Remove the inserted child elements
|
1252 |
| - |
| 1253 | + |
1253 | 1254 | delete this.instances[this.internal.instance]; // Clear the instance on the static instance object
|
1254 | 1255 | },
|
1255 | 1256 | destroyRemoved: function() { // Destroy any instances that have gone away.
|
|
1348 | 1349 | // Create the event listeners
|
1349 | 1350 | // Only want the active entity to affect jPlayer and bubble events.
|
1350 | 1351 | // Using entity.gate so that object is referenced and gate property always current
|
1351 |
| - |
| 1352 | + |
1352 | 1353 | mediaElement.addEventListener("progress", function() {
|
1353 | 1354 | if(entity.gate) {
|
1354 | 1355 | if(self.internal.cmdsIgnored && this.readyState > 0) { // Detect iOS executed the command
|
|
1508 | 1509 | // Create the event listeners
|
1509 | 1510 | // Only want the active entity to affect jPlayer and bubble events.
|
1510 | 1511 | // Using entity.gate so that object is referenced and gate property always current
|
1511 |
| - |
| 1512 | + |
1512 | 1513 | player.on("progress", function() {
|
1513 | 1514 | if(entity.gate) {
|
1514 | 1515 | if(self.internal.cmdsIgnored && this.readyState > 0) { // Detect iOS executed the command
|
|
1588 | 1589 | sp = 100;
|
1589 | 1590 | cpr = cpa;
|
1590 | 1591 | }
|
1591 |
| - |
| 1592 | + |
1592 | 1593 | if(override) {
|
1593 | 1594 | ct = 0;
|
1594 | 1595 | cpr = 0;
|
|
1624 | 1625 | sp = 100;
|
1625 | 1626 | cpr = cpa;
|
1626 | 1627 | }
|
1627 |
| - |
| 1628 | + |
1628 | 1629 | if(override) {
|
1629 | 1630 | ct = 0;
|
1630 | 1631 | cpr = 0;
|
|
1692 | 1693 |
|
1693 | 1694 | // Need to read original status before issuing the setMedia command.
|
1694 | 1695 | var currentTime = this.status.currentTime,
|
1695 |
| - paused = this.status.paused; |
| 1696 | + paused = this.status.paused; |
1696 | 1697 |
|
1697 | 1698 | this.setMedia(this.status.media);
|
1698 | 1699 | this.volumeWorker(this.options.volume);
|
|
1944 | 1945 | }
|
1945 | 1946 | },
|
1946 | 1947 | setMedia: function(media) {
|
1947 |
| - |
| 1948 | + |
1948 | 1949 | /* media[format] = String: URL of format. Must contain all of the supplied option's video or audio formats.
|
1949 | 1950 | * media.poster = String: Video poster URL.
|
1950 | 1951 | * media.track = Array: Of objects defining the track element: kind, src, srclang, label, def.
|
|
2012 | 2013 | }
|
2013 | 2014 | self.status.video = false;
|
2014 | 2015 | }
|
2015 |
| - |
| 2016 | + |
2016 | 2017 | supported = true;
|
2017 | 2018 | return false; // Exit $.each
|
2018 | 2019 | }
|
|
2266 | 2267 | }
|
2267 | 2268 | },
|
2268 | 2269 | volume: function(v) {
|
2269 |
| - v = Math.pow(v,this.options.volumePower); |
| 2270 | + // v is treated differently depending on whether useLogarithmicVolume is 'on'. |
| 2271 | + if (this.options.useLogarithmicVolume) { |
| 2272 | + v = Math.pow(v,this.options.volumePower); |
| 2273 | + } |
| 2274 | + |
2270 | 2275 | this.volumeWorker(v);
|
2271 | 2276 | if(this.options.globalVolume) {
|
2272 | 2277 | this.tellOthers("volumeWorker", function() {
|
|
2338 | 2343 | }
|
2339 | 2344 | if(this.css.jq.volumeBarValue.length) {
|
2340 | 2345 | this.css.jq.volumeBarValue.show();
|
2341 |
| - this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((Math.pow(v,1/this.options.volumePower)*100)+"%"); |
| 2346 | + |
| 2347 | + if (this.options.useLogarithmicVolume) { |
| 2348 | + this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((Math.pow(v,1/this.options.volumePower)*100)+"%"); |
| 2349 | + } else { |
| 2350 | + this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((v*100)+"%"); |
| 2351 | + } |
2342 | 2352 | }
|
2343 | 2353 | if(this.css.jq.volumeMax.length) {
|
2344 | 2354 | this.css.jq.volumeMax.show();
|
|
2389 | 2399 | if(cssSel) { // Checks for empty string
|
2390 | 2400 | this.css.jq[fn] = $(this.css.cs[fn]);
|
2391 | 2401 | } else {
|
2392 |
| - this.css.jq[fn] = []; // To comply with the css.jq[fn].length check before its use. As of jQuery 1.4 could have used $() for an empty set. |
| 2402 | + this.css.jq[fn] = []; // To comply with the css.jq[fn].length check before its use. As of jQuery 1.4 could have used $() for an empty set. |
2393 | 2403 | }
|
2394 | 2404 |
|
2395 | 2405 | if(this.css.jq[fn].length && this[fn]) {
|
|
2718 | 2728 | case "autoBlur" :
|
2719 | 2729 | this.options[key] = value;
|
2720 | 2730 | break;
|
| 2731 | + case "useLogarithmicVolume" : |
| 2732 | + this.options[key] = value; |
| 2733 | + break; |
2721 | 2734 | }
|
2722 | 2735 |
|
2723 | 2736 | return this;
|
|
2781 | 2794 | //get the change from last position to this position
|
2782 | 2795 | deltaX = self.internal.mouse.x - event.pageX;
|
2783 | 2796 | deltaY = self.internal.mouse.y - event.pageY;
|
2784 |
| - moved = (Math.floor(deltaX) > 0) || (Math.floor(deltaY)>0); |
| 2797 | + moved = (Math.floor(deltaX) > 0) || (Math.floor(deltaY)>0); |
2785 | 2798 | } else {
|
2786 | 2799 | moved = true;
|
2787 | 2800 | }
|
|
3097 | 3110 | }
|
3098 | 3111 | },
|
3099 | 3112 | _aurora_setAudio: function(media) {
|
3100 |
| - var self = this; |
3101 |
| - |
| 3113 | + var self = this; |
| 3114 | + |
3102 | 3115 | // Always finds a format due to checks in setMedia()
|
3103 | 3116 | $.each(this.formats, function(priority, format) {
|
3104 | 3117 | if(self.aurora.support[format] && media[format]) {
|
3105 | 3118 | self.status.src = media[format];
|
3106 | 3119 | self.status.format[format] = true;
|
3107 | 3120 | self.status.formatType = format;
|
3108 |
| - |
| 3121 | + |
3109 | 3122 | return false;
|
3110 | 3123 | }
|
3111 | 3124 | });
|
3112 |
| - |
| 3125 | + |
3113 | 3126 | this.aurora.player = new AV.Player.fromURL(this.status.src);
|
3114 | 3127 | this._addAuroraEventListeners(this.aurora.player, this.aurora);
|
3115 | 3128 |
|
|
3143 | 3156 | }
|
3144 | 3157 | this.status.waitForLoad = false;
|
3145 | 3158 | this._aurora_checkWaitForPlay();
|
3146 |
| - |
| 3159 | + |
3147 | 3160 | // No event from the player, update UI now.
|
3148 | 3161 | this._updateButtons(true);
|
3149 | 3162 | this._trigger($.jPlayer.event.play);
|
|
3153 | 3166 | this.aurora.player.seek(time * 1000);
|
3154 | 3167 | }
|
3155 | 3168 | this.aurora.player.pause();
|
3156 |
| - |
| 3169 | + |
3157 | 3170 | if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button.
|
3158 | 3171 | this._aurora_checkWaitForPlay();
|
3159 | 3172 | }
|
3160 |
| - |
| 3173 | + |
3161 | 3174 | // No event from the player, update UI now.
|
3162 | 3175 | this._updateButtons(false);
|
3163 | 3176 | this._trigger($.jPlayer.event.pause);
|
|
3167 | 3180 | // The seek() sould be in milliseconds, but the only codec that works with seek (aac.js) uses seconds.
|
3168 | 3181 | this.aurora.player.seek(percent * this.aurora.player.duration / 100); // Using seconds
|
3169 | 3182 | }
|
3170 |
| - |
| 3183 | + |
3171 | 3184 | if(!this.status.waitForLoad) {
|
3172 | 3185 | this._aurora_checkWaitForPlay();
|
3173 | 3186 | }
|
|
3233 | 3246 | break;
|
3234 | 3247 | case "rtmpv":
|
3235 | 3248 | self._getMovie().fl_setVideo_rtmp(media[format]);
|
3236 |
| - break; |
| 3249 | + break; |
3237 | 3250 | }
|
3238 | 3251 | self.status.src = media[format];
|
3239 | 3252 | self.status.format[format] = true;
|
|
0 commit comments