soundmanager-rails 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/soundmanager-rails/version.rb +1 -1
- data/vendor/assets/images/swf/soundmanager2.swf +0 -0
- data/vendor/assets/images/swf/soundmanager2_debug.swf +0 -0
- data/vendor/assets/images/swf/soundmanager2_flash9.swf +0 -0
- data/vendor/assets/images/swf/soundmanager2_flash9_debug.swf +0 -0
- data/vendor/assets/javascripts/soundmanager2-jsmin.js +97 -97
- data/vendor/assets/javascripts/soundmanager2-nodebug-jsmin.js +68 -68
- data/vendor/assets/javascripts/soundmanager2-nodebug.js +55 -47
- data/vendor/assets/javascripts/soundmanager2.js +121 -57
- metadata +3 -2
@@ -8,7 +8,7 @@
|
|
8
8
|
* Code provided under the BSD License:
|
9
9
|
* http://schillmania.com/projects/soundmanager2/license.txt
|
10
10
|
*
|
11
|
-
* V2.97a.
|
11
|
+
* V2.97a.20120916
|
12
12
|
*/
|
13
13
|
|
14
14
|
/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */
|
@@ -20,7 +20,7 @@
|
|
20
20
|
* This is the fully-commented source version of the SoundManager 2 API,
|
21
21
|
* recommended for use during development and testing.
|
22
22
|
*
|
23
|
-
* See soundmanager2-nodebug-jsmin.js for an optimized build (~
|
23
|
+
* See soundmanager2-nodebug-jsmin.js for an optimized build (~11KB with gzip.)
|
24
24
|
* http://schillmania.com/projects/soundmanager2/doc/getstarted/#basic-inclusion
|
25
25
|
* Alternately, serve this file with gzip for 75% compression savings (~30KB over HTTP.)
|
26
26
|
*
|
@@ -146,7 +146,6 @@ function SoundManager(smURL, smID) {
|
|
146
146
|
* determines HTML5 support + flash requirements.
|
147
147
|
* if no support (via flash and/or HTML5) for a "required" format, SM2 will fail to start.
|
148
148
|
* flash fallback is used for MP3 or MP4 if HTML5 can't play it (or if preferFlash = true)
|
149
|
-
* multiple MIME types may be tested while trying to get a positive canPlayType() response.
|
150
149
|
*/
|
151
150
|
|
152
151
|
'mp3': {
|
@@ -155,7 +154,7 @@ function SoundManager(smURL, smID) {
|
|
155
154
|
},
|
156
155
|
|
157
156
|
'mp4': {
|
158
|
-
'related': ['aac','m4a'], // additional formats under the MP4 container
|
157
|
+
'related': ['aac','m4a','m4b'], // additional formats under the MP4 container
|
159
158
|
'type': ['audio/mp4; codecs="mp4a.40.2"', 'audio/aac', 'audio/x-m4a', 'audio/MP4A-LATM', 'audio/mpeg4-generic'],
|
160
159
|
'required': false
|
161
160
|
},
|
@@ -182,7 +181,7 @@ function SoundManager(smURL, smID) {
|
|
182
181
|
|
183
182
|
// dynamic attributes
|
184
183
|
|
185
|
-
this.versionNumber = 'V2.97a.
|
184
|
+
this.versionNumber = 'V2.97a.20120916';
|
186
185
|
this.version = null;
|
187
186
|
this.movieURL = null;
|
188
187
|
this.altURL = null;
|
@@ -241,7 +240,8 @@ function SoundManager(smURL, smID) {
|
|
241
240
|
|
242
241
|
this.hasHTML5 = (function() {
|
243
242
|
try {
|
244
|
-
|
243
|
+
// new Audio(null) for stupid Opera 9.64 case, which throws not_enough_arguments exception otherwise.
|
244
|
+
return (typeof Audio !== 'undefined' && typeof (_isOpera && opera.version() < 10 ? new Audio(null) : new Audio()).canPlayType !== 'undefined');
|
245
245
|
} catch(e) {
|
246
246
|
return false;
|
247
247
|
}
|
@@ -277,14 +277,14 @@ function SoundManager(smURL, smID) {
|
|
277
277
|
_is_iDevice = _ua.match(/(ipad|iphone|ipod)/i), _isIE = _ua.match(/msie/i), _isWebkit = _ua.match(/webkit/i), _isSafari = (_ua.match(/safari/i) && !_ua.match(/chrome/i)), _isOpera = (_ua.match(/opera/i)),
|
278
278
|
_mobileHTML5 = (_ua.match(/(mobile|pre\/|xoom)/i) || _is_iDevice),
|
279
279
|
_isBadSafari = (!_wl.match(/usehtml5audio/i) && !_wl.match(/sm2\-ignorebadua/i) && _isSafari && !_ua.match(/silk/i) && _ua.match(/OS X 10_6_([3-7])/i)), // Safari 4 and 5 (excluding Kindle Fire, "Silk") occasionally fail to load/play HTML5 audio on Snow Leopard 10.6.3 through 10.6.7 due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Confirmed bug. https://bugs.webkit.org/show_bug.cgi?id=32159
|
280
|
-
_hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), _tryInitOnFocus = (_isSafari && (typeof _doc.hasFocus === 'undefined' || !_doc.hasFocus())), _okToDisable = !_tryInitOnFocus, _flashMIME = /(mp3|mp4|mpa|m4a)/i,
|
280
|
+
_hasConsole = (typeof console !== 'undefined' && typeof console.log !== 'undefined'), _isFocused = (typeof _doc.hasFocus !== 'undefined'?_doc.hasFocus():null), _tryInitOnFocus = (_isSafari && (typeof _doc.hasFocus === 'undefined' || !_doc.hasFocus())), _okToDisable = !_tryInitOnFocus, _flashMIME = /(mp3|mp4|mpa|m4a|m4b)/i,
|
281
281
|
_emptyURL = 'about:blank', // safe URL to unload, or load nothing from (flash 8 + most HTML5 UAs)
|
282
282
|
_overHTTP = (_doc.location?_doc.location.protocol.match(/http/i):null),
|
283
283
|
_http = (!_overHTTP ? 'http:/'+'/' : ''),
|
284
284
|
// mp3, mp4, aac etc.
|
285
|
-
_netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,
|
285
|
+
_netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,
|
286
286
|
// Flash v9.0r115+ "moviestar" formats
|
287
|
-
_netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'mp4v', '3gp', '3g2'],
|
287
|
+
_netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'm4b', 'mp4v', '3gp', '3g2'],
|
288
288
|
_netStreamPattern = new RegExp('\\.(' + _netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
|
289
289
|
|
290
290
|
this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // default mp3 set
|
@@ -336,6 +336,8 @@ function SoundManager(smURL, smID) {
|
|
336
336
|
|
337
337
|
this.setup = function(options) {
|
338
338
|
|
339
|
+
var noURL = (!_s.url);
|
340
|
+
|
339
341
|
// warn if flash options have already been applied
|
340
342
|
|
341
343
|
if (typeof options !== 'undefined' && _didInit && _needsFlash && _s.ok() && (typeof options.flashVersion !== 'undefined' || typeof options.url !== 'undefined')) {
|
@@ -346,6 +348,18 @@ function SoundManager(smURL, smID) {
|
|
346
348
|
|
347
349
|
_assign(options);
|
348
350
|
|
351
|
+
// special case 1: "Late setup". SM2 loaded normally, but user didn't assign flash URL eg., setup({url:...}) before SM2 init. Treat as delayed init.
|
352
|
+
|
353
|
+
if (noURL && _didDCLoaded && typeof options.url !== 'undefined') {
|
354
|
+
_s.beginDelayedInit();
|
355
|
+
}
|
356
|
+
|
357
|
+
// special case 2: If lazy-loading SM2 (DOMContentLoaded has already happened) and user calls setup() with url: parameter, try to init ASAP.
|
358
|
+
|
359
|
+
if (!_didDCLoaded && typeof options.url !== 'undefined' && _doc.readyState === 'complete') {
|
360
|
+
setTimeout(_domContentLoaded, 1);
|
361
|
+
}
|
362
|
+
|
349
363
|
return _s;
|
350
364
|
|
351
365
|
};
|
@@ -1458,7 +1472,8 @@ function SoundManager(smURL, smID) {
|
|
1458
1472
|
// local shortcut
|
1459
1473
|
_iO = _t._iO;
|
1460
1474
|
|
1461
|
-
|
1475
|
+
// make a local copy of the old url before we re-assign it
|
1476
|
+
_lastURL = (_t.url && _t.url.toString ? _t.url.toString() : null);
|
1462
1477
|
|
1463
1478
|
// reset a few state properties
|
1464
1479
|
|
@@ -1537,6 +1552,9 @@ function SoundManager(smURL, smID) {
|
|
1537
1552
|
|
1538
1553
|
}
|
1539
1554
|
|
1555
|
+
// after all of this, ensure sound url is up to date.
|
1556
|
+
_t.url = _iO.url;
|
1557
|
+
|
1540
1558
|
return _t;
|
1541
1559
|
|
1542
1560
|
};
|
@@ -1653,9 +1671,19 @@ function SoundManager(smURL, smID) {
|
|
1653
1671
|
oOptions = {};
|
1654
1672
|
}
|
1655
1673
|
|
1656
|
-
|
1674
|
+
// first, use local URL (if specified)
|
1675
|
+
if (_t.url) {
|
1676
|
+
_t._iO.url = _t.url;
|
1677
|
+
}
|
1678
|
+
|
1679
|
+
// mix in any options defined at createSound()
|
1657
1680
|
_t._iO = _mixin(_t._iO, _t.options);
|
1681
|
+
|
1682
|
+
// mix in any options specific to this method
|
1683
|
+
_t._iO = _mixin(oOptions, _t._iO);
|
1684
|
+
|
1658
1685
|
_t._iO.url = _parseURL(_t._iO.url);
|
1686
|
+
|
1659
1687
|
_t.instanceOptions = _t._iO;
|
1660
1688
|
|
1661
1689
|
// RTMP-only
|
@@ -1687,6 +1715,12 @@ function SoundManager(smURL, smID) {
|
|
1687
1715
|
return exit;
|
1688
1716
|
}
|
1689
1717
|
|
1718
|
+
// edge case: play() with explicit URL parameter
|
1719
|
+
if (oOptions.url && oOptions.url !== _t.url) {
|
1720
|
+
// load using merged options
|
1721
|
+
_t.load(_t._iO);
|
1722
|
+
}
|
1723
|
+
|
1690
1724
|
if (!_t.loaded) {
|
1691
1725
|
|
1692
1726
|
if (_t.readyState === 0) {
|
@@ -1736,9 +1770,10 @@ function SoundManager(smURL, smID) {
|
|
1736
1770
|
* If we just call resume() the onplay() callback will never be called.
|
1737
1771
|
* So only call resume() if the position is > 0.
|
1738
1772
|
* Another reason is because options like volume won't have been applied yet.
|
1773
|
+
* For normal sounds, just resume.
|
1739
1774
|
*/
|
1740
1775
|
|
1741
|
-
if (_t.paused && _t.position && _t.position > 0) {
|
1776
|
+
if (_t.paused && _t.position >= 0 && (!_t._iO.serverURL || _t.position > 0)) {
|
1742
1777
|
|
1743
1778
|
// https://gist.github.com/37b17df75cc4d7a90bf6
|
1744
1779
|
_s._wD(fN + '"' + _t.id + '" is resuming from paused state',1);
|
@@ -1989,7 +2024,7 @@ function SoundManager(smURL, smID) {
|
|
1989
2024
|
position, position1K,
|
1990
2025
|
// Use the duration from the instance options, if we don't have a track duration yet.
|
1991
2026
|
// position >= 0 and <= current available (loaded) duration
|
1992
|
-
offset = (_t.isHTML5 ? Math.max(nMsecOffset,0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0)));
|
2027
|
+
offset = (_t.isHTML5 ? Math.max(nMsecOffset, 0) : Math.min(_t.duration || _t._iO.duration, Math.max(nMsecOffset, 0)));
|
1993
2028
|
|
1994
2029
|
original_pos = _t.position;
|
1995
2030
|
_t.position = offset;
|
@@ -2613,8 +2648,9 @@ function SoundManager(smURL, smID) {
|
|
2613
2648
|
this._get_html5_duration = function() {
|
2614
2649
|
|
2615
2650
|
var _iO = _t._iO,
|
2616
|
-
|
2617
|
-
|
2651
|
+
// if audio object exists, use its duration - else, instance option duration (if provided - it's a hack, really, and should be retired) OR null
|
2652
|
+
d = (_t._a && _t._a.duration ? _t._a.duration*1000 : (_iO && _iO.duration ? _iO.duration : null)),
|
2653
|
+
result = (d && !isNaN(d) && d !== Infinity ? d : null);
|
2618
2654
|
|
2619
2655
|
return result;
|
2620
2656
|
|
@@ -2704,7 +2740,7 @@ function SoundManager(smURL, smID) {
|
|
2704
2740
|
} else {
|
2705
2741
|
|
2706
2742
|
// null for stupid Opera 9.64 case
|
2707
|
-
_t._a = (_isOpera ? new Audio(null) : new Audio());
|
2743
|
+
_t._a = (_isOpera && opera.version() < 10 ? new Audio(null) : new Audio());
|
2708
2744
|
|
2709
2745
|
}
|
2710
2746
|
|
@@ -2942,19 +2978,15 @@ function SoundManager(smURL, smID) {
|
|
2942
2978
|
_t.duration = Math.floor(nDuration);
|
2943
2979
|
_t.bufferLength = nBufferLength;
|
2944
2980
|
|
2945
|
-
if (!_iO.isMovieStar) {
|
2981
|
+
if (!_t.isHTML5 && !_iO.isMovieStar) {
|
2946
2982
|
|
2947
2983
|
if (_iO.duration) {
|
2948
|
-
// use duration from options, if specified and larger
|
2984
|
+
// use duration from options, if specified and larger. nobody should be specifying duration in options, actually, and it should be retired.
|
2949
2985
|
_t.durationEstimate = (_t.duration > _iO.duration) ? _t.duration : _iO.duration;
|
2950
2986
|
} else {
|
2951
2987
|
_t.durationEstimate = parseInt((_t.bytesTotal / _t.bytesLoaded) * _t.duration, 10);
|
2952
2988
|
}
|
2953
2989
|
|
2954
|
-
if (typeof _t.durationEstimate === 'undefined') {
|
2955
|
-
_t.durationEstimate = _t.duration;
|
2956
|
-
}
|
2957
|
-
|
2958
2990
|
} else {
|
2959
2991
|
|
2960
2992
|
_t.durationEstimate = _t.duration;
|
@@ -3051,7 +3083,7 @@ function SoundManager(smURL, smID) {
|
|
3051
3083
|
_t.captiondata = oData;
|
3052
3084
|
|
3053
3085
|
if (_t._iO.oncaptiondata) {
|
3054
|
-
_t._iO.oncaptiondata.apply(_t);
|
3086
|
+
_t._iO.oncaptiondata.apply(_t, [oData]);
|
3055
3087
|
}
|
3056
3088
|
|
3057
3089
|
};
|
@@ -3347,6 +3379,18 @@ function SoundManager(smURL, smID) {
|
|
3347
3379
|
|
3348
3380
|
};
|
3349
3381
|
|
3382
|
+
function _preferFlashCheck(kind) {
|
3383
|
+
|
3384
|
+
// whether flash should play a given type
|
3385
|
+
return (_s.preferFlash && _hasFlash && !_s.ignoreFlash && (typeof _s.flash[kind] !== 'undefined' && _s.flash[kind]));
|
3386
|
+
|
3387
|
+
}
|
3388
|
+
|
3389
|
+
/**
|
3390
|
+
* Internal DOM2-level event helpers
|
3391
|
+
* ---------------------------------
|
3392
|
+
*/
|
3393
|
+
|
3350
3394
|
_event = (function() {
|
3351
3395
|
|
3352
3396
|
var old = (_win.attachEvent),
|
@@ -3357,7 +3401,8 @@ function SoundManager(smURL, smID) {
|
|
3357
3401
|
|
3358
3402
|
function getArgs(oArgs) {
|
3359
3403
|
|
3360
|
-
var args = _slice.call(oArgs),
|
3404
|
+
var args = _slice.call(oArgs),
|
3405
|
+
len = args.length;
|
3361
3406
|
|
3362
3407
|
if (old) {
|
3363
3408
|
// prefix
|
@@ -3406,13 +3451,6 @@ function SoundManager(smURL, smID) {
|
|
3406
3451
|
|
3407
3452
|
}());
|
3408
3453
|
|
3409
|
-
function _preferFlashCheck(kind) {
|
3410
|
-
|
3411
|
-
// whether flash should play a given type
|
3412
|
-
return (_s.preferFlash && _hasFlash && !_s.ignoreFlash && (typeof _s.flash[kind] !== 'undefined' && _s.flash[kind]));
|
3413
|
-
|
3414
|
-
}
|
3415
|
-
|
3416
3454
|
/**
|
3417
3455
|
* Internal HTML5 event handling
|
3418
3456
|
* -----------------------------
|
@@ -3584,7 +3622,9 @@ function SoundManager(smURL, smID) {
|
|
3584
3622
|
ranges = e.target.buffered,
|
3585
3623
|
// firefox 3.6 implements e.loaded/total (bytes)
|
3586
3624
|
loaded = (e.loaded||0),
|
3587
|
-
total = (e.total||1)
|
3625
|
+
total = (e.total||1),
|
3626
|
+
// HTML5 returns msec. SM2 API uses seconds for setPosition() etc., whether Flash or HTML5.
|
3627
|
+
scale = 1000;
|
3588
3628
|
|
3589
3629
|
// reset the "buffered" (loaded byte ranges) array
|
3590
3630
|
t.buffered = [];
|
@@ -3597,23 +3637,23 @@ function SoundManager(smURL, smID) {
|
|
3597
3637
|
// re-build "buffered" array
|
3598
3638
|
for (i=0, j=ranges.length; i<j; i++) {
|
3599
3639
|
t.buffered.push({
|
3600
|
-
'start': ranges.start(i),
|
3601
|
-
'end': ranges.end(i)
|
3640
|
+
'start': ranges.start(i) * scale,
|
3641
|
+
'end': ranges.end(i) * scale
|
3602
3642
|
});
|
3603
3643
|
}
|
3604
3644
|
|
3605
3645
|
// use the last value locally
|
3606
|
-
buffered = (ranges.end(0) - ranges.start(0));
|
3646
|
+
buffered = (ranges.end(0) - ranges.start(0)) * scale;
|
3607
3647
|
|
3608
3648
|
// linear case, buffer sum; does not account for seeking and HTTP partials / byte ranges
|
3609
|
-
loaded = buffered/e.target.duration;
|
3649
|
+
loaded = buffered/(e.target.duration*scale);
|
3610
3650
|
|
3611
3651
|
// <d>
|
3612
3652
|
if (isProgress && ranges.length > 1) {
|
3613
3653
|
str = [];
|
3614
3654
|
j = ranges.length;
|
3615
3655
|
for (i=0; i<j; i++) {
|
3616
|
-
str.push(e.target.buffered.start(i) +'-'+ e.target.buffered.end(i));
|
3656
|
+
str.push(e.target.buffered.start(i)*scale +'-'+ e.target.buffered.end(i)*scale);
|
3617
3657
|
}
|
3618
3658
|
_s._wD(_h5+'progress: timeRanges: '+str.join(', '));
|
3619
3659
|
}
|
@@ -3797,12 +3837,17 @@ function SoundManager(smURL, smID) {
|
|
3797
3837
|
|
3798
3838
|
_testHTML5 = function() {
|
3799
3839
|
|
3800
|
-
|
3840
|
+
/**
|
3841
|
+
* Internal: Iterates over audioFormats, determining support eg. audio/mp3, audio/mpeg and so on
|
3842
|
+
* assigns results to html5[] and flash[].
|
3843
|
+
*/
|
3844
|
+
|
3845
|
+
if (!_s.useHTML5Audio || !_s.hasHTML5) {
|
3801
3846
|
return false;
|
3802
3847
|
}
|
3803
3848
|
|
3804
3849
|
// double-whammy: Opera 9.64 throws WRONG_ARGUMENTS_ERR if no parameter passed to Audio(), and Webkit + iOS happily tries to load "null" as a URL. :/
|
3805
|
-
var a = (typeof Audio !== 'undefined' ? (_isOpera ? new Audio(null) : new Audio()) : null),
|
3850
|
+
var a = (typeof Audio !== 'undefined' ? (_isOpera && opera.version() < 10 ? new Audio(null) : new Audio()) : null),
|
3806
3851
|
item, lookup, support = {}, aF, i;
|
3807
3852
|
|
3808
3853
|
function _cp(m) {
|
@@ -3817,7 +3862,7 @@ function SoundManager(smURL, smID) {
|
|
3817
3862
|
|
3818
3863
|
if (m instanceof Array) {
|
3819
3864
|
// iterate through all mime types, return any successes
|
3820
|
-
for (i=0, j=m.length; i<j
|
3865
|
+
for (i=0, j=m.length; i<j; i++) {
|
3821
3866
|
if (_s.html5[m[i]] || a.canPlayType(m[i]).match(_s.html5Test)) {
|
3822
3867
|
isOK = true;
|
3823
3868
|
_s.html5[m[i]] = true;
|
@@ -3931,13 +3976,16 @@ function SoundManager(smURL, smID) {
|
|
3931
3976
|
noNSLoop: 'Note: Looping not implemented for MovieStar formats',
|
3932
3977
|
needfl9: 'Note: Switching to flash 9, required for MP4 formats.',
|
3933
3978
|
mfTimeout: 'Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case',
|
3979
|
+
needFlash: _sm + ': Fatal error: Flash is needed to play some required formats, but is not available.',
|
3980
|
+
gotFocus: _sm + ': Got window focus.',
|
3934
3981
|
mfOn: 'mobileFlash::enabling on-screen flash repositioning',
|
3935
3982
|
policy: 'Enabling usePolicyFile for data access',
|
3936
3983
|
setup: _sm + '.setup(): allowed parameters: %s',
|
3937
3984
|
setupError: _sm + '.setup(): "%s" cannot be assigned with this method.',
|
3938
3985
|
setupUndef: _sm + '.setup(): Could not find option "%s"',
|
3939
3986
|
setupLate: _sm + '.setup(): url + flashVersion changes will not take effect until reboot().',
|
3940
|
-
h5a: 'creating HTML5 Audio() object'
|
3987
|
+
h5a: 'creating HTML5 Audio() object',
|
3988
|
+
noURL: _sm + ': Flash URL required. Call soundManager.setup({url:...}) to get started.'
|
3941
3989
|
// </d>
|
3942
3990
|
|
3943
3991
|
};
|
@@ -4472,8 +4520,6 @@ function SoundManager(smURL, smID) {
|
|
4472
4520
|
if (!_s.html5 || !_s.html5.canPlayType) {
|
4473
4521
|
_s._wD('SoundManager: No HTML5 Audio() support detected.');
|
4474
4522
|
_s.hasHTML5 = false;
|
4475
|
-
} else {
|
4476
|
-
_s.hasHTML5 = true;
|
4477
4523
|
}
|
4478
4524
|
|
4479
4525
|
// <d>
|
@@ -4799,9 +4845,11 @@ function SoundManager(smURL, smID) {
|
|
4799
4845
|
var remoteURL = (smURL || _s.url),
|
4800
4846
|
localURL = (_s.altURL || remoteURL),
|
4801
4847
|
swfTitle = 'JS/Flash audio component (SoundManager 2)',
|
4802
|
-
|
4803
|
-
|
4804
|
-
|
4848
|
+
oTarget = _getDocument(),
|
4849
|
+
extraClass = _getSWFCSS(),
|
4850
|
+
isRTL = null,
|
4851
|
+
html = _doc.getElementsByTagName('html')[0],
|
4852
|
+
oEmbed, oMovie, tmp, movieHTML, oEl, s, x, sClass;
|
4805
4853
|
|
4806
4854
|
isRTL = (html && html.dir && html.dir.match(/rtl/i));
|
4807
4855
|
smID = (typeof smID === 'undefined'?_s.id:smID);
|
@@ -4980,12 +5028,24 @@ function SoundManager(smURL, smID) {
|
|
4980
5028
|
return false;
|
4981
5029
|
}
|
4982
5030
|
|
4983
|
-
// attempt to get, or create, movie
|
4984
|
-
// may already exist
|
5031
|
+
// attempt to get, or create, movie (may already exist)
|
4985
5032
|
if (_flash) {
|
4986
5033
|
return false;
|
4987
5034
|
}
|
4988
5035
|
|
5036
|
+
if (!_s.url) {
|
5037
|
+
|
5038
|
+
/**
|
5039
|
+
* Something isn't right - we've reached init, but the soundManager url property has not been set.
|
5040
|
+
* User has not called setup({url: ...}), or has not set soundManager.url (legacy use case) directly before init time.
|
5041
|
+
* Notify and exit. If user calls setup() with a url: property, init will be restarted as in the deferred loading case.
|
5042
|
+
*/
|
5043
|
+
|
5044
|
+
_wDS('noURL');
|
5045
|
+
return false;
|
5046
|
+
|
5047
|
+
}
|
5048
|
+
|
4989
5049
|
// inline markup case
|
4990
5050
|
_flash = _s.getMovie(_s.id);
|
4991
5051
|
|
@@ -5031,6 +5091,11 @@ function SoundManager(smURL, smID) {
|
|
5031
5091
|
var p,
|
5032
5092
|
loadIncomplete = false;
|
5033
5093
|
|
5094
|
+
if (!_s.url) {
|
5095
|
+
// No SWF url to load (noURL case) - exit for now. Will be retried when url is set.
|
5096
|
+
return false;
|
5097
|
+
}
|
5098
|
+
|
5034
5099
|
if (_waitingForEI) {
|
5035
5100
|
return false;
|
5036
5101
|
}
|
@@ -5054,7 +5119,7 @@ function SoundManager(smURL, smID) {
|
|
5054
5119
|
|
5055
5120
|
setTimeout(function() {
|
5056
5121
|
|
5057
|
-
p = _s.getMoviePercent();
|
5122
|
+
p = _s.getMoviePercent();
|
5058
5123
|
|
5059
5124
|
if (loadIncomplete) {
|
5060
5125
|
// special case: if movie *partially* loaded, retry until it's 100% before assuming failure.
|
@@ -5123,7 +5188,7 @@ function SoundManager(smURL, smID) {
|
|
5123
5188
|
|
5124
5189
|
_okToDisable = true;
|
5125
5190
|
_isFocused = true;
|
5126
|
-
|
5191
|
+
_wDS('gotFocus');
|
5127
5192
|
|
5128
5193
|
// allow init to restart
|
5129
5194
|
_waitingForEI = false;
|
@@ -5138,6 +5203,8 @@ function SoundManager(smURL, smID) {
|
|
5138
5203
|
|
5139
5204
|
_showSupport = function() {
|
5140
5205
|
|
5206
|
+
// <d>
|
5207
|
+
|
5141
5208
|
var item, tests = [];
|
5142
5209
|
|
5143
5210
|
if (_s.useHTML5Audio && _s.hasHTML5) {
|
@@ -5149,6 +5216,8 @@ function SoundManager(smURL, smID) {
|
|
5149
5216
|
_s._wD('-- SoundManager 2: HTML5 support tests ('+_s.html5Test+'): '+tests.join(', ')+' --',1);
|
5150
5217
|
}
|
5151
5218
|
|
5219
|
+
// </d>
|
5220
|
+
|
5152
5221
|
};
|
5153
5222
|
|
5154
5223
|
_initComplete = function(bNoDisable) {
|
@@ -5177,7 +5246,7 @@ function SoundManager(smURL, smID) {
|
|
5177
5246
|
}
|
5178
5247
|
}
|
5179
5248
|
|
5180
|
-
_s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'security/load error':'OK') + ') --', 1);
|
5249
|
+
_s._wD('-- SoundManager 2 ' + (_disabled?'failed to load':'loaded') + ' (' + (_disabled?'Flash security/load error':'OK') + ') --', 1);
|
5181
5250
|
|
5182
5251
|
if (_disabled || bNoDisable) {
|
5183
5252
|
if (_s.useFlashBlock && _s.oMC) {
|
@@ -5384,7 +5453,7 @@ function SoundManager(smURL, smID) {
|
|
5384
5453
|
_showSupport();
|
5385
5454
|
|
5386
5455
|
if (!_hasFlash && _needsFlash) {
|
5387
|
-
|
5456
|
+
_wDS('needFlash');
|
5388
5457
|
// TODO: Fatal here vs. timeout approach, etc.
|
5389
5458
|
// hack: fail sooner.
|
5390
5459
|
_s.setup({
|
@@ -5442,11 +5511,6 @@ function SoundManager(smURL, smID) {
|
|
5442
5511
|
|
5443
5512
|
}
|
5444
5513
|
|
5445
|
-
if (_doc.readyState === 'complete') {
|
5446
|
-
// DOMReady has already happened.
|
5447
|
-
setTimeout(_domContentLoaded,100);
|
5448
|
-
}
|
5449
|
-
|
5450
5514
|
} // SoundManager()
|
5451
5515
|
|
5452
5516
|
// SM2_DEFER details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soundmanager-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: SoundManager2 JavaScript Library for Rails >= 3.1
|
15
15
|
email:
|
@@ -61,3 +61,4 @@ signing_key:
|
|
61
61
|
specification_version: 3
|
62
62
|
summary: Wraps SoundManager2 by Scott Schiller in a gem for use with Ruby on Rails
|
63
63
|
test_files: []
|
64
|
+
has_rdoc:
|