jplayer-rails 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cdb99efef11428a5a04bd45724ee97318ef7d41a
4
+ data.tar.gz: ca0f6a9f854e8f04206f243060c07793e6dc15a7
5
+ SHA512:
6
+ metadata.gz: f342f0e7325e9654bb09b6a12ed831022dffafa1f8476e443bddf1dff201c2e3cbbc646bc80249258e78ec8a6251442718f65386f294a3a9229aa5ef71149615
7
+ data.tar.gz: 45120000d12c7777c48acbb9dfcc7521545a65a5f82e659a0b3599a82e35255e9d5eafb7123f506821c2ac1123f363e87e32a47cb2126374ebeee4a0c7e66d91
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tony Miller
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ # jplayer-rails
2
+
3
+ jplayer for rails asset pipeline
4
+
5
+ http://www.jplayer.org/
6
+ https://github.com/happyworm/jPlayer
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'jplayer-rails'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install jplayer-rails
21
+
22
+ ## Usage
23
+
24
+ Add to your application.js
25
+
26
+ //= require 'jquery.jplayer'
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ require "jplayer-rails/version"
2
+
3
+ module Jplayer
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Jplayer
2
+ module Rails
3
+ VERSION = "2.4.1"
4
+ end
5
+ end
@@ -0,0 +1,2840 @@
1
+ /*
2
+ * jPlayer Plugin for jQuery JavaScript Library
3
+ * http://www.jplayer.org
4
+ *
5
+ * Copyright (c) 2009 - 2013 Happyworm Ltd
6
+ * Licensed under the MIT license.
7
+ * http://opensource.org/licenses/MIT
8
+ *
9
+ * Author: Mark J Panaghiston
10
+ * Version: 2.4.1
11
+ * Date: 21st June 2013
12
+ */
13
+
14
+ /* Code verified using http://www.jshint.com/ */
15
+ /*jshint asi:false, bitwise:false, boss:false, browser:true, curly:true, debug:false, eqeqeq:true, eqnull:false, evil:false, forin:false, immed:false, jquery:true, laxbreak:false, newcap:true, noarg:true, noempty:true, nonew:true, onevar:false, passfail:false, plusplus:false, regexp:false, undef:true, sub:false, strict:false, white:false, smarttabs:true */
16
+ /*global define:false, ActiveXObject:false, alert:false */
17
+
18
+ /* Support for Zepto 1.0 compiled with optional data module.
19
+ * For AMD support, you will need to manually switch the 2 lines in the code below.
20
+ * Search terms: "jQuery Switch" and "Zepto Switch"
21
+ */
22
+
23
+ (function (root, factory) {
24
+ if (typeof define === 'function' && define.amd) {
25
+ // AMD. Register as an anonymous module.
26
+ define(['jquery'], factory); // jQuery Switch
27
+ // define(['zepto'], factory); // Zepto Switch
28
+ } else {
29
+ // Browser globals
30
+ if(root.jQuery) { // Use jQuery if available
31
+ factory(root.jQuery);
32
+ } else { // Otherwise, use Zepto
33
+ factory(root.Zepto);
34
+ }
35
+ }
36
+ }(this, function ($, undefined) {
37
+
38
+ // Adapted from jquery.ui.widget.js (1.8.7): $.widget.bridge - Tweaked $.data(this,XYZ) to $(this).data(XYZ) for Zepto
39
+ $.fn.jPlayer = function( options ) {
40
+ var name = "jPlayer";
41
+ var isMethodCall = typeof options === "string",
42
+ args = Array.prototype.slice.call( arguments, 1 ),
43
+ returnValue = this;
44
+
45
+ // allow multiple hashes to be passed on init
46
+ options = !isMethodCall && args.length ?
47
+ $.extend.apply( null, [ true, options ].concat(args) ) :
48
+ options;
49
+
50
+ // prevent calls to internal methods
51
+ if ( isMethodCall && options.charAt( 0 ) === "_" ) {
52
+ return returnValue;
53
+ }
54
+
55
+ if ( isMethodCall ) {
56
+ this.each(function() {
57
+ var instance = $(this).data( name ),
58
+ methodValue = instance && $.isFunction( instance[options] ) ?
59
+ instance[ options ].apply( instance, args ) :
60
+ instance;
61
+ if ( methodValue !== instance && methodValue !== undefined ) {
62
+ returnValue = methodValue;
63
+ return false;
64
+ }
65
+ });
66
+ } else {
67
+ this.each(function() {
68
+ var instance = $(this).data( name );
69
+ if ( instance ) {
70
+ // instance.option( options || {} )._init(); // Orig jquery.ui.widget.js code: Not recommend for jPlayer. ie., Applying new options to an existing instance (via the jPlayer constructor) and performing the _init(). The _init() is what concerns me. It would leave a lot of event handlers acting on jPlayer instance and the interface.
71
+ instance.option( options || {} ); // The new constructor only changes the options. Changing options only has basic support atm.
72
+ } else {
73
+ $(this).data( name, new $.jPlayer( options, this ) );
74
+ }
75
+ });
76
+ }
77
+
78
+ return returnValue;
79
+ };
80
+
81
+ $.jPlayer = function( options, element ) {
82
+ // allow instantiation without initializing for simple inheritance
83
+ if ( arguments.length ) {
84
+ this.element = $(element);
85
+ this.options = $.extend(true, {},
86
+ this.options,
87
+ options
88
+ );
89
+ var self = this;
90
+ this.element.bind( "remove.jPlayer", function() {
91
+ self.destroy();
92
+ });
93
+ this._init();
94
+ }
95
+ };
96
+ // End of: (Adapted from jquery.ui.widget.js (1.8.7))
97
+
98
+ // Zepto is missing one of the animation methods.
99
+ if(typeof $.fn.stop !== 'function') {
100
+ $.fn.stop = function() {};
101
+ }
102
+
103
+ // Emulated HTML5 methods and properties
104
+ $.jPlayer.emulateMethods = "load play pause";
105
+ $.jPlayer.emulateStatus = "src readyState networkState currentTime duration paused ended playbackRate";
106
+ $.jPlayer.emulateOptions = "muted volume";
107
+
108
+ // Reserved event names generated by jPlayer that are not part of the HTML5 Media element spec
109
+ $.jPlayer.reservedEvent = "ready flashreset resize repeat error warning";
110
+
111
+ // Events generated by jPlayer
112
+ $.jPlayer.event = {};
113
+ $.each(
114
+ [
115
+ 'ready',
116
+ 'flashreset', // Similar to the ready event if the Flash solution is set to display:none and then shown again or if it's reloaded for another reason by the browser. For example, using CSS position:fixed on Firefox for the full screen feature.
117
+ 'resize', // Occurs when the size changes through a full/restore screen operation or if the size/sizeFull options are changed.
118
+ 'repeat', // Occurs when the repeat status changes. Usually through clicks on the repeat button of the interface.
119
+ 'click', // Occurs when the user clicks on one of the following: poster image, html video, flash video.
120
+ 'error', // Event error code in event.jPlayer.error.type. See $.jPlayer.error
121
+ 'warning', // Event warning code in event.jPlayer.warning.type. See $.jPlayer.warning
122
+
123
+ // Other events match HTML5 spec.
124
+ 'loadstart',
125
+ 'progress',
126
+ 'suspend',
127
+ 'abort',
128
+ 'emptied',
129
+ 'stalled',
130
+ 'play',
131
+ 'pause',
132
+ 'loadedmetadata',
133
+ 'loadeddata',
134
+ 'waiting',
135
+ 'playing',
136
+ 'canplay',
137
+ 'canplaythrough',
138
+ 'seeking',
139
+ 'seeked',
140
+ 'timeupdate',
141
+ 'ended',
142
+ 'ratechange',
143
+ 'durationchange',
144
+ 'volumechange'
145
+ ],
146
+ function() {
147
+ $.jPlayer.event[ this ] = 'jPlayer_' + this;
148
+ }
149
+ );
150
+
151
+ $.jPlayer.htmlEvent = [ // These HTML events are bubbled through to the jPlayer event, without any internal action.
152
+ "loadstart",
153
+ // "progress", // jPlayer uses internally before bubbling.
154
+ // "suspend", // jPlayer uses internally before bubbling.
155
+ "abort",
156
+ // "error", // jPlayer uses internally before bubbling.
157
+ "emptied",
158
+ "stalled",
159
+ // "play", // jPlayer uses internally before bubbling.
160
+ // "pause", // jPlayer uses internally before bubbling.
161
+ "loadedmetadata",
162
+ "loadeddata",
163
+ // "waiting", // jPlayer uses internally before bubbling.
164
+ // "playing", // jPlayer uses internally before bubbling.
165
+ "canplay",
166
+ "canplaythrough",
167
+ // "seeking", // jPlayer uses internally before bubbling.
168
+ // "seeked", // jPlayer uses internally before bubbling.
169
+ // "timeupdate", // jPlayer uses internally before bubbling.
170
+ // "ended", // jPlayer uses internally before bubbling.
171
+ "ratechange"
172
+ // "durationchange" // jPlayer uses internally before bubbling.
173
+ // "volumechange" // jPlayer uses internally before bubbling.
174
+ ];
175
+
176
+ $.jPlayer.pause = function() {
177
+ $.each($.jPlayer.prototype.instances, function(i, element) {
178
+ if(element.data("jPlayer").status.srcSet) { // Check that media is set otherwise would cause error event.
179
+ element.jPlayer("pause");
180
+ }
181
+ });
182
+ };
183
+
184
+ // Default for jPlayer option.timeFormat
185
+ $.jPlayer.timeFormat = {
186
+ showHour: false,
187
+ showMin: true,
188
+ showSec: true,
189
+ padHour: false,
190
+ padMin: true,
191
+ padSec: true,
192
+ sepHour: ":",
193
+ sepMin: ":",
194
+ sepSec: ""
195
+ };
196
+ var ConvertTime = function() {
197
+ this.init();
198
+ };
199
+ ConvertTime.prototype = {
200
+ init: function() {
201
+ this.options = {
202
+ timeFormat: $.jPlayer.timeFormat
203
+ };
204
+ },
205
+ time: function(s) { // function used on jPlayer.prototype._convertTime to enable per instance options.
206
+ s = (s && typeof s === 'number') ? s : 0;
207
+
208
+ var myTime = new Date(s * 1000),
209
+ hour = myTime.getUTCHours(),
210
+ min = this.options.timeFormat.showHour ? myTime.getUTCMinutes() : myTime.getUTCMinutes() + hour * 60,
211
+ sec = this.options.timeFormat.showMin ? myTime.getUTCSeconds() : myTime.getUTCSeconds() + min * 60,
212
+ strHour = (this.options.timeFormat.padHour && hour < 10) ? "0" + hour : hour,
213
+ strMin = (this.options.timeFormat.padMin && min < 10) ? "0" + min : min,
214
+ strSec = (this.options.timeFormat.padSec && sec < 10) ? "0" + sec : sec,
215
+ strTime = "";
216
+
217
+ strTime += this.options.timeFormat.showHour ? strHour + this.options.timeFormat.sepHour : "";
218
+ strTime += this.options.timeFormat.showMin ? strMin + this.options.timeFormat.sepMin : "";
219
+ strTime += this.options.timeFormat.showSec ? strSec + this.options.timeFormat.sepSec : "";
220
+
221
+ return strTime;
222
+ }
223
+ };
224
+ var myConvertTime = new ConvertTime();
225
+ $.jPlayer.convertTime = function(s) {
226
+ return myConvertTime.time(s);
227
+ };
228
+
229
+ // Adapting jQuery 1.4.4 code for jQuery.browser. Required since jQuery 1.3.2 does not detect Chrome as webkit.
230
+ $.jPlayer.uaBrowser = function( userAgent ) {
231
+ var ua = userAgent.toLowerCase();
232
+
233
+ // Useragent RegExp
234
+ var rwebkit = /(webkit)[ \/]([\w.]+)/;
235
+ var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/;
236
+ var rmsie = /(msie) ([\w.]+)/;
237
+ var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/;
238
+
239
+ var match = rwebkit.exec( ua ) ||
240
+ ropera.exec( ua ) ||
241
+ rmsie.exec( ua ) ||
242
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
243
+ [];
244
+
245
+ return { browser: match[1] || "", version: match[2] || "0" };
246
+ };
247
+
248
+ // Platform sniffer for detecting mobile devices
249
+ $.jPlayer.uaPlatform = function( userAgent ) {
250
+ var ua = userAgent.toLowerCase();
251
+
252
+ // Useragent RegExp
253
+ var rplatform = /(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/;
254
+ var rtablet = /(ipad|playbook)/;
255
+ var randroid = /(android)/;
256
+ var rmobile = /(mobile)/;
257
+
258
+ var platform = rplatform.exec( ua ) || [];
259
+ var tablet = rtablet.exec( ua ) ||
260
+ !rmobile.exec( ua ) && randroid.exec( ua ) ||
261
+ [];
262
+
263
+ if(platform[1]) {
264
+ platform[1] = platform[1].replace(/\s/g, "_"); // Change whitespace to underscore. Enables dot notation.
265
+ }
266
+
267
+ return { platform: platform[1] || "", tablet: tablet[1] || "" };
268
+ };
269
+
270
+ $.jPlayer.browser = {
271
+ };
272
+ $.jPlayer.platform = {
273
+ };
274
+
275
+ var browserMatch = $.jPlayer.uaBrowser(navigator.userAgent);
276
+ if ( browserMatch.browser ) {
277
+ $.jPlayer.browser[ browserMatch.browser ] = true;
278
+ $.jPlayer.browser.version = browserMatch.version;
279
+ }
280
+ var platformMatch = $.jPlayer.uaPlatform(navigator.userAgent);
281
+ if ( platformMatch.platform ) {
282
+ $.jPlayer.platform[ platformMatch.platform ] = true;
283
+ $.jPlayer.platform.mobile = !platformMatch.tablet;
284
+ $.jPlayer.platform.tablet = !!platformMatch.tablet;
285
+ }
286
+
287
+ // Internet Explorer (IE) Browser Document Mode Sniffer. Based on code at:
288
+ // http://msdn.microsoft.com/en-us/library/cc288325%28v=vs.85%29.aspx#GetMode
289
+ $.jPlayer.getDocMode = function() {
290
+ var docMode;
291
+ if ($.jPlayer.browser.msie) {
292
+ if (document.documentMode) { // IE8 or later
293
+ docMode = document.documentMode;
294
+ } else { // IE 5-7
295
+ docMode = 5; // Assume quirks mode unless proven otherwise
296
+ if (document.compatMode) {
297
+ if (document.compatMode === "CSS1Compat") {
298
+ docMode = 7; // standards mode
299
+ }
300
+ }
301
+ }
302
+ }
303
+ return docMode;
304
+ };
305
+ $.jPlayer.browser.documentMode = $.jPlayer.getDocMode();
306
+
307
+ $.jPlayer.nativeFeatures = {
308
+ init: function() {
309
+
310
+ /* Fullscreen function naming influenced by W3C naming.
311
+ * No support for: Mozilla Proposal: https://wiki.mozilla.org/Gecko:FullScreenAPI
312
+ */
313
+
314
+ var d = document,
315
+ v = d.createElement('video'),
316
+ spec = {
317
+ // http://www.w3.org/TR/fullscreen/
318
+ w3c: [
319
+ 'fullscreenEnabled',
320
+ 'fullscreenElement',
321
+ 'requestFullscreen',
322
+ 'exitFullscreen',
323
+ 'fullscreenchange',
324
+ 'fullscreenerror'
325
+ ],
326
+ // https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode
327
+ moz: [
328
+ 'mozFullScreenEnabled',
329
+ 'mozFullScreenElement',
330
+ 'mozRequestFullScreen',
331
+ 'mozCancelFullScreen',
332
+ 'mozfullscreenchange',
333
+ 'mozfullscreenerror'
334
+ ],
335
+ // http://developer.apple.com/library/safari/#documentation/WebKit/Reference/ElementClassRef/Element/Element.html
336
+ // http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
337
+ webkit: [
338
+ '',
339
+ 'webkitCurrentFullScreenElement',
340
+ 'webkitRequestFullScreen',
341
+ 'webkitCancelFullScreen',
342
+ 'webkitfullscreenchange',
343
+ ''
344
+ ],
345
+ // http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLVideoElementClassReference/HTMLVideoElement/HTMLVideoElement.html
346
+ webkitVideo: [
347
+ 'webkitSupportsFullscreen',
348
+ 'webkitDisplayingFullscreen',
349
+ 'webkitEnterFullscreen',
350
+ 'webkitExitFullscreen',
351
+ '',
352
+ ''
353
+ ]
354
+ },
355
+ specOrder = [
356
+ 'w3c',
357
+ 'moz',
358
+ 'webkit',
359
+ 'webkitVideo'
360
+ ],
361
+ fs, i, il;
362
+
363
+ this.fullscreen = fs = {
364
+ support: {
365
+ w3c: !!d[spec.w3c[0]],
366
+ moz: !!d[spec.moz[0]],
367
+ webkit: typeof d[spec.webkit[3]] === 'function',
368
+ webkitVideo: typeof v[spec.webkitVideo[2]] === 'function'
369
+ },
370
+ used: {}
371
+ };
372
+
373
+ // Store the name of the spec being used and as a handy boolean.
374
+ for(i = 0, il = specOrder.length; i < il; i++) {
375
+ var n = specOrder[i];
376
+ if(fs.support[n]) {
377
+ fs.spec = n;
378
+ fs.used[n] = true;
379
+ break;
380
+ }
381
+ }
382
+
383
+ if(fs.spec) {
384
+ var s = spec[fs.spec];
385
+ fs.api = {
386
+ fullscreenEnabled: true,
387
+ fullscreenElement: function(elem) {
388
+ elem = elem ? elem : d; // Video element required for webkitVideo
389
+ return elem[s[1]];
390
+ },
391
+ requestFullscreen: function(elem) {
392
+ return elem[s[2]]();
393
+ },
394
+ exitFullscreen: function(elem) {
395
+ elem = elem ? elem : d; // Video element required for webkitVideo
396
+ return elem[s[3]]();
397
+ }
398
+ };
399
+ fs.event = {
400
+ fullscreenchange: s[4],
401
+ fullscreenerror: s[5]
402
+ };
403
+ } else {
404
+ fs.api = {
405
+ fullscreenEnabled: false,
406
+ fullscreenElement: function() {
407
+ return null;
408
+ },
409
+ requestFullscreen: function() {},
410
+ exitFullscreen: function() {}
411
+ };
412
+ fs.event = {};
413
+ }
414
+ }
415
+ };
416
+ $.jPlayer.nativeFeatures.init();
417
+
418
+ // The keyboard control system.
419
+
420
+ // The current jPlayer instance in focus.
421
+ $.jPlayer.focus = null;
422
+
423
+ // The list of element node names to ignore with key controls.
424
+ $.jPlayer.keyIgnoreElementNames = "INPUT TEXTAREA";
425
+
426
+ // The function that deals with key presses.
427
+ var keyBindings = function(event) {
428
+
429
+ var f = $.jPlayer.focus,
430
+ ignoreKey;
431
+
432
+ // A jPlayer instance must be in focus. ie., keyEnabled and the last one played.
433
+ if(f) {
434
+ // What generated the key press?
435
+ $.each( $.jPlayer.keyIgnoreElementNames.split(/\s+/g), function(i, name) {
436
+ // The strings should already be uppercase.
437
+ if(event.target.nodeName.toUpperCase() === name.toUpperCase()) {
438
+ ignoreKey = true;
439
+ return false; // exit each.
440
+ }
441
+ });
442
+ if(!ignoreKey) {
443
+ // See if the key pressed matches any of the bindings.
444
+ $.each(f.options.keyBindings, function(action, binding) {
445
+ // The binding could be a null when the default has been disabled. ie., 1st clause in if()
446
+ if(binding && event.which === binding.key && $.isFunction(binding.fn)) {
447
+ event.preventDefault(); // Key being used by jPlayer, so prevent default operation.
448
+ binding.fn(f);
449
+ return false; // exit each.
450
+ }
451
+ });
452
+ }
453
+ }
454
+ };
455
+
456
+ $.jPlayer.keys = function(en) {
457
+ var event = "keydown.jPlayer";
458
+ // Remove any binding, just in case enabled more than once.
459
+ $(document.documentElement).unbind(event);
460
+ if(en) {
461
+ $(document.documentElement).bind(event, keyBindings);
462
+ }
463
+ };
464
+
465
+ // Enable the global key control handler ready for any jPlayer instance with the keyEnabled option enabled.
466
+ $.jPlayer.keys(true);
467
+
468
+ $.jPlayer.prototype = {
469
+ count: 0, // Static Variable: Change it via prototype.
470
+ version: { // Static Object
471
+ script: "2.4.1",
472
+ needFlash: "2.4.1",
473
+ flash: "unknown"
474
+ },
475
+ options: { // Instanced in $.jPlayer() constructor
476
+ swfPath: "js", // Path to Jplayer.swf. Can be relative, absolute or server root relative.
477
+ solution: "html, flash", // Valid solutions: html, flash. Order defines priority. 1st is highest,
478
+ supplied: "mp3", // Defines which formats jPlayer will try and support and the priority by the order. 1st is highest,
479
+ preload: 'metadata', // HTML5 Spec values: none, metadata, auto.
480
+ volume: 0.8, // The volume. Number 0 to 1.
481
+ muted: false,
482
+ wmode: "opaque", // Valid wmode: window, transparent, opaque, direct, gpu.
483
+ backgroundColor: "#000000", // To define the jPlayer div and Flash background color.
484
+ cssSelectorAncestor: "#jp_container_1",
485
+ 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.
486
+ videoPlay: ".jp-video-play", // *
487
+ play: ".jp-play",
488
+ pause: ".jp-pause",
489
+ stop: ".jp-stop",
490
+ seekBar: ".jp-seek-bar",
491
+ playBar: ".jp-play-bar",
492
+ mute: ".jp-mute",
493
+ unmute: ".jp-unmute",
494
+ volumeBar: ".jp-volume-bar",
495
+ volumeBarValue: ".jp-volume-bar-value",
496
+ volumeMax: ".jp-volume-max",
497
+ currentTime: ".jp-current-time",
498
+ duration: ".jp-duration",
499
+ fullScreen: ".jp-full-screen", // *
500
+ restoreScreen: ".jp-restore-screen", // *
501
+ repeat: ".jp-repeat",
502
+ repeatOff: ".jp-repeat-off",
503
+ gui: ".jp-gui", // The interface used with autohide feature.
504
+ noSolution: ".jp-no-solution" // For error feedback when jPlayer cannot find a solution.
505
+ },
506
+ smoothPlayBar: false, // Smooths the play bar transitions, which affects clicks and short media with big changes per second.
507
+ fullScreen: false, // Native Full Screen
508
+ fullWindow: false,
509
+ autohide: {
510
+ restored: false, // Controls the interface autohide feature.
511
+ full: true, // Controls the interface autohide feature.
512
+ fadeIn: 200, // Milliseconds. The period of the fadeIn anim.
513
+ fadeOut: 600, // Milliseconds. The period of the fadeOut anim.
514
+ hold: 1000 // Milliseconds. The period of the pause before autohide beings.
515
+ },
516
+ loop: false,
517
+ repeat: function(event) { // The default jPlayer repeat event handler
518
+ if(event.jPlayer.options.loop) {
519
+ $(this).unbind(".jPlayerRepeat").bind($.jPlayer.event.ended + ".jPlayer.jPlayerRepeat", function() {
520
+ $(this).jPlayer("play");
521
+ });
522
+ } else {
523
+ $(this).unbind(".jPlayerRepeat");
524
+ }
525
+ },
526
+ nativeVideoControls: {
527
+ // Works well on standard browsers.
528
+ // Phone and tablet browsers can have problems with the controls disappearing.
529
+ },
530
+ noFullWindow: {
531
+ msie: /msie [0-6]\./,
532
+ ipad: /ipad.*?os [0-4]\./,
533
+ iphone: /iphone/,
534
+ ipod: /ipod/,
535
+ android_pad: /android [0-3]\.(?!.*?mobile)/,
536
+ android_phone: /android.*?mobile/,
537
+ blackberry: /blackberry/,
538
+ windows_ce: /windows ce/,
539
+ iemobile: /iemobile/,
540
+ webos: /webos/
541
+ },
542
+ noVolume: {
543
+ ipad: /ipad/,
544
+ iphone: /iphone/,
545
+ ipod: /ipod/,
546
+ android_pad: /android(?!.*?mobile)/,
547
+ android_phone: /android.*?mobile/,
548
+ blackberry: /blackberry/,
549
+ windows_ce: /windows ce/,
550
+ iemobile: /iemobile/,
551
+ webos: /webos/,
552
+ playbook: /playbook/
553
+ },
554
+ timeFormat: {
555
+ // Specific time format for this instance. The supported options are defined in $.jPlayer.timeFormat
556
+ // For the undefined options we use the default from $.jPlayer.timeFormat
557
+ },
558
+ keyEnabled: false, // Enables keyboard controls.
559
+ audioFullScreen: false, // Enables keyboard controls to enter full screen with audio media.
560
+ keyBindings: { // The key control object, defining the key codes and the functions to execute.
561
+ // The parameter, f = $.jPlayer.focus, will be checked truethy before attempting to call any of these functions.
562
+ // Properties may be added to this object, in key/fn pairs, to enable other key controls. EG, for the playlist add-on.
563
+ play: {
564
+ key: 32, // space
565
+ fn: function(f) {
566
+ if(f.status.paused) {
567
+ f.play();
568
+ } else {
569
+ f.pause();
570
+ }
571
+ }
572
+ },
573
+ fullScreen: {
574
+ key: 13, // enter
575
+ fn: function(f) {
576
+ if(f.status.video || f.options.audioFullScreen) {
577
+ f._setOption("fullScreen", !f.options.fullScreen);
578
+ }
579
+ }
580
+ },
581
+ muted: {
582
+ key: 8, // backspace
583
+ fn: function(f) {
584
+ f._muted(!f.options.muted);
585
+ }
586
+ },
587
+ volumeUp: {
588
+ key: 38, // UP
589
+ fn: function(f) {
590
+ f.volume(f.options.volume + 0.1);
591
+ }
592
+ },
593
+ volumeDown: {
594
+ key: 40, // DOWN
595
+ fn: function(f) {
596
+ f.volume(f.options.volume - 0.1);
597
+ }
598
+ }
599
+ },
600
+ verticalVolume: false, // Calculate volume from the bottom of the volume bar. Default is from the left. Also volume affects either width or height.
601
+ // globalVolume: false, // Not implemented: Set to make volume changes affect all jPlayer instances
602
+ // globalMute: false, // Not implemented: Set to make mute changes affect all jPlayer instances
603
+ idPrefix: "jp", // Prefix for the ids of html elements created by jPlayer. For flash, this must not include characters: . - + * / \
604
+ noConflict: "jQuery",
605
+ emulateHtml: false, // Emulates the HTML5 Media element on the jPlayer element.
606
+ errorAlerts: false,
607
+ warningAlerts: false
608
+ },
609
+ optionsAudio: {
610
+ size: {
611
+ width: "0px",
612
+ height: "0px",
613
+ cssClass: ""
614
+ },
615
+ sizeFull: {
616
+ width: "0px",
617
+ height: "0px",
618
+ cssClass: ""
619
+ }
620
+ },
621
+ optionsVideo: {
622
+ size: {
623
+ width: "480px",
624
+ height: "270px",
625
+ cssClass: "jp-video-270p"
626
+ },
627
+ sizeFull: {
628
+ width: "100%",
629
+ height: "100%",
630
+ cssClass: "jp-video-full"
631
+ }
632
+ },
633
+ instances: {}, // Static Object
634
+ status: { // Instanced in _init()
635
+ src: "",
636
+ media: {},
637
+ paused: true,
638
+ format: {},
639
+ formatType: "",
640
+ waitForPlay: true, // Same as waitForLoad except in case where preloading.
641
+ waitForLoad: true,
642
+ srcSet: false,
643
+ video: false, // True if playing a video
644
+ seekPercent: 0,
645
+ currentPercentRelative: 0,
646
+ currentPercentAbsolute: 0,
647
+ currentTime: 0,
648
+ duration: 0,
649
+ videoWidth: 0, // Intrinsic width of the video in pixels.
650
+ videoHeight: 0, // Intrinsic height of the video in pixels.
651
+ readyState: 0,
652
+ networkState: 0,
653
+ playbackRate: 1,
654
+ ended: 0
655
+
656
+ /* Persistant status properties created dynamically at _init():
657
+ width
658
+ height
659
+ cssClass
660
+ nativeVideoControls
661
+ noFullWindow
662
+ noVolume
663
+ */
664
+ },
665
+
666
+ internal: { // Instanced in _init()
667
+ ready: false
668
+ // instance: undefined
669
+ // domNode: undefined
670
+ // htmlDlyCmdId: undefined
671
+ // autohideId: undefined
672
+ // cmdsIgnored
673
+ },
674
+ solution: { // Static Object: Defines the solutions built in jPlayer.
675
+ html: true,
676
+ flash: true
677
+ },
678
+ // 'MPEG-4 support' : canPlayType('video/mp4; codecs="mp4v.20.8"')
679
+ format: { // Static Object
680
+ mp3: {
681
+ codec: 'audio/mpeg; codecs="mp3"',
682
+ flashCanPlay: true,
683
+ media: 'audio'
684
+ },
685
+ m4a: { // AAC / MP4
686
+ codec: 'audio/mp4; codecs="mp4a.40.2"',
687
+ flashCanPlay: true,
688
+ media: 'audio'
689
+ },
690
+ oga: { // OGG
691
+ codec: 'audio/ogg; codecs="vorbis"',
692
+ flashCanPlay: false,
693
+ media: 'audio'
694
+ },
695
+ wav: { // PCM
696
+ codec: 'audio/wav; codecs="1"',
697
+ flashCanPlay: false,
698
+ media: 'audio'
699
+ },
700
+ webma: { // WEBM
701
+ codec: 'audio/webm; codecs="vorbis"',
702
+ flashCanPlay: false,
703
+ media: 'audio'
704
+ },
705
+ fla: { // FLV / F4A
706
+ codec: 'audio/x-flv',
707
+ flashCanPlay: true,
708
+ media: 'audio'
709
+ },
710
+ rtmpa: { // RTMP AUDIO
711
+ codec: 'audio/rtmp; codecs="rtmp"',
712
+ flashCanPlay: true,
713
+ media: 'audio'
714
+ },
715
+ m4v: { // H.264 / MP4
716
+ codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
717
+ flashCanPlay: true,
718
+ media: 'video'
719
+ },
720
+ ogv: { // OGG
721
+ codec: 'video/ogg; codecs="theora, vorbis"',
722
+ flashCanPlay: false,
723
+ media: 'video'
724
+ },
725
+ webmv: { // WEBM
726
+ codec: 'video/webm; codecs="vorbis, vp8"',
727
+ flashCanPlay: false,
728
+ media: 'video'
729
+ },
730
+ flv: { // FLV / F4V
731
+ codec: 'video/x-flv',
732
+ flashCanPlay: true,
733
+ media: 'video'
734
+ },
735
+ rtmpv: { // RTMP VIDEO
736
+ codec: 'video/rtmp; codecs="rtmp"',
737
+ flashCanPlay: true,
738
+ media: 'video'
739
+ }
740
+ },
741
+ _init: function() {
742
+ var self = this;
743
+
744
+ this.element.empty();
745
+
746
+ this.status = $.extend({}, this.status); // Copy static to unique instance.
747
+ this.internal = $.extend({}, this.internal); // Copy static to unique instance.
748
+
749
+ // Initialize the time format
750
+ this.options.timeFormat = $.extend({}, $.jPlayer.timeFormat, this.options.timeFormat);
751
+
752
+ // On iOS, assume commands will be ignored before user initiates them.
753
+ this.internal.cmdsIgnored = $.jPlayer.platform.ipad || $.jPlayer.platform.iphone || $.jPlayer.platform.ipod;
754
+
755
+ this.internal.domNode = this.element.get(0);
756
+
757
+ // Add key bindings focus to 1st jPlayer instanced with key control enabled.
758
+ if(this.options.keyEnabled && !$.jPlayer.focus) {
759
+ $.jPlayer.focus = this;
760
+ }
761
+
762
+ this.formats = []; // Array based on supplied string option. Order defines priority.
763
+ this.solutions = []; // Array based on solution string option. Order defines priority.
764
+ this.require = {}; // Which media types are required: video, audio.
765
+
766
+ this.htmlElement = {}; // DOM elements created by jPlayer
767
+ this.html = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.
768
+ this.html.audio = {};
769
+ this.html.video = {};
770
+ this.flash = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.
771
+
772
+ this.css = {};
773
+ this.css.cs = {}; // Holds the css selector strings
774
+ this.css.jq = {}; // Holds jQuery selectors. ie., $(css.cs.method)
775
+
776
+ this.ancestorJq = []; // Holds jQuery selector of cssSelectorAncestor. Init would use $() instead of [], but it is only 1.4+
777
+
778
+ this.options.volume = this._limitValue(this.options.volume, 0, 1); // Limit volume value's bounds.
779
+
780
+ // Create the formats array, with prority based on the order of the supplied formats string
781
+ $.each(this.options.supplied.toLowerCase().split(","), function(index1, value1) {
782
+ var format = value1.replace(/^\s+|\s+$/g, ""); //trim
783
+ if(self.format[format]) { // Check format is valid.
784
+ var dupFound = false;
785
+ $.each(self.formats, function(index2, value2) { // Check for duplicates
786
+ if(format === value2) {
787
+ dupFound = true;
788
+ return false;
789
+ }
790
+ });
791
+ if(!dupFound) {
792
+ self.formats.push(format);
793
+ }
794
+ }
795
+ });
796
+
797
+ // Create the solutions array, with prority based on the order of the solution string
798
+ $.each(this.options.solution.toLowerCase().split(","), function(index1, value1) {
799
+ var solution = value1.replace(/^\s+|\s+$/g, ""); //trim
800
+ if(self.solution[solution]) { // Check solution is valid.
801
+ var dupFound = false;
802
+ $.each(self.solutions, function(index2, value2) { // Check for duplicates
803
+ if(solution === value2) {
804
+ dupFound = true;
805
+ return false;
806
+ }
807
+ });
808
+ if(!dupFound) {
809
+ self.solutions.push(solution);
810
+ }
811
+ }
812
+ });
813
+
814
+ this.internal.instance = "jp_" + this.count;
815
+ this.instances[this.internal.instance] = this.element;
816
+
817
+ // Check the jPlayer div has an id and create one if required. Important for Flash to know the unique id for comms.
818
+ if(!this.element.attr("id")) {
819
+ this.element.attr("id", this.options.idPrefix + "_jplayer_" + this.count);
820
+ }
821
+
822
+ this.internal.self = $.extend({}, {
823
+ id: this.element.attr("id"),
824
+ jq: this.element
825
+ });
826
+ this.internal.audio = $.extend({}, {
827
+ id: this.options.idPrefix + "_audio_" + this.count,
828
+ jq: undefined
829
+ });
830
+ this.internal.video = $.extend({}, {
831
+ id: this.options.idPrefix + "_video_" + this.count,
832
+ jq: undefined
833
+ });
834
+ this.internal.flash = $.extend({}, {
835
+ id: this.options.idPrefix + "_flash_" + this.count,
836
+ jq: undefined,
837
+ swf: this.options.swfPath + (this.options.swfPath.toLowerCase().slice(-4) !== ".swf" ? (this.options.swfPath && this.options.swfPath.slice(-1) !== "/" ? "/" : "") + "Jplayer.swf" : "")
838
+ });
839
+ this.internal.poster = $.extend({}, {
840
+ id: this.options.idPrefix + "_poster_" + this.count,
841
+ jq: undefined
842
+ });
843
+
844
+ // Register listeners defined in the constructor
845
+ $.each($.jPlayer.event, function(eventName,eventType) {
846
+ if(self.options[eventName] !== undefined) {
847
+ self.element.bind(eventType + ".jPlayer", self.options[eventName]); // With .jPlayer namespace.
848
+ self.options[eventName] = undefined; // Destroy the handler pointer copy on the options. Reason, events can be added/removed in other ways so this could be obsolete and misleading.
849
+ }
850
+ });
851
+
852
+ // Determine if we require solutions for audio, video or both media types.
853
+ this.require.audio = false;
854
+ this.require.video = false;
855
+ $.each(this.formats, function(priority, format) {
856
+ self.require[self.format[format].media] = true;
857
+ });
858
+
859
+ // Now required types are known, finish the options default settings.
860
+ if(this.require.video) {
861
+ this.options = $.extend(true, {},
862
+ this.optionsVideo,
863
+ this.options
864
+ );
865
+ } else {
866
+ this.options = $.extend(true, {},
867
+ this.optionsAudio,
868
+ this.options
869
+ );
870
+ }
871
+ this._setSize(); // update status and jPlayer element size
872
+
873
+ // Determine the status for Blocklisted options.
874
+ this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls);
875
+ this.status.noFullWindow = this._uaBlocklist(this.options.noFullWindow);
876
+ this.status.noVolume = this._uaBlocklist(this.options.noVolume);
877
+
878
+ // Create event handlers if native fullscreen is supported
879
+ if($.jPlayer.nativeFeatures.fullscreen.api.fullscreenEnabled) {
880
+ this._fullscreenAddEventListeners();
881
+ }
882
+
883
+ // The native controls are only for video and are disabled when audio is also used.
884
+ this._restrictNativeVideoControls();
885
+
886
+ // Create the poster image.
887
+ this.htmlElement.poster = document.createElement('img');
888
+ this.htmlElement.poster.id = this.internal.poster.id;
889
+ this.htmlElement.poster.onload = function() { // Note that this did not work on Firefox 3.6: poster.addEventListener("onload", function() {}, false); Did not investigate x-browser.
890
+ if(!self.status.video || self.status.waitForPlay) {
891
+ self.internal.poster.jq.show();
892
+ }
893
+ };
894
+ this.element.append(this.htmlElement.poster);
895
+ this.internal.poster.jq = $("#" + this.internal.poster.id);
896
+ this.internal.poster.jq.css({'width': this.status.width, 'height': this.status.height});
897
+ this.internal.poster.jq.hide();
898
+ this.internal.poster.jq.bind("click.jPlayer", function() {
899
+ self._trigger($.jPlayer.event.click);
900
+ });
901
+
902
+ // Generate the required media elements
903
+ this.html.audio.available = false;
904
+ if(this.require.audio) { // If a supplied format is audio
905
+ this.htmlElement.audio = document.createElement('audio');
906
+ this.htmlElement.audio.id = this.internal.audio.id;
907
+ this.html.audio.available = !!this.htmlElement.audio.canPlayType && this._testCanPlayType(this.htmlElement.audio); // Test is for IE9 on Win Server 2008.
908
+ }
909
+ this.html.video.available = false;
910
+ if(this.require.video) { // If a supplied format is video
911
+ this.htmlElement.video = document.createElement('video');
912
+ this.htmlElement.video.id = this.internal.video.id;
913
+ this.html.video.available = !!this.htmlElement.video.canPlayType && this._testCanPlayType(this.htmlElement.video); // Test is for IE9 on Win Server 2008.
914
+ }
915
+
916
+ this.flash.available = this._checkForFlash(10.1);
917
+
918
+ this.html.canPlay = {};
919
+ this.flash.canPlay = {};
920
+ $.each(this.formats, function(priority, format) {
921
+ self.html.canPlay[format] = self.html[self.format[format].media].available && "" !== self.htmlElement[self.format[format].media].canPlayType(self.format[format].codec);
922
+ self.flash.canPlay[format] = self.format[format].flashCanPlay && self.flash.available;
923
+ });
924
+ this.html.desired = false;
925
+ this.flash.desired = false;
926
+ $.each(this.solutions, function(solutionPriority, solution) {
927
+ if(solutionPriority === 0) {
928
+ self[solution].desired = true;
929
+ } else {
930
+ var audioCanPlay = false;
931
+ var videoCanPlay = false;
932
+ $.each(self.formats, function(formatPriority, format) {
933
+ if(self[self.solutions[0]].canPlay[format]) { // The other solution can play
934
+ if(self.format[format].media === 'video') {
935
+ videoCanPlay = true;
936
+ } else {
937
+ audioCanPlay = true;
938
+ }
939
+ }
940
+ });
941
+ self[solution].desired = (self.require.audio && !audioCanPlay) || (self.require.video && !videoCanPlay);
942
+ }
943
+ });
944
+ // This is what jPlayer will support, based on solution and supplied.
945
+ this.html.support = {};
946
+ this.flash.support = {};
947
+ $.each(this.formats, function(priority, format) {
948
+ self.html.support[format] = self.html.canPlay[format] && self.html.desired;
949
+ self.flash.support[format] = self.flash.canPlay[format] && self.flash.desired;
950
+ });
951
+ // If jPlayer is supporting any format in a solution, then the solution is used.
952
+ this.html.used = false;
953
+ this.flash.used = false;
954
+ $.each(this.solutions, function(solutionPriority, solution) {
955
+ $.each(self.formats, function(formatPriority, format) {
956
+ if(self[solution].support[format]) {
957
+ self[solution].used = true;
958
+ return false;
959
+ }
960
+ });
961
+ });
962
+
963
+ // Init solution active state and the event gates to false.
964
+ this._resetActive();
965
+ this._resetGate();
966
+
967
+ // Set up the css selectors for the control and feedback entities.
968
+ this._cssSelectorAncestor(this.options.cssSelectorAncestor);
969
+
970
+ // If neither html nor flash are being used by this browser, then media playback is not possible. Trigger an error event.
971
+ if(!(this.html.used || this.flash.used)) {
972
+ this._error( {
973
+ type: $.jPlayer.error.NO_SOLUTION,
974
+ context: "{solution:'" + this.options.solution + "', supplied:'" + this.options.supplied + "'}",
975
+ message: $.jPlayer.errorMsg.NO_SOLUTION,
976
+ hint: $.jPlayer.errorHint.NO_SOLUTION
977
+ });
978
+ if(this.css.jq.noSolution.length) {
979
+ this.css.jq.noSolution.show();
980
+ }
981
+ } else {
982
+ if(this.css.jq.noSolution.length) {
983
+ this.css.jq.noSolution.hide();
984
+ }
985
+ }
986
+
987
+ // Add the flash solution if it is being used.
988
+ if(this.flash.used) {
989
+ var htmlObj,
990
+ flashVars = 'jQuery=' + encodeURI(this.options.noConflict) + '&id=' + encodeURI(this.internal.self.id) + '&vol=' + this.options.volume + '&muted=' + this.options.muted;
991
+
992
+ // Code influenced by SWFObject 2.2: http://code.google.com/p/swfobject/
993
+ // Non IE browsers have an initial Flash size of 1 by 1 otherwise the wmode affected the Flash ready event.
994
+
995
+ if($.jPlayer.browser.msie && (Number($.jPlayer.browser.version) < 9 || $.jPlayer.browser.documentMode < 9)) {
996
+ var objStr = '<object id="' + this.internal.flash.id + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" tabindex="-1"></object>';
997
+
998
+ var paramStr = [
999
+ '<param name="movie" value="' + this.internal.flash.swf + '" />',
1000
+ '<param name="FlashVars" value="' + flashVars + '" />',
1001
+ '<param name="allowScriptAccess" value="always" />',
1002
+ '<param name="bgcolor" value="' + this.options.backgroundColor + '" />',
1003
+ '<param name="wmode" value="' + this.options.wmode + '" />'
1004
+ ];
1005
+
1006
+ htmlObj = document.createElement(objStr);
1007
+ for(var i=0; i < paramStr.length; i++) {
1008
+ htmlObj.appendChild(document.createElement(paramStr[i]));
1009
+ }
1010
+ } else {
1011
+ var createParam = function(el, n, v) {
1012
+ var p = document.createElement("param");
1013
+ p.setAttribute("name", n);
1014
+ p.setAttribute("value", v);
1015
+ el.appendChild(p);
1016
+ };
1017
+
1018
+ htmlObj = document.createElement("object");
1019
+ htmlObj.setAttribute("id", this.internal.flash.id);
1020
+ htmlObj.setAttribute("name", this.internal.flash.id);
1021
+ htmlObj.setAttribute("data", this.internal.flash.swf);
1022
+ htmlObj.setAttribute("type", "application/x-shockwave-flash");
1023
+ htmlObj.setAttribute("width", "1"); // Non-zero
1024
+ htmlObj.setAttribute("height", "1"); // Non-zero
1025
+ htmlObj.setAttribute("tabindex", "-1");
1026
+ createParam(htmlObj, "flashvars", flashVars);
1027
+ createParam(htmlObj, "allowscriptaccess", "always");
1028
+ createParam(htmlObj, "bgcolor", this.options.backgroundColor);
1029
+ createParam(htmlObj, "wmode", this.options.wmode);
1030
+ }
1031
+
1032
+ this.element.append(htmlObj);
1033
+ this.internal.flash.jq = $(htmlObj);
1034
+ }
1035
+
1036
+ // Add the HTML solution if being used.
1037
+ if(this.html.used) {
1038
+
1039
+ // The HTML Audio handlers
1040
+ if(this.html.audio.available) {
1041
+ this._addHtmlEventListeners(this.htmlElement.audio, this.html.audio);
1042
+ this.element.append(this.htmlElement.audio);
1043
+ this.internal.audio.jq = $("#" + this.internal.audio.id);
1044
+ }
1045
+
1046
+ // The HTML Video handlers
1047
+ if(this.html.video.available) {
1048
+ this._addHtmlEventListeners(this.htmlElement.video, this.html.video);
1049
+ this.element.append(this.htmlElement.video);
1050
+ this.internal.video.jq = $("#" + this.internal.video.id);
1051
+ if(this.status.nativeVideoControls) {
1052
+ this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height});
1053
+ } else {
1054
+ this.internal.video.jq.css({'width':'0px', 'height':'0px'}); // Using size 0x0 since a .hide() causes issues in iOS
1055
+ }
1056
+ this.internal.video.jq.bind("click.jPlayer", function() {
1057
+ self._trigger($.jPlayer.event.click);
1058
+ });
1059
+ }
1060
+ }
1061
+
1062
+ // Create the bridge that emulates the HTML Media element on the jPlayer DIV
1063
+ if( this.options.emulateHtml ) {
1064
+ this._emulateHtmlBridge();
1065
+ }
1066
+
1067
+ if(this.html.used && !this.flash.used) { // If only HTML, then emulate flash ready() call after 100ms.
1068
+ setTimeout( function() {
1069
+ self.internal.ready = true;
1070
+ self.version.flash = "n/a";
1071
+ self._trigger($.jPlayer.event.repeat); // Trigger the repeat event so its handler can initialize itself with the loop option.
1072
+ self._trigger($.jPlayer.event.ready);
1073
+ }, 100);
1074
+ }
1075
+
1076
+ // Initialize the interface components with the options.
1077
+ this._updateNativeVideoControls();
1078
+ // The other controls are now setup in _cssSelectorAncestor()
1079
+ if(this.css.jq.videoPlay.length) {
1080
+ this.css.jq.videoPlay.hide();
1081
+ }
1082
+
1083
+ $.jPlayer.prototype.count++; // Change static variable via prototype.
1084
+ },
1085
+ destroy: function() {
1086
+ // MJP: The background change remains. Would need to store the original to restore it correctly.
1087
+ // MJP: The jPlayer element's size change remains.
1088
+
1089
+ // Clear the media to reset the GUI and stop any downloads. Streams on some browsers had persited. (Chrome)
1090
+ this.clearMedia();
1091
+ // Remove the size/sizeFull cssClass from the cssSelectorAncestor
1092
+ this._removeUiClass();
1093
+ // Remove the times from the GUI
1094
+ if(this.css.jq.currentTime.length) {
1095
+ this.css.jq.currentTime.text("");
1096
+ }
1097
+ if(this.css.jq.duration.length) {
1098
+ this.css.jq.duration.text("");
1099
+ }
1100
+ // Remove any bindings from the interface controls.
1101
+ $.each(this.css.jq, function(fn, jq) {
1102
+ // Check selector is valid before trying to execute method.
1103
+ if(jq.length) {
1104
+ jq.unbind(".jPlayer");
1105
+ }
1106
+ });
1107
+ // Remove the click handlers for $.jPlayer.event.click
1108
+ this.internal.poster.jq.unbind(".jPlayer");
1109
+ if(this.internal.video.jq) {
1110
+ this.internal.video.jq.unbind(".jPlayer");
1111
+ }
1112
+ // Remove the fullscreen event handlers
1113
+ this._fullscreenRemoveEventListeners();
1114
+ // Remove key bindings
1115
+ if(this === $.jPlayer.focus) {
1116
+ $.jPlayer.focus = null;
1117
+ }
1118
+ // Destroy the HTML bridge.
1119
+ if(this.options.emulateHtml) {
1120
+ this._destroyHtmlBridge();
1121
+ }
1122
+ this.element.removeData("jPlayer"); // Remove jPlayer data
1123
+ this.element.unbind(".jPlayer"); // Remove all event handlers created by the jPlayer constructor
1124
+ this.element.empty(); // Remove the inserted child elements
1125
+
1126
+ delete this.instances[this.internal.instance]; // Clear the instance on the static instance object
1127
+ },
1128
+ enable: function() { // Plan to implement
1129
+ // options.disabled = false
1130
+ },
1131
+ disable: function () { // Plan to implement
1132
+ // options.disabled = true
1133
+ },
1134
+ _testCanPlayType: function(elem) {
1135
+ // IE9 on Win Server 2008 did not implement canPlayType(), but it has the property.
1136
+ try {
1137
+ elem.canPlayType(this.format.mp3.codec); // The type is irrelevant.
1138
+ return true;
1139
+ } catch(err) {
1140
+ return false;
1141
+ }
1142
+ },
1143
+ _uaBlocklist: function(list) {
1144
+ // list : object with properties that are all regular expressions. Property names are irrelevant.
1145
+ // Returns true if the user agent is matched in list.
1146
+ var ua = navigator.userAgent.toLowerCase(),
1147
+ block = false;
1148
+
1149
+ $.each(list, function(p, re) {
1150
+ if(re && re.test(ua)) {
1151
+ block = true;
1152
+ return false; // exit $.each.
1153
+ }
1154
+ });
1155
+ return block;
1156
+ },
1157
+ _restrictNativeVideoControls: function() {
1158
+ // Fallback to noFullWindow when nativeVideoControls is true and audio media is being used. Affects when both media types are used.
1159
+ if(this.require.audio) {
1160
+ if(this.status.nativeVideoControls) {
1161
+ this.status.nativeVideoControls = false;
1162
+ this.status.noFullWindow = true;
1163
+ }
1164
+ }
1165
+ },
1166
+ _updateNativeVideoControls: function() {
1167
+ if(this.html.video.available && this.html.used) {
1168
+ // Turn the HTML Video controls on/off
1169
+ this.htmlElement.video.controls = this.status.nativeVideoControls;
1170
+ // Show/hide the jPlayer GUI.
1171
+ this._updateAutohide();
1172
+ // For when option changed. The poster image is not updated, as it is dealt with in setMedia(). Acceptable degradation since seriously doubt these options will change on the fly. Can again review later.
1173
+ if(this.status.nativeVideoControls && this.require.video) {
1174
+ this.internal.poster.jq.hide();
1175
+ this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height});
1176
+ } else if(this.status.waitForPlay && this.status.video) {
1177
+ this.internal.poster.jq.show();
1178
+ this.internal.video.jq.css({'width': '0px', 'height': '0px'});
1179
+ }
1180
+ }
1181
+ },
1182
+ _addHtmlEventListeners: function(mediaElement, entity) {
1183
+ var self = this;
1184
+ mediaElement.preload = this.options.preload;
1185
+ mediaElement.muted = this.options.muted;
1186
+ mediaElement.volume = this.options.volume;
1187
+
1188
+ // Create the event listeners
1189
+ // Only want the active entity to affect jPlayer and bubble events.
1190
+ // Using entity.gate so that object is referenced and gate property always current
1191
+
1192
+ mediaElement.addEventListener("progress", function() {
1193
+ if(entity.gate) {
1194
+ if(self.internal.cmdsIgnored && this.readyState > 0) { // Detect iOS executed the command
1195
+ self.internal.cmdsIgnored = false;
1196
+ }
1197
+ self._getHtmlStatus(mediaElement);
1198
+ self._updateInterface();
1199
+ self._trigger($.jPlayer.event.progress);
1200
+ }
1201
+ }, false);
1202
+ mediaElement.addEventListener("timeupdate", function() {
1203
+ if(entity.gate) {
1204
+ self._getHtmlStatus(mediaElement);
1205
+ self._updateInterface();
1206
+ self._trigger($.jPlayer.event.timeupdate);
1207
+ }
1208
+ }, false);
1209
+ mediaElement.addEventListener("durationchange", function() {
1210
+ if(entity.gate) {
1211
+ self._getHtmlStatus(mediaElement);
1212
+ self._updateInterface();
1213
+ self._trigger($.jPlayer.event.durationchange);
1214
+ }
1215
+ }, false);
1216
+ mediaElement.addEventListener("play", function() {
1217
+ if(entity.gate) {
1218
+ self._updateButtons(true);
1219
+ self._html_checkWaitForPlay(); // So the native controls update this variable and puts the hidden interface in the correct state. Affects toggling native controls.
1220
+ self._trigger($.jPlayer.event.play);
1221
+ }
1222
+ }, false);
1223
+ mediaElement.addEventListener("playing", function() {
1224
+ if(entity.gate) {
1225
+ self._updateButtons(true);
1226
+ self._seeked();
1227
+ self._trigger($.jPlayer.event.playing);
1228
+ }
1229
+ }, false);
1230
+ mediaElement.addEventListener("pause", function() {
1231
+ if(entity.gate) {
1232
+ self._updateButtons(false);
1233
+ self._trigger($.jPlayer.event.pause);
1234
+ }
1235
+ }, false);
1236
+ mediaElement.addEventListener("waiting", function() {
1237
+ if(entity.gate) {
1238
+ self._seeking();
1239
+ self._trigger($.jPlayer.event.waiting);
1240
+ }
1241
+ }, false);
1242
+ mediaElement.addEventListener("seeking", function() {
1243
+ if(entity.gate) {
1244
+ self._seeking();
1245
+ self._trigger($.jPlayer.event.seeking);
1246
+ }
1247
+ }, false);
1248
+ mediaElement.addEventListener("seeked", function() {
1249
+ if(entity.gate) {
1250
+ self._seeked();
1251
+ self._trigger($.jPlayer.event.seeked);
1252
+ }
1253
+ }, false);
1254
+ mediaElement.addEventListener("volumechange", function() {
1255
+ if(entity.gate) {
1256
+ // Read the values back from the element as the Blackberry PlayBook shares the volume with the physical buttons master volume control.
1257
+ // However, when tested 6th July 2011, those buttons do not generate an event. The physical play/pause button does though.
1258
+ self.options.volume = mediaElement.volume;
1259
+ self.options.muted = mediaElement.muted;
1260
+ self._updateMute();
1261
+ self._updateVolume();
1262
+ self._trigger($.jPlayer.event.volumechange);
1263
+ }
1264
+ }, false);
1265
+ mediaElement.addEventListener("suspend", function() { // Seems to be the only way of capturing that the iOS4 browser did not actually play the media from the page code. ie., It needs a user gesture.
1266
+ if(entity.gate) {
1267
+ self._seeked();
1268
+ self._trigger($.jPlayer.event.suspend);
1269
+ }
1270
+ }, false);
1271
+ mediaElement.addEventListener("ended", function() {
1272
+ if(entity.gate) {
1273
+ // Order of the next few commands are important. Change the time and then pause.
1274
+ // Solves a bug in Firefox, where issuing pause 1st causes the media to play from the start. ie., The pause is ignored.
1275
+ if(!$.jPlayer.browser.webkit) { // Chrome crashes if you do this in conjunction with a setMedia command in an ended event handler. ie., The playlist demo.
1276
+ self.htmlElement.media.currentTime = 0; // Safari does not care about this command. ie., It works with or without this line. (Both Safari and Chrome are Webkit.)
1277
+ }
1278
+ self.htmlElement.media.pause(); // Pause otherwise a click on the progress bar will play from that point, when it shouldn't, since it stopped playback.
1279
+ self._updateButtons(false);
1280
+ self._getHtmlStatus(mediaElement, true); // With override true. Otherwise Chrome leaves progress at full.
1281
+ self._updateInterface();
1282
+ self._trigger($.jPlayer.event.ended);
1283
+ }
1284
+ }, false);
1285
+ mediaElement.addEventListener("error", function() {
1286
+ if(entity.gate) {
1287
+ self._updateButtons(false);
1288
+ self._seeked();
1289
+ if(self.status.srcSet) { // Deals with case of clearMedia() causing an error event.
1290
+ clearTimeout(self.internal.htmlDlyCmdId); // Clears any delayed commands used in the HTML solution.
1291
+ self.status.waitForLoad = true; // Allows the load operation to try again.
1292
+ self.status.waitForPlay = true; // Reset since a play was captured.
1293
+ if(self.status.video && !self.status.nativeVideoControls) {
1294
+ self.internal.video.jq.css({'width':'0px', 'height':'0px'});
1295
+ }
1296
+ if(self._validString(self.status.media.poster) && !self.status.nativeVideoControls) {
1297
+ self.internal.poster.jq.show();
1298
+ }
1299
+ if(self.css.jq.videoPlay.length) {
1300
+ self.css.jq.videoPlay.show();
1301
+ }
1302
+ self._error( {
1303
+ type: $.jPlayer.error.URL,
1304
+ context: self.status.src, // this.src shows absolute urls. Want context to show the url given.
1305
+ message: $.jPlayer.errorMsg.URL,
1306
+ hint: $.jPlayer.errorHint.URL
1307
+ });
1308
+ }
1309
+ }
1310
+ }, false);
1311
+ // Create all the other event listeners that bubble up to a jPlayer event from html, without being used by jPlayer.
1312
+ $.each($.jPlayer.htmlEvent, function(i, eventType) {
1313
+ mediaElement.addEventListener(this, function() {
1314
+ if(entity.gate) {
1315
+ self._trigger($.jPlayer.event[eventType]);
1316
+ }
1317
+ }, false);
1318
+ });
1319
+ },
1320
+ _getHtmlStatus: function(media, override) {
1321
+ var ct = 0, cpa = 0, sp = 0, cpr = 0;
1322
+
1323
+ // Fixes the duration bug in iOS, where the durationchange event occurs when media.duration is not always correct.
1324
+ // Fixes the initial duration bug in BB OS7, where the media.duration is infinity and displays as NaN:NaN due to Date() using inifity.
1325
+ if(isFinite(media.duration)) {
1326
+ this.status.duration = media.duration;
1327
+ }
1328
+
1329
+ ct = media.currentTime;
1330
+ cpa = (this.status.duration > 0) ? 100 * ct / this.status.duration : 0;
1331
+ if((typeof media.seekable === "object") && (media.seekable.length > 0)) {
1332
+ sp = (this.status.duration > 0) ? 100 * media.seekable.end(media.seekable.length-1) / this.status.duration : 100;
1333
+ cpr = (this.status.duration > 0) ? 100 * media.currentTime / media.seekable.end(media.seekable.length-1) : 0; // Duration conditional for iOS duration bug. ie., seekable.end is a NaN in that case.
1334
+ } else {
1335
+ sp = 100;
1336
+ cpr = cpa;
1337
+ }
1338
+
1339
+ if(override) {
1340
+ ct = 0;
1341
+ cpr = 0;
1342
+ cpa = 0;
1343
+ }
1344
+
1345
+ this.status.seekPercent = sp;
1346
+ this.status.currentPercentRelative = cpr;
1347
+ this.status.currentPercentAbsolute = cpa;
1348
+ this.status.currentTime = ct;
1349
+
1350
+ this.status.videoWidth = media.videoWidth;
1351
+ this.status.videoHeight = media.videoHeight;
1352
+
1353
+ this.status.readyState = media.readyState;
1354
+ this.status.networkState = media.networkState;
1355
+ this.status.playbackRate = media.playbackRate;
1356
+ this.status.ended = media.ended;
1357
+ },
1358
+ _resetStatus: function() {
1359
+ this.status = $.extend({}, this.status, $.jPlayer.prototype.status); // Maintains the status properties that persist through a reset.
1360
+ },
1361
+ _trigger: function(eventType, error, warning) { // eventType always valid as called using $.jPlayer.event.eventType
1362
+ var event = $.Event(eventType);
1363
+ event.jPlayer = {};
1364
+ event.jPlayer.version = $.extend({}, this.version);
1365
+ event.jPlayer.options = $.extend(true, {}, this.options); // Deep copy
1366
+ event.jPlayer.status = $.extend(true, {}, this.status); // Deep copy
1367
+ event.jPlayer.html = $.extend(true, {}, this.html); // Deep copy
1368
+ event.jPlayer.flash = $.extend(true, {}, this.flash); // Deep copy
1369
+ if(error) {
1370
+ event.jPlayer.error = $.extend({}, error);
1371
+ }
1372
+ if(warning) {
1373
+ event.jPlayer.warning = $.extend({}, warning);
1374
+ }
1375
+ this.element.trigger(event);
1376
+ },
1377
+ jPlayerFlashEvent: function(eventType, status) { // Called from Flash
1378
+ if(eventType === $.jPlayer.event.ready) {
1379
+ if(!this.internal.ready) {
1380
+ this.internal.ready = true;
1381
+ this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); // Once Flash generates the ready event, minimise to zero as it is not affected by wmode anymore.
1382
+
1383
+ this.version.flash = status.version;
1384
+ if(this.version.needFlash !== this.version.flash) {
1385
+ this._error( {
1386
+ type: $.jPlayer.error.VERSION,
1387
+ context: this.version.flash,
1388
+ message: $.jPlayer.errorMsg.VERSION + this.version.flash,
1389
+ hint: $.jPlayer.errorHint.VERSION
1390
+ });
1391
+ }
1392
+ this._trigger($.jPlayer.event.repeat); // Trigger the repeat event so its handler can initialize itself with the loop option.
1393
+ this._trigger(eventType);
1394
+ } else {
1395
+ // This condition occurs if the Flash is hidden and then shown again.
1396
+ // Firefox also reloads the Flash if the CSS position changes. position:fixed is used for full screen.
1397
+
1398
+ // Only do this if the Flash is the solution being used at the moment. Affects Media players where both solution may be being used.
1399
+ if(this.flash.gate) {
1400
+
1401
+ // Send the current status to the Flash now that it is ready (available) again.
1402
+ if(this.status.srcSet) {
1403
+
1404
+ // Need to read original status before issuing the setMedia command.
1405
+ var currentTime = this.status.currentTime,
1406
+ paused = this.status.paused;
1407
+
1408
+ this.setMedia(this.status.media);
1409
+ if(currentTime > 0) {
1410
+ if(paused) {
1411
+ this.pause(currentTime);
1412
+ } else {
1413
+ this.play(currentTime);
1414
+ }
1415
+ }
1416
+ }
1417
+ this._trigger($.jPlayer.event.flashreset);
1418
+ }
1419
+ }
1420
+ }
1421
+ if(this.flash.gate) {
1422
+ switch(eventType) {
1423
+ case $.jPlayer.event.progress:
1424
+ this._getFlashStatus(status);
1425
+ this._updateInterface();
1426
+ this._trigger(eventType);
1427
+ break;
1428
+ case $.jPlayer.event.timeupdate:
1429
+ this._getFlashStatus(status);
1430
+ this._updateInterface();
1431
+ this._trigger(eventType);
1432
+ break;
1433
+ case $.jPlayer.event.play:
1434
+ this._seeked();
1435
+ this._updateButtons(true);
1436
+ this._trigger(eventType);
1437
+ break;
1438
+ case $.jPlayer.event.pause:
1439
+ this._updateButtons(false);
1440
+ this._trigger(eventType);
1441
+ break;
1442
+ case $.jPlayer.event.ended:
1443
+ this._updateButtons(false);
1444
+ this._trigger(eventType);
1445
+ break;
1446
+ case $.jPlayer.event.click:
1447
+ this._trigger(eventType); // This could be dealt with by the default
1448
+ break;
1449
+ case $.jPlayer.event.error:
1450
+ this.status.waitForLoad = true; // Allows the load operation to try again.
1451
+ this.status.waitForPlay = true; // Reset since a play was captured.
1452
+ if(this.status.video) {
1453
+ this.internal.flash.jq.css({'width':'0px', 'height':'0px'});
1454
+ }
1455
+ if(this._validString(this.status.media.poster)) {
1456
+ this.internal.poster.jq.show();
1457
+ }
1458
+ if(this.css.jq.videoPlay.length && this.status.video) {
1459
+ this.css.jq.videoPlay.show();
1460
+ }
1461
+ if(this.status.video) { // Set up for another try. Execute before error event.
1462
+ this._flash_setVideo(this.status.media);
1463
+ } else {
1464
+ this._flash_setAudio(this.status.media);
1465
+ }
1466
+ this._updateButtons(false);
1467
+ this._error( {
1468
+ type: $.jPlayer.error.URL,
1469
+ context:status.src,
1470
+ message: $.jPlayer.errorMsg.URL,
1471
+ hint: $.jPlayer.errorHint.URL
1472
+ });
1473
+ break;
1474
+ case $.jPlayer.event.seeking:
1475
+ this._seeking();
1476
+ this._trigger(eventType);
1477
+ break;
1478
+ case $.jPlayer.event.seeked:
1479
+ this._seeked();
1480
+ this._trigger(eventType);
1481
+ break;
1482
+ case $.jPlayer.event.ready:
1483
+ // The ready event is handled outside the switch statement.
1484
+ // Captured here otherwise 2 ready events would be generated if the ready event handler used setMedia.
1485
+ break;
1486
+ default:
1487
+ this._trigger(eventType);
1488
+ }
1489
+ }
1490
+ return false;
1491
+ },
1492
+ _getFlashStatus: function(status) {
1493
+ this.status.seekPercent = status.seekPercent;
1494
+ this.status.currentPercentRelative = status.currentPercentRelative;
1495
+ this.status.currentPercentAbsolute = status.currentPercentAbsolute;
1496
+ this.status.currentTime = status.currentTime;
1497
+ this.status.duration = status.duration;
1498
+
1499
+ this.status.videoWidth = status.videoWidth;
1500
+ this.status.videoHeight = status.videoHeight;
1501
+
1502
+ // The Flash does not generate this information in this release
1503
+ this.status.readyState = 4; // status.readyState;
1504
+ this.status.networkState = 0; // status.networkState;
1505
+ this.status.playbackRate = 1; // status.playbackRate;
1506
+ this.status.ended = false; // status.ended;
1507
+ },
1508
+ _updateButtons: function(playing) {
1509
+ if(playing === undefined) {
1510
+ playing = !this.status.paused;
1511
+ } else {
1512
+ this.status.paused = !playing;
1513
+ }
1514
+ if(this.css.jq.play.length && this.css.jq.pause.length) {
1515
+ if(playing) {
1516
+ this.css.jq.play.hide();
1517
+ this.css.jq.pause.show();
1518
+ } else {
1519
+ this.css.jq.play.show();
1520
+ this.css.jq.pause.hide();
1521
+ }
1522
+ }
1523
+ if(this.css.jq.restoreScreen.length && this.css.jq.fullScreen.length) {
1524
+ if(this.status.noFullWindow) {
1525
+ this.css.jq.fullScreen.hide();
1526
+ this.css.jq.restoreScreen.hide();
1527
+ } else if(this.options.fullWindow) {
1528
+ this.css.jq.fullScreen.hide();
1529
+ this.css.jq.restoreScreen.show();
1530
+ } else {
1531
+ this.css.jq.fullScreen.show();
1532
+ this.css.jq.restoreScreen.hide();
1533
+ }
1534
+ }
1535
+ if(this.css.jq.repeat.length && this.css.jq.repeatOff.length) {
1536
+ if(this.options.loop) {
1537
+ this.css.jq.repeat.hide();
1538
+ this.css.jq.repeatOff.show();
1539
+ } else {
1540
+ this.css.jq.repeat.show();
1541
+ this.css.jq.repeatOff.hide();
1542
+ }
1543
+ }
1544
+ },
1545
+ _updateInterface: function() {
1546
+ if(this.css.jq.seekBar.length) {
1547
+ this.css.jq.seekBar.width(this.status.seekPercent+"%");
1548
+ }
1549
+ if(this.css.jq.playBar.length) {
1550
+ if(this.options.smoothPlayBar) {
1551
+ this.css.jq.playBar.stop().animate({
1552
+ width: this.status.currentPercentAbsolute+"%"
1553
+ }, 250, "linear");
1554
+ } else {
1555
+ this.css.jq.playBar.width(this.status.currentPercentRelative+"%");
1556
+ }
1557
+ }
1558
+ if(this.css.jq.currentTime.length) {
1559
+ this.css.jq.currentTime.text(this._convertTime(this.status.currentTime));
1560
+ }
1561
+ if(this.css.jq.duration.length) {
1562
+ this.css.jq.duration.text(this._convertTime(this.status.duration));
1563
+ }
1564
+ },
1565
+ _convertTime: ConvertTime.prototype.time,
1566
+ _seeking: function() {
1567
+ if(this.css.jq.seekBar.length) {
1568
+ this.css.jq.seekBar.addClass("jp-seeking-bg");
1569
+ }
1570
+ },
1571
+ _seeked: function() {
1572
+ if(this.css.jq.seekBar.length) {
1573
+ this.css.jq.seekBar.removeClass("jp-seeking-bg");
1574
+ }
1575
+ },
1576
+ _resetGate: function() {
1577
+ this.html.audio.gate = false;
1578
+ this.html.video.gate = false;
1579
+ this.flash.gate = false;
1580
+ },
1581
+ _resetActive: function() {
1582
+ this.html.active = false;
1583
+ this.flash.active = false;
1584
+ },
1585
+ setMedia: function(media) {
1586
+
1587
+ /* media[format] = String: URL of format. Must contain all of the supplied option's video or audio formats.
1588
+ * media.poster = String: Video poster URL.
1589
+ * media.subtitles = String: * NOT IMPLEMENTED * URL of subtitles SRT file
1590
+ * media.chapters = String: * NOT IMPLEMENTED * URL of chapters SRT file
1591
+ * media.stream = Boolean: * NOT IMPLEMENTED * Designating actual media streams. ie., "false/undefined" for files. Plan to refresh the flash every so often.
1592
+ */
1593
+
1594
+ var self = this,
1595
+ supported = false,
1596
+ posterChanged = this.status.media.poster !== media.poster; // Compare before reset. Important for OSX Safari as this.htmlElement.poster.src is absolute, even if original poster URL was relative.
1597
+
1598
+ this._resetMedia();
1599
+ this._resetGate();
1600
+ this._resetActive();
1601
+
1602
+ $.each(this.formats, function(formatPriority, format) {
1603
+ var isVideo = self.format[format].media === 'video';
1604
+ $.each(self.solutions, function(solutionPriority, solution) {
1605
+ if(self[solution].support[format] && self._validString(media[format])) { // Format supported in solution and url given for format.
1606
+ var isHtml = solution === 'html';
1607
+
1608
+ if(isVideo) {
1609
+ if(isHtml) {
1610
+ self.html.video.gate = true;
1611
+ self._html_setVideo(media);
1612
+ self.html.active = true;
1613
+ } else {
1614
+ self.flash.gate = true;
1615
+ self._flash_setVideo(media);
1616
+ self.flash.active = true;
1617
+ }
1618
+ if(self.css.jq.videoPlay.length) {
1619
+ self.css.jq.videoPlay.show();
1620
+ }
1621
+ self.status.video = true;
1622
+ } else {
1623
+ if(isHtml) {
1624
+ self.html.audio.gate = true;
1625
+ self._html_setAudio(media);
1626
+ self.html.active = true;
1627
+ } else {
1628
+ self.flash.gate = true;
1629
+ self._flash_setAudio(media);
1630
+ self.flash.active = true;
1631
+ }
1632
+ if(self.css.jq.videoPlay.length) {
1633
+ self.css.jq.videoPlay.hide();
1634
+ }
1635
+ self.status.video = false;
1636
+ }
1637
+
1638
+ supported = true;
1639
+ return false; // Exit $.each
1640
+ }
1641
+ });
1642
+ if(supported) {
1643
+ return false; // Exit $.each
1644
+ }
1645
+ });
1646
+
1647
+ if(supported) {
1648
+ if(!(this.status.nativeVideoControls && this.html.video.gate)) {
1649
+ // Set poster IMG if native video controls are not being used
1650
+ // Note: With IE the IMG onload event occurs immediately when cached.
1651
+ // Note: Poster hidden by default in _resetMedia()
1652
+ if(this._validString(media.poster)) {
1653
+ if(posterChanged) { // Since some browsers do not generate img onload event.
1654
+ this.htmlElement.poster.src = media.poster;
1655
+ } else {
1656
+ this.internal.poster.jq.show();
1657
+ }
1658
+ }
1659
+ }
1660
+ this.status.srcSet = true;
1661
+ this.status.media = $.extend({}, media);
1662
+ this._updateButtons(false);
1663
+ this._updateInterface();
1664
+ } else { // jPlayer cannot support any formats provided in this browser
1665
+ // Send an error event
1666
+ this._error( {
1667
+ type: $.jPlayer.error.NO_SUPPORT,
1668
+ context: "{supplied:'" + this.options.supplied + "'}",
1669
+ message: $.jPlayer.errorMsg.NO_SUPPORT,
1670
+ hint: $.jPlayer.errorHint.NO_SUPPORT
1671
+ });
1672
+ }
1673
+ },
1674
+ _resetMedia: function() {
1675
+ this._resetStatus();
1676
+ this._updateButtons(false);
1677
+ this._updateInterface();
1678
+ this._seeked();
1679
+ this.internal.poster.jq.hide();
1680
+
1681
+ clearTimeout(this.internal.htmlDlyCmdId);
1682
+
1683
+ if(this.html.active) {
1684
+ this._html_resetMedia();
1685
+ } else if(this.flash.active) {
1686
+ this._flash_resetMedia();
1687
+ }
1688
+ },
1689
+ clearMedia: function() {
1690
+ this._resetMedia();
1691
+
1692
+ if(this.html.active) {
1693
+ this._html_clearMedia();
1694
+ } else if(this.flash.active) {
1695
+ this._flash_clearMedia();
1696
+ }
1697
+
1698
+ this._resetGate();
1699
+ this._resetActive();
1700
+ },
1701
+ load: function() {
1702
+ if(this.status.srcSet) {
1703
+ if(this.html.active) {
1704
+ this._html_load();
1705
+ } else if(this.flash.active) {
1706
+ this._flash_load();
1707
+ }
1708
+ } else {
1709
+ this._urlNotSetError("load");
1710
+ }
1711
+ },
1712
+ focus: function() {
1713
+ if(this.options.keyEnabled) {
1714
+ $.jPlayer.focus = this;
1715
+ }
1716
+ },
1717
+ play: function(time) {
1718
+ time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler
1719
+ if(this.status.srcSet) {
1720
+ this.focus();
1721
+ if(this.html.active) {
1722
+ this._html_play(time);
1723
+ } else if(this.flash.active) {
1724
+ this._flash_play(time);
1725
+ }
1726
+ } else {
1727
+ this._urlNotSetError("play");
1728
+ }
1729
+ },
1730
+ videoPlay: function() { // Handles clicks on the play button over the video poster
1731
+ this.play();
1732
+ },
1733
+ pause: function(time) {
1734
+ time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler
1735
+ if(this.status.srcSet) {
1736
+ if(this.html.active) {
1737
+ this._html_pause(time);
1738
+ } else if(this.flash.active) {
1739
+ this._flash_pause(time);
1740
+ }
1741
+ } else {
1742
+ this._urlNotSetError("pause");
1743
+ }
1744
+ },
1745
+ pauseOthers: function() {
1746
+ var self = this;
1747
+ $.each(this.instances, function(i, element) {
1748
+ if(self.element !== element) { // Do not this instance.
1749
+ if(element.data("jPlayer").status.srcSet) { // Check that media is set otherwise would cause error event.
1750
+ element.jPlayer("pause");
1751
+ }
1752
+ }
1753
+ });
1754
+ },
1755
+ stop: function() {
1756
+ if(this.status.srcSet) {
1757
+ if(this.html.active) {
1758
+ this._html_pause(0);
1759
+ } else if(this.flash.active) {
1760
+ this._flash_pause(0);
1761
+ }
1762
+ } else {
1763
+ this._urlNotSetError("stop");
1764
+ }
1765
+ },
1766
+ playHead: function(p) {
1767
+ p = this._limitValue(p, 0, 100);
1768
+ if(this.status.srcSet) {
1769
+ if(this.html.active) {
1770
+ this._html_playHead(p);
1771
+ } else if(this.flash.active) {
1772
+ this._flash_playHead(p);
1773
+ }
1774
+ } else {
1775
+ this._urlNotSetError("playHead");
1776
+ }
1777
+ },
1778
+ _muted: function(muted) {
1779
+ this.options.muted = muted;
1780
+ if(this.html.used) {
1781
+ this._html_mute(muted);
1782
+ }
1783
+ if(this.flash.used) {
1784
+ this._flash_mute(muted);
1785
+ }
1786
+
1787
+ // The HTML solution generates this event from the media element itself.
1788
+ if(!this.html.video.gate && !this.html.audio.gate) {
1789
+ this._updateMute(muted);
1790
+ this._updateVolume(this.options.volume);
1791
+ this._trigger($.jPlayer.event.volumechange);
1792
+ }
1793
+ },
1794
+ mute: function(mute) { // mute is either: undefined (true), an event object (true) or a boolean (muted).
1795
+ mute = mute === undefined ? true : !!mute;
1796
+ this._muted(mute);
1797
+ },
1798
+ unmute: function(unmute) { // unmute is either: undefined (true), an event object (true) or a boolean (!muted).
1799
+ unmute = unmute === undefined ? true : !!unmute;
1800
+ this._muted(!unmute);
1801
+ },
1802
+ _updateMute: function(mute) {
1803
+ if(mute === undefined) {
1804
+ mute = this.options.muted;
1805
+ }
1806
+ if(this.css.jq.mute.length && this.css.jq.unmute.length) {
1807
+ if(this.status.noVolume) {
1808
+ this.css.jq.mute.hide();
1809
+ this.css.jq.unmute.hide();
1810
+ } else if(mute) {
1811
+ this.css.jq.mute.hide();
1812
+ this.css.jq.unmute.show();
1813
+ } else {
1814
+ this.css.jq.mute.show();
1815
+ this.css.jq.unmute.hide();
1816
+ }
1817
+ }
1818
+ },
1819
+ volume: function(v) {
1820
+ v = this._limitValue(v, 0, 1);
1821
+ this.options.volume = v;
1822
+
1823
+ if(this.html.used) {
1824
+ this._html_volume(v);
1825
+ }
1826
+ if(this.flash.used) {
1827
+ this._flash_volume(v);
1828
+ }
1829
+
1830
+ // The HTML solution generates this event from the media element itself.
1831
+ if(!this.html.video.gate && !this.html.audio.gate) {
1832
+ this._updateVolume(v);
1833
+ this._trigger($.jPlayer.event.volumechange);
1834
+ }
1835
+ },
1836
+ volumeBar: function(e) { // Handles clicks on the volumeBar
1837
+ if(this.css.jq.volumeBar.length) {
1838
+ // Using $(e.currentTarget) to enable multiple volume bars
1839
+ var $bar = $(e.currentTarget),
1840
+ offset = $bar.offset(),
1841
+ x = e.pageX - offset.left,
1842
+ w = $bar.width(),
1843
+ y = $bar.height() - e.pageY + offset.top,
1844
+ h = $bar.height();
1845
+ if(this.options.verticalVolume) {
1846
+ this.volume(y/h);
1847
+ } else {
1848
+ this.volume(x/w);
1849
+ }
1850
+ }
1851
+ if(this.options.muted) {
1852
+ this._muted(false);
1853
+ }
1854
+ },
1855
+ volumeBarValue: function() { // Handles clicks on the volumeBarValue
1856
+ // The volumeBar handles this event as the event propagates up the DOM.
1857
+ },
1858
+ _updateVolume: function(v) {
1859
+ if(v === undefined) {
1860
+ v = this.options.volume;
1861
+ }
1862
+ v = this.options.muted ? 0 : v;
1863
+
1864
+ if(this.status.noVolume) {
1865
+ if(this.css.jq.volumeBar.length) {
1866
+ this.css.jq.volumeBar.hide();
1867
+ }
1868
+ if(this.css.jq.volumeBarValue.length) {
1869
+ this.css.jq.volumeBarValue.hide();
1870
+ }
1871
+ if(this.css.jq.volumeMax.length) {
1872
+ this.css.jq.volumeMax.hide();
1873
+ }
1874
+ } else {
1875
+ if(this.css.jq.volumeBar.length) {
1876
+ this.css.jq.volumeBar.show();
1877
+ }
1878
+ if(this.css.jq.volumeBarValue.length) {
1879
+ this.css.jq.volumeBarValue.show();
1880
+ this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((v*100)+"%");
1881
+ }
1882
+ if(this.css.jq.volumeMax.length) {
1883
+ this.css.jq.volumeMax.show();
1884
+ }
1885
+ }
1886
+ },
1887
+ volumeMax: function() { // Handles clicks on the volume max
1888
+ this.volume(1);
1889
+ if(this.options.muted) {
1890
+ this._muted(false);
1891
+ }
1892
+ },
1893
+ _cssSelectorAncestor: function(ancestor) {
1894
+ var self = this;
1895
+ this.options.cssSelectorAncestor = ancestor;
1896
+ this._removeUiClass();
1897
+ this.ancestorJq = ancestor ? $(ancestor) : []; // Would use $() instead of [], but it is only 1.4+
1898
+ if(ancestor && this.ancestorJq.length !== 1) { // So empty strings do not generate the warning.
1899
+ this._warning( {
1900
+ type: $.jPlayer.warning.CSS_SELECTOR_COUNT,
1901
+ context: ancestor,
1902
+ message: $.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.ancestorJq.length + " found for cssSelectorAncestor.",
1903
+ hint: $.jPlayer.warningHint.CSS_SELECTOR_COUNT
1904
+ });
1905
+ }
1906
+ this._addUiClass();
1907
+ $.each(this.options.cssSelector, function(fn, cssSel) {
1908
+ self._cssSelector(fn, cssSel);
1909
+ });
1910
+
1911
+ // Set the GUI to the current state.
1912
+ this._updateInterface();
1913
+ this._updateButtons();
1914
+ this._updateAutohide();
1915
+ this._updateVolume();
1916
+ this._updateMute();
1917
+ },
1918
+ _cssSelector: function(fn, cssSel) {
1919
+ var self = this;
1920
+ if(typeof cssSel === 'string') {
1921
+ if($.jPlayer.prototype.options.cssSelector[fn]) {
1922
+ if(this.css.jq[fn] && this.css.jq[fn].length) {
1923
+ this.css.jq[fn].unbind(".jPlayer");
1924
+ }
1925
+ this.options.cssSelector[fn] = cssSel;
1926
+ this.css.cs[fn] = this.options.cssSelectorAncestor + " " + cssSel;
1927
+
1928
+ if(cssSel) { // Checks for empty string
1929
+ this.css.jq[fn] = $(this.css.cs[fn]);
1930
+ } else {
1931
+ 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.
1932
+ }
1933
+
1934
+ if(this.css.jq[fn].length) {
1935
+ var handler = function(e) {
1936
+ e.preventDefault();
1937
+ self[fn](e);
1938
+ $(this).blur();
1939
+ };
1940
+ this.css.jq[fn].bind("click.jPlayer", handler); // Using jPlayer namespace
1941
+ }
1942
+
1943
+ if(cssSel && this.css.jq[fn].length !== 1) { // So empty strings do not generate the warning. ie., they just remove the old one.
1944
+ this._warning( {
1945
+ type: $.jPlayer.warning.CSS_SELECTOR_COUNT,
1946
+ context: this.css.cs[fn],
1947
+ message: $.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.css.jq[fn].length + " found for " + fn + " method.",
1948
+ hint: $.jPlayer.warningHint.CSS_SELECTOR_COUNT
1949
+ });
1950
+ }
1951
+ } else {
1952
+ this._warning( {
1953
+ type: $.jPlayer.warning.CSS_SELECTOR_METHOD,
1954
+ context: fn,
1955
+ message: $.jPlayer.warningMsg.CSS_SELECTOR_METHOD,
1956
+ hint: $.jPlayer.warningHint.CSS_SELECTOR_METHOD
1957
+ });
1958
+ }
1959
+ } else {
1960
+ this._warning( {
1961
+ type: $.jPlayer.warning.CSS_SELECTOR_STRING,
1962
+ context: cssSel,
1963
+ message: $.jPlayer.warningMsg.CSS_SELECTOR_STRING,
1964
+ hint: $.jPlayer.warningHint.CSS_SELECTOR_STRING
1965
+ });
1966
+ }
1967
+ },
1968
+ seekBar: function(e) { // Handles clicks on the seekBar
1969
+ if(this.css.jq.seekBar.length) {
1970
+ // Using $(e.currentTarget) to enable multiple seek bars
1971
+ var $bar = $(e.currentTarget),
1972
+ offset = $bar.offset(),
1973
+ x = e.pageX - offset.left,
1974
+ w = $bar.width(),
1975
+ p = 100 * x / w;
1976
+ this.playHead(p);
1977
+ }
1978
+ },
1979
+ playBar: function() { // Handles clicks on the playBar
1980
+ // The seekBar handles this event as the event propagates up the DOM.
1981
+ },
1982
+ repeat: function() { // Handle clicks on the repeat button
1983
+ this._loop(true);
1984
+ },
1985
+ repeatOff: function() { // Handle clicks on the repeatOff button
1986
+ this._loop(false);
1987
+ },
1988
+ _loop: function(loop) {
1989
+ if(this.options.loop !== loop) {
1990
+ this.options.loop = loop;
1991
+ this._updateButtons();
1992
+ this._trigger($.jPlayer.event.repeat);
1993
+ }
1994
+ },
1995
+
1996
+ // Plan to review the cssSelector method to cope with missing associated functions accordingly.
1997
+
1998
+ currentTime: function() { // Handles clicks on the text
1999
+ // Added to avoid errors using cssSelector system for the text
2000
+ },
2001
+ duration: function() { // Handles clicks on the text
2002
+ // Added to avoid errors using cssSelector system for the text
2003
+ },
2004
+ gui: function() { // Handles clicks on the gui
2005
+ // Added to avoid errors using cssSelector system for the gui
2006
+ },
2007
+ noSolution: function() { // Handles clicks on the error message
2008
+ // Added to avoid errors using cssSelector system for no-solution
2009
+ },
2010
+
2011
+ // Options code adapted from ui.widget.js (1.8.7). Made changes so the key can use dot notation. To match previous getData solution in jPlayer 1.
2012
+ option: function(key, value) {
2013
+ var options = key;
2014
+
2015
+ // Enables use: options(). Returns a copy of options object
2016
+ if ( arguments.length === 0 ) {
2017
+ return $.extend( true, {}, this.options );
2018
+ }
2019
+
2020
+ if(typeof key === "string") {
2021
+ var keys = key.split(".");
2022
+
2023
+ // Enables use: options("someOption") Returns a copy of the option. Supports dot notation.
2024
+ if(value === undefined) {
2025
+
2026
+ var opt = $.extend(true, {}, this.options);
2027
+ for(var i = 0; i < keys.length; i++) {
2028
+ if(opt[keys[i]] !== undefined) {
2029
+ opt = opt[keys[i]];
2030
+ } else {
2031
+ this._warning( {
2032
+ type: $.jPlayer.warning.OPTION_KEY,
2033
+ context: key,
2034
+ message: $.jPlayer.warningMsg.OPTION_KEY,
2035
+ hint: $.jPlayer.warningHint.OPTION_KEY
2036
+ });
2037
+ return undefined;
2038
+ }
2039
+ }
2040
+ return opt;
2041
+ }
2042
+
2043
+ // Enables use: options("someOptionObject", someObject}). Creates: {someOptionObject:someObject}
2044
+ // Enables use: options("someOption", someValue). Creates: {someOption:someValue}
2045
+ // Enables use: options("someOptionObject.someOption", someValue). Creates: {someOptionObject:{someOption:someValue}}
2046
+
2047
+ options = {};
2048
+ var opts = options;
2049
+
2050
+ for(var j = 0; j < keys.length; j++) {
2051
+ if(j < keys.length - 1) {
2052
+ opts[keys[j]] = {};
2053
+ opts = opts[keys[j]];
2054
+ } else {
2055
+ opts[keys[j]] = value;
2056
+ }
2057
+ }
2058
+ }
2059
+
2060
+ // Otherwise enables use: options(optionObject). Uses original object (the key)
2061
+
2062
+ this._setOptions(options);
2063
+
2064
+ return this;
2065
+ },
2066
+ _setOptions: function(options) {
2067
+ var self = this;
2068
+ $.each(options, function(key, value) { // This supports the 2 level depth that the options of jPlayer has. Would review if we ever need more depth.
2069
+ self._setOption(key, value);
2070
+ });
2071
+
2072
+ return this;
2073
+ },
2074
+ _setOption: function(key, value) {
2075
+ var self = this;
2076
+
2077
+ // The ability to set options is limited at this time.
2078
+
2079
+ switch(key) {
2080
+ case "volume" :
2081
+ this.volume(value);
2082
+ break;
2083
+ case "muted" :
2084
+ this._muted(value);
2085
+ break;
2086
+ case "cssSelectorAncestor" :
2087
+ this._cssSelectorAncestor(value); // Set and refresh all associations for the new ancestor.
2088
+ break;
2089
+ case "cssSelector" :
2090
+ $.each(value, function(fn, cssSel) {
2091
+ self._cssSelector(fn, cssSel); // NB: The option is set inside this function, after further validity checks.
2092
+ });
2093
+ break;
2094
+ case "fullScreen" :
2095
+ if(this.options[key] !== value) { // if changed
2096
+ var wkv = $.jPlayer.nativeFeatures.fullscreen.used.webkitVideo;
2097
+ if(!wkv || wkv && !this.status.waitForPlay) {
2098
+ if(!wkv) { // No sensible way to unset option on these devices.
2099
+ this.options[key] = value;
2100
+ }
2101
+ if(value) {
2102
+ this._requestFullscreen();
2103
+ } else {
2104
+ this._exitFullscreen();
2105
+ }
2106
+ if(!wkv) {
2107
+ this._setOption("fullWindow", value);
2108
+ }
2109
+ }
2110
+ }
2111
+ break;
2112
+ case "fullWindow" :
2113
+ if(this.options[key] !== value) { // if changed
2114
+ this._removeUiClass();
2115
+ this.options[key] = value;
2116
+ this._refreshSize();
2117
+ }
2118
+ break;
2119
+ case "size" :
2120
+ if(!this.options.fullWindow && this.options[key].cssClass !== value.cssClass) {
2121
+ this._removeUiClass();
2122
+ }
2123
+ this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
2124
+ this._refreshSize();
2125
+ break;
2126
+ case "sizeFull" :
2127
+ if(this.options.fullWindow && this.options[key].cssClass !== value.cssClass) {
2128
+ this._removeUiClass();
2129
+ }
2130
+ this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
2131
+ this._refreshSize();
2132
+ break;
2133
+ case "autohide" :
2134
+ this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
2135
+ this._updateAutohide();
2136
+ break;
2137
+ case "loop" :
2138
+ this._loop(value);
2139
+ break;
2140
+ case "nativeVideoControls" :
2141
+ this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
2142
+ this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls);
2143
+ this._restrictNativeVideoControls();
2144
+ this._updateNativeVideoControls();
2145
+ break;
2146
+ case "noFullWindow" :
2147
+ this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
2148
+ this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls); // Need to check again as noFullWindow can depend on this flag and the restrict() can override it.
2149
+ this.status.noFullWindow = this._uaBlocklist(this.options.noFullWindow);
2150
+ this._restrictNativeVideoControls();
2151
+ this._updateButtons();
2152
+ break;
2153
+ case "noVolume" :
2154
+ this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
2155
+ this.status.noVolume = this._uaBlocklist(this.options.noVolume);
2156
+ this._updateVolume();
2157
+ this._updateMute();
2158
+ break;
2159
+ case "emulateHtml" :
2160
+ if(this.options[key] !== value) { // To avoid multiple event handlers being created, if true already.
2161
+ this.options[key] = value;
2162
+ if(value) {
2163
+ this._emulateHtmlBridge();
2164
+ } else {
2165
+ this._destroyHtmlBridge();
2166
+ }
2167
+ }
2168
+ break;
2169
+ case "timeFormat" :
2170
+ this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed.
2171
+ break;
2172
+ case "keyEnabled" :
2173
+ this.options[key] = value;
2174
+ if(!value && this === $.jPlayer.focus) {
2175
+ $.jPlayer.focus = null;
2176
+ }
2177
+ break;
2178
+ case "keyBindings" :
2179
+ this.options[key] = $.extend(true, {}, this.options[key], value); // store a merged DEEP copy of it, incase not all properties changed.
2180
+ break;
2181
+ case "audioFullScreen" :
2182
+ this.options[key] = value;
2183
+ break;
2184
+ }
2185
+
2186
+ return this;
2187
+ },
2188
+ // End of: (Options code adapted from ui.widget.js)
2189
+
2190
+ _refreshSize: function() {
2191
+ this._setSize(); // update status and jPlayer element size
2192
+ this._addUiClass(); // update the ui class
2193
+ this._updateSize(); // update internal sizes
2194
+ this._updateButtons();
2195
+ this._updateAutohide();
2196
+ this._trigger($.jPlayer.event.resize);
2197
+ },
2198
+ _setSize: function() {
2199
+ // Determine the current size from the options
2200
+ if(this.options.fullWindow) {
2201
+ this.status.width = this.options.sizeFull.width;
2202
+ this.status.height = this.options.sizeFull.height;
2203
+ this.status.cssClass = this.options.sizeFull.cssClass;
2204
+ } else {
2205
+ this.status.width = this.options.size.width;
2206
+ this.status.height = this.options.size.height;
2207
+ this.status.cssClass = this.options.size.cssClass;
2208
+ }
2209
+
2210
+ // Set the size of the jPlayer area.
2211
+ this.element.css({'width': this.status.width, 'height': this.status.height});
2212
+ },
2213
+ _addUiClass: function() {
2214
+ if(this.ancestorJq.length) {
2215
+ this.ancestorJq.addClass(this.status.cssClass);
2216
+ }
2217
+ },
2218
+ _removeUiClass: function() {
2219
+ if(this.ancestorJq.length) {
2220
+ this.ancestorJq.removeClass(this.status.cssClass);
2221
+ }
2222
+ },
2223
+ _updateSize: function() {
2224
+ // The poster uses show/hide so can simply resize it.
2225
+ this.internal.poster.jq.css({'width': this.status.width, 'height': this.status.height});
2226
+
2227
+ // Video html or flash resized if necessary at this time, or if native video controls being used.
2228
+ if(!this.status.waitForPlay && this.html.active && this.status.video || this.html.video.available && this.html.used && this.status.nativeVideoControls) {
2229
+ this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height});
2230
+ }
2231
+ else if(!this.status.waitForPlay && this.flash.active && this.status.video) {
2232
+ this.internal.flash.jq.css({'width': this.status.width, 'height': this.status.height});
2233
+ }
2234
+ },
2235
+ _updateAutohide: function() {
2236
+ var self = this,
2237
+ event = "mousemove.jPlayer",
2238
+ namespace = ".jPlayerAutohide",
2239
+ eventType = event + namespace,
2240
+ handler = function() {
2241
+ self.css.jq.gui.fadeIn(self.options.autohide.fadeIn, function() {
2242
+ clearTimeout(self.internal.autohideId);
2243
+ self.internal.autohideId = setTimeout( function() {
2244
+ self.css.jq.gui.fadeOut(self.options.autohide.fadeOut);
2245
+ }, self.options.autohide.hold);
2246
+ });
2247
+ };
2248
+
2249
+ if(this.css.jq.gui.length) {
2250
+
2251
+ // End animations first so that its callback is executed now.
2252
+ // Otherwise an in progress fadeIn animation still has the callback to fadeOut again.
2253
+ this.css.jq.gui.stop(true, true);
2254
+
2255
+ // Removes the fadeOut operation from the fadeIn callback.
2256
+ clearTimeout(this.internal.autohideId);
2257
+
2258
+ this.element.unbind(namespace);
2259
+ this.css.jq.gui.unbind(namespace);
2260
+
2261
+ if(!this.status.nativeVideoControls) {
2262
+ if(this.options.fullWindow && this.options.autohide.full || !this.options.fullWindow && this.options.autohide.restored) {
2263
+ this.element.bind(eventType, handler);
2264
+ this.css.jq.gui.bind(eventType, handler);
2265
+ this.css.jq.gui.hide();
2266
+ } else {
2267
+ this.css.jq.gui.show();
2268
+ }
2269
+ } else {
2270
+ this.css.jq.gui.hide();
2271
+ }
2272
+ }
2273
+ },
2274
+ fullScreen: function() {
2275
+ this._setOption("fullScreen", true);
2276
+ },
2277
+ restoreScreen: function() {
2278
+ this._setOption("fullScreen", false);
2279
+ },
2280
+ _fullscreenAddEventListeners: function() {
2281
+ var self = this,
2282
+ fs = $.jPlayer.nativeFeatures.fullscreen;
2283
+
2284
+ if(fs.api.fullscreenEnabled) {
2285
+ if(fs.event.fullscreenchange) {
2286
+ // Create the event handler function and store it for removal.
2287
+ if(typeof this.internal.fullscreenchangeHandler !== 'function') {
2288
+ this.internal.fullscreenchangeHandler = function() {
2289
+ self._fullscreenchange();
2290
+ };
2291
+ }
2292
+ document.addEventListener(fs.event.fullscreenchange, this.internal.fullscreenchangeHandler, false);
2293
+ }
2294
+ // No point creating handler for fullscreenerror.
2295
+ // Either logic avoids fullscreen occurring (w3c/moz), or their is no event on the browser (webkit).
2296
+ }
2297
+ },
2298
+ _fullscreenRemoveEventListeners: function() {
2299
+ var fs = $.jPlayer.nativeFeatures.fullscreen;
2300
+ if(this.internal.fullscreenchangeHandler) {
2301
+ document.addEventListener(fs.event.fullscreenchange, this.internal.fullscreenchangeHandler, false);
2302
+ }
2303
+ },
2304
+ _fullscreenchange: function() {
2305
+ // If nothing is fullscreen, then we cannot be in fullscreen mode.
2306
+ if(this.options.fullScreen && !$.jPlayer.nativeFeatures.fullscreen.api.fullscreenElement()) {
2307
+ this._setOption("fullScreen", false);
2308
+ }
2309
+ },
2310
+ _requestFullscreen: function() {
2311
+ // Either the container or the jPlayer div
2312
+ var e = this.ancestorJq.length ? this.ancestorJq[0] : this.element[0],
2313
+ fs = $.jPlayer.nativeFeatures.fullscreen;
2314
+
2315
+ // This method needs the video element. For iOS and Android.
2316
+ if(fs.used.webkitVideo) {
2317
+ e = this.htmlElement.video;
2318
+ }
2319
+
2320
+ if(fs.api.fullscreenEnabled) {
2321
+ fs.api.requestFullscreen(e);
2322
+ }
2323
+ },
2324
+ _exitFullscreen: function() {
2325
+
2326
+ var fs = $.jPlayer.nativeFeatures.fullscreen,
2327
+ e;
2328
+
2329
+ // This method needs the video element. For iOS and Android.
2330
+ if(fs.used.webkitVideo) {
2331
+ e = this.htmlElement.video;
2332
+ }
2333
+
2334
+ if(fs.api.fullscreenEnabled) {
2335
+ fs.api.exitFullscreen(e);
2336
+ }
2337
+ },
2338
+ _html_initMedia: function(media) {
2339
+ // Remove any existing track elements
2340
+ var $media = $(this.htmlElement.media).empty();
2341
+
2342
+ // Create any track elements given with the media, as an Array of track Objects.
2343
+ $.each(media.track || [], function(i,v) {
2344
+ var track = document.createElement('track');
2345
+ track.setAttribute("kind", v.kind ? v.kind : "");
2346
+ track.setAttribute("src", v.src ? v.src : "");
2347
+ track.setAttribute("srclang", v.srclang ? v.srclang : "");
2348
+ track.setAttribute("label", v.label ? v.label : "");
2349
+ if(v.def) {
2350
+ track.setAttribute("default", v.def);
2351
+ }
2352
+ $media.append(track);
2353
+ });
2354
+
2355
+ this.htmlElement.media.src = this.status.src;
2356
+
2357
+ if(this.options.preload !== 'none') {
2358
+ this._html_load(); // See function for comments
2359
+ }
2360
+ this._trigger($.jPlayer.event.timeupdate); // The flash generates this event for its solution.
2361
+ },
2362
+ _html_setFormat: function(media) {
2363
+ var self = this;
2364
+ // Always finds a format due to checks in setMedia()
2365
+ $.each(this.formats, function(priority, format) {
2366
+ if(self.html.support[format] && media[format]) {
2367
+ self.status.src = media[format];
2368
+ self.status.format[format] = true;
2369
+ self.status.formatType = format;
2370
+ return false;
2371
+ }
2372
+ });
2373
+ },
2374
+ _html_setAudio: function(media) {
2375
+ this._html_setFormat(media);
2376
+ this.htmlElement.media = this.htmlElement.audio;
2377
+ this._html_initMedia(media);
2378
+ },
2379
+ _html_setVideo: function(media) {
2380
+ this._html_setFormat(media);
2381
+ if(this.status.nativeVideoControls) {
2382
+ this.htmlElement.video.poster = this._validString(media.poster) ? media.poster : "";
2383
+ }
2384
+ this.htmlElement.media = this.htmlElement.video;
2385
+ this._html_initMedia(media);
2386
+ },
2387
+ _html_resetMedia: function() {
2388
+ if(this.htmlElement.media) {
2389
+ if(this.htmlElement.media.id === this.internal.video.id && !this.status.nativeVideoControls) {
2390
+ this.internal.video.jq.css({'width':'0px', 'height':'0px'});
2391
+ }
2392
+ this.htmlElement.media.pause();
2393
+ }
2394
+ },
2395
+ _html_clearMedia: function() {
2396
+ if(this.htmlElement.media) {
2397
+ this.htmlElement.media.src = "about:blank";
2398
+ // The following load() is only required for Firefox 3.6 (PowerMacs).
2399
+ // Recent HTMl5 browsers only require the src change. Due to changes in W3C spec and load() effect.
2400
+ this.htmlElement.media.load(); // Stops an old, "in progress" download from continuing the download. Triggers the loadstart, error and emptied events, due to the empty src. Also an abort event if a download was in progress.
2401
+ }
2402
+ },
2403
+ _html_load: function() {
2404
+ // This function remains to allow the early HTML5 browsers to work, such as Firefox 3.6
2405
+ // A change in the W3C spec for the media.load() command means that this is no longer necessary.
2406
+ // This command should be removed and actually causes minor undesirable effects on some browsers. Such as loading the whole file and not only the metadata.
2407
+ if(this.status.waitForLoad) {
2408
+ this.status.waitForLoad = false;
2409
+ this.htmlElement.media.load();
2410
+ }
2411
+ clearTimeout(this.internal.htmlDlyCmdId);
2412
+ },
2413
+ _html_play: function(time) {
2414
+ var self = this,
2415
+ media = this.htmlElement.media;
2416
+
2417
+ this._html_load(); // Loads if required and clears any delayed commands.
2418
+
2419
+ if(!isNaN(time)) {
2420
+
2421
+ // Attempt to play it, since iOS has been ignoring commands
2422
+ if(this.internal.cmdsIgnored) {
2423
+ media.play();
2424
+ }
2425
+
2426
+ try {
2427
+ // !media.seekable is for old HTML5 browsers, like Firefox 3.6.
2428
+ // Checking seekable.length is important for iOS6 to work with setMedia().play(time)
2429
+ if(!media.seekable || typeof media.seekable === "object" && media.seekable.length > 0) {
2430
+ media.currentTime = time;
2431
+ media.play();
2432
+ } else {
2433
+ throw 1;
2434
+ }
2435
+ } catch(err) {
2436
+ this.internal.htmlDlyCmdId = setTimeout(function() {
2437
+ self.play(time);
2438
+ }, 250);
2439
+ return; // Cancel execution and wait for the delayed command.
2440
+ }
2441
+ } else {
2442
+ media.play();
2443
+ }
2444
+ this._html_checkWaitForPlay();
2445
+ },
2446
+ _html_pause: function(time) {
2447
+ var self = this,
2448
+ media = this.htmlElement.media;
2449
+
2450
+ if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation.
2451
+ this._html_load(); // Loads if required and clears any delayed commands.
2452
+ } else {
2453
+ clearTimeout(this.internal.htmlDlyCmdId);
2454
+ }
2455
+
2456
+ // Order of these commands is important for Safari (Win) and IE9. Pause then change currentTime.
2457
+ media.pause();
2458
+
2459
+ if(!isNaN(time)) {
2460
+ try {
2461
+ if(!media.seekable || typeof media.seekable === "object" && media.seekable.length > 0) {
2462
+ media.currentTime = time;
2463
+ } else {
2464
+ throw 1;
2465
+ }
2466
+ } catch(err) {
2467
+ this.internal.htmlDlyCmdId = setTimeout(function() {
2468
+ self.pause(time);
2469
+ }, 250);
2470
+ return; // Cancel execution and wait for the delayed command.
2471
+ }
2472
+ }
2473
+ if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button.
2474
+ this._html_checkWaitForPlay();
2475
+ }
2476
+ },
2477
+ _html_playHead: function(percent) {
2478
+ var self = this,
2479
+ media = this.htmlElement.media;
2480
+
2481
+ this._html_load(); // Loads if required and clears any delayed commands.
2482
+
2483
+ try {
2484
+ if(typeof media.seekable === "object" && media.seekable.length > 0) {
2485
+ media.currentTime = percent * media.seekable.end(media.seekable.length-1) / 100;
2486
+ } else if(media.duration > 0 && !isNaN(media.duration)) {
2487
+ media.currentTime = percent * media.duration / 100;
2488
+ } else {
2489
+ throw "e";
2490
+ }
2491
+ } catch(err) {
2492
+ this.internal.htmlDlyCmdId = setTimeout(function() {
2493
+ self.playHead(percent);
2494
+ }, 250);
2495
+ return; // Cancel execution and wait for the delayed command.
2496
+ }
2497
+ if(!this.status.waitForLoad) {
2498
+ this._html_checkWaitForPlay();
2499
+ }
2500
+ },
2501
+ _html_checkWaitForPlay: function() {
2502
+ if(this.status.waitForPlay) {
2503
+ this.status.waitForPlay = false;
2504
+ if(this.css.jq.videoPlay.length) {
2505
+ this.css.jq.videoPlay.hide();
2506
+ }
2507
+ if(this.status.video) {
2508
+ this.internal.poster.jq.hide();
2509
+ this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height});
2510
+ }
2511
+ }
2512
+ },
2513
+ _html_volume: function(v) {
2514
+ if(this.html.audio.available) {
2515
+ this.htmlElement.audio.volume = v;
2516
+ }
2517
+ if(this.html.video.available) {
2518
+ this.htmlElement.video.volume = v;
2519
+ }
2520
+ },
2521
+ _html_mute: function(m) {
2522
+ if(this.html.audio.available) {
2523
+ this.htmlElement.audio.muted = m;
2524
+ }
2525
+ if(this.html.video.available) {
2526
+ this.htmlElement.video.muted = m;
2527
+ }
2528
+ },
2529
+ _flash_setAudio: function(media) {
2530
+ var self = this;
2531
+ try {
2532
+ // Always finds a format due to checks in setMedia()
2533
+ $.each(this.formats, function(priority, format) {
2534
+ if(self.flash.support[format] && media[format]) {
2535
+ switch (format) {
2536
+ case "m4a" :
2537
+ case "fla" :
2538
+ self._getMovie().fl_setAudio_m4a(media[format]);
2539
+ break;
2540
+ case "mp3" :
2541
+ self._getMovie().fl_setAudio_mp3(media[format]);
2542
+ break;
2543
+ case "rtmpa":
2544
+ self._getMovie().fl_setAudio_rtmp(media[format]);
2545
+ break;
2546
+ }
2547
+ self.status.src = media[format];
2548
+ self.status.format[format] = true;
2549
+ self.status.formatType = format;
2550
+ return false;
2551
+ }
2552
+ });
2553
+
2554
+ if(this.options.preload === 'auto') {
2555
+ this._flash_load();
2556
+ this.status.waitForLoad = false;
2557
+ }
2558
+ } catch(err) { this._flashError(err); }
2559
+ },
2560
+ _flash_setVideo: function(media) {
2561
+ var self = this;
2562
+ try {
2563
+ // Always finds a format due to checks in setMedia()
2564
+ $.each(this.formats, function(priority, format) {
2565
+ if(self.flash.support[format] && media[format]) {
2566
+ switch (format) {
2567
+ case "m4v" :
2568
+ case "flv" :
2569
+ self._getMovie().fl_setVideo_m4v(media[format]);
2570
+ break;
2571
+ case "rtmpv":
2572
+ self._getMovie().fl_setVideo_rtmp(media[format]);
2573
+ break;
2574
+ }
2575
+ self.status.src = media[format];
2576
+ self.status.format[format] = true;
2577
+ self.status.formatType = format;
2578
+ return false;
2579
+ }
2580
+ });
2581
+
2582
+ if(this.options.preload === 'auto') {
2583
+ this._flash_load();
2584
+ this.status.waitForLoad = false;
2585
+ }
2586
+ } catch(err) { this._flashError(err); }
2587
+ },
2588
+ _flash_resetMedia: function() {
2589
+ this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); // Must do via CSS as setting attr() to zero causes a jQuery error in IE.
2590
+ this._flash_pause(NaN);
2591
+ },
2592
+ _flash_clearMedia: function() {
2593
+ try {
2594
+ this._getMovie().fl_clearMedia();
2595
+ } catch(err) { this._flashError(err); }
2596
+ },
2597
+ _flash_load: function() {
2598
+ try {
2599
+ this._getMovie().fl_load();
2600
+ } catch(err) { this._flashError(err); }
2601
+ this.status.waitForLoad = false;
2602
+ },
2603
+ _flash_play: function(time) {
2604
+ try {
2605
+ this._getMovie().fl_play(time);
2606
+ } catch(err) { this._flashError(err); }
2607
+ this.status.waitForLoad = false;
2608
+ this._flash_checkWaitForPlay();
2609
+ },
2610
+ _flash_pause: function(time) {
2611
+ try {
2612
+ this._getMovie().fl_pause(time);
2613
+ } catch(err) { this._flashError(err); }
2614
+ if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button.
2615
+ this.status.waitForLoad = false;
2616
+ this._flash_checkWaitForPlay();
2617
+ }
2618
+ },
2619
+ _flash_playHead: function(p) {
2620
+ try {
2621
+ this._getMovie().fl_play_head(p);
2622
+ } catch(err) { this._flashError(err); }
2623
+ if(!this.status.waitForLoad) {
2624
+ this._flash_checkWaitForPlay();
2625
+ }
2626
+ },
2627
+ _flash_checkWaitForPlay: function() {
2628
+ if(this.status.waitForPlay) {
2629
+ this.status.waitForPlay = false;
2630
+ if(this.css.jq.videoPlay.length) {
2631
+ this.css.jq.videoPlay.hide();
2632
+ }
2633
+ if(this.status.video) {
2634
+ this.internal.poster.jq.hide();
2635
+ this.internal.flash.jq.css({'width': this.status.width, 'height': this.status.height});
2636
+ }
2637
+ }
2638
+ },
2639
+ _flash_volume: function(v) {
2640
+ try {
2641
+ this._getMovie().fl_volume(v);
2642
+ } catch(err) { this._flashError(err); }
2643
+ },
2644
+ _flash_mute: function(m) {
2645
+ try {
2646
+ this._getMovie().fl_mute(m);
2647
+ } catch(err) { this._flashError(err); }
2648
+ },
2649
+ _getMovie: function() {
2650
+ return document[this.internal.flash.id];
2651
+ },
2652
+ _getFlashPluginVersion: function() {
2653
+
2654
+ // _getFlashPluginVersion() code influenced by:
2655
+ // - FlashReplace 1.01: http://code.google.com/p/flashreplace/
2656
+ // - SWFObject 2.2: http://code.google.com/p/swfobject/
2657
+
2658
+ var version = 0,
2659
+ flash;
2660
+ if(window.ActiveXObject) {
2661
+ try {
2662
+ flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
2663
+ if (flash) { // flash will return null when ActiveX is disabled
2664
+ var v = flash.GetVariable("$version");
2665
+ if(v) {
2666
+ v = v.split(" ")[1].split(",");
2667
+ version = parseInt(v[0], 10) + "." + parseInt(v[1], 10);
2668
+ }
2669
+ }
2670
+ } catch(e) {}
2671
+ }
2672
+ else if(navigator.plugins && navigator.mimeTypes.length > 0) {
2673
+ flash = navigator.plugins["Shockwave Flash"];
2674
+ if(flash) {
2675
+ version = navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1");
2676
+ }
2677
+ }
2678
+ return version * 1; // Converts to a number
2679
+ },
2680
+ _checkForFlash: function (version) {
2681
+ var flashOk = false;
2682
+ if(this._getFlashPluginVersion() >= version) {
2683
+ flashOk = true;
2684
+ }
2685
+ return flashOk;
2686
+ },
2687
+ _validString: function(url) {
2688
+ return (url && typeof url === "string"); // Empty strings return false
2689
+ },
2690
+ _limitValue: function(value, min, max) {
2691
+ return (value < min) ? min : ((value > max) ? max : value);
2692
+ },
2693
+ _urlNotSetError: function(context) {
2694
+ this._error( {
2695
+ type: $.jPlayer.error.URL_NOT_SET,
2696
+ context: context,
2697
+ message: $.jPlayer.errorMsg.URL_NOT_SET,
2698
+ hint: $.jPlayer.errorHint.URL_NOT_SET
2699
+ });
2700
+ },
2701
+ _flashError: function(error) {
2702
+ var errorType;
2703
+ if(!this.internal.ready) {
2704
+ errorType = "FLASH";
2705
+ } else {
2706
+ errorType = "FLASH_DISABLED";
2707
+ }
2708
+ this._error( {
2709
+ type: $.jPlayer.error[errorType],
2710
+ context: this.internal.flash.swf,
2711
+ message: $.jPlayer.errorMsg[errorType] + error.message,
2712
+ hint: $.jPlayer.errorHint[errorType]
2713
+ });
2714
+ // Allow the audio player to recover if display:none and then shown again, or with position:fixed on Firefox.
2715
+ // This really only affects audio in a media player, as an audio player could easily move the jPlayer element away from such issues.
2716
+ this.internal.flash.jq.css({'width':'1px', 'height':'1px'});
2717
+ },
2718
+ _error: function(error) {
2719
+ this._trigger($.jPlayer.event.error, error);
2720
+ if(this.options.errorAlerts) {
2721
+ this._alert("Error!" + (error.message ? "\n\n" + error.message : "") + (error.hint ? "\n\n" + error.hint : "") + "\n\nContext: " + error.context);
2722
+ }
2723
+ },
2724
+ _warning: function(warning) {
2725
+ this._trigger($.jPlayer.event.warning, undefined, warning);
2726
+ if(this.options.warningAlerts) {
2727
+ this._alert("Warning!" + (warning.message ? "\n\n" + warning.message : "") + (warning.hint ? "\n\n" + warning.hint : "") + "\n\nContext: " + warning.context);
2728
+ }
2729
+ },
2730
+ _alert: function(message) {
2731
+ alert("jPlayer " + this.version.script + " : id='" + this.internal.self.id +"' : " + message);
2732
+ },
2733
+ _emulateHtmlBridge: function() {
2734
+ var self = this;
2735
+
2736
+ // Emulate methods on jPlayer's DOM element.
2737
+ $.each( $.jPlayer.emulateMethods.split(/\s+/g), function(i, name) {
2738
+ self.internal.domNode[name] = function(arg) {
2739
+ self[name](arg);
2740
+ };
2741
+
2742
+ });
2743
+
2744
+ // Bubble jPlayer events to its DOM element.
2745
+ $.each($.jPlayer.event, function(eventName,eventType) {
2746
+ var nativeEvent = true;
2747
+ $.each( $.jPlayer.reservedEvent.split(/\s+/g), function(i, name) {
2748
+ if(name === eventName) {
2749
+ nativeEvent = false;
2750
+ return false;
2751
+ }
2752
+ });
2753
+ if(nativeEvent) {
2754
+ self.element.bind(eventType + ".jPlayer.jPlayerHtml", function() { // With .jPlayer & .jPlayerHtml namespaces.
2755
+ self._emulateHtmlUpdate();
2756
+ var domEvent = document.createEvent("Event");
2757
+ domEvent.initEvent(eventName, false, true);
2758
+ self.internal.domNode.dispatchEvent(domEvent);
2759
+ });
2760
+ }
2761
+ // The error event would require a special case
2762
+ });
2763
+
2764
+ // IE9 has a readyState property on all elements. The document should have it, but all (except media) elements inherit it in IE9. This conflicts with Popcorn, which polls the readyState.
2765
+ },
2766
+ _emulateHtmlUpdate: function() {
2767
+ var self = this;
2768
+
2769
+ $.each( $.jPlayer.emulateStatus.split(/\s+/g), function(i, name) {
2770
+ self.internal.domNode[name] = self.status[name];
2771
+ });
2772
+ $.each( $.jPlayer.emulateOptions.split(/\s+/g), function(i, name) {
2773
+ self.internal.domNode[name] = self.options[name];
2774
+ });
2775
+ },
2776
+ _destroyHtmlBridge: function() {
2777
+ var self = this;
2778
+
2779
+ // Bridge event handlers are also removed by destroy() through .jPlayer namespace.
2780
+ this.element.unbind(".jPlayerHtml"); // Remove all event handlers created by the jPlayer bridge. So you can change the emulateHtml option.
2781
+
2782
+ // Remove the methods and properties
2783
+ var emulated = $.jPlayer.emulateMethods + " " + $.jPlayer.emulateStatus + " " + $.jPlayer.emulateOptions;
2784
+ $.each( emulated.split(/\s+/g), function(i, name) {
2785
+ delete self.internal.domNode[name];
2786
+ });
2787
+ }
2788
+ };
2789
+
2790
+ $.jPlayer.error = {
2791
+ FLASH: "e_flash",
2792
+ FLASH_DISABLED: "e_flash_disabled",
2793
+ NO_SOLUTION: "e_no_solution",
2794
+ NO_SUPPORT: "e_no_support",
2795
+ URL: "e_url",
2796
+ URL_NOT_SET: "e_url_not_set",
2797
+ VERSION: "e_version"
2798
+ };
2799
+
2800
+ $.jPlayer.errorMsg = {
2801
+ FLASH: "jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ", // Used in: _flashError()
2802
+ FLASH_DISABLED: "jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ", // Used in: _flashError()
2803
+ NO_SOLUTION: "No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.", // Used in: _init()
2804
+ NO_SUPPORT: "It is not possible to play any media format provided in setMedia() on this browser using your current options.", // Used in: setMedia()
2805
+ URL: "Media URL could not be loaded.", // Used in: jPlayerFlashEvent() and _addHtmlEventListeners()
2806
+ URL_NOT_SET: "Attempt to issue media playback commands, while no media url is set.", // Used in: load(), play(), pause(), stop() and playHead()
2807
+ VERSION: "jPlayer " + $.jPlayer.prototype.version.script + " needs Jplayer.swf version " + $.jPlayer.prototype.version.needFlash + " but found " // Used in: jPlayerReady()
2808
+ };
2809
+
2810
+ $.jPlayer.errorHint = {
2811
+ FLASH: "Check your swfPath option and that Jplayer.swf is there.",
2812
+ FLASH_DISABLED: "Check that you have not display:none; the jPlayer entity or any ancestor.",
2813
+ NO_SOLUTION: "Review the jPlayer options: support and supplied.",
2814
+ NO_SUPPORT: "Video or audio formats defined in the supplied option are missing.",
2815
+ URL: "Check media URL is valid.",
2816
+ URL_NOT_SET: "Use setMedia() to set the media URL.",
2817
+ VERSION: "Update jPlayer files."
2818
+ };
2819
+
2820
+ $.jPlayer.warning = {
2821
+ CSS_SELECTOR_COUNT: "e_css_selector_count",
2822
+ CSS_SELECTOR_METHOD: "e_css_selector_method",
2823
+ CSS_SELECTOR_STRING: "e_css_selector_string",
2824
+ OPTION_KEY: "e_option_key"
2825
+ };
2826
+
2827
+ $.jPlayer.warningMsg = {
2828
+ CSS_SELECTOR_COUNT: "The number of css selectors found did not equal one: ",
2829
+ CSS_SELECTOR_METHOD: "The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",
2830
+ CSS_SELECTOR_STRING: "The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",
2831
+ OPTION_KEY: "The option requested in jPlayer('option') is undefined."
2832
+ };
2833
+
2834
+ $.jPlayer.warningHint = {
2835
+ CSS_SELECTOR_COUNT: "Check your css selector and the ancestor.",
2836
+ CSS_SELECTOR_METHOD: "Check your method name.",
2837
+ CSS_SELECTOR_STRING: "Check your css selector is a string.",
2838
+ OPTION_KEY: "Check your option name."
2839
+ };
2840
+ }));