soundmanager2-rails 2.97.20140901 → 2.97.20150601
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.
- checksums.yaml +4 -4
- data/README.md +2 -6
- data/VERSION +1 -1
- data/soundmanager2-rails.gemspec +4 -4
- data/vendor/assets/javascripts/soundmanager2-jsmin.js +101 -100
- data/vendor/assets/javascripts/soundmanager2-nodebug-jsmin.js +72 -72
- data/vendor/assets/javascripts/soundmanager2-nodebug.js +172 -100
- data/vendor/assets/javascripts/soundmanager2.js +480 -227
- data/vendor/assets/javascripts/soundmanager2.swf +0 -0
- data/vendor/assets/javascripts/soundmanager2_debug.swf +0 -0
- data/vendor/assets/javascripts/soundmanager2_flash9.swf +0 -0
- data/vendor/assets/javascripts/soundmanager2_flash9_debug.swf +0 -0
- metadata +3 -3
@@ -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.20150601
|
12
12
|
*/
|
13
13
|
|
14
14
|
/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio, opera, module, define */
|
@@ -38,6 +38,8 @@ function SoundManager(smURL, smID) {
|
|
38
38
|
'allowScriptAccess': 'always',
|
39
39
|
'useFlashBlock': false,
|
40
40
|
'useHTML5Audio': true,
|
41
|
+
'forceUseGlobalHTML5Audio': false,
|
42
|
+
'ignoreMobileRestrictions': false,
|
41
43
|
'html5Test': /^(probably|maybe)$/i,
|
42
44
|
'preferFlash': false,
|
43
45
|
'noSWFCache': false,
|
@@ -110,7 +112,7 @@ function SoundManager(smURL, smID) {
|
|
110
112
|
this.id = (smID || 'sm2movie');
|
111
113
|
this.debugID = 'soundmanager-debug';
|
112
114
|
this.debugURLParam = /([#?&])debug=1/i;
|
113
|
-
this.versionNumber = 'V2.97a.
|
115
|
+
this.versionNumber = 'V2.97a.20150601';
|
114
116
|
this.version = null;
|
115
117
|
this.movieURL = null;
|
116
118
|
this.altURL = null;
|
@@ -142,15 +144,22 @@ function SoundManager(smURL, smID) {
|
|
142
144
|
this.html5Only = false;
|
143
145
|
this.ignoreFlash = false;
|
144
146
|
var SMSound,
|
145
|
-
sm2 = this, globalHTML5Audio = null, flash = null, sm = 'soundManager', smc = sm + ': ', h5 = 'HTML5::', id, ua = navigator.userAgent, wl = window.location.href.toString(), doc = document, doNothing, setProperties, init, fV, on_queue = [], debugOpen = true, debugTS, didAppend = false, appendSuccess = false, didInit = false, disabled = false, windowLoaded = false, _wDS, wdCount = 0, initComplete, mixin, assign, extraOptions, addOnEvent, processOnEvents, initUserOnload, delayWaitForEI, waitForEI, rebootIntoHTML5, setVersionInfo, handleFocus, strings, initMovie,
|
146
|
-
canIgnoreFlash, needsFlash = null, featureCheck, html5OK, html5CanPlay, html5Ext, html5Unload, domContentLoadedIE, testHTML5, event, slice = Array.prototype.slice, useGlobalHTML5Audio = false, lastGlobalHTML5URL, hasFlash, detectFlash, badSafariFix, html5_events, showSupport, flushMessages, wrapCallback, idCounter = 0,
|
147
|
-
is_iDevice = ua.match(/(ipad|iphone|ipod)/i), isAndroid = ua.match(/android/i), isIE = ua.match(/msie/i),
|
147
|
+
sm2 = this, globalHTML5Audio = null, flash = null, sm = 'soundManager', smc = sm + ': ', h5 = 'HTML5::', id, ua = navigator.userAgent, wl = window.location.href.toString(), doc = document, doNothing, setProperties, init, fV, on_queue = [], debugOpen = true, debugTS, didAppend = false, appendSuccess = false, didInit = false, disabled = false, windowLoaded = false, _wDS, wdCount = 0, initComplete, mixin, assign, extraOptions, addOnEvent, processOnEvents, initUserOnload, delayWaitForEI, waitForEI, rebootIntoHTML5, setVersionInfo, handleFocus, strings, initMovie, domContentLoaded, winOnLoad, didDCLoaded, getDocument, createMovie, catchError, setPolling, initDebug, debugLevels = ['log', 'info', 'warn', 'error'], defaultFlashVersion = 8, disableObject, failSafely, normalizeMovieURL, oRemoved = null, oRemovedHTML = null, str, flashBlockHandler, getSWFCSS, swfCSS, toggleDebug, loopFix, policyFix, complain, idCheck, waitingForEI = false, initPending = false, startTimer, stopTimer, timerExecute, h5TimerCount = 0, h5IntervalTimer = null, parseURL, messages = [],
|
148
|
+
canIgnoreFlash, needsFlash = null, featureCheck, html5OK, html5CanPlay, html5Ext, html5Unload, domContentLoadedIE, testHTML5, event, slice = Array.prototype.slice, useGlobalHTML5Audio = false, lastGlobalHTML5URL, hasFlash, detectFlash, badSafariFix, html5_events, showSupport, flushMessages, wrapCallback, idCounter = 0, didSetup, msecScale = 1000,
|
149
|
+
is_iDevice = ua.match(/(ipad|iphone|ipod)/i), isAndroid = ua.match(/android/i), isIE = ua.match(/msie/i),
|
150
|
+
isWebkit = ua.match(/webkit/i),
|
151
|
+
isSafari = (ua.match(/safari/i) && !ua.match(/chrome/i)),
|
152
|
+
isOpera = (ua.match(/opera/i)),
|
148
153
|
mobileHTML5 = (ua.match(/(mobile|pre\/|xoom)/i) || is_iDevice || isAndroid),
|
149
154
|
isBadSafari = (!wl.match(/usehtml5audio/i) && !wl.match(/sm2\-ignorebadua/i) && isSafari && !ua.match(/silk/i) && ua.match(/OS X 10_6_([3-7])/i)),
|
150
|
-
hasConsole = (window.console !== _undefined && console.log !== _undefined),
|
155
|
+
hasConsole = (window.console !== _undefined && console.log !== _undefined),
|
156
|
+
isFocused = (doc.hasFocus !== _undefined ? doc.hasFocus() : null),
|
157
|
+
tryInitOnFocus = (isSafari && (doc.hasFocus === _undefined || !doc.hasFocus())),
|
158
|
+
okToDisable = !tryInitOnFocus,
|
159
|
+
flashMIME = /(mp3|mp4|mpa|m4a|m4b)/i,
|
151
160
|
emptyURL = 'about:blank',
|
152
161
|
emptyWAV = 'data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w==',
|
153
|
-
overHTTP = (doc.location?doc.location.protocol.match(/http/i):null),
|
162
|
+
overHTTP = (doc.location ? doc.location.protocol.match(/http/i) : null),
|
154
163
|
http = (!overHTTP ? 'http:/'+'/' : ''),
|
155
164
|
netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,
|
156
165
|
netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'm4b', 'mp4v', '3gp', '3g2'],
|
@@ -180,6 +189,32 @@ function SoundManager(smURL, smID) {
|
|
180
189
|
if (options !== _undefined && didInit && needsFlash && sm2.ok() && (options.flashVersion !== _undefined || options.url !== _undefined || options.html5Test !== _undefined)) {
|
181
190
|
}
|
182
191
|
assign(options);
|
192
|
+
if (!useGlobalHTML5Audio) {
|
193
|
+
if (mobileHTML5) {
|
194
|
+
if (!sm2.setupOptions.ignoreMobileRestrictions || sm2.setupOptions.forceUseGlobalHTML5Audio) {
|
195
|
+
messages.push(strings.globalHTML5);
|
196
|
+
useGlobalHTML5Audio = true;
|
197
|
+
}
|
198
|
+
} else {
|
199
|
+
if (sm2.setupOptions.forceUseGlobalHTML5Audio) {
|
200
|
+
messages.push(strings.globalHTML5);
|
201
|
+
useGlobalHTML5Audio = true;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
if (!didSetup && mobileHTML5) {
|
206
|
+
if (sm2.setupOptions.ignoreMobileRestrictions) {
|
207
|
+
messages.push(strings.ignoreMobile);
|
208
|
+
} else {
|
209
|
+
sm2.setupOptions.useHTML5Audio = true;
|
210
|
+
sm2.setupOptions.preferFlash = false;
|
211
|
+
if (is_iDevice) {
|
212
|
+
sm2.ignoreFlash = true;
|
213
|
+
} else if ((isAndroid && !ua.match(/android\s2\.3/i)) || !isAndroid) {
|
214
|
+
useGlobalHTML5Audio = true;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
183
218
|
if (options) {
|
184
219
|
if (noURL && didDCLoaded && options.url !== _undefined) {
|
185
220
|
sm2.beginDelayedInit();
|
@@ -188,6 +223,7 @@ function SoundManager(smURL, smID) {
|
|
188
223
|
setTimeout(domContentLoaded, 1);
|
189
224
|
}
|
190
225
|
}
|
226
|
+
didSetup = true;
|
191
227
|
return sm2;
|
192
228
|
};
|
193
229
|
this.ok = function() {
|
@@ -210,7 +246,7 @@ function SoundManager(smURL, smID) {
|
|
210
246
|
}
|
211
247
|
options = mixin(oOptions);
|
212
248
|
options.url = parseURL(options.url);
|
213
|
-
if (options.id ===
|
249
|
+
if (options.id === _undefined) {
|
214
250
|
options.id = sm2.setupOptions.idPrefix + (idCounter++);
|
215
251
|
}
|
216
252
|
if (idCheck(options.id, true)) {
|
@@ -240,9 +276,9 @@ function SoundManager(smURL, smID) {
|
|
240
276
|
options = policyFix(options, cs);
|
241
277
|
oSound = make();
|
242
278
|
if (fV === 8) {
|
243
|
-
flash._createSound(options.id, options.loops||1, options.usePolicyFile);
|
279
|
+
flash._createSound(options.id, options.loops || 1, options.usePolicyFile);
|
244
280
|
} else {
|
245
|
-
flash._createSound(options.id, options.url, options.usePeakData, options.useWaveformData, options.useEQData, options.isMovieStar, (options.isMovieStar?options.bufferTime:false), options.loops||1, options.serverURL, options.duration||null, options.autoPlay, true, options.autoLoad, options.usePolicyFile);
|
281
|
+
flash._createSound(options.id, options.url, options.usePeakData, options.useWaveformData, options.useEQData, options.isMovieStar, (options.isMovieStar ? options.bufferTime : false), options.loops || 1, options.serverURL, options.duration || null, options.autoPlay, true, options.autoLoad, options.usePolicyFile);
|
246
282
|
if (!options.serverURL) {
|
247
283
|
oSound.connected = true;
|
248
284
|
if (options.onconnect) {
|
@@ -264,8 +300,8 @@ function SoundManager(smURL, smID) {
|
|
264
300
|
return false;
|
265
301
|
}
|
266
302
|
var oS = sm2.sounds[sID], i;
|
267
|
-
oS._iO = {};
|
268
303
|
oS.stop();
|
304
|
+
oS._iO = {};
|
269
305
|
oS.unload();
|
270
306
|
for (i = 0; i < sm2.soundIDs.length; i++) {
|
271
307
|
if (sm2.soundIDs[i] === sID) {
|
@@ -363,7 +399,7 @@ function SoundManager(smURL, smID) {
|
|
363
399
|
};
|
364
400
|
this.pauseAll = function() {
|
365
401
|
var i;
|
366
|
-
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
402
|
+
for (i = sm2.soundIDs.length - 1; i >= 0; i--) {
|
367
403
|
sm2.sounds[sm2.soundIDs[i]].pause();
|
368
404
|
}
|
369
405
|
};
|
@@ -375,7 +411,7 @@ function SoundManager(smURL, smID) {
|
|
375
411
|
};
|
376
412
|
this.resumeAll = function() {
|
377
413
|
var i;
|
378
|
-
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
414
|
+
for (i = sm2.soundIDs.length- 1 ; i >= 0; i--) {
|
379
415
|
sm2.sounds[sm2.soundIDs[i]].resume();
|
380
416
|
}
|
381
417
|
};
|
@@ -392,6 +428,13 @@ function SoundManager(smURL, smID) {
|
|
392
428
|
return sm2.sounds[sID].setPan(nPan);
|
393
429
|
};
|
394
430
|
this.setVolume = function(sID, nVol) {
|
431
|
+
var i, j;
|
432
|
+
if (sID !== _undefined && !isNaN(sID) && nVol === _undefined) {
|
433
|
+
for (i = 0, j = sm2.soundIDs.length; i < j; i++) {
|
434
|
+
sm2.sounds[sm2.soundIDs[i]].setVolume(sID);
|
435
|
+
}
|
436
|
+
return;
|
437
|
+
}
|
395
438
|
if (!idCheck(sID)) {
|
396
439
|
return false;
|
397
440
|
}
|
@@ -403,7 +446,7 @@ function SoundManager(smURL, smID) {
|
|
403
446
|
sID = null;
|
404
447
|
}
|
405
448
|
if (!sID) {
|
406
|
-
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
449
|
+
for (i = sm2.soundIDs.length - 1; i >= 0; i--) {
|
407
450
|
sm2.sounds[sm2.soundIDs[i]].mute();
|
408
451
|
}
|
409
452
|
sm2.muted = true;
|
@@ -424,7 +467,7 @@ function SoundManager(smURL, smID) {
|
|
424
467
|
sID = null;
|
425
468
|
}
|
426
469
|
if (!sID) {
|
427
|
-
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
470
|
+
for (i = sm2.soundIDs.length - 1; i >= 0; i--) {
|
428
471
|
sm2.sounds[sm2.soundIDs[i]].unmute();
|
429
472
|
}
|
430
473
|
sm2.muted = false;
|
@@ -461,7 +504,7 @@ function SoundManager(smURL, smID) {
|
|
461
504
|
return false;
|
462
505
|
}
|
463
506
|
disabled = true;
|
464
|
-
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
507
|
+
for (i = sm2.soundIDs.length - 1; i >= 0; i--) {
|
465
508
|
disableObject(sm2.sounds[sm2.soundIDs[i]]);
|
466
509
|
}
|
467
510
|
initComplete(bNoDisable);
|
@@ -471,7 +514,9 @@ function SoundManager(smURL, smID) {
|
|
471
514
|
this.canPlayMIME = function(sMIME) {
|
472
515
|
var result;
|
473
516
|
if (sm2.hasHTML5) {
|
474
|
-
result = html5CanPlay({
|
517
|
+
result = html5CanPlay({
|
518
|
+
type: sMIME
|
519
|
+
});
|
475
520
|
}
|
476
521
|
if (!result && needsFlash) {
|
477
522
|
result = (sMIME && sm2.ok() ? !!((fV > 8 ? sMIME.match(netStreamMimeTypes) : null) || sMIME.match(sm2.mimePattern)) : null);
|
@@ -481,7 +526,9 @@ function SoundManager(smURL, smID) {
|
|
481
526
|
this.canPlayURL = function(sURL) {
|
482
527
|
var result;
|
483
528
|
if (sm2.hasHTML5) {
|
484
|
-
result = html5CanPlay({
|
529
|
+
result = html5CanPlay({
|
530
|
+
url: sURL
|
531
|
+
});
|
485
532
|
}
|
486
533
|
if (!result && needsFlash) {
|
487
534
|
result = (sURL && sm2.ok() ? !!(sURL.match(sm2.filePattern)) : null);
|
@@ -541,7 +588,7 @@ function SoundManager(smURL, smID) {
|
|
541
588
|
};
|
542
589
|
this.reboot = function(resetEvents, excludeInit) {
|
543
590
|
var i, j, k;
|
544
|
-
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
591
|
+
for (i = sm2.soundIDs.length- 1 ; i >= 0; i--) {
|
545
592
|
sm2.sounds[sm2.soundIDs[i]].destruct();
|
546
593
|
}
|
547
594
|
if (flash) {
|
@@ -558,6 +605,7 @@ function SoundManager(smURL, smID) {
|
|
558
605
|
sm2.soundIDs = [];
|
559
606
|
sm2.sounds = {};
|
560
607
|
idCounter = 0;
|
608
|
+
didSetup = false;
|
561
609
|
if (!resetEvents) {
|
562
610
|
for (i in on_queue) {
|
563
611
|
if (on_queue.hasOwnProperty(i)) {
|
@@ -576,7 +624,6 @@ function SoundManager(smURL, smID) {
|
|
576
624
|
sm2.html5Only = false;
|
577
625
|
sm2.ignoreFlash = false;
|
578
626
|
window.setTimeout(function() {
|
579
|
-
preInit();
|
580
627
|
if (!excludeInit) {
|
581
628
|
sm2.beginDelayedInit();
|
582
629
|
}
|
@@ -689,10 +736,13 @@ function SoundManager(smURL, smID) {
|
|
689
736
|
if (fV === 8) {
|
690
737
|
flash._load(s.id, instanceOptions.url, instanceOptions.stream, instanceOptions.autoPlay, instanceOptions.usePolicyFile);
|
691
738
|
} else {
|
692
|
-
flash._load(s.id, instanceOptions.url, !!(instanceOptions.stream), !!(instanceOptions.autoPlay), instanceOptions.loops||1, !!(instanceOptions.autoLoad), instanceOptions.usePolicyFile);
|
739
|
+
flash._load(s.id, instanceOptions.url, !!(instanceOptions.stream), !!(instanceOptions.autoPlay), instanceOptions.loops || 1, !!(instanceOptions.autoLoad), instanceOptions.usePolicyFile);
|
693
740
|
}
|
694
741
|
} catch(e) {
|
695
|
-
catchError({
|
742
|
+
catchError({
|
743
|
+
type: 'SMSOUND_LOAD_JS_EXCEPTION',
|
744
|
+
fatal: true
|
745
|
+
});
|
696
746
|
}
|
697
747
|
}
|
698
748
|
s.url = instanceOptions.url;
|
@@ -879,7 +929,7 @@ function SoundManager(smURL, smID) {
|
|
879
929
|
audioClone.play();
|
880
930
|
};
|
881
931
|
event.add(audioClone, 'ended', onended);
|
882
|
-
if (s._iO.volume !==
|
932
|
+
if (s._iO.volume !== _undefined) {
|
883
933
|
audioClone.volume = Math.max(0, Math.min(1, s._iO.volume/100));
|
884
934
|
}
|
885
935
|
if (s.muted) {
|
@@ -1064,7 +1114,7 @@ function SoundManager(smURL, smID) {
|
|
1064
1114
|
_bInstanceOnly = false;
|
1065
1115
|
}
|
1066
1116
|
if (!s.isHTML5) {
|
1067
|
-
flash._setVolume(s.id, (sm2.muted && !s.muted) || s.muted?0:nVol);
|
1117
|
+
flash._setVolume(s.id, (sm2.muted && !s.muted) || s.muted ? 0 : nVol);
|
1068
1118
|
} else if (s._a) {
|
1069
1119
|
if (sm2.muted && !s.muted) {
|
1070
1120
|
s.muted = true;
|
@@ -1092,14 +1142,14 @@ function SoundManager(smURL, smID) {
|
|
1092
1142
|
s.muted = false;
|
1093
1143
|
var hasIO = (s._iO.volume !== _undefined);
|
1094
1144
|
if (!s.isHTML5) {
|
1095
|
-
flash._setVolume(s.id, hasIO?s._iO.volume:s.options.volume);
|
1145
|
+
flash._setVolume(s.id, hasIO ? s._iO.volume : s.options.volume);
|
1096
1146
|
} else if (s._a) {
|
1097
1147
|
s._a.muted = false;
|
1098
1148
|
}
|
1099
1149
|
return s;
|
1100
1150
|
};
|
1101
1151
|
this.toggleMute = function() {
|
1102
|
-
return (s.muted?s.unmute():s.mute());
|
1152
|
+
return (s.muted ? s.unmute() : s.mute());
|
1103
1153
|
};
|
1104
1154
|
this.onPosition = function(nPosition, oMethod, oScope) {
|
1105
1155
|
onPositionItems.push({
|
@@ -1133,13 +1183,13 @@ function SoundManager(smURL, smID) {
|
|
1133
1183
|
if (!j || !s.playState || onPositionFired >= j) {
|
1134
1184
|
return false;
|
1135
1185
|
}
|
1136
|
-
for (i=j-1; i >= 0; i--) {
|
1186
|
+
for (i = j - 1; i >= 0; i--) {
|
1137
1187
|
item = onPositionItems[i];
|
1138
1188
|
if (!item.fired && s.position >= item.position) {
|
1139
1189
|
item.fired = true;
|
1140
1190
|
onPositionFired++;
|
1141
1191
|
item.method.apply(item.scope, [item.position]);
|
1142
|
-
|
1192
|
+
j = onPositionItems.length;
|
1143
1193
|
}
|
1144
1194
|
}
|
1145
1195
|
return true;
|
@@ -1149,7 +1199,7 @@ function SoundManager(smURL, smID) {
|
|
1149
1199
|
if (!j) {
|
1150
1200
|
return false;
|
1151
1201
|
}
|
1152
|
-
for (i=j-1; i >= 0; i--) {
|
1202
|
+
for (i = j - 1; i >= 0; i--) {
|
1153
1203
|
item = onPositionItems[i];
|
1154
1204
|
if (item.fired && nPosition <= item.position) {
|
1155
1205
|
item.fired = false;
|
@@ -1267,7 +1317,7 @@ function SoundManager(smURL, smID) {
|
|
1267
1317
|
isNew = true;
|
1268
1318
|
}
|
1269
1319
|
if (isNew || bForce) {
|
1270
|
-
s._whileplaying(time,x,x,x,x);
|
1320
|
+
s._whileplaying(time, x, x, x, x);
|
1271
1321
|
}
|
1272
1322
|
}
|
1273
1323
|
return isNew;
|
@@ -1275,7 +1325,7 @@ function SoundManager(smURL, smID) {
|
|
1275
1325
|
};
|
1276
1326
|
this._get_html5_duration = function() {
|
1277
1327
|
var instanceOptions = s._iO,
|
1278
|
-
d = (s._a && s._a.duration ? s._a.duration*msecScale : (instanceOptions && instanceOptions.duration ? instanceOptions.duration : null)),
|
1328
|
+
d = (s._a && s._a.duration ? s._a.duration * msecScale : (instanceOptions && instanceOptions.duration ? instanceOptions.duration : null)),
|
1279
1329
|
result = (d && !isNaN(d) && d !== Infinity ? d : null);
|
1280
1330
|
return result;
|
1281
1331
|
};
|
@@ -1347,7 +1397,7 @@ function SoundManager(smURL, smID) {
|
|
1347
1397
|
}
|
1348
1398
|
var f;
|
1349
1399
|
function add(oEvt, oFn, bCapture) {
|
1350
|
-
return s._a ? s._a.addEventListener(oEvt, oFn, bCapture||false) : null;
|
1400
|
+
return s._a ? s._a.addEventListener(oEvt, oFn, bCapture || false) : null;
|
1351
1401
|
}
|
1352
1402
|
s._a._added_events = true;
|
1353
1403
|
for (f in html5_events) {
|
@@ -1360,7 +1410,7 @@ function SoundManager(smURL, smID) {
|
|
1360
1410
|
remove_html5_events = function() {
|
1361
1411
|
var f;
|
1362
1412
|
function remove(oEvt, oFn, bCapture) {
|
1363
|
-
return (s._a ? s._a.removeEventListener(oEvt, oFn, bCapture||false) : null);
|
1413
|
+
return (s._a ? s._a.removeEventListener(oEvt, oFn, bCapture || false) : null);
|
1364
1414
|
}
|
1365
1415
|
s._a._added_events = false;
|
1366
1416
|
for (f in html5_events) {
|
@@ -1373,7 +1423,7 @@ function SoundManager(smURL, smID) {
|
|
1373
1423
|
var fN,
|
1374
1424
|
loadOK = !!nSuccess || (!s.isHTML5 && fV === 8 && s.duration);
|
1375
1425
|
s.loaded = loadOK;
|
1376
|
-
s.readyState = loadOK?3:2;
|
1426
|
+
s.readyState = (loadOK ? 3 : 2);
|
1377
1427
|
s._onbufferchange(0);
|
1378
1428
|
if (s._iO.onload) {
|
1379
1429
|
wrapCallback(s, function() {
|
@@ -1519,7 +1569,6 @@ function SoundManager(smURL, smID) {
|
|
1519
1569
|
oData[oMDProps[i]] = oMDData[i];
|
1520
1570
|
}
|
1521
1571
|
s.metadata = oData;
|
1522
|
-
console.log('updated metadata', s.metadata);
|
1523
1572
|
if (s._iO.onmetadata) {
|
1524
1573
|
s._iO.onmetadata.call(s, s.metadata);
|
1525
1574
|
}
|
@@ -1611,7 +1660,7 @@ console.log('updated metadata', s.metadata);
|
|
1611
1660
|
result = false;
|
1612
1661
|
} else {
|
1613
1662
|
if (sm2[i] instanceof Function) {
|
1614
|
-
sm2[i].apply(sm2, (o[i] instanceof Array? o[i] : [o[i]]));
|
1663
|
+
sm2[i].apply(sm2, (o[i] instanceof Array ? o[i] : [o[i]]));
|
1615
1664
|
} else {
|
1616
1665
|
sm2[i] = o[i];
|
1617
1666
|
}
|
@@ -1633,8 +1682,8 @@ console.log('updated metadata', s.metadata);
|
|
1633
1682
|
event = (function() {
|
1634
1683
|
var old = (window.attachEvent),
|
1635
1684
|
evt = {
|
1636
|
-
add: (old?'attachEvent':'addEventListener'),
|
1637
|
-
remove: (old?'detachEvent':'removeEventListener')
|
1685
|
+
add: (old ? 'attachEvent' : 'addEventListener'),
|
1686
|
+
remove: (old ? 'detachEvent' : 'removeEventListener')
|
1638
1687
|
};
|
1639
1688
|
function getArgs(oArgs) {
|
1640
1689
|
var args = slice.call(oArgs),
|
@@ -1748,18 +1797,18 @@ console.log('updated metadata', s.metadata);
|
|
1748
1797
|
i, j, progStr, buffered = 0,
|
1749
1798
|
isProgress = (e.type === 'progress'),
|
1750
1799
|
ranges = e.target.buffered,
|
1751
|
-
loaded = (e.loaded||0),
|
1752
|
-
total = (e.total||1);
|
1800
|
+
loaded = (e.loaded || 0),
|
1801
|
+
total = (e.total || 1);
|
1753
1802
|
s.buffered = [];
|
1754
1803
|
if (ranges && ranges.length) {
|
1755
|
-
for (i=0, j=ranges.length; i<j; i++) {
|
1804
|
+
for (i = 0, j = ranges.length; i < j; i++) {
|
1756
1805
|
s.buffered.push({
|
1757
1806
|
'start': ranges.start(i) * msecScale,
|
1758
1807
|
'end': ranges.end(i) * msecScale
|
1759
1808
|
});
|
1760
1809
|
}
|
1761
1810
|
buffered = (ranges.end(0) - ranges.start(0)) * msecScale;
|
1762
|
-
loaded = Math.min(1, buffered/(e.target.duration*msecScale));
|
1811
|
+
loaded = Math.min(1, buffered / (e.target.duration * msecScale));
|
1763
1812
|
}
|
1764
1813
|
if (!isNaN(loaded)) {
|
1765
1814
|
s._whileloading(loaded, total, s._get_html5_duration());
|
@@ -1801,7 +1850,7 @@ console.log('updated metadata', s.metadata);
|
|
1801
1850
|
if (oAudio) {
|
1802
1851
|
url = (isSafari ? emptyURL : (sm2.html5.canPlayType('audio/wav') ? emptyWAV : emptyURL));
|
1803
1852
|
oAudio.src = url;
|
1804
|
-
if (oAudio._called_unload !==
|
1853
|
+
if (oAudio._called_unload !== _undefined) {
|
1805
1854
|
oAudio._called_load = false;
|
1806
1855
|
}
|
1807
1856
|
}
|
@@ -1842,7 +1891,7 @@ console.log('updated metadata', s.metadata);
|
|
1842
1891
|
result = false;
|
1843
1892
|
} else {
|
1844
1893
|
offset = mime.indexOf(';');
|
1845
|
-
fileExt = (offset !== -1?mime.substr(0,offset):mime).substr(6);
|
1894
|
+
fileExt = (offset !== -1 ? mime.substr(0,offset) : mime).substr(6);
|
1846
1895
|
}
|
1847
1896
|
} else {
|
1848
1897
|
fileExt = fileExt[1];
|
@@ -1850,7 +1899,7 @@ console.log('updated metadata', s.metadata);
|
|
1850
1899
|
if (fileExt && sm2.html5[fileExt] !== _undefined) {
|
1851
1900
|
result = (sm2.html5[fileExt] && !preferFlashCheck(fileExt));
|
1852
1901
|
} else {
|
1853
|
-
mime = 'audio/'+fileExt;
|
1902
|
+
mime = 'audio/' + fileExt;
|
1854
1903
|
result = sm2.html5.canPlayType({type:mime});
|
1855
1904
|
sm2.html5[fileExt] = result;
|
1856
1905
|
result = (result && sm2.html5[mime] && !preferFlashCheck(mime));
|
@@ -1873,7 +1922,7 @@ console.log('updated metadata', s.metadata);
|
|
1873
1922
|
return result;
|
1874
1923
|
}
|
1875
1924
|
if (m instanceof Array) {
|
1876
|
-
for (i=0, j=m.length; i<j; i++) {
|
1925
|
+
for (i = 0, j = m.length; i < j; i++) {
|
1877
1926
|
if (sm2.html5[m[i]] || a.canPlayType(m[i]).match(sm2.html5Test)) {
|
1878
1927
|
isOK = true;
|
1879
1928
|
sm2.html5[m[i]] = true;
|
@@ -1901,15 +1950,15 @@ console.log('updated metadata', s.metadata);
|
|
1901
1950
|
sm2.flash[lookup] = false;
|
1902
1951
|
}
|
1903
1952
|
if (aF[item] && aF[item].related) {
|
1904
|
-
for (i=aF[item].related.length-1; i >= 0; i--) {
|
1905
|
-
support['audio/'+aF[item].related[i]] = support[item];
|
1953
|
+
for (i = aF[item].related.length - 1; i >= 0; i--) {
|
1954
|
+
support['audio/' + aF[item].related[i]] = support[item];
|
1906
1955
|
sm2.html5[aF[item].related[i]] = support[item];
|
1907
1956
|
sm2.flash[aF[item].related[i]] = support[item];
|
1908
1957
|
}
|
1909
1958
|
}
|
1910
1959
|
}
|
1911
1960
|
}
|
1912
|
-
support.canPlayType = (a?cp:null);
|
1961
|
+
support.canPlayType = (a ? cp : null);
|
1913
1962
|
sm2.html5 = mixin(sm2.html5, support);
|
1914
1963
|
sm2.html5.usingFlash = featureCheck();
|
1915
1964
|
needsFlash = sm2.html5.usingFlash;
|
@@ -1976,11 +2025,11 @@ console.log('updated metadata', s.metadata);
|
|
1976
2025
|
if (fV !== 8 && fV !== 9) {
|
1977
2026
|
sm2.flashVersion = fV = defaultFlashVersion;
|
1978
2027
|
}
|
1979
|
-
var isDebug = (sm2.debugMode || sm2.debugFlash?'_debug.swf':'.swf');
|
2028
|
+
var isDebug = (sm2.debugMode || sm2.debugFlash ? '_debug.swf' : '.swf');
|
1980
2029
|
if (sm2.useHTML5Audio && !sm2.html5Only && sm2.audioFormats.mp4.required && fV < 9) {
|
1981
2030
|
sm2.flashVersion = fV = 9;
|
1982
2031
|
}
|
1983
|
-
sm2.version = sm2.versionNumber + (sm2.html5Only?' (HTML5-only mode)':(fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)'));
|
2032
|
+
sm2.version = sm2.versionNumber + (sm2.html5Only ? ' (HTML5-only mode)' : (fV === 9 ? ' (AS3/Flash 9)' : ' (AS2/Flash 8)'));
|
1984
2033
|
if (fV > 8) {
|
1985
2034
|
sm2.defaultOptions = mixin(sm2.defaultOptions, sm2.flash9Options);
|
1986
2035
|
sm2.features.buffering = true;
|
@@ -1990,8 +2039,8 @@ console.log('updated metadata', s.metadata);
|
|
1990
2039
|
} else {
|
1991
2040
|
sm2.features.movieStar = false;
|
1992
2041
|
}
|
1993
|
-
sm2.filePattern = sm2.filePatterns[(fV !== 8?'flash9':'flash8')];
|
1994
|
-
sm2.movieURL = (fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf', isDebug);
|
2042
|
+
sm2.filePattern = sm2.filePatterns[(fV !== 8 ? 'flash9' : 'flash8')];
|
2043
|
+
sm2.movieURL = (fV === 8 ? 'soundmanager2.swf' : 'soundmanager2_flash9.swf').replace('.swf', isDebug);
|
1995
2044
|
sm2.features.peakData = sm2.features.waveformData = sm2.features.eqData = (fV > 8);
|
1996
2045
|
};
|
1997
2046
|
setPolling = function(bPolling, bHighPerformance) {
|
@@ -2020,20 +2069,26 @@ console.log('updated metadata', s.metadata);
|
|
2020
2069
|
var name = str('fbHandler'),
|
2021
2070
|
p = sm2.getMoviePercent(),
|
2022
2071
|
css = swfCSS,
|
2023
|
-
error = {
|
2072
|
+
error = {
|
2073
|
+
type:'FLASHBLOCK'
|
2074
|
+
};
|
2024
2075
|
if (sm2.html5Only) {
|
2025
2076
|
return false;
|
2026
2077
|
}
|
2027
2078
|
if (!sm2.ok()) {
|
2028
2079
|
if (needsFlash) {
|
2029
|
-
sm2.oMC.className = getSWFCSS() + ' ' + css.swfDefault + ' ' + (p === null?css.swfTimedout:css.swfError);
|
2080
|
+
sm2.oMC.className = getSWFCSS() + ' ' + css.swfDefault + ' ' + (p === null ? css.swfTimedout : css.swfError);
|
2030
2081
|
}
|
2031
2082
|
sm2.didFlashBlock = true;
|
2032
|
-
processOnEvents({
|
2083
|
+
processOnEvents({
|
2084
|
+
type: 'ontimeout',
|
2085
|
+
ignoreInit: true,
|
2086
|
+
error: error
|
2087
|
+
});
|
2033
2088
|
catchError(error);
|
2034
2089
|
} else {
|
2035
2090
|
if (sm2.oMC) {
|
2036
|
-
sm2.oMC.className = [getSWFCSS(), css.swfDefault, css.swfLoaded + (sm2.didFlashBlock?' '+css.swfUnblocked:'')].join(' ');
|
2091
|
+
sm2.oMC.className = [getSWFCSS(), css.swfDefault, css.swfLoaded + (sm2.didFlashBlock ? ' ' + css.swfUnblocked : '')].join(' ');
|
2037
2092
|
}
|
2038
2093
|
}
|
2039
2094
|
};
|
@@ -2060,9 +2115,9 @@ console.log('updated metadata', s.metadata);
|
|
2060
2115
|
return false;
|
2061
2116
|
}
|
2062
2117
|
var status = {
|
2063
|
-
success: (oOptions && oOptions.ignoreInit?sm2.ok()
|
2118
|
+
success: (oOptions && oOptions.ignoreInit ? sm2.ok() : !disabled)
|
2064
2119
|
},
|
2065
|
-
srcQueue = (oOptions && oOptions.type?on_queue[oOptions.type]||[]:[]),
|
2120
|
+
srcQueue = (oOptions && oOptions.type ? on_queue[oOptions.type] || [] : []),
|
2066
2121
|
queue = [], i, j,
|
2067
2122
|
args = [status],
|
2068
2123
|
canRetry = (needsFlash && !sm2.ok());
|
@@ -2100,7 +2155,7 @@ console.log('updated metadata', s.metadata);
|
|
2100
2155
|
if (sm2.waitForWindowLoad) {
|
2101
2156
|
event.add(window, 'load', initUserOnload);
|
2102
2157
|
}
|
2103
|
-
},1);
|
2158
|
+
}, 1);
|
2104
2159
|
};
|
2105
2160
|
detectFlash = function() {
|
2106
2161
|
if (hasFlash !== _undefined) {
|
@@ -2168,7 +2223,7 @@ featureCheck = function() {
|
|
2168
2223
|
parseURL = function(url) {
|
2169
2224
|
var i, j, urlResult = 0, result;
|
2170
2225
|
if (url instanceof Array) {
|
2171
|
-
for (i=0, j=url.length; i<j; i++) {
|
2226
|
+
for (i = 0, j = url.length; i < j; i++) {
|
2172
2227
|
if (url[i] instanceof Object) {
|
2173
2228
|
if (sm2.canPlayMIME(url[i].type)) {
|
2174
2229
|
urlResult = i;
|
@@ -2214,7 +2269,7 @@ featureCheck = function() {
|
|
2214
2269
|
h5IntervalTimer = null;
|
2215
2270
|
return false;
|
2216
2271
|
}
|
2217
|
-
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
2272
|
+
for (i = sm2.soundIDs.length - 1; i >= 0; i--) {
|
2218
2273
|
if (sm2.sounds[sm2.soundIDs[i]].isHTML5 && sm2.sounds[sm2.soundIDs[i]]._hasTimer) {
|
2219
2274
|
sm2.sounds[sm2.soundIDs[i]]._onTimer();
|
2220
2275
|
}
|
@@ -2223,7 +2278,9 @@ featureCheck = function() {
|
|
2223
2278
|
catchError = function(options) {
|
2224
2279
|
options = (options !== _undefined ? options : {});
|
2225
2280
|
if (typeof sm2.onerror === 'function') {
|
2226
|
-
sm2.onerror.apply(window, [{
|
2281
|
+
sm2.onerror.apply(window, [{
|
2282
|
+
type: (options.type !== _undefined ? options.type : null)
|
2283
|
+
}]);
|
2227
2284
|
}
|
2228
2285
|
if (options.fatal !== _undefined && options.fatal) {
|
2229
2286
|
sm2.disable();
|
@@ -2239,7 +2296,7 @@ featureCheck = function() {
|
|
2239
2296
|
if (item === 'mp3' || item === 'mp4') {
|
2240
2297
|
sm2.html5[item] = false;
|
2241
2298
|
if (aF[item] && aF[item].related) {
|
2242
|
-
for (i = aF[item].related.length-1; i >= 0; i--) {
|
2299
|
+
for (i = aF[item].related.length - 1; i >= 0; i--) {
|
2243
2300
|
sm2.html5[aF[item].related[i]] = false;
|
2244
2301
|
}
|
2245
2302
|
}
|
@@ -2285,12 +2342,12 @@ featureCheck = function() {
|
|
2285
2342
|
html = doc.getElementsByTagName('html')[0],
|
2286
2343
|
oEmbed, oMovie, tmp, movieHTML, oEl, s, x, sClass;
|
2287
2344
|
isRTL = (html && html.dir && html.dir.match(/rtl/i));
|
2288
|
-
smID = (smID === _undefined?sm2.id:smID);
|
2345
|
+
smID = (smID === _undefined ? sm2.id : smID);
|
2289
2346
|
function param(name, value) {
|
2290
|
-
return '<param name="'+name+'" value="'+value+'" />';
|
2347
|
+
return '<param name="' + name + '" value="' + value + '" />';
|
2291
2348
|
}
|
2292
2349
|
setVersionInfo();
|
2293
|
-
sm2.url = normalizeMovieURL(overHTTP?remoteURL:localURL);
|
2350
|
+
sm2.url = normalizeMovieURL(overHTTP ? remoteURL : localURL);
|
2294
2351
|
smURL = sm2.url;
|
2295
2352
|
sm2.wmode = (!sm2.wmode && sm2.useHighPerformance ? 'transparent' : sm2.wmode);
|
2296
2353
|
if (sm2.wmode !== null && (ua.match(/msie 8/i) || (!isIE && !sm2.useHighPerformance)) && navigator.platform.match(/win32|win64/i)) {
|
@@ -2304,7 +2361,7 @@ featureCheck = function() {
|
|
2304
2361
|
'quality': 'high',
|
2305
2362
|
'allowScriptAccess': sm2.allowScriptAccess,
|
2306
2363
|
'bgcolor': sm2.bgColor,
|
2307
|
-
'pluginspage': http+'www.macromedia.com/go/getflashplayer',
|
2364
|
+
'pluginspage': http + 'www.macromedia.com/go/getflashplayer',
|
2308
2365
|
'title': swfTitle,
|
2309
2366
|
'type': 'application/x-shockwave-flash',
|
2310
2367
|
'wmode': sm2.wmode,
|
@@ -2319,7 +2376,7 @@ featureCheck = function() {
|
|
2319
2376
|
if (isIE) {
|
2320
2377
|
oMovie = doc.createElement('div');
|
2321
2378
|
movieHTML = [
|
2322
|
-
'<object id="' + smID + '" data="' + smURL + '" type="' + oEmbed.type + '" title="' + oEmbed.title +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
|
2379
|
+
'<object id="' + smID + '" data="' + smURL + '" type="' + oEmbed.type + '" title="' + oEmbed.title +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">',
|
2323
2380
|
param('movie', smURL),
|
2324
2381
|
param('AllowScriptAccess', sm2.allowScriptAccess),
|
2325
2382
|
param('quality', oEmbed.quality),
|
@@ -2366,7 +2423,7 @@ featureCheck = function() {
|
|
2366
2423
|
'left': '-9999px'
|
2367
2424
|
};
|
2368
2425
|
if (isRTL) {
|
2369
|
-
s.left = Math.abs(parseInt(s.left,10))+'px';
|
2426
|
+
s.left = Math.abs(parseInt(s.left, 10)) + 'px';
|
2370
2427
|
}
|
2371
2428
|
}
|
2372
2429
|
}
|
@@ -2392,11 +2449,11 @@ featureCheck = function() {
|
|
2392
2449
|
}
|
2393
2450
|
appendSuccess = true;
|
2394
2451
|
} catch(e) {
|
2395
|
-
throw new Error(str('domError')+' \n'+e.toString());
|
2452
|
+
throw new Error(str('domError') + ' \n' + e.toString());
|
2396
2453
|
}
|
2397
2454
|
} else {
|
2398
2455
|
sClass = sm2.oMC.className;
|
2399
|
-
sm2.oMC.className = (sClass?sClass+' ':swfCSS.swfDefault) + (extraClass?' '+extraClass:'');
|
2456
|
+
sm2.oMC.className = (sClass ? sClass + ' ' : swfCSS.swfDefault) + (extraClass ? ' ' + extraClass : '');
|
2400
2457
|
sm2.oMC.appendChild(oMovie);
|
2401
2458
|
if (isIE) {
|
2402
2459
|
oEl = sm2.oMC.appendChild(doc.createElement('div'));
|
@@ -2490,7 +2547,13 @@ featureCheck = function() {
|
|
2490
2547
|
if (!sm2.useFlashBlock && canIgnoreFlash) {
|
2491
2548
|
rebootIntoHTML5();
|
2492
2549
|
} else {
|
2493
|
-
processOnEvents({
|
2550
|
+
processOnEvents({
|
2551
|
+
type: 'ontimeout',
|
2552
|
+
ignoreInit: true,
|
2553
|
+
error: {
|
2554
|
+
type: 'INIT_FLASHBLOCK'
|
2555
|
+
}
|
2556
|
+
});
|
2494
2557
|
}
|
2495
2558
|
}
|
2496
2559
|
} else {
|
@@ -2540,12 +2603,18 @@ featureCheck = function() {
|
|
2540
2603
|
if (!wasTimeout) {
|
2541
2604
|
didInit = true;
|
2542
2605
|
}
|
2543
|
-
error = {
|
2606
|
+
error = {
|
2607
|
+
type: (!hasFlash && needsFlash ? 'NO_FLASH' : 'INIT_TIMEOUT')
|
2608
|
+
};
|
2544
2609
|
if (disabled || bNoDisable) {
|
2545
2610
|
if (sm2.useFlashBlock && sm2.oMC) {
|
2546
|
-
sm2.oMC.className = getSWFCSS() + ' ' + (sm2.getMoviePercent() === null?swfCSS.swfTimedout:swfCSS.swfError);
|
2611
|
+
sm2.oMC.className = getSWFCSS() + ' ' + (sm2.getMoviePercent() === null ? swfCSS.swfTimedout : swfCSS.swfError);
|
2547
2612
|
}
|
2548
|
-
processOnEvents({
|
2613
|
+
processOnEvents({
|
2614
|
+
type: 'ontimeout',
|
2615
|
+
error: error,
|
2616
|
+
ignoreInit: true
|
2617
|
+
});
|
2549
2618
|
catchError(error);
|
2550
2619
|
result = false;
|
2551
2620
|
} else {
|
@@ -2599,7 +2668,10 @@ featureCheck = function() {
|
|
2599
2668
|
event.add(window, 'unload', doNothing);
|
2600
2669
|
}
|
2601
2670
|
} catch(e) {
|
2602
|
-
catchError({
|
2671
|
+
catchError({
|
2672
|
+
type: 'JS_TO_FLASH_EXCEPTION',
|
2673
|
+
fatal: true
|
2674
|
+
});
|
2603
2675
|
failSafely(true);
|
2604
2676
|
initComplete();
|
2605
2677
|
return false;
|
@@ -2646,19 +2718,6 @@ featureCheck = function() {
|
|
2646
2718
|
domContentLoaded();
|
2647
2719
|
event.remove(window, 'load', winOnLoad);
|
2648
2720
|
};
|
2649
|
-
preInit = function() {
|
2650
|
-
if (mobileHTML5) {
|
2651
|
-
sm2.setupOptions.useHTML5Audio = true;
|
2652
|
-
sm2.setupOptions.preferFlash = false;
|
2653
|
-
if (is_iDevice || (isAndroid && !ua.match(/android\s2\.3/i))) {
|
2654
|
-
if (is_iDevice) {
|
2655
|
-
sm2.ignoreFlash = true;
|
2656
|
-
}
|
2657
|
-
useGlobalHTML5Audio = true;
|
2658
|
-
}
|
2659
|
-
}
|
2660
|
-
};
|
2661
|
-
preInit();
|
2662
2721
|
detectFlash();
|
2663
2722
|
event.add(window, 'focus', handleFocus);
|
2664
2723
|
event.add(window, 'load', delayWaitForEI);
|
@@ -2668,26 +2727,39 @@ featureCheck = function() {
|
|
2668
2727
|
} else if (doc.attachEvent) {
|
2669
2728
|
doc.attachEvent('onreadystatechange', domContentLoadedIE);
|
2670
2729
|
} else {
|
2671
|
-
catchError({
|
2730
|
+
catchError({
|
2731
|
+
type: 'NO_DOM2_EVENTS',
|
2732
|
+
fatal: true
|
2733
|
+
});
|
2672
2734
|
}
|
2673
2735
|
}
|
2674
2736
|
// SM2_DEFER details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading
|
2675
|
-
if (window.SM2_DEFER ===
|
2737
|
+
if (window.SM2_DEFER === _undefined || !SM2_DEFER) {
|
2676
2738
|
soundManager = new SoundManager();
|
2677
2739
|
}
|
2678
2740
|
if (typeof module === 'object' && module && typeof module.exports === 'object') {
|
2679
|
-
window.soundManager = soundManager;
|
2680
2741
|
module.exports.SoundManager = SoundManager;
|
2681
2742
|
module.exports.soundManager = soundManager;
|
2682
2743
|
} else if (typeof define === 'function' && define.amd) {
|
2683
|
-
define(
|
2744
|
+
define(function() {
|
2745
|
+
function getInstance(smBuilder) {
|
2746
|
+
if (!window.soundManager && smBuilder instanceof Function) {
|
2747
|
+
var instance = smBuilder(SoundManager);
|
2748
|
+
if (instance instanceof SoundManager) {
|
2749
|
+
window.soundManager = instance;
|
2750
|
+
}
|
2751
|
+
}
|
2752
|
+
return window.soundManager;
|
2753
|
+
}
|
2684
2754
|
return {
|
2685
|
-
|
2686
|
-
|
2687
|
-
}
|
2755
|
+
constructor: SoundManager,
|
2756
|
+
getInstance: getInstance
|
2757
|
+
}
|
2688
2758
|
});
|
2689
|
-
} else {
|
2690
|
-
window.SoundManager = SoundManager;
|
2691
|
-
window.soundManager = soundManager;
|
2692
2759
|
}
|
2760
|
+
// standard browser case
|
2761
|
+
// constructor
|
2762
|
+
window.SoundManager = SoundManager;
|
2763
|
+
// public API, flash callbacks etc.
|
2764
|
+
window.soundManager = soundManager;
|
2693
2765
|
}(window));
|