soundmanager2-rails 2.97.20120916 → 2.97.20130324
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +0 -1
- data/VERSION +1 -1
- data/soundmanager2-rails.gemspec +4 -4
- data/vendor/assets/javascripts/soundmanager2-jsmin.js +95 -98
- data/vendor/assets/javascripts/soundmanager2-nodebug-jsmin.js +68 -69
- data/vendor/assets/javascripts/soundmanager2-nodebug.js +1192 -1140
- data/vendor/assets/javascripts/soundmanager2.js +1673 -1485
- 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 +5 -14
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MmI5OTgzNGI3OTE1ZGQ5OTlhOTcxNjQ4YzA3NGNjZGQxMDc0MGFkOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NWUyN2MzNDUzZDYwNjI0ZGI2ODUxYmJiNWVkNmE4ODBiOTliMDQ0NQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjllMzExNmNlM2NhNjM2YTdhMjZhNDlmNGI4NjAyY2QyOTg2M2IwNDI2MTYw
|
10
|
+
MzBmMGM5YmRhYzVhMWE0Yzc0MDBhNjJkYzIxZWExMzIwNDY1MDBlZThkZTdj
|
11
|
+
ZmQxMDJmODgzMWRjYTVmNTdkZDA5NTRhZTE1Y2ExNDMzZjQyNTM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzZmZTIwNWZhZmRmMDgwNTg2OWQ0MDY0YTVjZmI3OGQ1M2EyZjQzNTAxZTg0
|
14
|
+
NTMyMmNjYjdmMWQzNTVjN2ZjZmU1NTIwZjcyMmY0ZTc4YzY5YTQ5MDkwODll
|
15
|
+
ZTMxNzgxYmU1Nzk4OWUzZmNiNjQ2ZjJhMTQ5MDVmYzM2MDY1ZjY=
|
data/README.md
CHANGED
@@ -40,7 +40,6 @@ You probably want to include some config. I normally have a "settings.html.erb"
|
|
40
40
|
soundManager.multiShot = false
|
41
41
|
soundManager.url = "<%= asset_path('soundmanager2.swf') %>"
|
42
42
|
soundManager.useHTML5Audio = true
|
43
|
-
soundManager.preferFlash = true // still prefer flash even though HTML5 support might be there (because it's skeeeetchhhhyyy)
|
44
43
|
soundManager.consoleOnly = true
|
45
44
|
|
46
45
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.97.
|
1
|
+
2.97.20130324
|
data/soundmanager2-rails.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "soundmanager2-rails"
|
8
|
-
s.version = "2.97.
|
8
|
+
s.version = "2.97.20130324"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sudara"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-03-28"
|
13
13
|
s.description = "Exposes soundmanager2 as a vendored js lib in rails 3 "
|
14
14
|
s.email = "sudara@alonetone.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -36,11 +36,11 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.homepage = "http://github.com/sudara/soundmanager2-rails"
|
37
37
|
s.licenses = ["MIT"]
|
38
38
|
s.require_paths = ["lib"]
|
39
|
-
s.rubygems_version = "
|
39
|
+
s.rubygems_version = "2.0.2"
|
40
40
|
s.summary = "Exposes soundmanager2 as a vendored js lib in rails 3"
|
41
41
|
|
42
42
|
if s.respond_to? :specification_version then
|
43
|
-
s.specification_version =
|
43
|
+
s.specification_version = 4
|
44
44
|
|
45
45
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
46
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
@@ -9,102 +9,99 @@
|
|
9
9
|
Code provided under the BSD License:
|
10
10
|
http://schillmania.com/projects/soundmanager2/license.txt
|
11
11
|
|
12
|
-
V2.97a.
|
12
|
+
V2.97a.20130324 ("Mahalo" Edition)
|
13
13
|
*/
|
14
|
-
(function(
|
15
|
-
|
16
|
-
|
17
|
-
required:!1},wav:{type:['audio/wav; codecs
|
18
|
-
this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={type:null,types:{remote:"remote (domain-based) rules",localWithFile:"local with file access (no internet access)",localWithNetwork:"local with network (internet access only, no local access)",localTrusted:"local, trusted (local+internet access)"},description:null,noRemote:null,noLocal:null};
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
a;a
|
29
|
-
|
30
|
-
(c
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
1;
|
35
|
-
|
36
|
-
|
37
|
-
b.
|
38
|
-
"
|
39
|
-
|
40
|
-
|
41
|
-
b.
|
42
|
-
b.
|
43
|
-
b.
|
44
|
-
b.
|
45
|
-
|
46
|
-
|
47
|
-
a,(0===b.
|
48
|
-
(
|
49
|
-
|
50
|
-
a;return
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
a.
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
a.length;
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
"
|
68
|
-
|
69
|
-
|
70
|
-
[]
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
p=function(
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
a.
|
86
|
-
|
87
|
-
|
88
|
-
d
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
c.
|
94
|
-
c.
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
a
|
104
|
-
!1,"
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
x("jstoflash",!1),M({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),ha(!0),T(),!1}T();u.remove(k,"load",c.beginDelayedInit);return!0};L=function(){if(U)return!1;U=!0;La();ya();var a=null,a=null,d="undefined"!==typeof console&&"function"===typeof console.log,e=Q.toLowerCase();-1!==e.indexOf("sm2-usehtml5audio=")&&(a="1"===e.charAt(e.indexOf("sm2-usehtml5audio=")+18),d&&console.log((a?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),c.setup({useHTML5Audio:a}));-1!==e.indexOf("sm2-preferflash=")&&
|
109
|
-
(a="1"===e.charAt(e.indexOf("sm2-preferflash=")+16),d&&console.log((a?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),c.setup({preferFlash:a}));!z&&c.hasHTML5&&(c._wD("SoundManager: No Flash detected"+(!c.useHTML5Audio?", enabling HTML5.":". Trying HTML5-only mode.")),c.setup({useHTML5Audio:!0,preferFlash:!1}));Va();c.html5.usingFlash=Ua();B=c.html5.usingFlash;Ya();!z&&B&&(n("needFlash"),c.setup({flashLoadTimeout:1}));i.removeEventListener&&i.removeEventListener("DOMContentLoaded",L,!1);
|
110
|
-
ea();return!0};Da=function(){"complete"===i.readyState&&(L(),i.detachEvent("onreadystatechange",Da));return!0};xa=function(){ba=!0;u.remove(k,"load",xa)};Ea();u.add(k,"focus",ca);u.add(k,"load",K);u.add(k,"load",xa);i.addEventListener?i.addEventListener("DOMContentLoaded",L,!1):i.attachEvent?i.attachEvent("onreadystatechange",Da):(x("onload",!1),M({type:"NO_DOM2_EVENTS",fatal:!0}))}var oa=null;if("undefined"===typeof SM2_DEFER||!SM2_DEFER)oa=new $;Z.SoundManager=$;Z.soundManager=oa})(window);
|
14
|
+
(function(m,g){function ba(ba,qa){function ca(a){return c.preferFlash&&A&&!c.ignoreFlash&&c.flash[a]!==g&&c.flash[a]}function s(a){return function(d){var e=this._s;!e||!e._a?(e&&e.id?c._wD(e.id+": Ignoring "+d.type):c._wD(ob+"Ignoring "+d.type),d=null):d=a.call(this,d);return d}}this.setupOptions={url:ba||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1E3,
|
15
|
+
wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!0,noSWFCache:!1};this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100};this.flash9Options={isMovieStar:null,usePeakData:!1,
|
16
|
+
useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null};this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.audioFormats={mp3:{type:['audio/mpeg; codecs\x3d"mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],type:['audio/mp4; codecs\x3d"mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs\x3dvorbis"],required:!1},opus:{type:["audio/ogg; codecs\x3dopus",
|
17
|
+
"audio/opus"],required:!1},wav:{type:['audio/wav; codecs\x3d"1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}};this.movieID="sm2-container";this.id=qa||"sm2movie";this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20130324";this.altURL=this.movieURL=this.version=null;this.enabled=this.swfLoaded=!1;this.oMC=null;this.sounds={};this.soundIDs=[];this.didFlashBlock=this.muted=!1;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};
|
18
|
+
this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={type:null,types:{remote:"remote (domain-based) rules",localWithFile:"local with file access (no internet access)",localWithNetwork:"local with network (internet access only, no local access)",localTrusted:"local, trusted (local+internet access)"},description:null,noRemote:null,noLocal:null};this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=!1;var Qa,c=this,Ra=null,l=null,ob="HTML5::",
|
19
|
+
B,u=navigator.userAgent,S=m.location.href.toString(),h=document,ra,Sa,sa,p,D=[],ta=!0,y,T=!1,U=!1,q=!1,t=!1,da=!1,n,pb=0,V,x,ua,L,va,J,M,N,Ta,wa,ea,G,fa,xa,O,ya,W,ga,ha,P,Ua,za,Va=["log","info","warn","error"],Wa,Aa,Xa,X=null,Ba=null,r,Ca,Q,Ya,ia,ja,R,v,Y=!1,Da=!1,Za,$a,ab,ka=0,Z=null,la,K=[],C=null,bb,ma,$,H,Ea,Fa,cb,w,db=Array.prototype.slice,E=!1,Ga,A,Ha,eb,F,fb,Ia,na,oa=u.match(/(ipad|iphone|ipod)/i),gb=u.match(/android/i),I=u.match(/msie/i),qb=u.match(/webkit/i),Ja=u.match(/safari/i)&&!u.match(/chrome/i),
|
20
|
+
Ka=u.match(/opera/i),La=u.match(/(mobile|pre\/|xoom)/i)||oa||gb,Ma=!S.match(/usehtml5audio/i)&&!S.match(/sm2\-ignorebadua/i)&&Ja&&!u.match(/silk/i)&&u.match(/OS X 10_6_([3-7])/i),hb=m.console!==g&&console.log!==g,Na=h.hasFocus!==g?h.hasFocus():null,pa=Ja&&(h.hasFocus===g||!h.hasFocus()),ib=!pa,jb=/(mp3|mp4|mpa|m4a|m4b)/i,aa=h.location?h.location.protocol.match(/http/i):null,kb=!aa?"http://":"",lb=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,mb="mpeg4 aac flv mov mp4 m4v f4v m4a m4b mp4v 3gp 3g2".split(" "),
|
21
|
+
rb=RegExp("\\.("+mb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!aa;var Oa;try{Oa=Audio!==g&&(Ka&&opera!==g&&10>opera.version()?new Audio(null):new Audio).canPlayType!==g}catch(sb){Oa=!1}this.hasHTML5=Oa;this.setup=function(a){var d=!c.url;a!==g&&(q&&C&&c.ok()&&(a.flashVersion!==g||a.url!==g||a.html5Test!==g))&&R(r("setupLate"));ua(a);d&&(W&&a.url!==g)&&c.beginDelayedInit();!W&&(a.url!==g&&"complete"===h.readyState)&&setTimeout(O,1);return c};
|
22
|
+
this.supported=this.ok=function(){return C?q&&!t:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(c){return B(c)||h[c]||m[c]};this.createSound=function(a,d){function e(){f=ia(f);c.sounds[f.id]=new Qa(f);c.soundIDs.push(f.id);return c.sounds[f.id]}var b,f;b=null;b="soundManager.createSound(): "+r(!q?"notReady":"notOK");if(!q||!c.ok())return R(b),!1;d!==g&&(a={id:a,url:d});f=x(a);f.url=la(f.url);f.id.toString().charAt(0).match(/^[0-9]$/)&&c._wD("soundManager.createSound(): "+r("badID",f.id),2);c._wD("soundManager.createSound(): "+
|
23
|
+
f.id+" ("+f.url+")",1);if(v(f.id,!0))return c._wD("soundManager.createSound(): "+f.id+" exists",1),c.sounds[f.id];ma(f)?(b=e(),c._wD(f.id+": Using HTML5"),b._setup_html5(f)):(8<p&&(null===f.isMovieStar&&(f.isMovieStar=!(!f.serverURL&&!(f.type&&f.type.match(lb)||f.url.match(rb)))),f.isMovieStar&&(c._wD("soundManager.createSound(): using MovieStar handling"),1<f.loops&&n("noNSLoop"))),f=ja(f,"soundManager.createSound(): "),b=e(),8===p?l._createSound(f.id,f.loops||1,f.usePolicyFile):(l._createSound(f.id,
|
24
|
+
f.url,f.usePeakData,f.useWaveformData,f.useEQData,f.isMovieStar,f.isMovieStar?f.bufferTime:!1,f.loops||1,f.serverURL,f.duration||null,f.autoPlay,!0,f.autoLoad,f.usePolicyFile),f.serverURL||(b.connected=!0,f.onconnect&&f.onconnect.apply(b))),!f.serverURL&&(f.autoLoad||f.autoPlay)&&b.load(f));!f.serverURL&&f.autoPlay&&b.play();return b};this.destroySound=function(a,d){if(!v(a))return!1;var e=c.sounds[a],b;e._iO={};e.stop();e.unload();for(b=0;b<c.soundIDs.length;b++)if(c.soundIDs[b]===a){c.soundIDs.splice(b,
|
25
|
+
1);break}d||e.destruct(!0);delete c.sounds[a];return!0};this.load=function(a,d){return!v(a)?!1:c.sounds[a].load(d)};this.unload=function(a){return!v(a)?!1:c.sounds[a].unload()};this.onposition=this.onPosition=function(a,d,e,b){return!v(a)?!1:c.sounds[a].onposition(d,e,b)};this.clearOnPosition=function(a,d,e){return!v(a)?!1:c.sounds[a].clearOnPosition(d,e)};this.start=this.play=function(a,d){var e=!1;return!q||!c.ok()?(R("soundManager.play(): "+r(!q?"notReady":"notOK")),e):!v(a)?(d instanceof Object||
|
26
|
+
(d={url:d}),d&&d.url&&(c._wD('soundManager.play(): attempting to create "'+a+'"',1),d.id=a,e=c.createSound(d).play()),e):c.sounds[a].play(d)};this.setPosition=function(a,d){return!v(a)?!1:c.sounds[a].setPosition(d)};this.stop=function(a){if(!v(a))return!1;c._wD("soundManager.stop("+a+")",1);return c.sounds[a].stop()};this.stopAll=function(){var a;c._wD("soundManager.stopAll()",1);for(a in c.sounds)c.sounds.hasOwnProperty(a)&&c.sounds[a].stop()};this.pause=function(a){return!v(a)?!1:c.sounds[a].pause()};
|
27
|
+
this.pauseAll=function(){var a;for(a=c.soundIDs.length-1;0<=a;a--)c.sounds[c.soundIDs[a]].pause()};this.resume=function(a){return!v(a)?!1:c.sounds[a].resume()};this.resumeAll=function(){var a;for(a=c.soundIDs.length-1;0<=a;a--)c.sounds[c.soundIDs[a]].resume()};this.togglePause=function(a){return!v(a)?!1:c.sounds[a].togglePause()};this.setPan=function(a,d){return!v(a)?!1:c.sounds[a].setPan(d)};this.setVolume=function(a,d){return!v(a)?!1:c.sounds[a].setVolume(d)};this.mute=function(a){var d=0;a instanceof
|
28
|
+
String&&(a=null);if(a){if(!v(a))return!1;c._wD('soundManager.mute(): Muting "'+a+'"');return c.sounds[a].mute()}c._wD("soundManager.mute(): Muting all sounds");for(d=c.soundIDs.length-1;0<=d;d--)c.sounds[c.soundIDs[d]].mute();return c.muted=!0};this.muteAll=function(){c.mute()};this.unmute=function(a){a instanceof String&&(a=null);if(a){if(!v(a))return!1;c._wD('soundManager.unmute(): Unmuting "'+a+'"');return c.sounds[a].unmute()}c._wD("soundManager.unmute(): Unmuting all sounds");for(a=c.soundIDs.length-
|
29
|
+
1;0<=a;a--)c.sounds[c.soundIDs[a]].unmute();c.muted=!1;return!0};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(a){return!v(a)?!1:c.sounds[a].toggleMute()};this.getMemoryUse=function(){var c=0;l&&8!==p&&(c=parseInt(l._getMemoryUse(),10));return c};this.disable=function(a){var d;a===g&&(a=!1);if(t)return!1;t=!0;n("shutdown",1);for(d=c.soundIDs.length-1;0<=d;d--)Wa(c.sounds[c.soundIDs[d]]);V(a);w.remove(m,"load",M);return!0};this.canPlayMIME=function(a){var d;c.hasHTML5&&(d=$({type:a}));
|
30
|
+
!d&&C&&(d=a&&c.ok()?!!(8<p&&a.match(lb)||a.match(c.mimePattern)):null);return d};this.canPlayURL=function(a){var d;c.hasHTML5&&(d=$({url:a}));!d&&C&&(d=a&&c.ok()?!!a.match(c.filePattern):null);return d};this.canPlayLink=function(a){return a.type!==g&&a.type&&c.canPlayMIME(a.type)?!0:c.canPlayURL(a.href)};this.getSoundById=function(a,d){if(!a)throw Error("soundManager.getSoundById(): sID is null/_undefined");var e=c.sounds[a];!e&&!d&&c._wD('"'+a+'" is an invalid sound ID.',2);return e};this.onready=
|
31
|
+
function(a,d){if("function"===typeof a)q&&c._wD(r("queue","onready")),d||(d=m),va("onready",a,d),J();else throw r("needFunction","onready");return!0};this.ontimeout=function(a,d){if("function"===typeof a)q&&c._wD(r("queue","ontimeout")),d||(d=m),va("ontimeout",a,d),J({type:"ontimeout"});else throw r("needFunction","ontimeout");return!0};this._writeDebug=function(a,d){var e,b;if(!c.debugMode)return!1;if(hb&&c.useConsole){if(d&&"object"===typeof d)console.log(a,d);else if(Va[d]!==g)console[Va[d]](a);
|
32
|
+
else console.log(a);if(c.consoleOnly)return!0}e=B("soundmanager-debug");if(!e)return!1;b=h.createElement("div");0===++pb%2&&(b.className="sm2-alt");d=d===g?0:parseInt(d,10);b.appendChild(h.createTextNode(a));d&&(2<=d&&(b.style.fontWeight="bold"),3===d&&(b.style.color="#ff3333"));e.insertBefore(b,e.firstChild);return!0};-1!==S.indexOf("sm2-debug\x3dalert")&&(this._writeDebug=function(c){m.alert(c)});this._wD=this._writeDebug;this._debug=function(){var a,d;n("currentObj",1);a=0;for(d=c.soundIDs.length;a<
|
33
|
+
d;a++)c.sounds[c.soundIDs[a]]._debug()};this.reboot=function(a,d){c.soundIDs.length&&c._wD("Destroying "+c.soundIDs.length+" SMSound objects...");var e,b,f;for(e=c.soundIDs.length-1;0<=e;e--)c.sounds[c.soundIDs[e]].destruct();if(l)try{I&&(Ba=l.innerHTML),X=l.parentNode.removeChild(l),n("flRemoved")}catch(g){n("badRemove",2)}Ba=X=C=l=null;c.enabled=W=q=Y=Da=T=U=t=E=c.swfLoaded=!1;c.soundIDs=[];c.sounds={};if(a)D=[];else for(e in D)if(D.hasOwnProperty(e)){b=0;for(f=D[e].length;b<f;b++)D[e][b].fired=
|
34
|
+
!1}d||c._wD("soundManager: Rebooting...");c.html5={usingFlash:null};c.flash={};c.html5Only=!1;c.ignoreFlash=!1;m.setTimeout(function(){xa();d||c.beginDelayedInit()},20);return c};this.reset=function(){n("reset");return c.reboot(!0,!0)};this.getMoviePercent=function(){return l&&"PercentLoaded"in l?l.PercentLoaded():null};this.beginDelayedInit=function(){da=!0;O();setTimeout(function(){if(Da)return!1;ha();fa();return Da=!0},20);N()};this.destruct=function(){c._wD("soundManager.destruct()");c.disable(!0)};
|
35
|
+
Qa=function(a){var d,e,b=this,f,m,nb,k,h,q,s=!1,z=[],u=0,Pa,w,t=null;e=d=null;this.sID=this.id=a.id;this.url=a.url;this._iO=this.instanceOptions=this.options=x(a);this.pan=this.options.pan;this.volume=this.options.volume;this.isHTML5=!1;this._a=null;this.id3={};this._debug=function(){c._wD(b.id+": Merged options:",b.options)};this.load=function(a){var d=null,e;a!==g?b._iO=x(a,b.options):(a=b.options,b._iO=a,t&&t!==b.url&&(n("manURL"),b._iO.url=b.url,b.url=null));b._iO.url||(b._iO.url=b.url);b._iO.url=
|
36
|
+
la(b._iO.url);e=b.instanceOptions=b._iO;c._wD(b.id+": load ("+e.url+")");if(e.url===b.url&&0!==b.readyState&&2!==b.readyState)return n("onURL",1),3===b.readyState&&e.onload&&na(b,function(){e.onload.apply(b,[!!b.duration])}),b;b.loaded=!1;b.readyState=1;b.playState=0;b.id3={};if(ma(e))d=b._setup_html5(e),d._called_load?c._wD(b.id+": Ignoring request to load again"):(b._html5_canplay=!1,b.url!==e.url&&(c._wD(n("manURL")+": "+e.url),b._a.src=e.url,b.setPosition(0)),b._a.autobuffer="auto",b._a.preload=
|
37
|
+
"auto",b._a._called_load=!0,e.autoPlay&&b.play());else try{b.isHTML5=!1,b._iO=ja(ia(e)),e=b._iO,8===p?l._load(b.id,e.url,e.stream,e.autoPlay,e.usePolicyFile):l._load(b.id,e.url,!!e.stream,!!e.autoPlay,e.loops||1,!!e.autoLoad,e.usePolicyFile)}catch(f){n("smError",2),y("onload",!1),P({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}b.url=e.url;return b};this.unload=function(){0!==b.readyState&&(c._wD(b.id+": unload()"),b.isHTML5?(k(),b._a&&(b._a.pause(),Ea(b._a,"about:blank"),t="about:blank")):8===p?l._unload(b.id,
|
38
|
+
"about:blank"):l._unload(b.id),f());return b};this.destruct=function(a){c._wD(b.id+": Destruct");b.isHTML5?(k(),b._a&&(b._a.pause(),Ea(b._a),E||nb(),b._a._s=null,b._a=null)):(b._iO.onfailure=null,l._destroySound(b.id));a||c.destroySound(b.id,!0)};this.start=this.play=function(a,d){var e,f,k=!0,k=null;e=b.id+": play(): ";d=d===g?!0:d;a||(a={});b.url&&(b._iO.url=b.url);b._iO=x(b._iO,b.options);b._iO=x(a,b._iO);b._iO.url=la(b._iO.url);b.instanceOptions=b._iO;if(b._iO.serverURL&&!b.connected)return b.getAutoPlay()||
|
39
|
+
(c._wD(e+" Netstream not connected yet - setting autoPlay"),b.setAutoPlay(!0)),b;ma(b._iO)&&(b._setup_html5(b._iO),h());1===b.playState&&!b.paused&&((f=b._iO.multiShot)?c._wD(e+"Already playing (multi-shot)",1):(c._wD(e+"Already playing (one-shot)",1),k=b));if(null!==k)return k;a.url&&a.url!==b.url&&b.load(b._iO);b.loaded?c._wD(e.substr(0,e.lastIndexOf(":"))):0===b.readyState?(c._wD(e+"Attempting to load"),b.isHTML5||(b._iO.autoPlay=!0),b.load(b._iO),b.instanceOptions=b._iO):2===b.readyState?(c._wD(e+
|
40
|
+
"Could not load - exiting",2),k=b):c._wD(e+"Loading - attempting to play...");if(null!==k)return k;!b.isHTML5&&(9===p&&0<b.position&&b.position===b.duration)&&(c._wD(e+"Sound at end, resetting to position:0"),a.position=0);if(b.paused&&0<=b.position&&(!b._iO.serverURL||0<b.position))c._wD(e+"Resuming from paused state",1),b.resume();else{b._iO=x(a,b._iO);if(null!==b._iO.from&&null!==b._iO.to&&0===b.instanceCount&&0===b.playState&&!b._iO.serverURL){f=function(){b._iO=x(a,b._iO);b.play(b._iO)};if(b.isHTML5&&
|
41
|
+
!b._html5_canplay)c._wD(e+"Beginning load for from/to case"),b.load({oncanplay:f}),k=!1;else if(!b.isHTML5&&!b.loaded&&(!b.readyState||2!==b.readyState))c._wD(e+"Preloading for from/to case"),b.load({onload:f}),k=!1;if(null!==k)return k;b._iO=w()}c._wD(e+"Starting to play");(!b.instanceCount||b._iO.multiShotEvents||!b.isHTML5&&8<p&&!b.getAutoPlay())&&b.instanceCount++;b._iO.onposition&&0===b.playState&&q(b);b.playState=1;b.paused=!1;b.position=b._iO.position!==g&&!isNaN(b._iO.position)?b._iO.position:
|
42
|
+
0;b.isHTML5||(b._iO=ja(ia(b._iO)));b._iO.onplay&&d&&(b._iO.onplay.apply(b),s=!0);b.setVolume(b._iO.volume,!0);b.setPan(b._iO.pan,!0);b.isHTML5?(h(),e=b._setup_html5(),b.setPosition(b._iO.position),e.play()):(k=l._start(b.id,b._iO.loops||1,9===p?b.position:b.position/1E3,b._iO.multiShot||!1),9===p&&!k&&(c._wD(e+"No sound hardware, or 32-sound ceiling hit"),b._iO.onplayerror&&b._iO.onplayerror.apply(b)))}return b};this.stop=function(a){var d=b._iO;1===b.playState&&(c._wD(b.id+": stop()"),b._onbufferchange(0),
|
43
|
+
b._resetOnPosition(0),b.paused=!1,b.isHTML5||(b.playState=0),Pa(),d.to&&b.clearOnPosition(d.to),b.isHTML5?b._a&&(a=b.position,b.setPosition(0),b.position=a,b._a.pause(),b.playState=0,b._onTimer(),k()):(l._stop(b.id,a),d.serverURL&&b.unload()),b.instanceCount=0,b._iO={},d.onstop&&d.onstop.apply(b));return b};this.setAutoPlay=function(a){c._wD(b.id+": Autoplay turned "+(a?"on":"off"));b._iO.autoPlay=a;b.isHTML5||(l._setAutoPlay(b.id,a),a&&(!b.instanceCount&&1===b.readyState)&&(b.instanceCount++,c._wD(b.id+
|
44
|
+
": Incremented instance count to "+b.instanceCount)))};this.getAutoPlay=function(){return b._iO.autoPlay};this.setPosition=function(a){a===g&&(a=0);var d=b.isHTML5?Math.max(a,0):Math.min(b.duration||b._iO.duration,Math.max(a,0));b.position=d;a=b.position/1E3;b._resetOnPosition(b.position);b._iO.position=d;if(b.isHTML5){if(b._a)if(b._html5_canplay){if(b._a.currentTime!==a){c._wD(b.id+": setPosition("+a+")");try{b._a.currentTime=a,(0===b.playState||b.paused)&&b._a.pause()}catch(e){c._wD(b.id+": setPosition("+
|
45
|
+
a+") failed: "+e.message,2)}}}else c._wD(b.id+": setPosition("+a+"): Cannot seek yet, sound not ready")}else a=9===p?b.position:a,b.readyState&&2!==b.readyState&&l._setPosition(b.id,a,b.paused||!b.playState,b._iO.multiShot);b.isHTML5&&b.paused&&b._onTimer(!0);return b};this.pause=function(a){if(b.paused||0===b.playState&&1!==b.readyState)return b;c._wD(b.id+": pause()");b.paused=!0;b.isHTML5?(b._setup_html5().pause(),k()):(a||a===g)&&l._pause(b.id,b._iO.multiShot);b._iO.onpause&&b._iO.onpause.apply(b);
|
46
|
+
return b};this.resume=function(){var a=b._iO;if(!b.paused)return b;c._wD(b.id+": resume()");b.paused=!1;b.playState=1;b.isHTML5?(b._setup_html5().play(),h()):(a.isMovieStar&&!a.serverURL&&b.setPosition(b.position),l._pause(b.id,a.multiShot));!s&&a.onplay?(a.onplay.apply(b),s=!0):a.onresume&&a.onresume.apply(b);return b};this.togglePause=function(){c._wD(b.id+": togglePause()");if(0===b.playState)return b.play({position:9===p&&!b.isHTML5?b.position:b.position/1E3}),b;b.paused?b.resume():b.pause();
|
47
|
+
return b};this.setPan=function(a,c){a===g&&(a=0);c===g&&(c=!1);b.isHTML5||l._setPan(b.id,a);b._iO.pan=a;c||(b.pan=a,b.options.pan=a);return b};this.setVolume=function(a,d){a===g&&(a=100);d===g&&(d=!1);b.isHTML5?b._a&&(b._a.volume=Math.max(0,Math.min(1,a/100))):l._setVolume(b.id,c.muted&&!b.muted||b.muted?0:a);b._iO.volume=a;d||(b.volume=a,b.options.volume=a);return b};this.mute=function(){b.muted=!0;b.isHTML5?b._a&&(b._a.muted=!0):l._setVolume(b.id,0);return b};this.unmute=function(){b.muted=!1;var a=
|
48
|
+
b._iO.volume!==g;b.isHTML5?b._a&&(b._a.muted=!1):l._setVolume(b.id,a?b._iO.volume:b.options.volume);return b};this.toggleMute=function(){return b.muted?b.unmute():b.mute()};this.onposition=this.onPosition=function(a,c,d){z.push({position:parseInt(a,10),method:c,scope:d!==g?d:b,fired:!1});return b};this.clearOnPosition=function(b,a){var c;b=parseInt(b,10);if(isNaN(b))return!1;for(c=0;c<z.length;c++)if(b===z[c].position&&(!a||a===z[c].method))z[c].fired&&u--,z.splice(c,1)};this._processOnPosition=function(){var a,
|
49
|
+
c;a=z.length;if(!a||!b.playState||u>=a)return!1;for(a-=1;0<=a;a--)c=z[a],!c.fired&&b.position>=c.position&&(c.fired=!0,u++,c.method.apply(c.scope,[c.position]));return!0};this._resetOnPosition=function(b){var a,c;a=z.length;if(!a)return!1;for(a-=1;0<=a;a--)c=z[a],c.fired&&b<=c.position&&(c.fired=!1,u--);return!0};w=function(){var a=b._iO,d=a.from,e=a.to,f,g;g=function(){c._wD(b.id+': "To" time of '+e+" reached.");b.clearOnPosition(e,g);b.stop()};f=function(){c._wD(b.id+': Playing "from" '+d);if(null!==
|
50
|
+
e&&!isNaN(e))b.onPosition(e,g)};null!==d&&!isNaN(d)&&(a.position=d,a.multiShot=!1,f());return a};q=function(){var a,c=b._iO.onposition;if(c)for(a in c)if(c.hasOwnProperty(a))b.onPosition(parseInt(a,10),c[a])};Pa=function(){var a,c=b._iO.onposition;if(c)for(a in c)c.hasOwnProperty(a)&&b.clearOnPosition(parseInt(a,10))};h=function(){b.isHTML5&&Za(b)};k=function(){b.isHTML5&&$a(b)};f=function(a){a||(z=[],u=0);s=!1;b._hasTimer=null;b._a=null;b._html5_canplay=!1;b.bytesLoaded=null;b.bytesTotal=null;b.duration=
|
51
|
+
b._iO&&b._iO.duration?b._iO.duration:null;b.durationEstimate=null;b.buffered=[];b.eqData=[];b.eqData.left=[];b.eqData.right=[];b.failures=0;b.isBuffering=!1;b.instanceOptions={};b.instanceCount=0;b.loaded=!1;b.metadata={};b.readyState=0;b.muted=!1;b.paused=!1;b.peakData={left:0,right:0};b.waveformData={left:[],right:[]};b.playState=0;b.position=null;b.id3={}};f();this._onTimer=function(a){var c,f=!1,g={};if(b._hasTimer||a){if(b._a&&(a||(0<b.playState||1===b.readyState)&&!b.paused))c=b._get_html5_duration(),
|
52
|
+
c!==d&&(d=c,b.duration=c,f=!0),b.durationEstimate=b.duration,c=1E3*b._a.currentTime||0,c!==e&&(e=c,f=!0),(f||a)&&b._whileplaying(c,g,g,g,g);return f}};this._get_html5_duration=function(){var a=b._iO;return(a=b._a&&b._a.duration?1E3*b._a.duration:a&&a.duration?a.duration:null)&&!isNaN(a)&&Infinity!==a?a:null};this._apply_loop=function(b,a){!b.loop&&1<a&&c._wD("Note: Native HTML5 looping is infinite.",1);b.loop=1<a?"loop":""};this._setup_html5=function(a){a=x(b._iO,a);var c=E?Ra:b._a,d=decodeURI(a.url),
|
53
|
+
e;E?d===decodeURI(Ga)&&(e=!0):d===decodeURI(t)&&(e=!0);if(c){if(c._s)if(E)c._s&&(c._s.playState&&!e)&&c._s.stop();else if(!E&&d===decodeURI(t))return b._apply_loop(c,a.loops),c;e||(f(!1),c.src=a.url,Ga=t=b.url=a.url,c._called_load=!1)}else b._a=a.autoLoad||a.autoPlay?new Audio(a.url):Ka&&10>opera.version()?new Audio(null):new Audio,c=b._a,c._called_load=!1,E&&(Ra=c);b.isHTML5=!0;b._a=c;c._s=b;m();b._apply_loop(c,a.loops);a.autoLoad||a.autoPlay?b.load():(c.autobuffer=!1,c.preload="auto");return c};
|
54
|
+
m=function(){if(b._a._added_events)return!1;var a;b._a._added_events=!0;for(a in F)F.hasOwnProperty(a)&&b._a&&b._a.addEventListener(a,F[a],!1);return!0};nb=function(){var a;c._wD(b.id+": Removing event listeners");b._a._added_events=!1;for(a in F)F.hasOwnProperty(a)&&b._a&&b._a.removeEventListener(a,F[a],!1)};this._onload=function(a){var d=!!a||!b.isHTML5&&8===p&&b.duration;a=b.id+": ";c._wD(a+(d?"onload()":"Failed to load? - "+b.url),d?1:2);!d&&!b.isHTML5&&(!0===c.sandbox.noRemote&&c._wD(a+r("noNet"),
|
55
|
+
1),!0===c.sandbox.noLocal&&c._wD(a+r("noLocal"),1));b.loaded=d;b.readyState=d?3:2;b._onbufferchange(0);b._iO.onload&&na(b,function(){b._iO.onload.apply(b,[d])});return!0};this._onbufferchange=function(a){if(0===b.playState||a&&b.isBuffering||!a&&!b.isBuffering)return!1;b.isBuffering=1===a;b._iO.onbufferchange&&(c._wD(b.id+": Buffer state change: "+a),b._iO.onbufferchange.apply(b));return!0};this._onsuspend=function(){b._iO.onsuspend&&(c._wD(b.id+": Playback suspended"),b._iO.onsuspend.apply(b));return!0};
|
56
|
+
this._onfailure=function(a,d,e){b.failures++;c._wD(b.id+": Failures \x3d "+b.failures);if(b._iO.onfailure&&1===b.failures)b._iO.onfailure(b,a,d,e);else c._wD(b.id+": Ignoring failure")};this._onfinish=function(){var a=b._iO.onfinish;b._onbufferchange(0);b._resetOnPosition(0);if(b.instanceCount&&(b.instanceCount--,b.instanceCount||(Pa(),b.playState=0,b.paused=!1,b.instanceCount=0,b.instanceOptions={},b._iO={},k(),b.isHTML5&&(b.position=0)),(!b.instanceCount||b._iO.multiShotEvents)&&a))c._wD(b.id+": onfinish()"),
|
57
|
+
na(b,function(){a.apply(b)})};this._whileloading=function(a,c,d,e){var f=b._iO;b.bytesLoaded=a;b.bytesTotal=c;b.duration=Math.floor(d);b.bufferLength=e;b.durationEstimate=!b.isHTML5&&!f.isMovieStar?f.duration?b.duration>f.duration?b.duration:f.duration:parseInt(b.bytesTotal/b.bytesLoaded*b.duration,10):b.duration;b.isHTML5||(b.buffered=[{start:0,end:b.duration}]);(3!==b.readyState||b.isHTML5)&&f.whileloading&&f.whileloading.apply(b)};this._whileplaying=function(a,c,d,e,f){var k=b._iO;if(isNaN(a)||
|
58
|
+
null===a)return!1;b.position=Math.max(0,a);b._processOnPosition();!b.isHTML5&&8<p&&(k.usePeakData&&(c!==g&&c)&&(b.peakData={left:c.leftPeak,right:c.rightPeak}),k.useWaveformData&&(d!==g&&d)&&(b.waveformData={left:d.split(","),right:e.split(",")}),k.useEQData&&(f!==g&&f&&f.leftEQ)&&(a=f.leftEQ.split(","),b.eqData=a,b.eqData.left=a,f.rightEQ!==g&&f.rightEQ&&(b.eqData.right=f.rightEQ.split(","))));1===b.playState&&(!b.isHTML5&&(8===p&&!b.position&&b.isBuffering)&&b._onbufferchange(0),k.whileplaying&&
|
59
|
+
k.whileplaying.apply(b));return!0};this._oncaptiondata=function(a){c._wD(b.id+": Caption data received.");b.captiondata=a;b._iO.oncaptiondata&&b._iO.oncaptiondata.apply(b,[a])};this._onmetadata=function(a,d){c._wD(b.id+": Metadata received.");var e={},f,g;f=0;for(g=a.length;f<g;f++)e[a[f]]=d[f];b.metadata=e;b._iO.onmetadata&&b._iO.onmetadata.apply(b)};this._onid3=function(a,d){c._wD(b.id+": ID3 data received.");var e=[],f,g;f=0;for(g=a.length;f<g;f++)e[a[f]]=d[f];b.id3=x(b.id3,e);b._iO.onid3&&b._iO.onid3.apply(b)};
|
60
|
+
this._onconnect=function(a){a=1===a;c._wD(b.id+": "+(a?"Connected.":"Failed to connect? - "+b.url),a?1:2);if(b.connected=a)b.failures=0,v(b.id)&&(b.getAutoPlay()?b.play(g,b.getAutoPlay()):b._iO.autoLoad&&b.load()),b._iO.onconnect&&b._iO.onconnect.apply(b,[a])};this._ondataerror=function(a){0<b.playState&&(c._wD(b.id+": Data error: "+a),b._iO.ondataerror&&b._iO.ondataerror.apply(b))};this._debug()};ga=function(){return h.body||h._docElement||h.getElementsByTagName("div")[0]};B=function(a){return h.getElementById(a)};
|
61
|
+
x=function(a,d){var e=a||{},b,f;b=d===g?c.defaultOptions:d;for(f in b)b.hasOwnProperty(f)&&e[f]===g&&(e[f]="object"!==typeof b[f]||null===b[f]?b[f]:x(e[f],b[f]));return e};na=function(a,c){!a.isHTML5&&8===p?m.setTimeout(c,0):c()};L={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1};ua=function(a,d){var e,b=!0,f=d!==g,h=c.setupOptions;if(a===g){b=[];for(e in h)h.hasOwnProperty(e)&&b.push(e);for(e in L)L.hasOwnProperty(e)&&("object"===typeof c[e]?b.push(e+": {...}"):c[e]instanceof
|
62
|
+
Function?b.push(e+": function() {...}"):b.push(e));c._wD(r("setup",b.join(", ")));return!1}for(e in a)if(a.hasOwnProperty(e))if("object"!==typeof a[e]||null===a[e]||a[e]instanceof Array||a[e]instanceof RegExp)f&&L[d]!==g?c[d][e]=a[e]:h[e]!==g?(c.setupOptions[e]=a[e],c[e]=a[e]):L[e]===g?(R(r(c[e]===g?"setupUndef":"setupError",e),2),b=!1):c[e]instanceof Function?c[e].apply(c,a[e]instanceof Array?a[e]:[a[e]]):c[e]=a[e];else if(L[e]===g)R(r(c[e]===g?"setupUndef":"setupError",e),2),b=!1;else return ua(a[e],
|
63
|
+
e);return b};w=function(){function a(a){a=db.call(a);var b=a.length;e?(a[1]="on"+a[1],3<b&&a.pop()):3===b&&a.push(!1);return a}function c(a,d){var g=a.shift(),k=[b[d]];if(e)g[k](a[0],a[1]);else g[k].apply(g,a)}var e=m.attachEvent,b={add:e?"attachEvent":"addEventListener",remove:e?"detachEvent":"removeEventListener"};return{add:function(){c(a(arguments),"add")},remove:function(){c(a(arguments),"remove")}}}();F={abort:s(function(){c._wD(this._s.id+": abort")}),canplay:s(function(){var a=this._s,d;if(a._html5_canplay)return!0;
|
64
|
+
a._html5_canplay=!0;c._wD(a.id+": canplay");a._onbufferchange(0);d=a._iO.position!==g&&!isNaN(a._iO.position)?a._iO.position/1E3:null;if(a.position&&this.currentTime!==d){c._wD(a.id+": canplay: Setting position to "+d);try{this.currentTime=d}catch(e){c._wD(a.id+": canplay: Setting position of "+d+" failed: "+e.message,2)}}a._iO._oncanplay&&a._iO._oncanplay()}),canplaythrough:s(function(){var a=this._s;a.loaded||(a._onbufferchange(0),a._whileloading(a.bytesLoaded,a.bytesTotal,a._get_html5_duration()),
|
65
|
+
a._onload(!0))}),ended:s(function(){var a=this._s;c._wD(a.id+": ended");a._onfinish()}),error:s(function(){c._wD(this._s.id+": HTML5 error, code "+this.error.code);this._s._onload(!1)}),loadeddata:s(function(){var a=this._s;c._wD(a.id+": loadeddata");!a._loaded&&!Ja&&(a.duration=a._get_html5_duration())}),loadedmetadata:s(function(){c._wD(this._s.id+": loadedmetadata")}),loadstart:s(function(){c._wD(this._s.id+": loadstart");this._s._onbufferchange(1)}),play:s(function(){c._wD(this._s.id+": play()");
|
66
|
+
this._s._onbufferchange(0)}),playing:s(function(){c._wD(this._s.id+": playing");this._s._onbufferchange(0)}),progress:s(function(a){var d=this._s,e,b,f;e=0;var g="progress"===a.type,h=a.target.buffered,k=a.loaded||0,m=a.total||1;d.buffered=[];if(h&&h.length){e=0;for(b=h.length;e<b;e++)d.buffered.push({start:1E3*h.start(e),end:1E3*h.end(e)});e=1E3*(h.end(0)-h.start(0));k=e/(1E3*a.target.duration);if(g&&1<h.length){f=[];b=h.length;for(e=0;e<b;e++)f.push(1E3*a.target.buffered.start(e)+"-"+1E3*a.target.buffered.end(e));
|
67
|
+
c._wD(this._s.id+": progress, timeRanges: "+f.join(", "))}g&&!isNaN(k)&&c._wD(this._s.id+": progress, "+Math.floor(100*k)+"% loaded")}isNaN(k)||(d._onbufferchange(0),d._whileloading(k,m,d._get_html5_duration()),k&&(m&&k===m)&&F.canplaythrough.call(this,a))}),ratechange:s(function(){c._wD(this._s.id+": ratechange")}),suspend:s(function(a){var d=this._s;c._wD(this._s.id+": suspend");F.progress.call(this,a);d._onsuspend()}),stalled:s(function(){c._wD(this._s.id+": stalled")}),timeupdate:s(function(){this._s._onTimer()}),
|
68
|
+
waiting:s(function(){var a=this._s;c._wD(this._s.id+": waiting");a._onbufferchange(1)})};ma=function(a){return a.serverURL||a.type&&ca(a.type)?!1:a.type?$({type:a.type}):$({url:a.url})||c.html5Only};Ea=function(a,c){a&&(a.src=c,a._called_load=!1);E&&(Ga=null)};$=function(a){if(!c.useHTML5Audio||!c.hasHTML5)return!1;var d=a.url||null;a=a.type||null;var e=c.audioFormats,b;if(a&&c.html5[a]!==g)return c.html5[a]&&!ca(a);if(!H){H=[];for(b in e)e.hasOwnProperty(b)&&(H.push(b),e[b].related&&(H=H.concat(e[b].related)));
|
69
|
+
H=RegExp("\\.("+H.join("|")+")(\\?.*)?$","i")}b=d?d.toLowerCase().match(H):null;!b||!b.length?a&&(d=a.indexOf(";"),b=(-1!==d?a.substr(0,d):a).substr(6)):b=b[1];b&&c.html5[b]!==g?d=c.html5[b]&&!ca(b):(a="audio/"+b,d=c.html5.canPlayType({type:a}),d=(c.html5[b]=d)&&c.html5[a]&&!ca(a));return d};cb=function(){function a(a){var b,e,f=b=!1;if(!d||"function"!==typeof d.canPlayType)return b;if(a instanceof Array){b=0;for(e=a.length;b<e;b++)if(c.html5[a[b]]||d.canPlayType(a[b]).match(c.html5Test))f=!0,c.html5[a[b]]=
|
70
|
+
!0,c.flash[a[b]]=!!a[b].match(jb);b=f}else a=d&&"function"===typeof d.canPlayType?d.canPlayType(a):!1,b=!(!a||!a.match(c.html5Test));return b}if(!c.useHTML5Audio||!c.hasHTML5)return!1;var d=Audio!==g?Ka&&10>opera.version()?new Audio(null):new Audio:null,e,b,f={},h;h=c.audioFormats;for(e in h)if(h.hasOwnProperty(e)&&(b="audio/"+e,f[e]=a(h[e].type),f[b]=f[e],e.match(jb)?(c.flash[e]=!0,c.flash[b]=!0):(c.flash[e]=!1,c.flash[b]=!1),h[e]&&h[e].related))for(b=h[e].related.length-1;0<=b;b--)f["audio/"+h[e].related[b]]=
|
71
|
+
f[e],c.html5[h[e].related[b]]=f[e],c.flash[h[e].related[b]]=f[e];f.canPlayType=d?a:null;c.html5=x(c.html5,f);return!0};G={notReady:"Unavailable - wait until onready() has fired.",notOK:"Audio support is not available.",domError:"soundManagerexception caught while appending SWF to DOM.",spcWmode:"Removing wmode, preventing known SWF loading issue(s)",swf404:"soundManager: Verify that %s is a valid path.",tryDebug:"Try soundManager.debugFlash \x3d true for more security details (output goes to SWF.)",
|
72
|
+
checkSWF:"See SWF output for more debug info.",localFail:"soundManager: Non-HTTP page ("+h.location.protocol+" URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/",waitFocus:"soundManager: Special case: Waiting for SWF to load with window focus...",waitForever:"soundManager: Waiting indefinitely for Flash (will recover if unblocked)...",
|
73
|
+
waitSWF:"soundManager: Waiting for 100% SWF load...",needFunction:"soundManager: Function object expected for %s",badID:'Warning: Sound ID "%s" should be a string, starting with a non-numeric character',currentObj:"soundManager: _debug(): Current sound objects",waitOnload:"soundManager: Waiting for window.onload()",docLoaded:"soundManager: Document already loaded",onload:"soundManager: initComplete(): calling soundManager.onload()",onloadOK:"soundManager.onload() complete",didInit:"soundManager: init(): Already called?",
|
74
|
+
secNote:"Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html",badRemove:"soundManager: Failed to remove Flash node.",shutdown:"soundManager.disable(): Shutting down",queue:"soundManager: Queueing %s handler",smError:"SMSound.load(): Exception: JS-Flash communication failed, or JS error.",fbTimeout:"No flash response, applying .swf_timedout CSS...",
|
75
|
+
fbLoaded:"Flash loaded",flRemoved:"soundManager: Flash movie removed.",fbHandler:"soundManager: flashBlockHandler()",manURL:"SMSound.load(): Using manually-assigned URL",onURL:"soundManager.load(): current URL already assigned.",badFV:'soundManager.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',as2loop:"Note: Setting stream:false so looping can work (flash 8 limitation)",noNSLoop:"Note: Looping not implemented for MovieStar formats",needfl9:"Note: Switching to flash 9, required for MP4 formats.",
|
76
|
+
mfTimeout:"Setting flashLoadTimeout \x3d 0 (infinite) for off-screen, mobile flash case",needFlash:"soundManager: Fatal error: Flash is needed to play some required formats, but is not available.",gotFocus:"soundManager: Got window focus.",policy:"Enabling usePolicyFile for data access",setup:"soundManager.setup(): allowed parameters: %s",setupError:'soundManager.setup(): "%s" cannot be assigned with this method.',setupUndef:'soundManager.setup(): Could not find option "%s"',setupLate:"soundManager.setup(): url, flashVersion and html5Test property changes will not take effect until reboot().",
|
77
|
+
noURL:"soundManager: Flash URL required. Call soundManager.setup({url:...}) to get started.",sm2Loaded:"SoundManager 2: Ready.",reset:"soundManager.reset(): Removing event callbacks",mobileUA:"Mobile UA detected, preferring HTML5 by default.",globalHTML5:"Using singleton HTML5 Audio() pattern for this device."};r=function(){var a=db.call(arguments),c=a.shift(),c=G&&G[c]?G[c]:"",e,b;if(c&&a&&a.length){e=0;for(b=a.length;e<b;e++)c=c.replace("%s",a[e])}return c};ia=function(a){8===p&&(1<a.loops&&a.stream)&&
|
78
|
+
(n("as2loop"),a.stream=!1);return a};ja=function(a,d){if(a&&!a.usePolicyFile&&(a.onid3||a.usePeakData||a.useWaveformData||a.useEQData))c._wD((d||"")+r("policy")),a.usePolicyFile=!0;return a};R=function(a){console!==g&&console.warn!==g?console.warn(a):c._wD(a)};ra=function(){return!1};Wa=function(a){for(var c in a)a.hasOwnProperty(c)&&"function"===typeof a[c]&&(a[c]=ra)};Aa=function(a){a===g&&(a=!1);(t||a)&&c.disable(a)};Xa=function(a){var d=null;if(a)if(a.match(/\.swf(\?.*)?$/i)){if(d=a.substr(a.toLowerCase().lastIndexOf(".swf?")+
|
79
|
+
4))return a}else a.lastIndexOf("/")!==a.length-1&&(a+="/");a=(a&&-1!==a.lastIndexOf("/")?a.substr(0,a.lastIndexOf("/")+1):"./")+c.movieURL;c.noSWFCache&&(a+="?ts\x3d"+(new Date).getTime());return a};wa=function(){p=parseInt(c.flashVersion,10);8!==p&&9!==p&&(c._wD(r("badFV",p,8)),c.flashVersion=p=8);var a=c.debugMode||c.debugFlash?"_debug.swf":".swf";c.useHTML5Audio&&(!c.html5Only&&c.audioFormats.mp4.required&&9>p)&&(c._wD(r("needfl9")),c.flashVersion=p=9);c.version=c.versionNumber+(c.html5Only?" (HTML5-only mode)":
|
80
|
+
9===p?" (AS3/Flash 9)":" (AS2/Flash 8)");8<p?(c.defaultOptions=x(c.defaultOptions,c.flash9Options),c.features.buffering=!0,c.defaultOptions=x(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+mb.join("|")+")(\\?.*)?$","i"),c.features.movieStar=!0):c.features.movieStar=!1;c.filePattern=c.filePatterns[8!==p?"flash9":"flash8"];c.movieURL=(8===p?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",a);c.features.peakData=c.features.waveformData=c.features.eqData=8<
|
81
|
+
p};Ua=function(a,c){if(!l)return!1;l._setPolling(a,c)};za=function(){c.debugURLParam.test(S)&&(c.debugMode=!0);if(B(c.debugID))return!1;var a,d,e,b;if(c.debugMode&&!B(c.debugID)&&(!hb||!c.useConsole||!c.consoleOnly)){a=h.createElement("div");a.id=c.debugID+"-toggle";d={position:"fixed",bottom:"0px",right:"0px",width:"1.2em",height:"1.2em",lineHeight:"1.2em",margin:"2px",textAlign:"center",border:"1px solid #999",cursor:"pointer",background:"#fff",color:"#333",zIndex:10001};a.appendChild(h.createTextNode("-"));
|
82
|
+
a.onclick=Ya;a.title="Toggle SM2 debug console";u.match(/msie 6/i)&&(a.style.position="absolute",a.style.cursor="hand");for(b in d)d.hasOwnProperty(b)&&(a.style[b]=d[b]);d=h.createElement("div");d.id=c.debugID;d.style.display=c.debugMode?"block":"none";if(c.debugMode&&!B(a.id)){try{e=ga(),e.appendChild(a)}catch(f){throw Error(r("domError")+" \n"+f.toString());}e.appendChild(d)}}};v=this.getSoundById;n=function(a,d){return!a?"":c._wD(r(a),d)};Ya=function(){var a=B(c.debugID),d=B(c.debugID+"-toggle");
|
83
|
+
if(!a)return!1;ta?(d.innerHTML="+",a.style.display="none"):(d.innerHTML="-",a.style.display="block");ta=!ta};y=function(a,c,e){if(m.sm2Debugger!==g)try{sm2Debugger.handleEvent(a,c,e)}catch(b){}return!0};Q=function(){var a=[];c.debugMode&&a.push("sm2_debug");c.debugFlash&&a.push("flash_debug");c.useHighPerformance&&a.push("high_performance");return a.join(" ")};Ca=function(){var a=r("fbHandler"),d=c.getMoviePercent(),e={type:"FLASHBLOCK"};if(c.html5Only)return!1;c.ok()?(c.didFlashBlock&&c._wD(a+": Unblocked"),
|
84
|
+
c.oMC&&(c.oMC.className=[Q(),"movieContainer","swf_loaded"+(c.didFlashBlock?" swf_unblocked":"")].join(" "))):(C&&(c.oMC.className=Q()+" movieContainer "+(null===d?"swf_timedout":"swf_error"),c._wD(a+": "+r("fbTimeout")+(d?" ("+r("fbLoaded")+")":""))),c.didFlashBlock=!0,J({type:"ontimeout",ignoreInit:!0,error:e}),P(e))};va=function(a,c,e){D[a]===g&&(D[a]=[]);D[a].push({method:c,scope:e||null,fired:!1})};J=function(a){a||(a={type:c.ok()?"onready":"ontimeout"});if(!q&&a&&!a.ignoreInit||"ontimeout"===
|
85
|
+
a.type&&(c.ok()||t&&!a.ignoreInit))return!1;var d={success:a&&a.ignoreInit?c.ok():!t},e=a&&a.type?D[a.type]||[]:[],b=[],f,d=[d],g=C&&!c.ok();a.error&&(d[0].error=a.error);a=0;for(f=e.length;a<f;a++)!0!==e[a].fired&&b.push(e[a]);if(b.length){a=0;for(f=b.length;a<f;a++)b[a].scope?b[a].method.apply(b[a].scope,d):b[a].method.apply(this,d),g||(b[a].fired=!0)}return!0};M=function(){m.setTimeout(function(){c.useFlashBlock&&Ca();J();"function"===typeof c.onload&&(n("onload",1),c.onload.apply(m),n("onloadOK",
|
86
|
+
1));c.waitForWindowLoad&&w.add(m,"load",M)},1)};Ha=function(){if(A!==g)return A;var a=!1,c=navigator,e=c.plugins,b,f=m.ActiveXObject;if(e&&e.length)(c=c.mimeTypes)&&(c["application/x-shockwave-flash"]&&c["application/x-shockwave-flash"].enabledPlugin&&c["application/x-shockwave-flash"].enabledPlugin.description)&&(a=!0);else if(f!==g&&!u.match(/MSAppHost/i)){try{b=new f("ShockwaveFlash.ShockwaveFlash")}catch(h){}a=!!b}return A=a};bb=function(){var a,d,e=c.audioFormats;if(oa&&u.match(/os (1|2|3_0|3_1)/i))c.hasHTML5=
|
87
|
+
!1,c.html5Only=!0,c.oMC&&(c.oMC.style.display="none");else if(c.useHTML5Audio){if(!c.html5||!c.html5.canPlayType)c._wD("SoundManager: No HTML5 Audio() support detected."),c.hasHTML5=!1;Ma&&c._wD("soundManager: Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id\x3d32159 - "+(!A?" would use flash fallback for MP3/MP4, but none detected.":"will use flash fallback for MP3/MP4, if available"),1)}if(c.useHTML5Audio&&c.hasHTML5)for(d in e)if(e.hasOwnProperty(d)&&
|
88
|
+
(e[d].required&&!c.html5.canPlayType(e[d].type)||c.preferFlash&&(c.flash[d]||c.flash[e[d].type])))a=!0;c.ignoreFlash&&(a=!1);c.html5Only=c.hasHTML5&&c.useHTML5Audio&&!a;return!c.html5Only};la=function(a){var d,e,b=0;if(a instanceof Array){d=0;for(e=a.length;d<e;d++)if(a[d]instanceof Object){if(c.canPlayMIME(a[d].type)){b=d;break}}else if(c.canPlayURL(a[d])){b=d;break}a[b].url&&(a[b]=a[b].url);a=a[b]}return a};Za=function(a){a._hasTimer||(a._hasTimer=!0,!La&&c.html5PollingInterval&&(null===Z&&0===
|
89
|
+
ka&&(Z=setInterval(ab,c.html5PollingInterval)),ka++))};$a=function(a){a._hasTimer&&(a._hasTimer=!1,!La&&c.html5PollingInterval&&ka--)};ab=function(){var a;if(null!==Z&&!ka)return clearInterval(Z),Z=null,!1;for(a=c.soundIDs.length-1;0<=a;a--)c.sounds[c.soundIDs[a]].isHTML5&&c.sounds[c.soundIDs[a]]._hasTimer&&c.sounds[c.soundIDs[a]]._onTimer()};P=function(a){a=a!==g?a:{};"function"===typeof c.onerror&&c.onerror.apply(m,[{type:a.type!==g?a.type:null}]);a.fatal!==g&&a.fatal&&c.disable()};eb=function(){if(!Ma||
|
90
|
+
!Ha())return!1;var a=c.audioFormats,d,e;for(e in a)if(a.hasOwnProperty(e)&&("mp3"===e||"mp4"===e))if(c._wD("soundManager: Using flash fallback for "+e+" format"),c.html5[e]=!1,a[e]&&a[e].related)for(d=a[e].related.length-1;0<=d;d--)c.html5[a[e].related[d]]=!1};this._setSandboxType=function(a){var d=c.sandbox;d.type=a;d.description=d.types[d.types[a]!==g?a:"unknown"];"localWithFile"===d.type?(d.noRemote=!0,d.noLocal=!1,n("secNote",2)):"localWithNetwork"===d.type?(d.noRemote=!1,d.noLocal=!0):"localTrusted"===
|
91
|
+
d.type&&(d.noRemote=!1,d.noLocal=!1)};this._externalInterfaceOK=function(a,d){if(c.swfLoaded)return!1;var e;y("swf",!0);y("flashtojs",!0);c.swfLoaded=!0;pa=!1;Ma&&eb();if(!d||d.replace(/\+dev/i,"")!==c.versionNumber.replace(/\+dev/i,""))return e='soundManager: Fatal: JavaScript file build "'+c.versionNumber+'" does not match Flash SWF build "'+d+'" at '+c.url+". Ensure both are up-to-date.",setTimeout(function(){throw Error(e);},0),!1;setTimeout(sa,I?100:1)};ha=function(a,d){function e(){var a=[],
|
92
|
+
b,d=[];b="SoundManager "+c.version+(!c.html5Only&&c.useHTML5Audio?c.hasHTML5?" + HTML5 audio":", no HTML5 audio support":"");c.html5Only?c.html5PollingInterval&&a.push("html5PollingInterval ("+c.html5PollingInterval+"ms)"):(c.preferFlash&&a.push("preferFlash"),c.useHighPerformance&&a.push("useHighPerformance"),c.flashPollingInterval&&a.push("flashPollingInterval ("+c.flashPollingInterval+"ms)"),c.html5PollingInterval&&a.push("html5PollingInterval ("+c.html5PollingInterval+"ms)"),c.wmode&&a.push("wmode ("+
|
93
|
+
c.wmode+")"),c.debugFlash&&a.push("debugFlash"),c.useFlashBlock&&a.push("flashBlock"));a.length&&(d=d.concat([a.join(" + ")]));c._wD(b+(d.length?" + "+d.join(", "):""),1);fb()}function b(a,b){return'\x3cparam name\x3d"'+a+'" value\x3d"'+b+'" /\x3e'}if(T&&U)return!1;if(c.html5Only)return wa(),e(),c.oMC=B(c.movieID),sa(),U=T=!0,!1;var f=d||c.url,m=c.altURL||f,l=ga(),k=Q(),p=null,p=h.getElementsByTagName("html")[0],n,s,q,p=p&&p.dir&&p.dir.match(/rtl/i);a=a===g?c.id:a;wa();c.url=Xa(aa?f:m);d=c.url;c.wmode=
|
94
|
+
!c.wmode&&c.useHighPerformance?"transparent":c.wmode;if(null!==c.wmode&&(u.match(/msie 8/i)||!I&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))K.push(G.spcWmode),c.wmode=null;l={name:a,id:a,src:d,quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:kb+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};c.debugFlash&&(l.FlashVars="debug\x3d1");
|
95
|
+
c.wmode||delete l.wmode;if(I)f=h.createElement("div"),s=['\x3cobject id\x3d"'+a+'" data\x3d"'+d+'" type\x3d"'+l.type+'" title\x3d"'+l.title+'" classid\x3d"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase\x3d"'+kb+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\x3d6,0,40,0"\x3e',b("movie",d),b("AllowScriptAccess",c.allowScriptAccess),b("quality",l.quality),c.wmode?b("wmode",c.wmode):"",b("bgcolor",c.bgColor),b("hasPriority","true"),c.debugFlash?b("FlashVars",l.FlashVars):
|
96
|
+
"","\x3c/object\x3e"].join("");else for(n in f=h.createElement("embed"),l)l.hasOwnProperty(n)&&f.setAttribute(n,l[n]);za();k=Q();if(l=ga())if(c.oMC=B(c.movieID)||h.createElement("div"),c.oMC.id)q=c.oMC.className,c.oMC.className=(q?q+" ":"movieContainer")+(k?" "+k:""),c.oMC.appendChild(f),I&&(n=c.oMC.appendChild(h.createElement("div")),n.className="sm2-object-box",n.innerHTML=s),U=!0;else{c.oMC.id=c.movieID;c.oMC.className="movieContainer "+k;n=k=null;c.useFlashBlock||(c.useHighPerformance?k={position:"fixed",
|
97
|
+
width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(k={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},p&&(k.left=Math.abs(parseInt(k.left,10))+"px")));qb&&(c.oMC.style.zIndex=1E4);if(!c.debugFlash)for(q in k)k.hasOwnProperty(q)&&(c.oMC.style[q]=k[q]);try{I||c.oMC.appendChild(f),l.appendChild(c.oMC),I&&(n=c.oMC.appendChild(h.createElement("div")),n.className="sm2-object-box",n.innerHTML=s),U=!0}catch(t){throw Error(r("domError")+" \n"+t.toString());}}T=
|
98
|
+
!0;e();return!0};fa=function(){if(c.html5Only)return ha(),!1;if(l)return!1;if(!c.url)return n("noURL"),!1;l=c.getMovie(c.id);l||(X?(I?c.oMC.innerHTML=Ba:c.oMC.appendChild(X),X=null,T=!0):ha(c.id,c.url),l=c.getMovie(c.id));"function"===typeof c.oninitmovie&&setTimeout(c.oninitmovie,1);Ia();return!0};N=function(){setTimeout(Ta,1E3)};Ta=function(){var a,d=!1;if(!c.url||Y)return!1;Y=!0;w.remove(m,"load",N);if(pa&&!Na)return n("waitFocus"),!1;q||(a=c.getMoviePercent(),0<a&&100>a&&(d=!0));setTimeout(function(){a=
|
99
|
+
c.getMoviePercent();if(d)return Y=!1,c._wD(r("waitSWF")),m.setTimeout(N,1),!1;q||(c._wD("soundManager: No Flash response within expected time. Likely causes: "+(0===a?"SWF load failed, ":"")+"Flash blocked or JS-Flash security error."+(c.debugFlash?" "+r("checkSWF"):""),2),!aa&&a&&(n("localFail",2),c.debugFlash||n("tryDebug",2)),0===a&&c._wD(r("swf404",c.url),1),y("flashtojs",!1,": Timed out"+aa?" (Check flash security or flash blockers)":" (No plugin/missing SWF?)"));!q&&ib&&(null===a?c.useFlashBlock||
|
100
|
+
0===c.flashLoadTimeout?(c.useFlashBlock&&Ca(),n("waitForever")):(n("waitForever"),J({type:"ontimeout",ignoreInit:!0})):0===c.flashLoadTimeout?n("waitForever"):Aa(!0))},c.flashLoadTimeout)};ea=function(){if(Na||!pa)return w.remove(m,"focus",ea),!0;Na=ib=!0;n("gotFocus");Y=!1;N();w.remove(m,"focus",ea);return!0};Ia=function(){K.length&&(c._wD("SoundManager 2: "+K.join(" "),1),K=[])};fb=function(){Ia();var a,d=[];if(c.useHTML5Audio&&c.hasHTML5){for(a in c.audioFormats)c.audioFormats.hasOwnProperty(a)&&
|
101
|
+
d.push(a+" \x3d "+c.html5[a]+(!c.html5[a]&&A&&c.flash[a]?" (using flash)":c.preferFlash&&c.flash[a]&&A?" (preferring flash)":!c.html5[a]?" ("+(c.audioFormats[a].required?"required, ":"")+"and no flash support)":""));c._wD("SoundManager 2 HTML5 support: "+d.join(", "),1)}};V=function(a){if(q)return!1;if(c.html5Only)return n("sm2Loaded"),q=!0,M(),y("onload",!0),!0;var d=!0,e;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())q=!0,t&&(e={type:!A&&C?"NO_FLASH":"INIT_TIMEOUT"});c._wD("SoundManager 2 "+
|
102
|
+
(t?"failed to load":"loaded")+" ("+(t?"Flash security/load error":"OK")+")",t?2:1);t||a?(c.useFlashBlock&&c.oMC&&(c.oMC.className=Q()+" "+(null===c.getMoviePercent()?"swf_timedout":"swf_error")),J({type:"ontimeout",error:e,ignoreInit:!0}),y("onload",!1),P(e),d=!1):y("onload",!0);t||(c.waitForWindowLoad&&!da?(n("waitOnload"),w.add(m,"load",M)):(c.waitForWindowLoad&&da&&n("docLoaded"),M()));return d};Sa=function(){var a,d=c.setupOptions;for(a in d)d.hasOwnProperty(a)&&(c[a]===g?c[a]=d[a]:c[a]!==d[a]&&
|
103
|
+
(c.setupOptions[a]=c[a]))};sa=function(){if(q)return n("didInit"),!1;if(c.html5Only)return q||(w.remove(m,"load",c.beginDelayedInit),c.enabled=!0,V()),!0;fa();try{l._externalInterfaceTest(!1),Ua(!0,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||l._disableDebug(),c.enabled=!0,y("jstoflash",!0),c.html5Only||w.add(m,"unload",ra)}catch(a){return c._wD("js/flash exception: "+a.toString()),y("jstoflash",!1),P({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),Aa(!0),V(),!1}V();w.remove(m,"load",
|
104
|
+
c.beginDelayedInit);return!0};O=function(){if(W)return!1;W=!0;Sa();za();var a=null,a=null,d=m.console!==g&&"function"===typeof console.log,e=S.toLowerCase();-1!==e.indexOf("sm2-usehtml5audio\x3d")&&(a="1"===e.charAt(e.indexOf("sm2-usehtml5audio\x3d")+18),d&&console.log((a?"Enabling ":"Disabling ")+"useHTML5Audio via URL parameter"),c.setup({useHTML5Audio:a}));-1!==e.indexOf("sm2-preferflash\x3d")&&(a="1"===e.charAt(e.indexOf("sm2-preferflash\x3d")+16),d&&console.log((a?"Enabling ":"Disabling ")+"preferFlash via URL parameter"),
|
105
|
+
c.setup({preferFlash:a}));!A&&c.hasHTML5&&(c._wD("SoundManager: No Flash detected"+(!c.useHTML5Audio?", enabling HTML5.":". Trying HTML5-only mode."),1),c.setup({useHTML5Audio:!0,preferFlash:!1}));cb();c.html5.usingFlash=bb();C=c.html5.usingFlash;!A&&C&&(K.push(G.needFlash),c.setup({flashLoadTimeout:1}));h.removeEventListener&&h.removeEventListener("DOMContentLoaded",O,!1);fa();return!0};Fa=function(){"complete"===h.readyState&&(O(),h.detachEvent("onreadystatechange",Fa));return!0};ya=function(){da=
|
106
|
+
!0;w.remove(m,"load",ya)};xa=function(){if(La&&((!c.setupOptions.useHTML5Audio||c.setupOptions.preferFlash)&&K.push(G.mobileUA),c.setupOptions.useHTML5Audio=!0,c.setupOptions.preferFlash=!1,oa||gb&&!u.match(/android\s2\.3/i)))K.push(G.globalHTML5),oa&&(c.ignoreFlash=!0),E=!0};xa();Ha();w.add(m,"focus",ea);w.add(m,"load",N);w.add(m,"load",ya);h.addEventListener?h.addEventListener("DOMContentLoaded",O,!1):h.attachEvent?h.attachEvent("onreadystatechange",Fa):(y("onload",!1),P({type:"NO_DOM2_EVENTS",
|
107
|
+
fatal:!0}))}var qa=null;if(void 0===m.SM2_DEFER||!SM2_DEFER)qa=new ba;m.SoundManager=ba;m.soundManager=qa})(window);
|
@@ -8,73 +8,72 @@
|
|
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.20130324 ("Mahalo" Edition)
|
12
12
|
*/
|
13
|
-
(function(
|
14
|
-
|
15
|
-
|
16
|
-
required:!1}};this.movieID="sm2-container";this.id=
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
a.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
function(
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
f
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
a.
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
c.
|
64
|
-
"
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
(
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
(
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
m.addEventListener("DOMContentLoaded",E,!1):m.attachEvent?m.attachEvent("onreadystatechange",wa):F({type:"NO_DOM2_EVENTS",fatal:!0})}var ea=null;if("undefined"===typeof SM2_DEFER||!SM2_DEFER)ea=new R;fa.SoundManager=R;fa.soundManager=ea})(window);
|
13
|
+
(function(k,g){function U(U,ia){function V(b){return c.preferFlash&&D&&!c.ignoreFlash&&c.flash[b]!==g&&c.flash[b]}function m(b){return function(c){var d=this._s;return!d||!d._a?null:b.call(this,c)}}this.setupOptions={url:U||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1E3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,
|
14
|
+
html5Test:/^(probably|maybe)$/i,preferFlash:!0,noSWFCache:!1};this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100};this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null};
|
15
|
+
this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.audioFormats={mp3:{type:['audio/mpeg; codecs\x3d"mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],type:['audio/mp4; codecs\x3d"mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs\x3dvorbis"],required:!1},opus:{type:["audio/ogg; codecs\x3dopus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs\x3d"1"',
|
16
|
+
"audio/wav","audio/wave","audio/x-wav"],required:!1}};this.movieID="sm2-container";this.id=ia||"sm2movie";this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20130324";this.altURL=this.movieURL=this.version=null;this.enabled=this.swfLoaded=!1;this.oMC=null;this.sounds={};this.soundIDs=[];this.didFlashBlock=this.muted=!1;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:!1,peakData:!1,waveformData:!1,
|
17
|
+
eqData:!1,movieStar:!1};this.sandbox={};this.html5={usingFlash:null};this.flash={};this.ignoreFlash=this.html5Only=!1;var Ja,c=this,Ka=null,h=null,W,q=navigator.userAgent,ja=k.location.href.toString(),n=document,ka,La,la,l,x=[],M=!1,N=!1,r=!1,v=!1,ma=!1,O,u,na,X,oa,E,F,G,Ma,pa,Y,qa,Z,ra,H,sa,P,ta,$,I,Na,ua,Oa,va,Pa,Q=null,wa=null,y,xa,J,aa,ba,K,p,R=!1,ya=!1,Qa,Ra,Sa,ca=0,S=null,da,Ta=[],t=null,Ua,ea,T,B,za,Aa,Va,s,eb=Array.prototype.slice,z=!1,Ba,D,Ca,Wa,A,fa,ga=q.match(/(ipad|iphone|ipod)/i),Xa=
|
18
|
+
q.match(/android/i),C=q.match(/msie/i),fb=q.match(/webkit/i),Da=q.match(/safari/i)&&!q.match(/chrome/i),Ea=q.match(/opera/i),Fa=q.match(/(mobile|pre\/|xoom)/i)||ga||Xa,Ya=!ja.match(/usehtml5audio/i)&&!ja.match(/sm2\-ignorebadua/i)&&Da&&!q.match(/silk/i)&&q.match(/OS X 10_6_([3-7])/i),Ga=n.hasFocus!==g?n.hasFocus():null,ha=Da&&(n.hasFocus===g||!n.hasFocus()),Za=!ha,$a=/(mp3|mp4|mpa|m4a|m4b)/i,Ha=n.location?n.location.protocol.match(/http/i):null,ab=!Ha?"http://":"",bb=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,
|
19
|
+
cb="mpeg4 aac flv mov mp4 m4v f4v m4a m4b mp4v 3gp 3g2".split(" "),gb=RegExp("\\.("+cb.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!Ha;var Ia;try{Ia=Audio!==g&&(Ea&&opera!==g&&10>opera.version()?new Audio(null):new Audio).canPlayType!==g}catch(hb){Ia=!1}this.hasHTML5=Ia;this.setup=function(b){var e=!c.url;b!==g&&(r&&t&&c.ok()&&(b.flashVersion!==g||b.url!==g||b.html5Test!==g))&&K(y("setupLate"));na(b);e&&(P&&b.url!==g)&&c.beginDelayedInit();
|
20
|
+
!P&&(b.url!==g&&"complete"===n.readyState)&&setTimeout(H,1);return c};this.supported=this.ok=function(){return t?r&&!v:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(b){return W(b)||n[b]||k[b]};this.createSound=function(b,e){function d(){a=aa(a);c.sounds[a.id]=new Ja(a);c.soundIDs.push(a.id);return c.sounds[a.id]}var a,f=null;if(!r||!c.ok())return K(void 0),!1;e!==g&&(b={id:b,url:e});a=u(b);a.url=da(a.url);if(p(a.id,!0))return c.sounds[a.id];ea(a)?(f=d(),f._setup_html5(a)):(8<l&&null===a.isMovieStar&&
|
21
|
+
(a.isMovieStar=!(!a.serverURL&&!(a.type&&a.type.match(bb)||a.url.match(gb)))),a=ba(a,void 0),f=d(),8===l?h._createSound(a.id,a.loops||1,a.usePolicyFile):(h._createSound(a.id,a.url,a.usePeakData,a.useWaveformData,a.useEQData,a.isMovieStar,a.isMovieStar?a.bufferTime:!1,a.loops||1,a.serverURL,a.duration||null,a.autoPlay,!0,a.autoLoad,a.usePolicyFile),a.serverURL||(f.connected=!0,a.onconnect&&a.onconnect.apply(f))),!a.serverURL&&(a.autoLoad||a.autoPlay)&&f.load(a));!a.serverURL&&a.autoPlay&&f.play();
|
22
|
+
return f};this.destroySound=function(b,e){if(!p(b))return!1;var d=c.sounds[b],a;d._iO={};d.stop();d.unload();for(a=0;a<c.soundIDs.length;a++)if(c.soundIDs[a]===b){c.soundIDs.splice(a,1);break}e||d.destruct(!0);delete c.sounds[b];return!0};this.load=function(b,e){return!p(b)?!1:c.sounds[b].load(e)};this.unload=function(b){return!p(b)?!1:c.sounds[b].unload()};this.onposition=this.onPosition=function(b,e,d,a){return!p(b)?!1:c.sounds[b].onposition(e,d,a)};this.clearOnPosition=function(b,e,d){return!p(b)?
|
23
|
+
!1:c.sounds[b].clearOnPosition(e,d)};this.start=this.play=function(b,e){var d=!1;return!r||!c.ok()?(K("soundManager.play(): "+y(!r?"notReady":"notOK")),d):!p(b)?(e instanceof Object||(e={url:e}),e&&e.url&&(e.id=b,d=c.createSound(e).play()),d):c.sounds[b].play(e)};this.setPosition=function(b,e){return!p(b)?!1:c.sounds[b].setPosition(e)};this.stop=function(b){return!p(b)?!1:c.sounds[b].stop()};this.stopAll=function(){for(var b in c.sounds)c.sounds.hasOwnProperty(b)&&c.sounds[b].stop()};this.pause=function(b){return!p(b)?
|
24
|
+
!1:c.sounds[b].pause()};this.pauseAll=function(){var b;for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].pause()};this.resume=function(b){return!p(b)?!1:c.sounds[b].resume()};this.resumeAll=function(){var b;for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){return!p(b)?!1:c.sounds[b].togglePause()};this.setPan=function(b,e){return!p(b)?!1:c.sounds[b].setPan(e)};this.setVolume=function(b,e){return!p(b)?!1:c.sounds[b].setVolume(e)};this.mute=function(b){var e=
|
25
|
+
0;b instanceof String&&(b=null);if(b)return!p(b)?!1:c.sounds[b].mute();for(e=c.soundIDs.length-1;0<=e;e--)c.sounds[c.soundIDs[e]].mute();return c.muted=!0};this.muteAll=function(){c.mute()};this.unmute=function(b){b instanceof String&&(b=null);if(b)return!p(b)?!1:c.sounds[b].unmute();for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].unmute();c.muted=!1;return!0};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){return!p(b)?!1:c.sounds[b].toggleMute()};this.getMemoryUse=function(){var b=
|
26
|
+
0;h&&8!==l&&(b=parseInt(h._getMemoryUse(),10));return b};this.disable=function(b){var e;b===g&&(b=!1);if(v)return!1;v=!0;for(e=c.soundIDs.length-1;0<=e;e--)Oa(c.sounds[c.soundIDs[e]]);O(b);s.remove(k,"load",F);return!0};this.canPlayMIME=function(b){var e;c.hasHTML5&&(e=T({type:b}));!e&&t&&(e=b&&c.ok()?!!(8<l&&b.match(bb)||b.match(c.mimePattern)):null);return e};this.canPlayURL=function(b){var e;c.hasHTML5&&(e=T({url:b}));!e&&t&&(e=b&&c.ok()?!!b.match(c.filePattern):null);return e};this.canPlayLink=
|
27
|
+
function(b){return b.type!==g&&b.type&&c.canPlayMIME(b.type)?!0:c.canPlayURL(b.href)};this.getSoundById=function(b,e){if(!b)throw Error("soundManager.getSoundById(): sID is null/_undefined");return c.sounds[b]};this.onready=function(b,c){if("function"===typeof b)c||(c=k),oa("onready",b,c),E();else throw y("needFunction","onready");return!0};this.ontimeout=function(b,c){if("function"===typeof b)c||(c=k),oa("ontimeout",b,c),E({type:"ontimeout"});else throw y("needFunction","ontimeout");return!0};this._wD=
|
28
|
+
this._writeDebug=function(b,c){return!0};this._debug=function(){};this.reboot=function(b,e){var d,a,f;for(d=c.soundIDs.length-1;0<=d;d--)c.sounds[c.soundIDs[d]].destruct();if(h)try{C&&(wa=h.innerHTML),Q=h.parentNode.removeChild(h)}catch(g){}wa=Q=t=h=null;c.enabled=P=r=R=ya=M=N=v=z=c.swfLoaded=!1;c.soundIDs=[];c.sounds={};if(b)x=[];else for(d in x)if(x.hasOwnProperty(d)){a=0;for(f=x[d].length;a<f;a++)x[d][a].fired=!1}c.html5={usingFlash:null};c.flash={};c.html5Only=!1;c.ignoreFlash=!1;k.setTimeout(function(){ra();
|
29
|
+
e||c.beginDelayedInit()},20);return c};this.reset=function(){return c.reboot(!0,!0)};this.getMoviePercent=function(){return h&&"PercentLoaded"in h?h.PercentLoaded():null};this.beginDelayedInit=function(){ma=!0;H();setTimeout(function(){if(ya)return!1;$();Z();return ya=!0},20);G()};this.destruct=function(){c.disable(!0)};Ja=function(b){var e,d,a=this,f,w,db,L,k,n,m=!1,q=[],r=0,s,v,t=null;d=e=null;this.sID=this.id=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=u(b);this.pan=this.options.pan;
|
30
|
+
this.volume=this.options.volume;this.isHTML5=!1;this._a=null;this.id3={};this._debug=function(){};this.load=function(b){var c=null,e;b!==g?a._iO=u(b,a.options):(b=a.options,a._iO=b,t&&t!==a.url&&(a._iO.url=a.url,a.url=null));a._iO.url||(a._iO.url=a.url);a._iO.url=da(a._iO.url);e=a.instanceOptions=a._iO;if(e.url===a.url&&0!==a.readyState&&2!==a.readyState)return 3===a.readyState&&e.onload&&fa(a,function(){e.onload.apply(a,[!!a.duration])}),a;a.loaded=!1;a.readyState=1;a.playState=0;a.id3={};if(ea(e))c=
|
31
|
+
a._setup_html5(e),c._called_load||(a._html5_canplay=!1,a.url!==e.url&&(a._a.src=e.url,a.setPosition(0)),a._a.autobuffer="auto",a._a.preload="auto",a._a._called_load=!0,e.autoPlay&&a.play());else try{a.isHTML5=!1,a._iO=ba(aa(e)),e=a._iO,8===l?h._load(a.id,e.url,e.stream,e.autoPlay,e.usePolicyFile):h._load(a.id,e.url,!!e.stream,!!e.autoPlay,e.loops||1,!!e.autoLoad,e.usePolicyFile)}catch(d){I({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}a.url=e.url;return a};this.unload=function(){0!==a.readyState&&
|
32
|
+
(a.isHTML5?(L(),a._a&&(a._a.pause(),za(a._a,"about:blank"),t="about:blank")):8===l?h._unload(a.id,"about:blank"):h._unload(a.id),f());return a};this.destruct=function(b){a.isHTML5?(L(),a._a&&(a._a.pause(),za(a._a),z||db(),a._a._s=null,a._a=null)):(a._iO.onfailure=null,h._destroySound(a.id));b||c.destroySound(a.id,!0)};this.start=this.play=function(b,c){var e,d;d=!0;d=null;c=c===g?!0:c;b||(b={});a.url&&(a._iO.url=a.url);a._iO=u(a._iO,a.options);a._iO=u(b,a._iO);a._iO.url=da(a._iO.url);a.instanceOptions=
|
33
|
+
a._iO;if(a._iO.serverURL&&!a.connected)return a.getAutoPlay()||a.setAutoPlay(!0),a;ea(a._iO)&&(a._setup_html5(a._iO),k());1===a.playState&&!a.paused&&((e=a._iO.multiShot)||(d=a));if(null!==d)return d;b.url&&b.url!==a.url&&a.load(a._iO);a.loaded||(0===a.readyState?(a.isHTML5||(a._iO.autoPlay=!0),a.load(a._iO),a.instanceOptions=a._iO):2===a.readyState&&(d=a));if(null!==d)return d;!a.isHTML5&&(9===l&&0<a.position&&a.position===a.duration)&&(b.position=0);if(a.paused&&0<=a.position&&(!a._iO.serverURL||
|
34
|
+
0<a.position))a.resume();else{a._iO=u(b,a._iO);if(null!==a._iO.from&&null!==a._iO.to&&0===a.instanceCount&&0===a.playState&&!a._iO.serverURL){e=function(){a._iO=u(b,a._iO);a.play(a._iO)};if(a.isHTML5&&!a._html5_canplay)a.load({oncanplay:e}),d=!1;else if(!a.isHTML5&&!a.loaded&&(!a.readyState||2!==a.readyState))a.load({onload:e}),d=!1;if(null!==d)return d;a._iO=v()}(!a.instanceCount||a._iO.multiShotEvents||!a.isHTML5&&8<l&&!a.getAutoPlay())&&a.instanceCount++;a._iO.onposition&&0===a.playState&&n(a);
|
35
|
+
a.playState=1;a.paused=!1;a.position=a._iO.position!==g&&!isNaN(a._iO.position)?a._iO.position:0;a.isHTML5||(a._iO=ba(aa(a._iO)));a._iO.onplay&&c&&(a._iO.onplay.apply(a),m=!0);a.setVolume(a._iO.volume,!0);a.setPan(a._iO.pan,!0);a.isHTML5?(k(),d=a._setup_html5(),a.setPosition(a._iO.position),d.play()):(d=h._start(a.id,a._iO.loops||1,9===l?a.position:a.position/1E3,a._iO.multiShot||!1),9===l&&!d&&a._iO.onplayerror&&a._iO.onplayerror.apply(a))}return a};this.stop=function(b){var c=a._iO;1===a.playState&&
|
36
|
+
(a._onbufferchange(0),a._resetOnPosition(0),a.paused=!1,a.isHTML5||(a.playState=0),s(),c.to&&a.clearOnPosition(c.to),a.isHTML5?a._a&&(b=a.position,a.setPosition(0),a.position=b,a._a.pause(),a.playState=0,a._onTimer(),L()):(h._stop(a.id,b),c.serverURL&&a.unload()),a.instanceCount=0,a._iO={},c.onstop&&c.onstop.apply(a));return a};this.setAutoPlay=function(b){a._iO.autoPlay=b;a.isHTML5||(h._setAutoPlay(a.id,b),b&&!a.instanceCount&&1===a.readyState&&a.instanceCount++)};this.getAutoPlay=function(){return a._iO.autoPlay};
|
37
|
+
this.setPosition=function(b){b===g&&(b=0);var c=a.isHTML5?Math.max(b,0):Math.min(a.duration||a._iO.duration,Math.max(b,0));a.position=c;b=a.position/1E3;a._resetOnPosition(a.position);a._iO.position=c;if(a.isHTML5){if(a._a&&a._html5_canplay&&a._a.currentTime!==b)try{a._a.currentTime=b,(0===a.playState||a.paused)&&a._a.pause()}catch(e){}}else b=9===l?a.position:b,a.readyState&&2!==a.readyState&&h._setPosition(a.id,b,a.paused||!a.playState,a._iO.multiShot);a.isHTML5&&a.paused&&a._onTimer(!0);return a};
|
38
|
+
this.pause=function(b){if(a.paused||0===a.playState&&1!==a.readyState)return a;a.paused=!0;a.isHTML5?(a._setup_html5().pause(),L()):(b||b===g)&&h._pause(a.id,a._iO.multiShot);a._iO.onpause&&a._iO.onpause.apply(a);return a};this.resume=function(){var b=a._iO;if(!a.paused)return a;a.paused=!1;a.playState=1;a.isHTML5?(a._setup_html5().play(),k()):(b.isMovieStar&&!b.serverURL&&a.setPosition(a.position),h._pause(a.id,b.multiShot));!m&&b.onplay?(b.onplay.apply(a),m=!0):b.onresume&&b.onresume.apply(a);return a};
|
39
|
+
this.togglePause=function(){if(0===a.playState)return a.play({position:9===l&&!a.isHTML5?a.position:a.position/1E3}),a;a.paused?a.resume():a.pause();return a};this.setPan=function(b,c){b===g&&(b=0);c===g&&(c=!1);a.isHTML5||h._setPan(a.id,b);a._iO.pan=b;c||(a.pan=b,a.options.pan=b);return a};this.setVolume=function(b,e){b===g&&(b=100);e===g&&(e=!1);a.isHTML5?a._a&&(a._a.volume=Math.max(0,Math.min(1,b/100))):h._setVolume(a.id,c.muted&&!a.muted||a.muted?0:b);a._iO.volume=b;e||(a.volume=b,a.options.volume=
|
40
|
+
b);return a};this.mute=function(){a.muted=!0;a.isHTML5?a._a&&(a._a.muted=!0):h._setVolume(a.id,0);return a};this.unmute=function(){a.muted=!1;var b=a._iO.volume!==g;a.isHTML5?a._a&&(a._a.muted=!1):h._setVolume(a.id,b?a._iO.volume:a.options.volume);return a};this.toggleMute=function(){return a.muted?a.unmute():a.mute()};this.onposition=this.onPosition=function(b,c,e){q.push({position:parseInt(b,10),method:c,scope:e!==g?e:a,fired:!1});return a};this.clearOnPosition=function(a,b){var c;a=parseInt(a,
|
41
|
+
10);if(isNaN(a))return!1;for(c=0;c<q.length;c++)if(a===q[c].position&&(!b||b===q[c].method))q[c].fired&&r--,q.splice(c,1)};this._processOnPosition=function(){var b,c;b=q.length;if(!b||!a.playState||r>=b)return!1;for(b-=1;0<=b;b--)c=q[b],!c.fired&&a.position>=c.position&&(c.fired=!0,r++,c.method.apply(c.scope,[c.position]));return!0};this._resetOnPosition=function(a){var b,c;b=q.length;if(!b)return!1;for(b-=1;0<=b;b--)c=q[b],c.fired&&a<=c.position&&(c.fired=!1,r--);return!0};v=function(){var b=a._iO,
|
42
|
+
c=b.from,e=b.to,d,f;f=function(){a.clearOnPosition(e,f);a.stop()};d=function(){if(null!==e&&!isNaN(e))a.onPosition(e,f)};null!==c&&!isNaN(c)&&(b.position=c,b.multiShot=!1,d());return b};n=function(){var b,c=a._iO.onposition;if(c)for(b in c)if(c.hasOwnProperty(b))a.onPosition(parseInt(b,10),c[b])};s=function(){var b,c=a._iO.onposition;if(c)for(b in c)c.hasOwnProperty(b)&&a.clearOnPosition(parseInt(b,10))};k=function(){a.isHTML5&&Qa(a)};L=function(){a.isHTML5&&Ra(a)};f=function(b){b||(q=[],r=0);m=!1;
|
43
|
+
a._hasTimer=null;a._a=null;a._html5_canplay=!1;a.bytesLoaded=null;a.bytesTotal=null;a.duration=a._iO&&a._iO.duration?a._iO.duration:null;a.durationEstimate=null;a.buffered=[];a.eqData=[];a.eqData.left=[];a.eqData.right=[];a.failures=0;a.isBuffering=!1;a.instanceOptions={};a.instanceCount=0;a.loaded=!1;a.metadata={};a.readyState=0;a.muted=!1;a.paused=!1;a.peakData={left:0,right:0};a.waveformData={left:[],right:[]};a.playState=0;a.position=null;a.id3={}};f();this._onTimer=function(b){var c,f=!1,g={};
|
44
|
+
if(a._hasTimer||b){if(a._a&&(b||(0<a.playState||1===a.readyState)&&!a.paused))c=a._get_html5_duration(),c!==e&&(e=c,a.duration=c,f=!0),a.durationEstimate=a.duration,c=1E3*a._a.currentTime||0,c!==d&&(d=c,f=!0),(f||b)&&a._whileplaying(c,g,g,g,g);return f}};this._get_html5_duration=function(){var b=a._iO;return(b=a._a&&a._a.duration?1E3*a._a.duration:b&&b.duration?b.duration:null)&&!isNaN(b)&&Infinity!==b?b:null};this._apply_loop=function(a,b){a.loop=1<b?"loop":""};this._setup_html5=function(b){b=u(a._iO,
|
45
|
+
b);var c=z?Ka:a._a,e=decodeURI(b.url),d;z?e===decodeURI(Ba)&&(d=!0):e===decodeURI(t)&&(d=!0);if(c){if(c._s)if(z)c._s&&(c._s.playState&&!d)&&c._s.stop();else if(!z&&e===decodeURI(t))return a._apply_loop(c,b.loops),c;d||(f(!1),c.src=b.url,Ba=t=a.url=b.url,c._called_load=!1)}else a._a=b.autoLoad||b.autoPlay?new Audio(b.url):Ea&&10>opera.version()?new Audio(null):new Audio,c=a._a,c._called_load=!1,z&&(Ka=c);a.isHTML5=!0;a._a=c;c._s=a;w();a._apply_loop(c,b.loops);b.autoLoad||b.autoPlay?a.load():(c.autobuffer=
|
46
|
+
!1,c.preload="auto");return c};w=function(){if(a._a._added_events)return!1;var b;a._a._added_events=!0;for(b in A)A.hasOwnProperty(b)&&a._a&&a._a.addEventListener(b,A[b],!1);return!0};db=function(){var b;a._a._added_events=!1;for(b in A)A.hasOwnProperty(b)&&a._a&&a._a.removeEventListener(b,A[b],!1)};this._onload=function(b){var c=!!b||!a.isHTML5&&8===l&&a.duration;a.loaded=c;a.readyState=c?3:2;a._onbufferchange(0);a._iO.onload&&fa(a,function(){a._iO.onload.apply(a,[c])});return!0};this._onbufferchange=
|
47
|
+
function(b){if(0===a.playState||b&&a.isBuffering||!b&&!a.isBuffering)return!1;a.isBuffering=1===b;a._iO.onbufferchange&&a._iO.onbufferchange.apply(a);return!0};this._onsuspend=function(){a._iO.onsuspend&&a._iO.onsuspend.apply(a);return!0};this._onfailure=function(b,c,e){a.failures++;if(a._iO.onfailure&&1===a.failures)a._iO.onfailure(a,b,c,e)};this._onfinish=function(){var b=a._iO.onfinish;a._onbufferchange(0);a._resetOnPosition(0);a.instanceCount&&(a.instanceCount--,a.instanceCount||(s(),a.playState=
|
48
|
+
0,a.paused=!1,a.instanceCount=0,a.instanceOptions={},a._iO={},L(),a.isHTML5&&(a.position=0)),(!a.instanceCount||a._iO.multiShotEvents)&&b&&fa(a,function(){b.apply(a)}))};this._whileloading=function(b,c,e,d){var f=a._iO;a.bytesLoaded=b;a.bytesTotal=c;a.duration=Math.floor(e);a.bufferLength=d;a.durationEstimate=!a.isHTML5&&!f.isMovieStar?f.duration?a.duration>f.duration?a.duration:f.duration:parseInt(a.bytesTotal/a.bytesLoaded*a.duration,10):a.duration;a.isHTML5||(a.buffered=[{start:0,end:a.duration}]);
|
49
|
+
(3!==a.readyState||a.isHTML5)&&f.whileloading&&f.whileloading.apply(a)};this._whileplaying=function(b,c,e,d,f){var w=a._iO;if(isNaN(b)||null===b)return!1;a.position=Math.max(0,b);a._processOnPosition();!a.isHTML5&&8<l&&(w.usePeakData&&(c!==g&&c)&&(a.peakData={left:c.leftPeak,right:c.rightPeak}),w.useWaveformData&&(e!==g&&e)&&(a.waveformData={left:e.split(","),right:d.split(",")}),w.useEQData&&(f!==g&&f&&f.leftEQ)&&(b=f.leftEQ.split(","),a.eqData=b,a.eqData.left=b,f.rightEQ!==g&&f.rightEQ&&(a.eqData.right=
|
50
|
+
f.rightEQ.split(","))));1===a.playState&&(!a.isHTML5&&(8===l&&!a.position&&a.isBuffering)&&a._onbufferchange(0),w.whileplaying&&w.whileplaying.apply(a));return!0};this._oncaptiondata=function(b){a.captiondata=b;a._iO.oncaptiondata&&a._iO.oncaptiondata.apply(a,[b])};this._onmetadata=function(b,c){var e={},d,f;d=0;for(f=b.length;d<f;d++)e[b[d]]=c[d];a.metadata=e;a._iO.onmetadata&&a._iO.onmetadata.apply(a)};this._onid3=function(b,c){var e=[],d,f;d=0;for(f=b.length;d<f;d++)e[b[d]]=c[d];a.id3=u(a.id3,
|
51
|
+
e);a._iO.onid3&&a._iO.onid3.apply(a)};this._onconnect=function(b){b=1===b;if(a.connected=b)a.failures=0,p(a.id)&&(a.getAutoPlay()?a.play(g,a.getAutoPlay()):a._iO.autoLoad&&a.load()),a._iO.onconnect&&a._iO.onconnect.apply(a,[b])};this._ondataerror=function(b){0<a.playState&&a._iO.ondataerror&&a._iO.ondataerror.apply(a)}};ta=function(){return n.body||n._docElement||n.getElementsByTagName("div")[0]};W=function(b){return n.getElementById(b)};u=function(b,e){var d=b||{},a,f;a=e===g?c.defaultOptions:e;
|
52
|
+
for(f in a)a.hasOwnProperty(f)&&d[f]===g&&(d[f]="object"!==typeof a[f]||null===a[f]?a[f]:u(d[f],a[f]));return d};fa=function(b,c){!b.isHTML5&&8===l?k.setTimeout(c,0):c()};X={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1};na=function(b,e){var d,a=!0,f=e!==g,w=c.setupOptions;for(d in b)if(b.hasOwnProperty(d))if("object"!==typeof b[d]||null===b[d]||b[d]instanceof Array||b[d]instanceof RegExp)f&&X[e]!==g?c[e][d]=b[d]:w[d]!==g?(c.setupOptions[d]=b[d],c[d]=b[d]):X[d]===g?(K(y(c[d]===
|
53
|
+
g?"setupUndef":"setupError",d),2),a=!1):c[d]instanceof Function?c[d].apply(c,b[d]instanceof Array?b[d]:[b[d]]):c[d]=b[d];else if(X[d]===g)K(y(c[d]===g?"setupUndef":"setupError",d),2),a=!1;else return na(b[d],d);return a};s=function(){function b(a){a=eb.call(a);var b=a.length;d?(a[1]="on"+a[1],3<b&&a.pop()):3===b&&a.push(!1);return a}function c(b,e){var g=b.shift(),h=[a[e]];if(d)g[h](b[0],b[1]);else g[h].apply(g,b)}var d=k.attachEvent,a={add:d?"attachEvent":"addEventListener",remove:d?"detachEvent":
|
54
|
+
"removeEventListener"};return{add:function(){c(b(arguments),"add")},remove:function(){c(b(arguments),"remove")}}}();A={abort:m(function(){}),canplay:m(function(){var b=this._s,c;if(b._html5_canplay)return!0;b._html5_canplay=!0;b._onbufferchange(0);c=b._iO.position!==g&&!isNaN(b._iO.position)?b._iO.position/1E3:null;if(b.position&&this.currentTime!==c)try{this.currentTime=c}catch(d){}b._iO._oncanplay&&b._iO._oncanplay()}),canplaythrough:m(function(){var b=this._s;b.loaded||(b._onbufferchange(0),b._whileloading(b.bytesLoaded,
|
55
|
+
b.bytesTotal,b._get_html5_duration()),b._onload(!0))}),ended:m(function(){this._s._onfinish()}),error:m(function(){this._s._onload(!1)}),loadeddata:m(function(){var b=this._s;!b._loaded&&!Da&&(b.duration=b._get_html5_duration())}),loadedmetadata:m(function(){}),loadstart:m(function(){this._s._onbufferchange(1)}),play:m(function(){this._s._onbufferchange(0)}),playing:m(function(){this._s._onbufferchange(0)}),progress:m(function(b){var c=this._s,d,a,f=0,f=b.target.buffered;d=b.loaded||0;var g=b.total||
|
56
|
+
1;c.buffered=[];if(f&&f.length){d=0;for(a=f.length;d<a;d++)c.buffered.push({start:1E3*f.start(d),end:1E3*f.end(d)});f=1E3*(f.end(0)-f.start(0));d=f/(1E3*b.target.duration)}isNaN(d)||(c._onbufferchange(0),c._whileloading(d,g,c._get_html5_duration()),d&&(g&&d===g)&&A.canplaythrough.call(this,b))}),ratechange:m(function(){}),suspend:m(function(b){var c=this._s;A.progress.call(this,b);c._onsuspend()}),stalled:m(function(){}),timeupdate:m(function(){this._s._onTimer()}),waiting:m(function(){this._s._onbufferchange(1)})};
|
57
|
+
ea=function(b){return b.serverURL||b.type&&V(b.type)?!1:b.type?T({type:b.type}):T({url:b.url})||c.html5Only};za=function(b,c){b&&(b.src=c,b._called_load=!1);z&&(Ba=null)};T=function(b){if(!c.useHTML5Audio||!c.hasHTML5)return!1;var e=b.url||null;b=b.type||null;var d=c.audioFormats,a;if(b&&c.html5[b]!==g)return c.html5[b]&&!V(b);if(!B){B=[];for(a in d)d.hasOwnProperty(a)&&(B.push(a),d[a].related&&(B=B.concat(d[a].related)));B=RegExp("\\.("+B.join("|")+")(\\?.*)?$","i")}a=e?e.toLowerCase().match(B):
|
58
|
+
null;!a||!a.length?b&&(e=b.indexOf(";"),a=(-1!==e?b.substr(0,e):b).substr(6)):a=a[1];a&&c.html5[a]!==g?e=c.html5[a]&&!V(a):(b="audio/"+a,e=c.html5.canPlayType({type:b}),e=(c.html5[a]=e)&&c.html5[b]&&!V(b));return e};Va=function(){function b(a){var b,d,f=b=!1;if(!e||"function"!==typeof e.canPlayType)return b;if(a instanceof Array){b=0;for(d=a.length;b<d;b++)if(c.html5[a[b]]||e.canPlayType(a[b]).match(c.html5Test))f=!0,c.html5[a[b]]=!0,c.flash[a[b]]=!!a[b].match($a);b=f}else a=e&&"function"===typeof e.canPlayType?
|
59
|
+
e.canPlayType(a):!1,b=!(!a||!a.match(c.html5Test));return b}if(!c.useHTML5Audio||!c.hasHTML5)return!1;var e=Audio!==g?Ea&&10>opera.version()?new Audio(null):new Audio:null,d,a,f={},h;h=c.audioFormats;for(d in h)if(h.hasOwnProperty(d)&&(a="audio/"+d,f[d]=b(h[d].type),f[a]=f[d],d.match($a)?(c.flash[d]=!0,c.flash[a]=!0):(c.flash[d]=!1,c.flash[a]=!1),h[d]&&h[d].related))for(a=h[d].related.length-1;0<=a;a--)f["audio/"+h[d].related[a]]=f[d],c.html5[h[d].related[a]]=f[d],c.flash[h[d].related[a]]=f[d];f.canPlayType=
|
60
|
+
e?b:null;c.html5=u(c.html5,f);return!0};qa={};y=function(){};aa=function(b){8===l&&(1<b.loops&&b.stream)&&(b.stream=!1);return b};ba=function(b,c){if(b&&!b.usePolicyFile&&(b.onid3||b.usePeakData||b.useWaveformData||b.useEQData))b.usePolicyFile=!0;return b};K=function(b){};ka=function(){return!1};Oa=function(b){for(var c in b)b.hasOwnProperty(c)&&"function"===typeof b[c]&&(b[c]=ka)};va=function(b){b===g&&(b=!1);(v||b)&&c.disable(b)};Pa=function(b){var e=null;if(b)if(b.match(/\.swf(\?.*)?$/i)){if(e=
|
61
|
+
b.substr(b.toLowerCase().lastIndexOf(".swf?")+4))return b}else b.lastIndexOf("/")!==b.length-1&&(b+="/");b=(b&&-1!==b.lastIndexOf("/")?b.substr(0,b.lastIndexOf("/")+1):"./")+c.movieURL;c.noSWFCache&&(b+="?ts\x3d"+(new Date).getTime());return b};pa=function(){l=parseInt(c.flashVersion,10);8!==l&&9!==l&&(c.flashVersion=l=8);var b=c.debugMode||c.debugFlash?"_debug.swf":".swf";c.useHTML5Audio&&(!c.html5Only&&c.audioFormats.mp4.required&&9>l)&&(c.flashVersion=l=9);c.version=c.versionNumber+(c.html5Only?
|
62
|
+
" (HTML5-only mode)":9===l?" (AS3/Flash 9)":" (AS2/Flash 8)");8<l?(c.defaultOptions=u(c.defaultOptions,c.flash9Options),c.features.buffering=!0,c.defaultOptions=u(c.defaultOptions,c.movieStarOptions),c.filePatterns.flash9=RegExp("\\.(mp3|"+cb.join("|")+")(\\?.*)?$","i"),c.features.movieStar=!0):c.features.movieStar=!1;c.filePattern=c.filePatterns[8!==l?"flash9":"flash8"];c.movieURL=(8===l?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",b);c.features.peakData=c.features.waveformData=
|
63
|
+
c.features.eqData=8<l};Na=function(b,c){if(!h)return!1;h._setPolling(b,c)};ua=function(){c.debugURLParam.test(ja)&&(c.debugMode=!0)};p=this.getSoundById;J=function(){var b=[];c.debugMode&&b.push("sm2_debug");c.debugFlash&&b.push("flash_debug");c.useHighPerformance&&b.push("high_performance");return b.join(" ")};xa=function(){y("fbHandler");var b=c.getMoviePercent(),e={type:"FLASHBLOCK"};if(c.html5Only)return!1;c.ok()?c.oMC&&(c.oMC.className=[J(),"movieContainer","swf_loaded"+(c.didFlashBlock?" swf_unblocked":
|
64
|
+
"")].join(" ")):(t&&(c.oMC.className=J()+" movieContainer "+(null===b?"swf_timedout":"swf_error")),c.didFlashBlock=!0,E({type:"ontimeout",ignoreInit:!0,error:e}),I(e))};oa=function(b,c,d){x[b]===g&&(x[b]=[]);x[b].push({method:c,scope:d||null,fired:!1})};E=function(b){b||(b={type:c.ok()?"onready":"ontimeout"});if(!r&&b&&!b.ignoreInit||"ontimeout"===b.type&&(c.ok()||v&&!b.ignoreInit))return!1;var e={success:b&&b.ignoreInit?c.ok():!v},d=b&&b.type?x[b.type]||[]:[],a=[],f,e=[e],g=t&&!c.ok();b.error&&(e[0].error=
|
65
|
+
b.error);b=0;for(f=d.length;b<f;b++)!0!==d[b].fired&&a.push(d[b]);if(a.length){b=0;for(f=a.length;b<f;b++)a[b].scope?a[b].method.apply(a[b].scope,e):a[b].method.apply(this,e),g||(a[b].fired=!0)}return!0};F=function(){k.setTimeout(function(){c.useFlashBlock&&xa();E();"function"===typeof c.onload&&c.onload.apply(k);c.waitForWindowLoad&&s.add(k,"load",F)},1)};Ca=function(){if(D!==g)return D;var b=!1,c=navigator,d=c.plugins,a,f=k.ActiveXObject;if(d&&d.length)(c=c.mimeTypes)&&(c["application/x-shockwave-flash"]&&
|
66
|
+
c["application/x-shockwave-flash"].enabledPlugin&&c["application/x-shockwave-flash"].enabledPlugin.description)&&(b=!0);else if(f!==g&&!q.match(/MSAppHost/i)){try{a=new f("ShockwaveFlash.ShockwaveFlash")}catch(h){}b=!!a}return D=b};Ua=function(){var b,e,d=c.audioFormats;if(ga&&q.match(/os (1|2|3_0|3_1)/i))c.hasHTML5=!1,c.html5Only=!0,c.oMC&&(c.oMC.style.display="none");else if(c.useHTML5Audio&&(!c.html5||!c.html5.canPlayType))c.hasHTML5=!1;if(c.useHTML5Audio&&c.hasHTML5)for(e in d)if(d.hasOwnProperty(e)&&
|
67
|
+
(d[e].required&&!c.html5.canPlayType(d[e].type)||c.preferFlash&&(c.flash[e]||c.flash[d[e].type])))b=!0;c.ignoreFlash&&(b=!1);c.html5Only=c.hasHTML5&&c.useHTML5Audio&&!b;return!c.html5Only};da=function(b){var e,d,a=0;if(b instanceof Array){e=0;for(d=b.length;e<d;e++)if(b[e]instanceof Object){if(c.canPlayMIME(b[e].type)){a=e;break}}else if(c.canPlayURL(b[e])){a=e;break}b[a].url&&(b[a]=b[a].url);b=b[a]}return b};Qa=function(b){b._hasTimer||(b._hasTimer=!0,!Fa&&c.html5PollingInterval&&(null===S&&0===
|
68
|
+
ca&&(S=setInterval(Sa,c.html5PollingInterval)),ca++))};Ra=function(b){b._hasTimer&&(b._hasTimer=!1,!Fa&&c.html5PollingInterval&&ca--)};Sa=function(){var b;if(null!==S&&!ca)return clearInterval(S),S=null,!1;for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].isHTML5&&c.sounds[c.soundIDs[b]]._hasTimer&&c.sounds[c.soundIDs[b]]._onTimer()};I=function(b){b=b!==g?b:{};"function"===typeof c.onerror&&c.onerror.apply(k,[{type:b.type!==g?b.type:null}]);b.fatal!==g&&b.fatal&&c.disable()};Wa=function(){if(!Ya||
|
69
|
+
!Ca())return!1;var b=c.audioFormats,e,d;for(d in b)if(b.hasOwnProperty(d)&&("mp3"===d||"mp4"===d))if(c.html5[d]=!1,b[d]&&b[d].related)for(e=b[d].related.length-1;0<=e;e--)c.html5[b[d].related[e]]=!1};this._setSandboxType=function(b){};this._externalInterfaceOK=function(b,e){if(c.swfLoaded)return!1;c.swfLoaded=!0;ha=!1;Ya&&Wa();setTimeout(la,C?100:1)};$=function(b,e){function d(a,b){return'\x3cparam name\x3d"'+a+'" value\x3d"'+b+'" /\x3e'}if(M&&N)return!1;if(c.html5Only)return pa(),c.oMC=W(c.movieID),
|
70
|
+
la(),N=M=!0,!1;var a=e||c.url,f=c.altURL||a,h=ta(),k=J(),l=null,l=n.getElementsByTagName("html")[0],m,r,p,l=l&&l.dir&&l.dir.match(/rtl/i);b=b===g?c.id:b;pa();c.url=Pa(Ha?a:f);e=c.url;c.wmode=!c.wmode&&c.useHighPerformance?"transparent":c.wmode;if(null!==c.wmode&&(q.match(/msie 8/i)||!C&&!c.useHighPerformance)&&navigator.platform.match(/win32|win64/i))Ta.push(qa.spcWmode),c.wmode=null;h={name:b,id:b,src:e,quality:"high",allowScriptAccess:c.allowScriptAccess,bgcolor:c.bgColor,pluginspage:ab+"www.macromedia.com/go/getflashplayer",
|
71
|
+
title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:c.wmode,hasPriority:"true"};c.debugFlash&&(h.FlashVars="debug\x3d1");c.wmode||delete h.wmode;if(C)a=n.createElement("div"),r=['\x3cobject id\x3d"'+b+'" data\x3d"'+e+'" type\x3d"'+h.type+'" title\x3d"'+h.title+'" classid\x3d"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase\x3d"'+ab+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\x3d6,0,40,0"\x3e',d("movie",e),d("AllowScriptAccess",
|
72
|
+
c.allowScriptAccess),d("quality",h.quality),c.wmode?d("wmode",c.wmode):"",d("bgcolor",c.bgColor),d("hasPriority","true"),c.debugFlash?d("FlashVars",h.FlashVars):"","\x3c/object\x3e"].join("");else for(m in a=n.createElement("embed"),h)h.hasOwnProperty(m)&&a.setAttribute(m,h[m]);ua();k=J();if(h=ta())if(c.oMC=W(c.movieID)||n.createElement("div"),c.oMC.id)p=c.oMC.className,c.oMC.className=(p?p+" ":"movieContainer")+(k?" "+k:""),c.oMC.appendChild(a),C&&(m=c.oMC.appendChild(n.createElement("div")),m.className=
|
73
|
+
"sm2-object-box",m.innerHTML=r),N=!0;else{c.oMC.id=c.movieID;c.oMC.className="movieContainer "+k;m=k=null;c.useFlashBlock||(c.useHighPerformance?k={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(k={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},l&&(k.left=Math.abs(parseInt(k.left,10))+"px")));fb&&(c.oMC.style.zIndex=1E4);if(!c.debugFlash)for(p in k)k.hasOwnProperty(p)&&(c.oMC.style[p]=k[p]);try{C||c.oMC.appendChild(a),h.appendChild(c.oMC),
|
74
|
+
C&&(m=c.oMC.appendChild(n.createElement("div")),m.className="sm2-object-box",m.innerHTML=r),N=!0}catch(s){throw Error(y("domError")+" \n"+s.toString());}}return M=!0};Z=function(){if(c.html5Only)return $(),!1;if(h||!c.url)return!1;h=c.getMovie(c.id);h||(Q?(C?c.oMC.innerHTML=wa:c.oMC.appendChild(Q),Q=null,M=!0):$(c.id,c.url),h=c.getMovie(c.id));"function"===typeof c.oninitmovie&&setTimeout(c.oninitmovie,1);return!0};G=function(){setTimeout(Ma,1E3)};Ma=function(){var b,e=!1;if(!c.url||R)return!1;R=
|
75
|
+
!0;s.remove(k,"load",G);if(ha&&!Ga)return!1;r||(b=c.getMoviePercent(),0<b&&100>b&&(e=!0));setTimeout(function(){b=c.getMoviePercent();if(e)return R=!1,k.setTimeout(G,1),!1;!r&&Za&&(null===b?c.useFlashBlock||0===c.flashLoadTimeout?c.useFlashBlock&&xa():E({type:"ontimeout",ignoreInit:!0}):0!==c.flashLoadTimeout&&va(!0))},c.flashLoadTimeout)};Y=function(){if(Ga||!ha)return s.remove(k,"focus",Y),!0;Ga=Za=!0;R=!1;G();s.remove(k,"focus",Y);return!0};O=function(b){if(r)return!1;if(c.html5Only)return r=!0,
|
76
|
+
F(),!0;var e=!0,d;if(!c.useFlashBlock||!c.flashLoadTimeout||c.getMoviePercent())r=!0,v&&(d={type:!D&&t?"NO_FLASH":"INIT_TIMEOUT"});if(v||b)c.useFlashBlock&&c.oMC&&(c.oMC.className=J()+" "+(null===c.getMoviePercent()?"swf_timedout":"swf_error")),E({type:"ontimeout",error:d,ignoreInit:!0}),I(d),e=!1;v||(c.waitForWindowLoad&&!ma?s.add(k,"load",F):F());return e};La=function(){var b,e=c.setupOptions;for(b in e)e.hasOwnProperty(b)&&(c[b]===g?c[b]=e[b]:c[b]!==e[b]&&(c.setupOptions[b]=c[b]))};la=function(){if(r)return!1;
|
77
|
+
if(c.html5Only)return r||(s.remove(k,"load",c.beginDelayedInit),c.enabled=!0,O()),!0;Z();try{h._externalInterfaceTest(!1),Na(!0,c.flashPollingInterval||(c.useHighPerformance?10:50)),c.debugMode||h._disableDebug(),c.enabled=!0,c.html5Only||s.add(k,"unload",ka)}catch(b){return I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),va(!0),O(),!1}O();s.remove(k,"load",c.beginDelayedInit);return!0};H=function(){if(P)return!1;P=!0;La();ua();!D&&c.hasHTML5&&c.setup({useHTML5Audio:!0,preferFlash:!1});Va();c.html5.usingFlash=
|
78
|
+
Ua();t=c.html5.usingFlash;!D&&t&&(Ta.push(qa.needFlash),c.setup({flashLoadTimeout:1}));n.removeEventListener&&n.removeEventListener("DOMContentLoaded",H,!1);Z();return!0};Aa=function(){"complete"===n.readyState&&(H(),n.detachEvent("onreadystatechange",Aa));return!0};sa=function(){ma=!0;s.remove(k,"load",sa)};ra=function(){if(Fa&&(c.setupOptions.useHTML5Audio=!0,c.setupOptions.preferFlash=!1,ga||Xa&&!q.match(/android\s2\.3/i)))ga&&(c.ignoreFlash=!0),z=!0};ra();Ca();s.add(k,"focus",Y);s.add(k,"load",
|
79
|
+
G);s.add(k,"load",sa);n.addEventListener?n.addEventListener("DOMContentLoaded",H,!1):n.attachEvent?n.attachEvent("onreadystatechange",Aa):I({type:"NO_DOM2_EVENTS",fatal:!0})}var ia=null;if(void 0===k.SM2_DEFER||!SM2_DEFER)ia=new U;k.SoundManager=U;k.soundManager=ia})(window);
|
@@ -8,13 +8,14 @@
|
|
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.20130324 ("Mahalo" Edition)
|
12
12
|
*/
|
13
13
|
|
14
|
-
/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio */
|
15
|
-
/*jslint regexp: true, sloppy: true, white: true, nomen: true, plusplus: true */
|
14
|
+
/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio, opera */
|
15
|
+
/*jslint regexp: true, sloppy: true, white: true, nomen: true, plusplus: true, todo: true */
|
16
16
|
|
17
|
-
(function(window) {
|
17
|
+
(function(window, _undefined) {
|
18
|
+
"use strict";
|
18
19
|
var soundManager = null;
|
19
20
|
function SoundManager(smURL, smID) {
|
20
21
|
this.setupOptions = {
|
@@ -92,6 +93,10 @@ function SoundManager(smURL, smID) {
|
|
92
93
|
'type': ['audio/ogg; codecs=vorbis'],
|
93
94
|
'required': false
|
94
95
|
},
|
96
|
+
'opus': {
|
97
|
+
'type': ['audio/ogg; codecs=opus', 'audio/opus'],
|
98
|
+
'required': false
|
99
|
+
},
|
95
100
|
'wav': {
|
96
101
|
'type': ['audio/wav; codecs="1"', 'audio/wav', 'audio/wave', 'audio/x-wav'],
|
97
102
|
'required': false
|
@@ -101,7 +106,7 @@ function SoundManager(smURL, smID) {
|
|
101
106
|
this.id = (smID || 'sm2movie');
|
102
107
|
this.debugID = 'soundmanager-debug';
|
103
108
|
this.debugURLParam = /([#?&])debug=1/i;
|
104
|
-
this.versionNumber = 'V2.97a.
|
109
|
+
this.versionNumber = 'V2.97a.20130324';
|
105
110
|
this.version = null;
|
106
111
|
this.movieURL = null;
|
107
112
|
this.altURL = null;
|
@@ -126,13 +131,6 @@ function SoundManager(smURL, smID) {
|
|
126
131
|
};
|
127
132
|
this.sandbox = {
|
128
133
|
};
|
129
|
-
this.hasHTML5 = (function() {
|
130
|
-
try {
|
131
|
-
return (typeof Audio !== 'undefined' && typeof (_isOpera && opera.version() < 10 ? new Audio(null) : new Audio()).canPlayType !== 'undefined');
|
132
|
-
} catch(e) {
|
133
|
-
return false;
|
134
|
-
}
|
135
|
-
}());
|
136
134
|
this.html5 = {
|
137
135
|
'usingFlash': null
|
138
136
|
};
|
@@ -140,22 +138,21 @@ function SoundManager(smURL, smID) {
|
|
140
138
|
this.html5Only = false;
|
141
139
|
this.ignoreFlash = false;
|
142
140
|
var SMSound,
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
141
|
+
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, setVersionInfo, handleFocus, strings, initMovie, preInit, 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 = [],
|
142
|
+
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,
|
143
|
+
is_iDevice = ua.match(/(ipad|iphone|ipod)/i), isAndroid = ua.match(/android/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)),
|
144
|
+
mobileHTML5 = (ua.match(/(mobile|pre\/|xoom)/i) || is_iDevice || isAndroid),
|
145
|
+
isBadSafari = (!wl.match(/usehtml5audio/i) && !wl.match(/sm2\-ignorebadua/i) && isSafari && !ua.match(/silk/i) && ua.match(/OS X 10_6_([3-7])/i)),
|
146
|
+
hasConsole = (window.console !== _undefined && console.log !== _undefined), isFocused = (doc.hasFocus !== _undefined?doc.hasFocus():null), tryInitOnFocus = (isSafari && (doc.hasFocus === _undefined || !doc.hasFocus())), okToDisable = !tryInitOnFocus, flashMIME = /(mp3|mp4|mpa|m4a|m4b)/i,
|
147
|
+
emptyURL = 'about:blank',
|
148
|
+
overHTTP = (doc.location?doc.location.protocol.match(/http/i):null),
|
149
|
+
http = (!overHTTP ? 'http:/'+'/' : ''),
|
150
|
+
netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,
|
151
|
+
netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'm4b', 'mp4v', '3gp', '3g2'],
|
152
|
+
netStreamPattern = new RegExp('\\.(' + netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
|
155
153
|
this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;
|
156
|
-
this.useAltURL = !
|
157
|
-
|
158
|
-
_swfCSS = {
|
154
|
+
this.useAltURL = !overHTTP;
|
155
|
+
swfCSS = {
|
159
156
|
'swfBox': 'sm2-object-box',
|
160
157
|
'swfDefault': 'movieContainer',
|
161
158
|
'swfError': 'swf_error',
|
@@ -166,101 +163,99 @@ function SoundManager(smURL, smID) {
|
|
166
163
|
'highPerf': 'high_performance',
|
167
164
|
'flashDebug': 'flash_debug'
|
168
165
|
};
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
_useGlobalHTML5Audio = true;
|
166
|
+
this.hasHTML5 = (function() {
|
167
|
+
try {
|
168
|
+
return (Audio !== _undefined && (isOpera && opera !== _undefined && opera.version() < 10 ? new Audio(null) : new Audio()).canPlayType !== _undefined);
|
169
|
+
} catch(e) {
|
170
|
+
return false;
|
175
171
|
}
|
176
|
-
}
|
172
|
+
}());
|
177
173
|
this.setup = function(options) {
|
178
|
-
var noURL = (!
|
179
|
-
if (
|
180
|
-
|
174
|
+
var noURL = (!sm2.url);
|
175
|
+
if (options !== _undefined && didInit && needsFlash && sm2.ok() && (options.flashVersion !== _undefined || options.url !== _undefined || options.html5Test !== _undefined)) {
|
176
|
+
complain(str('setupLate'));
|
181
177
|
}
|
182
|
-
|
183
|
-
if (noURL &&
|
184
|
-
|
178
|
+
assign(options);
|
179
|
+
if (noURL && didDCLoaded && options.url !== _undefined) {
|
180
|
+
sm2.beginDelayedInit();
|
185
181
|
}
|
186
|
-
if (!
|
187
|
-
setTimeout(
|
182
|
+
if (!didDCLoaded && options.url !== _undefined && doc.readyState === 'complete') {
|
183
|
+
setTimeout(domContentLoaded, 1);
|
188
184
|
}
|
189
|
-
return
|
185
|
+
return sm2;
|
190
186
|
};
|
191
187
|
this.ok = function() {
|
192
|
-
return (
|
188
|
+
return (needsFlash?(didInit && !disabled):(sm2.useHTML5Audio && sm2.hasHTML5));
|
193
189
|
};
|
194
190
|
this.supported = this.ok;
|
195
191
|
this.getMovie = function(smID) {
|
196
|
-
return
|
192
|
+
return id(smID) || doc[smID] || window[smID];
|
197
193
|
};
|
198
194
|
this.createSound = function(oOptions, _url) {
|
199
|
-
var
|
200
|
-
if (!
|
201
|
-
|
195
|
+
var cs, cs_string, options, oSound = null;
|
196
|
+
if (!didInit || !sm2.ok()) {
|
197
|
+
complain(cs_string);
|
202
198
|
return false;
|
203
199
|
}
|
204
|
-
if (
|
200
|
+
if (_url !== _undefined) {
|
205
201
|
oOptions = {
|
206
202
|
'id': oOptions,
|
207
203
|
'url': _url
|
208
204
|
};
|
209
205
|
}
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
return _s.sounds[_tO.id];
|
206
|
+
options = mixin(oOptions);
|
207
|
+
options.url = parseURL(options.url);
|
208
|
+
if (idCheck(options.id, true)) {
|
209
|
+
return sm2.sounds[options.id];
|
215
210
|
}
|
216
211
|
function make() {
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
return
|
212
|
+
options = loopFix(options);
|
213
|
+
sm2.sounds[options.id] = new SMSound(options);
|
214
|
+
sm2.soundIDs.push(options.id);
|
215
|
+
return sm2.sounds[options.id];
|
221
216
|
}
|
222
|
-
if (
|
217
|
+
if (html5OK(options)) {
|
223
218
|
oSound = make();
|
224
|
-
oSound._setup_html5(
|
219
|
+
oSound._setup_html5(options);
|
225
220
|
} else {
|
226
|
-
if (
|
227
|
-
if (
|
228
|
-
|
221
|
+
if (fV > 8) {
|
222
|
+
if (options.isMovieStar === null) {
|
223
|
+
options.isMovieStar = !!(options.serverURL || (options.type ? options.type.match(netStreamMimeTypes) : false) || options.url.match(netStreamPattern));
|
229
224
|
}
|
230
225
|
}
|
231
|
-
|
226
|
+
options = policyFix(options, cs);
|
232
227
|
oSound = make();
|
233
|
-
if (
|
234
|
-
|
228
|
+
if (fV === 8) {
|
229
|
+
flash._createSound(options.id, options.loops||1, options.usePolicyFile);
|
235
230
|
} else {
|
236
|
-
|
237
|
-
if (!
|
231
|
+
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);
|
232
|
+
if (!options.serverURL) {
|
238
233
|
oSound.connected = true;
|
239
|
-
if (
|
240
|
-
|
234
|
+
if (options.onconnect) {
|
235
|
+
options.onconnect.apply(oSound);
|
241
236
|
}
|
242
237
|
}
|
243
238
|
}
|
244
|
-
if (!
|
245
|
-
oSound.load(
|
239
|
+
if (!options.serverURL && (options.autoLoad || options.autoPlay)) {
|
240
|
+
oSound.load(options);
|
246
241
|
}
|
247
242
|
}
|
248
|
-
if (!
|
243
|
+
if (!options.serverURL && options.autoPlay) {
|
249
244
|
oSound.play();
|
250
245
|
}
|
251
246
|
return oSound;
|
252
247
|
};
|
253
248
|
this.destroySound = function(sID, _bFromSound) {
|
254
|
-
if (!
|
249
|
+
if (!idCheck(sID)) {
|
255
250
|
return false;
|
256
251
|
}
|
257
|
-
var oS =
|
252
|
+
var oS = sm2.sounds[sID], i;
|
258
253
|
oS._iO = {};
|
259
254
|
oS.stop();
|
260
255
|
oS.unload();
|
261
|
-
for (i = 0; i <
|
262
|
-
if (
|
263
|
-
|
256
|
+
for (i = 0; i < sm2.soundIDs.length; i++) {
|
257
|
+
if (sm2.soundIDs[i] === sID) {
|
258
|
+
sm2.soundIDs.splice(i, 1);
|
264
259
|
break;
|
265
260
|
}
|
266
261
|
}
|
@@ -268,41 +263,41 @@ function SoundManager(smURL, smID) {
|
|
268
263
|
oS.destruct(true);
|
269
264
|
}
|
270
265
|
oS = null;
|
271
|
-
delete
|
266
|
+
delete sm2.sounds[sID];
|
272
267
|
return true;
|
273
268
|
};
|
274
269
|
this.load = function(sID, oOptions) {
|
275
|
-
if (!
|
270
|
+
if (!idCheck(sID)) {
|
276
271
|
return false;
|
277
272
|
}
|
278
|
-
return
|
273
|
+
return sm2.sounds[sID].load(oOptions);
|
279
274
|
};
|
280
275
|
this.unload = function(sID) {
|
281
|
-
if (!
|
276
|
+
if (!idCheck(sID)) {
|
282
277
|
return false;
|
283
278
|
}
|
284
|
-
return
|
279
|
+
return sm2.sounds[sID].unload();
|
285
280
|
};
|
286
281
|
this.onPosition = function(sID, nPosition, oMethod, oScope) {
|
287
|
-
if (!
|
282
|
+
if (!idCheck(sID)) {
|
288
283
|
return false;
|
289
284
|
}
|
290
|
-
return
|
285
|
+
return sm2.sounds[sID].onposition(nPosition, oMethod, oScope);
|
291
286
|
};
|
292
287
|
this.onposition = this.onPosition;
|
293
288
|
this.clearOnPosition = function(sID, nPosition, oMethod) {
|
294
|
-
if (!
|
289
|
+
if (!idCheck(sID)) {
|
295
290
|
return false;
|
296
291
|
}
|
297
|
-
return
|
292
|
+
return sm2.sounds[sID].clearOnPosition(nPosition, oMethod);
|
298
293
|
};
|
299
294
|
this.play = function(sID, oOptions) {
|
300
295
|
var result = false;
|
301
|
-
if (!
|
302
|
-
|
296
|
+
if (!didInit || !sm2.ok()) {
|
297
|
+
complain(sm + '.play(): ' + str(!didInit?'notReady':'notOK'));
|
303
298
|
return result;
|
304
299
|
}
|
305
|
-
if (!
|
300
|
+
if (!idCheck(sID)) {
|
306
301
|
if (!(oOptions instanceof Object)) {
|
307
302
|
oOptions = {
|
308
303
|
url: oOptions
|
@@ -310,179 +305,179 @@ function SoundManager(smURL, smID) {
|
|
310
305
|
}
|
311
306
|
if (oOptions && oOptions.url) {
|
312
307
|
oOptions.id = sID;
|
313
|
-
result =
|
308
|
+
result = sm2.createSound(oOptions).play();
|
314
309
|
}
|
315
310
|
return result;
|
316
311
|
}
|
317
|
-
return
|
312
|
+
return sm2.sounds[sID].play(oOptions);
|
318
313
|
};
|
319
314
|
this.start = this.play;
|
320
315
|
this.setPosition = function(sID, nMsecOffset) {
|
321
|
-
if (!
|
316
|
+
if (!idCheck(sID)) {
|
322
317
|
return false;
|
323
318
|
}
|
324
|
-
return
|
319
|
+
return sm2.sounds[sID].setPosition(nMsecOffset);
|
325
320
|
};
|
326
321
|
this.stop = function(sID) {
|
327
|
-
if (!
|
322
|
+
if (!idCheck(sID)) {
|
328
323
|
return false;
|
329
324
|
}
|
330
|
-
return
|
325
|
+
return sm2.sounds[sID].stop();
|
331
326
|
};
|
332
327
|
this.stopAll = function() {
|
333
328
|
var oSound;
|
334
|
-
for (oSound in
|
335
|
-
if (
|
336
|
-
|
329
|
+
for (oSound in sm2.sounds) {
|
330
|
+
if (sm2.sounds.hasOwnProperty(oSound)) {
|
331
|
+
sm2.sounds[oSound].stop();
|
337
332
|
}
|
338
333
|
}
|
339
334
|
};
|
340
335
|
this.pause = function(sID) {
|
341
|
-
if (!
|
336
|
+
if (!idCheck(sID)) {
|
342
337
|
return false;
|
343
338
|
}
|
344
|
-
return
|
339
|
+
return sm2.sounds[sID].pause();
|
345
340
|
};
|
346
341
|
this.pauseAll = function() {
|
347
342
|
var i;
|
348
|
-
for (i =
|
349
|
-
|
343
|
+
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
344
|
+
sm2.sounds[sm2.soundIDs[i]].pause();
|
350
345
|
}
|
351
346
|
};
|
352
347
|
this.resume = function(sID) {
|
353
|
-
if (!
|
348
|
+
if (!idCheck(sID)) {
|
354
349
|
return false;
|
355
350
|
}
|
356
|
-
return
|
351
|
+
return sm2.sounds[sID].resume();
|
357
352
|
};
|
358
353
|
this.resumeAll = function() {
|
359
354
|
var i;
|
360
|
-
for (i =
|
361
|
-
|
355
|
+
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
356
|
+
sm2.sounds[sm2.soundIDs[i]].resume();
|
362
357
|
}
|
363
358
|
};
|
364
359
|
this.togglePause = function(sID) {
|
365
|
-
if (!
|
360
|
+
if (!idCheck(sID)) {
|
366
361
|
return false;
|
367
362
|
}
|
368
|
-
return
|
363
|
+
return sm2.sounds[sID].togglePause();
|
369
364
|
};
|
370
365
|
this.setPan = function(sID, nPan) {
|
371
|
-
if (!
|
366
|
+
if (!idCheck(sID)) {
|
372
367
|
return false;
|
373
368
|
}
|
374
|
-
return
|
369
|
+
return sm2.sounds[sID].setPan(nPan);
|
375
370
|
};
|
376
371
|
this.setVolume = function(sID, nVol) {
|
377
|
-
if (!
|
372
|
+
if (!idCheck(sID)) {
|
378
373
|
return false;
|
379
374
|
}
|
380
|
-
return
|
375
|
+
return sm2.sounds[sID].setVolume(nVol);
|
381
376
|
};
|
382
377
|
this.mute = function(sID) {
|
383
378
|
var i = 0;
|
384
|
-
if (
|
379
|
+
if (sID instanceof String) {
|
385
380
|
sID = null;
|
386
381
|
}
|
387
382
|
if (!sID) {
|
388
|
-
for (i =
|
389
|
-
|
383
|
+
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
384
|
+
sm2.sounds[sm2.soundIDs[i]].mute();
|
390
385
|
}
|
391
|
-
|
386
|
+
sm2.muted = true;
|
392
387
|
} else {
|
393
|
-
if (!
|
388
|
+
if (!idCheck(sID)) {
|
394
389
|
return false;
|
395
390
|
}
|
396
|
-
return
|
391
|
+
return sm2.sounds[sID].mute();
|
397
392
|
}
|
398
393
|
return true;
|
399
394
|
};
|
400
395
|
this.muteAll = function() {
|
401
|
-
|
396
|
+
sm2.mute();
|
402
397
|
};
|
403
398
|
this.unmute = function(sID) {
|
404
399
|
var i;
|
405
|
-
if (
|
400
|
+
if (sID instanceof String) {
|
406
401
|
sID = null;
|
407
402
|
}
|
408
403
|
if (!sID) {
|
409
|
-
for (i =
|
410
|
-
|
404
|
+
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
405
|
+
sm2.sounds[sm2.soundIDs[i]].unmute();
|
411
406
|
}
|
412
|
-
|
407
|
+
sm2.muted = false;
|
413
408
|
} else {
|
414
|
-
if (!
|
409
|
+
if (!idCheck(sID)) {
|
415
410
|
return false;
|
416
411
|
}
|
417
|
-
return
|
412
|
+
return sm2.sounds[sID].unmute();
|
418
413
|
}
|
419
414
|
return true;
|
420
415
|
};
|
421
416
|
this.unmuteAll = function() {
|
422
|
-
|
417
|
+
sm2.unmute();
|
423
418
|
};
|
424
419
|
this.toggleMute = function(sID) {
|
425
|
-
if (!
|
420
|
+
if (!idCheck(sID)) {
|
426
421
|
return false;
|
427
422
|
}
|
428
|
-
return
|
423
|
+
return sm2.sounds[sID].toggleMute();
|
429
424
|
};
|
430
425
|
this.getMemoryUse = function() {
|
431
426
|
var ram = 0;
|
432
|
-
if (
|
433
|
-
ram = parseInt(
|
427
|
+
if (flash && fV !== 8) {
|
428
|
+
ram = parseInt(flash._getMemoryUse(), 10);
|
434
429
|
}
|
435
430
|
return ram;
|
436
431
|
};
|
437
432
|
this.disable = function(bNoDisable) {
|
438
433
|
var i;
|
439
|
-
if (
|
434
|
+
if (bNoDisable === _undefined) {
|
440
435
|
bNoDisable = false;
|
441
436
|
}
|
442
|
-
if (
|
437
|
+
if (disabled) {
|
443
438
|
return false;
|
444
439
|
}
|
445
|
-
|
446
|
-
for (i =
|
447
|
-
|
440
|
+
disabled = true;
|
441
|
+
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
442
|
+
disableObject(sm2.sounds[sm2.soundIDs[i]]);
|
448
443
|
}
|
449
|
-
|
450
|
-
|
444
|
+
initComplete(bNoDisable);
|
445
|
+
event.remove(window, 'load', initUserOnload);
|
451
446
|
return true;
|
452
447
|
};
|
453
448
|
this.canPlayMIME = function(sMIME) {
|
454
449
|
var result;
|
455
|
-
if (
|
456
|
-
result =
|
450
|
+
if (sm2.hasHTML5) {
|
451
|
+
result = html5CanPlay({type:sMIME});
|
457
452
|
}
|
458
|
-
if (!result &&
|
459
|
-
result = (sMIME &&
|
453
|
+
if (!result && needsFlash) {
|
454
|
+
result = (sMIME && sm2.ok() ? !!((fV > 8 ? sMIME.match(netStreamMimeTypes) : null) || sMIME.match(sm2.mimePattern)) : null);
|
460
455
|
}
|
461
456
|
return result;
|
462
457
|
};
|
463
458
|
this.canPlayURL = function(sURL) {
|
464
459
|
var result;
|
465
|
-
if (
|
466
|
-
result =
|
460
|
+
if (sm2.hasHTML5) {
|
461
|
+
result = html5CanPlay({url: sURL});
|
467
462
|
}
|
468
|
-
if (!result &&
|
469
|
-
result = (sURL &&
|
463
|
+
if (!result && needsFlash) {
|
464
|
+
result = (sURL && sm2.ok() ? !!(sURL.match(sm2.filePattern)) : null);
|
470
465
|
}
|
471
466
|
return result;
|
472
467
|
};
|
473
468
|
this.canPlayLink = function(oLink) {
|
474
|
-
if (
|
475
|
-
if (
|
469
|
+
if (oLink.type !== _undefined && oLink.type) {
|
470
|
+
if (sm2.canPlayMIME(oLink.type)) {
|
476
471
|
return true;
|
477
472
|
}
|
478
473
|
}
|
479
|
-
return
|
474
|
+
return sm2.canPlayURL(oLink.href);
|
480
475
|
};
|
481
476
|
this.getSoundById = function(sID, _suppressDebug) {
|
482
477
|
if (!sID) {
|
483
|
-
throw new Error(
|
478
|
+
throw new Error(sm + '.getSoundById(): sID is null/_undefined');
|
484
479
|
}
|
485
|
-
var result =
|
480
|
+
var result = sm2.sounds[sID];
|
486
481
|
return result;
|
487
482
|
};
|
488
483
|
this.onready = function(oMethod, oScope) {
|
@@ -490,13 +485,13 @@ function SoundManager(smURL, smID) {
|
|
490
485
|
result = false;
|
491
486
|
if (typeof oMethod === 'function') {
|
492
487
|
if (!oScope) {
|
493
|
-
oScope =
|
488
|
+
oScope = window;
|
494
489
|
}
|
495
|
-
|
496
|
-
|
490
|
+
addOnEvent(sType, oMethod, oScope);
|
491
|
+
processOnEvents();
|
497
492
|
result = true;
|
498
493
|
} else {
|
499
|
-
throw
|
494
|
+
throw str('needFunction', sType);
|
500
495
|
}
|
501
496
|
return result;
|
502
497
|
};
|
@@ -505,80 +500,98 @@ function SoundManager(smURL, smID) {
|
|
505
500
|
result = false;
|
506
501
|
if (typeof oMethod === 'function') {
|
507
502
|
if (!oScope) {
|
508
|
-
oScope =
|
503
|
+
oScope = window;
|
509
504
|
}
|
510
|
-
|
511
|
-
|
505
|
+
addOnEvent(sType, oMethod, oScope);
|
506
|
+
processOnEvents({type:sType});
|
512
507
|
result = true;
|
513
508
|
} else {
|
514
|
-
throw
|
509
|
+
throw str('needFunction', sType);
|
515
510
|
}
|
516
511
|
return result;
|
517
512
|
};
|
518
|
-
this._writeDebug = function(sText,
|
513
|
+
this._writeDebug = function(sText, sTypeOrObject) {
|
519
514
|
return true;
|
520
515
|
};
|
521
516
|
this._wD = this._writeDebug;
|
522
517
|
this._debug = function() {
|
523
518
|
};
|
524
|
-
this.reboot = function() {
|
525
|
-
var i, j;
|
526
|
-
for (i =
|
527
|
-
|
519
|
+
this.reboot = function(resetEvents, excludeInit) {
|
520
|
+
var i, j, k;
|
521
|
+
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
522
|
+
sm2.sounds[sm2.soundIDs[i]].destruct();
|
528
523
|
}
|
529
|
-
if (
|
524
|
+
if (flash) {
|
530
525
|
try {
|
531
|
-
if (
|
532
|
-
|
526
|
+
if (isIE) {
|
527
|
+
oRemovedHTML = flash.innerHTML;
|
533
528
|
}
|
534
|
-
|
529
|
+
oRemoved = flash.parentNode.removeChild(flash);
|
535
530
|
} catch(e) {
|
536
531
|
}
|
537
532
|
}
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
533
|
+
oRemovedHTML = oRemoved = needsFlash = flash = null;
|
534
|
+
sm2.enabled = didDCLoaded = didInit = waitingForEI = initPending = didAppend = appendSuccess = disabled = useGlobalHTML5Audio = sm2.swfLoaded = false;
|
535
|
+
sm2.soundIDs = [];
|
536
|
+
sm2.sounds = {};
|
537
|
+
if (!resetEvents) {
|
538
|
+
for (i in on_queue) {
|
539
|
+
if (on_queue.hasOwnProperty(i)) {
|
540
|
+
for (j = 0, k = on_queue[i].length; j < k; j++) {
|
541
|
+
on_queue[i][j].fired = false;
|
542
|
+
}
|
547
543
|
}
|
548
544
|
}
|
545
|
+
} else {
|
546
|
+
on_queue = [];
|
549
547
|
}
|
550
|
-
|
548
|
+
sm2.html5 = {
|
549
|
+
'usingFlash': null
|
550
|
+
};
|
551
|
+
sm2.flash = {};
|
552
|
+
sm2.html5Only = false;
|
553
|
+
sm2.ignoreFlash = false;
|
554
|
+
window.setTimeout(function() {
|
555
|
+
preInit();
|
556
|
+
if (!excludeInit) {
|
557
|
+
sm2.beginDelayedInit();
|
558
|
+
}
|
559
|
+
}, 20);
|
560
|
+
return sm2;
|
561
|
+
};
|
562
|
+
this.reset = function() {
|
563
|
+
return sm2.reboot(true, true);
|
551
564
|
};
|
552
565
|
this.getMoviePercent = function() {
|
553
|
-
return (
|
566
|
+
return (flash && 'PercentLoaded' in flash ? flash.PercentLoaded() : null);
|
554
567
|
};
|
555
568
|
this.beginDelayedInit = function() {
|
556
|
-
|
557
|
-
|
569
|
+
windowLoaded = true;
|
570
|
+
domContentLoaded();
|
558
571
|
setTimeout(function() {
|
559
|
-
if (
|
572
|
+
if (initPending) {
|
560
573
|
return false;
|
561
574
|
}
|
562
|
-
|
563
|
-
|
564
|
-
|
575
|
+
createMovie();
|
576
|
+
initMovie();
|
577
|
+
initPending = true;
|
565
578
|
return true;
|
566
579
|
}, 20);
|
567
|
-
|
580
|
+
delayWaitForEI();
|
568
581
|
};
|
569
582
|
this.destruct = function() {
|
570
|
-
|
583
|
+
sm2.disable(true);
|
571
584
|
};
|
572
585
|
SMSound = function(oOptions) {
|
573
|
-
var
|
574
|
-
|
586
|
+
var s = this, resetProperties, add_html5_events, remove_html5_events, stop_html5_timer, start_html5_timer, attachOnPosition, onplay_called = false, onPositionItems = [], onPositionFired = 0, detachOnPosition, applyFromTo, lastURL = null, lastHTML5State;
|
587
|
+
lastHTML5State = {
|
575
588
|
duration: null,
|
576
589
|
time: null
|
577
590
|
};
|
578
591
|
this.id = oOptions.id;
|
579
592
|
this.sID = this.id;
|
580
593
|
this.url = oOptions.url;
|
581
|
-
this.options =
|
594
|
+
this.options = mixin(oOptions);
|
582
595
|
this.instanceOptions = this.options;
|
583
596
|
this._iO = this.instanceOptions;
|
584
597
|
this.pan = this.options.pan;
|
@@ -589,155 +602,156 @@ function SoundManager(smURL, smID) {
|
|
589
602
|
this._debug = function() {
|
590
603
|
};
|
591
604
|
this.load = function(oOptions) {
|
592
|
-
var
|
593
|
-
if (
|
594
|
-
|
595
|
-
_t.instanceOptions = _t._iO;
|
605
|
+
var oSound = null, instanceOptions;
|
606
|
+
if (oOptions !== _undefined) {
|
607
|
+
s._iO = mixin(oOptions, s.options);
|
596
608
|
} else {
|
597
|
-
oOptions =
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
609
|
+
oOptions = s.options;
|
610
|
+
s._iO = oOptions;
|
611
|
+
if (lastURL && lastURL !== s.url) {
|
612
|
+
s._iO.url = s.url;
|
613
|
+
s.url = null;
|
614
|
+
}
|
615
|
+
}
|
616
|
+
if (!s._iO.url) {
|
617
|
+
s._iO.url = s.url;
|
618
|
+
}
|
619
|
+
s._iO.url = parseURL(s._iO.url);
|
620
|
+
s.instanceOptions = s._iO;
|
621
|
+
instanceOptions = s._iO;
|
622
|
+
if (instanceOptions.url === s.url && s.readyState !== 0 && s.readyState !== 2) {
|
623
|
+
if (s.readyState === 3 && instanceOptions.onload) {
|
624
|
+
wrapCallback(s, function() {
|
625
|
+
instanceOptions.onload.apply(s, [(!!s.duration)]);
|
626
|
+
});
|
627
|
+
}
|
628
|
+
return s;
|
629
|
+
}
|
630
|
+
s.loaded = false;
|
631
|
+
s.readyState = 1;
|
632
|
+
s.playState = 0;
|
633
|
+
s.id3 = {};
|
634
|
+
if (html5OK(instanceOptions)) {
|
635
|
+
oSound = s._setup_html5(instanceOptions);
|
636
|
+
if (!oSound._called_load) {
|
637
|
+
s._html5_canplay = false;
|
638
|
+
if (s.url !== instanceOptions.url) {
|
639
|
+
s._a.src = instanceOptions.url;
|
640
|
+
s.setPosition(0);
|
628
641
|
}
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
if (
|
633
|
-
|
642
|
+
s._a.autobuffer = 'auto';
|
643
|
+
s._a.preload = 'auto';
|
644
|
+
s._a._called_load = true;
|
645
|
+
if (instanceOptions.autoPlay) {
|
646
|
+
s.play();
|
634
647
|
}
|
635
648
|
} else {
|
636
649
|
}
|
637
650
|
} else {
|
638
651
|
try {
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
if (
|
643
|
-
|
652
|
+
s.isHTML5 = false;
|
653
|
+
s._iO = policyFix(loopFix(instanceOptions));
|
654
|
+
instanceOptions = s._iO;
|
655
|
+
if (fV === 8) {
|
656
|
+
flash._load(s.id, instanceOptions.url, instanceOptions.stream, instanceOptions.autoPlay, instanceOptions.usePolicyFile);
|
644
657
|
} else {
|
645
|
-
|
658
|
+
flash._load(s.id, instanceOptions.url, !!(instanceOptions.stream), !!(instanceOptions.autoPlay), instanceOptions.loops||1, !!(instanceOptions.autoLoad), instanceOptions.usePolicyFile);
|
646
659
|
}
|
647
660
|
} catch(e) {
|
648
|
-
|
661
|
+
catchError({type:'SMSOUND_LOAD_JS_EXCEPTION', fatal:true});
|
649
662
|
}
|
650
663
|
}
|
651
|
-
|
652
|
-
return
|
664
|
+
s.url = instanceOptions.url;
|
665
|
+
return s;
|
653
666
|
};
|
654
667
|
this.unload = function() {
|
655
|
-
if (
|
656
|
-
if (!
|
657
|
-
if (
|
658
|
-
|
668
|
+
if (s.readyState !== 0) {
|
669
|
+
if (!s.isHTML5) {
|
670
|
+
if (fV === 8) {
|
671
|
+
flash._unload(s.id, emptyURL);
|
659
672
|
} else {
|
660
|
-
|
673
|
+
flash._unload(s.id);
|
661
674
|
}
|
662
675
|
} else {
|
663
|
-
|
664
|
-
if (
|
665
|
-
|
666
|
-
|
667
|
-
|
676
|
+
stop_html5_timer();
|
677
|
+
if (s._a) {
|
678
|
+
s._a.pause();
|
679
|
+
html5Unload(s._a, emptyURL);
|
680
|
+
lastURL = emptyURL;
|
668
681
|
}
|
669
682
|
}
|
670
|
-
|
683
|
+
resetProperties();
|
671
684
|
}
|
672
|
-
return
|
685
|
+
return s;
|
673
686
|
};
|
674
687
|
this.destruct = function(_bFromSM) {
|
675
|
-
if (!
|
676
|
-
|
677
|
-
|
688
|
+
if (!s.isHTML5) {
|
689
|
+
s._iO.onfailure = null;
|
690
|
+
flash._destroySound(s.id);
|
678
691
|
} else {
|
679
|
-
|
680
|
-
if (
|
681
|
-
|
682
|
-
|
683
|
-
if (!
|
684
|
-
|
692
|
+
stop_html5_timer();
|
693
|
+
if (s._a) {
|
694
|
+
s._a.pause();
|
695
|
+
html5Unload(s._a);
|
696
|
+
if (!useGlobalHTML5Audio) {
|
697
|
+
remove_html5_events();
|
685
698
|
}
|
686
|
-
|
687
|
-
|
699
|
+
s._a._s = null;
|
700
|
+
s._a = null;
|
688
701
|
}
|
689
702
|
}
|
690
703
|
if (!_bFromSM) {
|
691
|
-
|
704
|
+
sm2.destroySound(s.id, true);
|
692
705
|
}
|
693
706
|
};
|
694
707
|
this.play = function(oOptions, _updatePlayState) {
|
695
708
|
var fN, allowMulti, a, onready, startOK = true,
|
696
709
|
exit = null;
|
697
|
-
_updatePlayState = (
|
710
|
+
_updatePlayState = (_updatePlayState === _undefined ? true : _updatePlayState);
|
698
711
|
if (!oOptions) {
|
699
712
|
oOptions = {};
|
700
713
|
}
|
701
|
-
if (
|
702
|
-
|
714
|
+
if (s.url) {
|
715
|
+
s._iO.url = s.url;
|
703
716
|
}
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
if (
|
709
|
-
if (!
|
710
|
-
|
717
|
+
s._iO = mixin(s._iO, s.options);
|
718
|
+
s._iO = mixin(oOptions, s._iO);
|
719
|
+
s._iO.url = parseURL(s._iO.url);
|
720
|
+
s.instanceOptions = s._iO;
|
721
|
+
if (s._iO.serverURL && !s.connected) {
|
722
|
+
if (!s.getAutoPlay()) {
|
723
|
+
s.setAutoPlay(true);
|
711
724
|
}
|
712
|
-
return
|
725
|
+
return s;
|
713
726
|
}
|
714
|
-
if (
|
715
|
-
|
716
|
-
|
727
|
+
if (html5OK(s._iO)) {
|
728
|
+
s._setup_html5(s._iO);
|
729
|
+
start_html5_timer();
|
717
730
|
}
|
718
|
-
if (
|
719
|
-
allowMulti =
|
731
|
+
if (s.playState === 1 && !s.paused) {
|
732
|
+
allowMulti = s._iO.multiShot;
|
720
733
|
if (!allowMulti) {
|
721
|
-
exit =
|
734
|
+
exit = s;
|
722
735
|
} else {
|
723
736
|
}
|
724
737
|
}
|
725
738
|
if (exit !== null) {
|
726
739
|
return exit;
|
727
740
|
}
|
728
|
-
if (oOptions.url && oOptions.url !==
|
729
|
-
|
741
|
+
if (oOptions.url && oOptions.url !== s.url) {
|
742
|
+
s.load(s._iO);
|
730
743
|
}
|
731
|
-
if (!
|
732
|
-
if (
|
733
|
-
if (!
|
734
|
-
|
735
|
-
|
744
|
+
if (!s.loaded) {
|
745
|
+
if (s.readyState === 0) {
|
746
|
+
if (!s.isHTML5) {
|
747
|
+
s._iO.autoPlay = true;
|
748
|
+
s.load(s._iO);
|
736
749
|
} else {
|
737
|
-
|
750
|
+
s.load(s._iO);
|
738
751
|
}
|
739
|
-
|
740
|
-
|
752
|
+
s.instanceOptions = s._iO;
|
753
|
+
} else if (s.readyState === 2) {
|
754
|
+
exit = s;
|
741
755
|
} else {
|
742
756
|
}
|
743
757
|
} else {
|
@@ -745,25 +759,25 @@ function SoundManager(smURL, smID) {
|
|
745
759
|
if (exit !== null) {
|
746
760
|
return exit;
|
747
761
|
}
|
748
|
-
if (!
|
762
|
+
if (!s.isHTML5 && fV === 9 && s.position > 0 && s.position === s.duration) {
|
749
763
|
oOptions.position = 0;
|
750
764
|
}
|
751
|
-
if (
|
752
|
-
|
765
|
+
if (s.paused && s.position >= 0 && (!s._iO.serverURL || s.position > 0)) {
|
766
|
+
s.resume();
|
753
767
|
} else {
|
754
|
-
|
755
|
-
if (
|
768
|
+
s._iO = mixin(oOptions, s._iO);
|
769
|
+
if (s._iO.from !== null && s._iO.to !== null && s.instanceCount === 0 && s.playState === 0 && !s._iO.serverURL) {
|
756
770
|
onready = function() {
|
757
|
-
|
758
|
-
|
771
|
+
s._iO = mixin(oOptions, s._iO);
|
772
|
+
s.play(s._iO);
|
759
773
|
};
|
760
|
-
if (
|
761
|
-
|
762
|
-
|
774
|
+
if (s.isHTML5 && !s._html5_canplay) {
|
775
|
+
s.load({
|
776
|
+
oncanplay: onready
|
763
777
|
});
|
764
778
|
exit = false;
|
765
|
-
} else if (!
|
766
|
-
|
779
|
+
} else if (!s.isHTML5 && !s.loaded && (!s.readyState || s.readyState !== 2)) {
|
780
|
+
s.load({
|
767
781
|
onload: onready
|
768
782
|
});
|
769
783
|
exit = false;
|
@@ -771,118 +785,119 @@ function SoundManager(smURL, smID) {
|
|
771
785
|
if (exit !== null) {
|
772
786
|
return exit;
|
773
787
|
}
|
774
|
-
|
775
|
-
}
|
776
|
-
if (!
|
777
|
-
|
778
|
-
}
|
779
|
-
if (
|
780
|
-
|
781
|
-
}
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
if (!
|
786
|
-
|
787
|
-
}
|
788
|
-
if (
|
789
|
-
|
790
|
-
|
791
|
-
}
|
792
|
-
|
793
|
-
|
794
|
-
if (!
|
795
|
-
startOK =
|
796
|
-
if (
|
797
|
-
if (
|
798
|
-
|
788
|
+
s._iO = applyFromTo();
|
789
|
+
}
|
790
|
+
if (!s.instanceCount || s._iO.multiShotEvents || (!s.isHTML5 && fV > 8 && !s.getAutoPlay())) {
|
791
|
+
s.instanceCount++;
|
792
|
+
}
|
793
|
+
if (s._iO.onposition && s.playState === 0) {
|
794
|
+
attachOnPosition(s);
|
795
|
+
}
|
796
|
+
s.playState = 1;
|
797
|
+
s.paused = false;
|
798
|
+
s.position = (s._iO.position !== _undefined && !isNaN(s._iO.position) ? s._iO.position : 0);
|
799
|
+
if (!s.isHTML5) {
|
800
|
+
s._iO = policyFix(loopFix(s._iO));
|
801
|
+
}
|
802
|
+
if (s._iO.onplay && _updatePlayState) {
|
803
|
+
s._iO.onplay.apply(s);
|
804
|
+
onplay_called = true;
|
805
|
+
}
|
806
|
+
s.setVolume(s._iO.volume, true);
|
807
|
+
s.setPan(s._iO.pan, true);
|
808
|
+
if (!s.isHTML5) {
|
809
|
+
startOK = flash._start(s.id, s._iO.loops || 1, (fV === 9 ? s.position : s.position / 1000), s._iO.multiShot || false);
|
810
|
+
if (fV === 9 && !startOK) {
|
811
|
+
if (s._iO.onplayerror) {
|
812
|
+
s._iO.onplayerror.apply(s);
|
799
813
|
}
|
800
814
|
}
|
801
815
|
} else {
|
802
|
-
|
803
|
-
a =
|
804
|
-
|
816
|
+
start_html5_timer();
|
817
|
+
a = s._setup_html5();
|
818
|
+
s.setPosition(s._iO.position);
|
805
819
|
a.play();
|
806
820
|
}
|
807
821
|
}
|
808
|
-
return
|
822
|
+
return s;
|
809
823
|
};
|
810
824
|
this.start = this.play;
|
811
825
|
this.stop = function(bAll) {
|
812
|
-
var
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
826
|
+
var instanceOptions = s._iO,
|
827
|
+
originalPosition;
|
828
|
+
if (s.playState === 1) {
|
829
|
+
s._onbufferchange(0);
|
830
|
+
s._resetOnPosition(0);
|
831
|
+
s.paused = false;
|
832
|
+
if (!s.isHTML5) {
|
833
|
+
s.playState = 0;
|
834
|
+
}
|
835
|
+
detachOnPosition();
|
836
|
+
if (instanceOptions.to) {
|
837
|
+
s.clearOnPosition(instanceOptions.to);
|
838
|
+
}
|
839
|
+
if (!s.isHTML5) {
|
840
|
+
flash._stop(s.id, bAll);
|
841
|
+
if (instanceOptions.serverURL) {
|
842
|
+
s.unload();
|
828
843
|
}
|
829
844
|
} else {
|
830
|
-
if (
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
845
|
+
if (s._a) {
|
846
|
+
originalPosition = s.position;
|
847
|
+
s.setPosition(0);
|
848
|
+
s.position = originalPosition;
|
849
|
+
s._a.pause();
|
850
|
+
s.playState = 0;
|
851
|
+
s._onTimer();
|
852
|
+
stop_html5_timer();
|
838
853
|
}
|
839
854
|
}
|
840
|
-
|
841
|
-
|
842
|
-
if (
|
843
|
-
|
855
|
+
s.instanceCount = 0;
|
856
|
+
s._iO = {};
|
857
|
+
if (instanceOptions.onstop) {
|
858
|
+
instanceOptions.onstop.apply(s);
|
844
859
|
}
|
845
860
|
}
|
846
|
-
return
|
861
|
+
return s;
|
847
862
|
};
|
848
863
|
this.setAutoPlay = function(autoPlay) {
|
849
|
-
|
850
|
-
if (!
|
851
|
-
|
864
|
+
s._iO.autoPlay = autoPlay;
|
865
|
+
if (!s.isHTML5) {
|
866
|
+
flash._setAutoPlay(s.id, autoPlay);
|
852
867
|
if (autoPlay) {
|
853
|
-
if (!
|
854
|
-
|
868
|
+
if (!s.instanceCount && s.readyState === 1) {
|
869
|
+
s.instanceCount++;
|
855
870
|
}
|
856
871
|
}
|
857
872
|
}
|
858
873
|
};
|
859
874
|
this.getAutoPlay = function() {
|
860
|
-
return
|
875
|
+
return s._iO.autoPlay;
|
861
876
|
};
|
862
877
|
this.setPosition = function(nMsecOffset) {
|
863
|
-
if (
|
878
|
+
if (nMsecOffset === _undefined) {
|
864
879
|
nMsecOffset = 0;
|
865
880
|
}
|
866
881
|
var original_pos,
|
867
882
|
position, position1K,
|
868
|
-
offset = (
|
869
|
-
original_pos =
|
870
|
-
|
871
|
-
position1K =
|
872
|
-
|
873
|
-
|
874
|
-
if (!
|
875
|
-
position = (
|
876
|
-
if (
|
877
|
-
|
878
|
-
}
|
879
|
-
} else if (
|
880
|
-
if (
|
881
|
-
if (
|
883
|
+
offset = (s.isHTML5 ? Math.max(nMsecOffset, 0) : Math.min(s.duration || s._iO.duration, Math.max(nMsecOffset, 0)));
|
884
|
+
original_pos = s.position;
|
885
|
+
s.position = offset;
|
886
|
+
position1K = s.position/1000;
|
887
|
+
s._resetOnPosition(s.position);
|
888
|
+
s._iO.position = offset;
|
889
|
+
if (!s.isHTML5) {
|
890
|
+
position = (fV === 9 ? s.position : position1K);
|
891
|
+
if (s.readyState && s.readyState !== 2) {
|
892
|
+
flash._setPosition(s.id, position, (s.paused || !s.playState), s._iO.multiShot);
|
893
|
+
}
|
894
|
+
} else if (s._a) {
|
895
|
+
if (s._html5_canplay) {
|
896
|
+
if (s._a.currentTime !== position1K) {
|
882
897
|
try {
|
883
|
-
|
884
|
-
if (
|
885
|
-
|
898
|
+
s._a.currentTime = position1K;
|
899
|
+
if (s.playState === 0 || s.paused) {
|
900
|
+
s._a.pause();
|
886
901
|
}
|
887
902
|
} catch(e) {
|
888
903
|
}
|
@@ -890,135 +905,135 @@ function SoundManager(smURL, smID) {
|
|
890
905
|
} else {
|
891
906
|
}
|
892
907
|
}
|
893
|
-
if (
|
894
|
-
if (
|
895
|
-
|
908
|
+
if (s.isHTML5) {
|
909
|
+
if (s.paused) {
|
910
|
+
s._onTimer(true);
|
896
911
|
}
|
897
912
|
}
|
898
|
-
return
|
913
|
+
return s;
|
899
914
|
};
|
900
915
|
this.pause = function(_bCallFlash) {
|
901
|
-
if (
|
902
|
-
return
|
916
|
+
if (s.paused || (s.playState === 0 && s.readyState !== 1)) {
|
917
|
+
return s;
|
903
918
|
}
|
904
|
-
|
905
|
-
if (!
|
906
|
-
if (_bCallFlash ||
|
907
|
-
|
919
|
+
s.paused = true;
|
920
|
+
if (!s.isHTML5) {
|
921
|
+
if (_bCallFlash || _bCallFlash === _undefined) {
|
922
|
+
flash._pause(s.id, s._iO.multiShot);
|
908
923
|
}
|
909
924
|
} else {
|
910
|
-
|
911
|
-
|
925
|
+
s._setup_html5().pause();
|
926
|
+
stop_html5_timer();
|
912
927
|
}
|
913
|
-
if (
|
914
|
-
|
928
|
+
if (s._iO.onpause) {
|
929
|
+
s._iO.onpause.apply(s);
|
915
930
|
}
|
916
|
-
return
|
931
|
+
return s;
|
917
932
|
};
|
918
933
|
this.resume = function() {
|
919
|
-
var
|
920
|
-
if (!
|
921
|
-
return
|
934
|
+
var instanceOptions = s._iO;
|
935
|
+
if (!s.paused) {
|
936
|
+
return s;
|
922
937
|
}
|
923
|
-
|
924
|
-
|
925
|
-
if (!
|
926
|
-
if (
|
927
|
-
|
938
|
+
s.paused = false;
|
939
|
+
s.playState = 1;
|
940
|
+
if (!s.isHTML5) {
|
941
|
+
if (instanceOptions.isMovieStar && !instanceOptions.serverURL) {
|
942
|
+
s.setPosition(s.position);
|
928
943
|
}
|
929
|
-
|
944
|
+
flash._pause(s.id, instanceOptions.multiShot);
|
930
945
|
} else {
|
931
|
-
|
932
|
-
|
946
|
+
s._setup_html5().play();
|
947
|
+
start_html5_timer();
|
933
948
|
}
|
934
|
-
if (!
|
935
|
-
|
936
|
-
|
937
|
-
} else if (
|
938
|
-
|
949
|
+
if (!onplay_called && instanceOptions.onplay) {
|
950
|
+
instanceOptions.onplay.apply(s);
|
951
|
+
onplay_called = true;
|
952
|
+
} else if (instanceOptions.onresume) {
|
953
|
+
instanceOptions.onresume.apply(s);
|
939
954
|
}
|
940
|
-
return
|
955
|
+
return s;
|
941
956
|
};
|
942
957
|
this.togglePause = function() {
|
943
|
-
if (
|
944
|
-
|
945
|
-
position: (
|
958
|
+
if (s.playState === 0) {
|
959
|
+
s.play({
|
960
|
+
position: (fV === 9 && !s.isHTML5 ? s.position : s.position / 1000)
|
946
961
|
});
|
947
|
-
return
|
962
|
+
return s;
|
948
963
|
}
|
949
|
-
if (
|
950
|
-
|
964
|
+
if (s.paused) {
|
965
|
+
s.resume();
|
951
966
|
} else {
|
952
|
-
|
967
|
+
s.pause();
|
953
968
|
}
|
954
|
-
return
|
969
|
+
return s;
|
955
970
|
};
|
956
971
|
this.setPan = function(nPan, bInstanceOnly) {
|
957
|
-
if (
|
972
|
+
if (nPan === _undefined) {
|
958
973
|
nPan = 0;
|
959
974
|
}
|
960
|
-
if (
|
975
|
+
if (bInstanceOnly === _undefined) {
|
961
976
|
bInstanceOnly = false;
|
962
977
|
}
|
963
|
-
if (!
|
964
|
-
|
978
|
+
if (!s.isHTML5) {
|
979
|
+
flash._setPan(s.id, nPan);
|
965
980
|
}
|
966
|
-
|
981
|
+
s._iO.pan = nPan;
|
967
982
|
if (!bInstanceOnly) {
|
968
|
-
|
969
|
-
|
983
|
+
s.pan = nPan;
|
984
|
+
s.options.pan = nPan;
|
970
985
|
}
|
971
|
-
return
|
986
|
+
return s;
|
972
987
|
};
|
973
988
|
this.setVolume = function(nVol, _bInstanceOnly) {
|
974
|
-
if (
|
989
|
+
if (nVol === _undefined) {
|
975
990
|
nVol = 100;
|
976
991
|
}
|
977
|
-
if (
|
992
|
+
if (_bInstanceOnly === _undefined) {
|
978
993
|
_bInstanceOnly = false;
|
979
994
|
}
|
980
|
-
if (!
|
981
|
-
|
982
|
-
} else if (
|
983
|
-
|
995
|
+
if (!s.isHTML5) {
|
996
|
+
flash._setVolume(s.id, (sm2.muted && !s.muted) || s.muted?0:nVol);
|
997
|
+
} else if (s._a) {
|
998
|
+
s._a.volume = Math.max(0, Math.min(1, nVol/100));
|
984
999
|
}
|
985
|
-
|
1000
|
+
s._iO.volume = nVol;
|
986
1001
|
if (!_bInstanceOnly) {
|
987
|
-
|
988
|
-
|
1002
|
+
s.volume = nVol;
|
1003
|
+
s.options.volume = nVol;
|
989
1004
|
}
|
990
|
-
return
|
1005
|
+
return s;
|
991
1006
|
};
|
992
1007
|
this.mute = function() {
|
993
|
-
|
994
|
-
if (!
|
995
|
-
|
996
|
-
} else if (
|
997
|
-
|
1008
|
+
s.muted = true;
|
1009
|
+
if (!s.isHTML5) {
|
1010
|
+
flash._setVolume(s.id, 0);
|
1011
|
+
} else if (s._a) {
|
1012
|
+
s._a.muted = true;
|
998
1013
|
}
|
999
|
-
return
|
1014
|
+
return s;
|
1000
1015
|
};
|
1001
1016
|
this.unmute = function() {
|
1002
|
-
|
1003
|
-
var hasIO = (
|
1004
|
-
if (!
|
1005
|
-
|
1006
|
-
} else if (
|
1007
|
-
|
1008
|
-
}
|
1009
|
-
return
|
1017
|
+
s.muted = false;
|
1018
|
+
var hasIO = (s._iO.volume !== _undefined);
|
1019
|
+
if (!s.isHTML5) {
|
1020
|
+
flash._setVolume(s.id, hasIO?s._iO.volume:s.options.volume);
|
1021
|
+
} else if (s._a) {
|
1022
|
+
s._a.muted = false;
|
1023
|
+
}
|
1024
|
+
return s;
|
1010
1025
|
};
|
1011
1026
|
this.toggleMute = function() {
|
1012
|
-
return (
|
1027
|
+
return (s.muted?s.unmute():s.mute());
|
1013
1028
|
};
|
1014
1029
|
this.onPosition = function(nPosition, oMethod, oScope) {
|
1015
|
-
|
1030
|
+
onPositionItems.push({
|
1016
1031
|
position: parseInt(nPosition, 10),
|
1017
1032
|
method: oMethod,
|
1018
|
-
scope: (
|
1033
|
+
scope: (oScope !== _undefined ? oScope : s),
|
1019
1034
|
fired: false
|
1020
1035
|
});
|
1021
|
-
return
|
1036
|
+
return s;
|
1022
1037
|
};
|
1023
1038
|
this.onposition = this.onPosition;
|
1024
1039
|
this.clearOnPosition = function(nPosition, oMethod) {
|
@@ -1027,164 +1042,164 @@ function SoundManager(smURL, smID) {
|
|
1027
1042
|
if (isNaN(nPosition)) {
|
1028
1043
|
return false;
|
1029
1044
|
}
|
1030
|
-
for (i=0; i <
|
1031
|
-
if (nPosition ===
|
1032
|
-
if (!oMethod || (oMethod ===
|
1033
|
-
if (
|
1034
|
-
|
1045
|
+
for (i=0; i < onPositionItems.length; i++) {
|
1046
|
+
if (nPosition === onPositionItems[i].position) {
|
1047
|
+
if (!oMethod || (oMethod === onPositionItems[i].method)) {
|
1048
|
+
if (onPositionItems[i].fired) {
|
1049
|
+
onPositionFired--;
|
1035
1050
|
}
|
1036
|
-
|
1051
|
+
onPositionItems.splice(i, 1);
|
1037
1052
|
}
|
1038
1053
|
}
|
1039
1054
|
}
|
1040
1055
|
};
|
1041
1056
|
this._processOnPosition = function() {
|
1042
|
-
var i, item, j =
|
1043
|
-
if (!j || !
|
1057
|
+
var i, item, j = onPositionItems.length;
|
1058
|
+
if (!j || !s.playState || onPositionFired >= j) {
|
1044
1059
|
return false;
|
1045
1060
|
}
|
1046
1061
|
for (i=j-1; i >= 0; i--) {
|
1047
|
-
item =
|
1048
|
-
if (!item.fired &&
|
1062
|
+
item = onPositionItems[i];
|
1063
|
+
if (!item.fired && s.position >= item.position) {
|
1049
1064
|
item.fired = true;
|
1050
|
-
|
1065
|
+
onPositionFired++;
|
1051
1066
|
item.method.apply(item.scope, [item.position]);
|
1052
1067
|
}
|
1053
1068
|
}
|
1054
1069
|
return true;
|
1055
1070
|
};
|
1056
1071
|
this._resetOnPosition = function(nPosition) {
|
1057
|
-
var i, item, j =
|
1072
|
+
var i, item, j = onPositionItems.length;
|
1058
1073
|
if (!j) {
|
1059
1074
|
return false;
|
1060
1075
|
}
|
1061
1076
|
for (i=j-1; i >= 0; i--) {
|
1062
|
-
item =
|
1077
|
+
item = onPositionItems[i];
|
1063
1078
|
if (item.fired && nPosition <= item.position) {
|
1064
1079
|
item.fired = false;
|
1065
|
-
|
1080
|
+
onPositionFired--;
|
1066
1081
|
}
|
1067
1082
|
}
|
1068
1083
|
return true;
|
1069
1084
|
};
|
1070
|
-
|
1071
|
-
var
|
1072
|
-
f =
|
1073
|
-
t =
|
1085
|
+
applyFromTo = function() {
|
1086
|
+
var instanceOptions = s._iO,
|
1087
|
+
f = instanceOptions.from,
|
1088
|
+
t = instanceOptions.to,
|
1074
1089
|
start, end;
|
1075
1090
|
end = function() {
|
1076
|
-
|
1077
|
-
|
1091
|
+
s.clearOnPosition(t, end);
|
1092
|
+
s.stop();
|
1078
1093
|
};
|
1079
1094
|
start = function() {
|
1080
1095
|
if (t !== null && !isNaN(t)) {
|
1081
|
-
|
1096
|
+
s.onPosition(t, end);
|
1082
1097
|
}
|
1083
1098
|
};
|
1084
1099
|
if (f !== null && !isNaN(f)) {
|
1085
|
-
|
1086
|
-
|
1100
|
+
instanceOptions.position = f;
|
1101
|
+
instanceOptions.multiShot = false;
|
1087
1102
|
start();
|
1088
1103
|
}
|
1089
|
-
return
|
1104
|
+
return instanceOptions;
|
1090
1105
|
};
|
1091
|
-
|
1106
|
+
attachOnPosition = function() {
|
1092
1107
|
var item,
|
1093
|
-
op =
|
1108
|
+
op = s._iO.onposition;
|
1094
1109
|
if (op) {
|
1095
1110
|
for (item in op) {
|
1096
1111
|
if (op.hasOwnProperty(item)) {
|
1097
|
-
|
1112
|
+
s.onPosition(parseInt(item, 10), op[item]);
|
1098
1113
|
}
|
1099
1114
|
}
|
1100
1115
|
}
|
1101
1116
|
};
|
1102
|
-
|
1117
|
+
detachOnPosition = function() {
|
1103
1118
|
var item,
|
1104
|
-
op =
|
1119
|
+
op = s._iO.onposition;
|
1105
1120
|
if (op) {
|
1106
1121
|
for (item in op) {
|
1107
1122
|
if (op.hasOwnProperty(item)) {
|
1108
|
-
|
1123
|
+
s.clearOnPosition(parseInt(item, 10));
|
1109
1124
|
}
|
1110
1125
|
}
|
1111
1126
|
}
|
1112
1127
|
};
|
1113
|
-
|
1114
|
-
if (
|
1115
|
-
|
1128
|
+
start_html5_timer = function() {
|
1129
|
+
if (s.isHTML5) {
|
1130
|
+
startTimer(s);
|
1116
1131
|
}
|
1117
1132
|
};
|
1118
|
-
|
1119
|
-
if (
|
1120
|
-
|
1133
|
+
stop_html5_timer = function() {
|
1134
|
+
if (s.isHTML5) {
|
1135
|
+
stopTimer(s);
|
1121
1136
|
}
|
1122
1137
|
};
|
1123
|
-
|
1138
|
+
resetProperties = function(retainPosition) {
|
1124
1139
|
if (!retainPosition) {
|
1125
|
-
|
1126
|
-
|
1127
|
-
}
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1140
|
+
onPositionItems = [];
|
1141
|
+
onPositionFired = 0;
|
1142
|
+
}
|
1143
|
+
onplay_called = false;
|
1144
|
+
s._hasTimer = null;
|
1145
|
+
s._a = null;
|
1146
|
+
s._html5_canplay = false;
|
1147
|
+
s.bytesLoaded = null;
|
1148
|
+
s.bytesTotal = null;
|
1149
|
+
s.duration = (s._iO && s._iO.duration ? s._iO.duration : null);
|
1150
|
+
s.durationEstimate = null;
|
1151
|
+
s.buffered = [];
|
1152
|
+
s.eqData = [];
|
1153
|
+
s.eqData.left = [];
|
1154
|
+
s.eqData.right = [];
|
1155
|
+
s.failures = 0;
|
1156
|
+
s.isBuffering = false;
|
1157
|
+
s.instanceOptions = {};
|
1158
|
+
s.instanceCount = 0;
|
1159
|
+
s.loaded = false;
|
1160
|
+
s.metadata = {};
|
1161
|
+
s.readyState = 0;
|
1162
|
+
s.muted = false;
|
1163
|
+
s.paused = false;
|
1164
|
+
s.peakData = {
|
1150
1165
|
left: 0,
|
1151
1166
|
right: 0
|
1152
1167
|
};
|
1153
|
-
|
1168
|
+
s.waveformData = {
|
1154
1169
|
left: [],
|
1155
1170
|
right: []
|
1156
1171
|
};
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1172
|
+
s.playState = 0;
|
1173
|
+
s.position = null;
|
1174
|
+
s.id3 = {};
|
1160
1175
|
};
|
1161
|
-
|
1176
|
+
resetProperties();
|
1162
1177
|
this._onTimer = function(bForce) {
|
1163
1178
|
var duration, isNew = false, time, x = {};
|
1164
|
-
if (
|
1165
|
-
if (
|
1166
|
-
duration =
|
1167
|
-
if (duration !==
|
1168
|
-
|
1169
|
-
|
1179
|
+
if (s._hasTimer || bForce) {
|
1180
|
+
if (s._a && (bForce || ((s.playState > 0 || s.readyState === 1) && !s.paused))) {
|
1181
|
+
duration = s._get_html5_duration();
|
1182
|
+
if (duration !== lastHTML5State.duration) {
|
1183
|
+
lastHTML5State.duration = duration;
|
1184
|
+
s.duration = duration;
|
1170
1185
|
isNew = true;
|
1171
1186
|
}
|
1172
|
-
|
1173
|
-
time = (
|
1174
|
-
if (time !==
|
1175
|
-
|
1187
|
+
s.durationEstimate = s.duration;
|
1188
|
+
time = (s._a.currentTime * 1000 || 0);
|
1189
|
+
if (time !== lastHTML5State.time) {
|
1190
|
+
lastHTML5State.time = time;
|
1176
1191
|
isNew = true;
|
1177
1192
|
}
|
1178
1193
|
if (isNew || bForce) {
|
1179
|
-
|
1194
|
+
s._whileplaying(time,x,x,x,x);
|
1180
1195
|
}
|
1181
1196
|
}
|
1182
1197
|
return isNew;
|
1183
1198
|
}
|
1184
1199
|
};
|
1185
1200
|
this._get_html5_duration = function() {
|
1186
|
-
var
|
1187
|
-
d = (
|
1201
|
+
var instanceOptions = s._iO,
|
1202
|
+
d = (s._a && s._a.duration ? s._a.duration*1000 : (instanceOptions && instanceOptions.duration ? instanceOptions.duration : null)),
|
1188
1203
|
result = (d && !isNaN(d) && d !== Infinity ? d : null);
|
1189
1204
|
return result;
|
1190
1205
|
};
|
@@ -1192,338 +1207,354 @@ function SoundManager(smURL, smID) {
|
|
1192
1207
|
a.loop = (nLoops > 1 ? 'loop' : '');
|
1193
1208
|
};
|
1194
1209
|
this._setup_html5 = function(oOptions) {
|
1195
|
-
var
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
+
var instanceOptions = mixin(s._iO, oOptions),
|
1211
|
+
a = useGlobalHTML5Audio ? globalHTML5Audio : s._a,
|
1212
|
+
dURL = decodeURI(instanceOptions.url),
|
1213
|
+
sameURL;
|
1214
|
+
if (useGlobalHTML5Audio) {
|
1215
|
+
if (dURL === decodeURI(lastGlobalHTML5URL)) {
|
1216
|
+
sameURL = true;
|
1217
|
+
}
|
1218
|
+
} else if (dURL === decodeURI(lastURL)) {
|
1219
|
+
sameURL = true;
|
1220
|
+
}
|
1221
|
+
if (a) {
|
1222
|
+
if (a._s) {
|
1223
|
+
if (useGlobalHTML5Audio) {
|
1224
|
+
if (a._s && a._s.playState && !sameURL) {
|
1225
|
+
a._s.stop();
|
1226
|
+
}
|
1227
|
+
} else if (!useGlobalHTML5Audio && dURL === decodeURI(lastURL)) {
|
1228
|
+
s._apply_loop(a, instanceOptions.loops);
|
1229
|
+
return a;
|
1210
1230
|
}
|
1211
1231
|
}
|
1212
|
-
if (
|
1213
|
-
|
1232
|
+
if (!sameURL) {
|
1233
|
+
resetProperties(false);
|
1234
|
+
a.src = instanceOptions.url;
|
1235
|
+
s.url = instanceOptions.url;
|
1236
|
+
lastURL = instanceOptions.url;
|
1237
|
+
lastGlobalHTML5URL = instanceOptions.url;
|
1238
|
+
a._called_load = false;
|
1214
1239
|
}
|
1215
|
-
_resetProperties((_oldIO && _oldIO.url ? _iO.url === _oldIO.url : (_lastURL ? _lastURL === _iO.url : false)));
|
1216
|
-
_a.src = _iO.url;
|
1217
|
-
_t.url = _iO.url;
|
1218
|
-
_lastURL = _iO.url;
|
1219
|
-
_a._called_load = false;
|
1220
1240
|
} else {
|
1221
|
-
if (
|
1222
|
-
|
1241
|
+
if (instanceOptions.autoLoad || instanceOptions.autoPlay) {
|
1242
|
+
s._a = new Audio(instanceOptions.url);
|
1223
1243
|
} else {
|
1224
|
-
|
1244
|
+
s._a = (isOpera && opera.version() < 10 ? new Audio(null) : new Audio());
|
1225
1245
|
}
|
1226
|
-
|
1227
|
-
|
1228
|
-
if (
|
1229
|
-
|
1246
|
+
a = s._a;
|
1247
|
+
a._called_load = false;
|
1248
|
+
if (useGlobalHTML5Audio) {
|
1249
|
+
globalHTML5Audio = a;
|
1230
1250
|
}
|
1231
1251
|
}
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
if (
|
1238
|
-
|
1252
|
+
s.isHTML5 = true;
|
1253
|
+
s._a = a;
|
1254
|
+
a._s = s;
|
1255
|
+
add_html5_events();
|
1256
|
+
s._apply_loop(a, instanceOptions.loops);
|
1257
|
+
if (instanceOptions.autoLoad || instanceOptions.autoPlay) {
|
1258
|
+
s.load();
|
1239
1259
|
} else {
|
1240
|
-
|
1241
|
-
|
1260
|
+
a.autobuffer = false;
|
1261
|
+
a.preload = 'auto';
|
1242
1262
|
}
|
1243
|
-
return
|
1263
|
+
return a;
|
1244
1264
|
};
|
1245
|
-
|
1246
|
-
if (
|
1265
|
+
add_html5_events = function() {
|
1266
|
+
if (s._a._added_events) {
|
1247
1267
|
return false;
|
1248
1268
|
}
|
1249
1269
|
var f;
|
1250
1270
|
function add(oEvt, oFn, bCapture) {
|
1251
|
-
return
|
1271
|
+
return s._a ? s._a.addEventListener(oEvt, oFn, bCapture||false) : null;
|
1252
1272
|
}
|
1253
|
-
|
1254
|
-
for (f in
|
1255
|
-
if (
|
1256
|
-
add(f,
|
1273
|
+
s._a._added_events = true;
|
1274
|
+
for (f in html5_events) {
|
1275
|
+
if (html5_events.hasOwnProperty(f)) {
|
1276
|
+
add(f, html5_events[f]);
|
1257
1277
|
}
|
1258
1278
|
}
|
1259
1279
|
return true;
|
1260
1280
|
};
|
1261
|
-
|
1281
|
+
remove_html5_events = function() {
|
1262
1282
|
var f;
|
1263
1283
|
function remove(oEvt, oFn, bCapture) {
|
1264
|
-
return (
|
1284
|
+
return (s._a ? s._a.removeEventListener(oEvt, oFn, bCapture||false) : null);
|
1265
1285
|
}
|
1266
|
-
|
1267
|
-
for (f in
|
1268
|
-
if (
|
1269
|
-
remove(f,
|
1286
|
+
s._a._added_events = false;
|
1287
|
+
for (f in html5_events) {
|
1288
|
+
if (html5_events.hasOwnProperty(f)) {
|
1289
|
+
remove(f, html5_events[f]);
|
1270
1290
|
}
|
1271
1291
|
}
|
1272
1292
|
};
|
1273
1293
|
this._onload = function(nSuccess) {
|
1274
1294
|
var fN,
|
1275
|
-
loadOK =
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
if (
|
1280
|
-
|
1295
|
+
loadOK = !!nSuccess || (!s.isHTML5 && fV === 8 && s.duration);
|
1296
|
+
s.loaded = loadOK;
|
1297
|
+
s.readyState = loadOK?3:2;
|
1298
|
+
s._onbufferchange(0);
|
1299
|
+
if (s._iO.onload) {
|
1300
|
+
wrapCallback(s, function() {
|
1301
|
+
s._iO.onload.apply(s, [loadOK]);
|
1302
|
+
});
|
1281
1303
|
}
|
1282
1304
|
return true;
|
1283
1305
|
};
|
1284
1306
|
this._onbufferchange = function(nIsBuffering) {
|
1285
|
-
if (
|
1307
|
+
if (s.playState === 0) {
|
1286
1308
|
return false;
|
1287
1309
|
}
|
1288
|
-
if ((nIsBuffering &&
|
1310
|
+
if ((nIsBuffering && s.isBuffering) || (!nIsBuffering && !s.isBuffering)) {
|
1289
1311
|
return false;
|
1290
1312
|
}
|
1291
|
-
|
1292
|
-
if (
|
1293
|
-
|
1313
|
+
s.isBuffering = (nIsBuffering === 1);
|
1314
|
+
if (s._iO.onbufferchange) {
|
1315
|
+
s._iO.onbufferchange.apply(s);
|
1294
1316
|
}
|
1295
1317
|
return true;
|
1296
1318
|
};
|
1297
1319
|
this._onsuspend = function() {
|
1298
|
-
if (
|
1299
|
-
|
1320
|
+
if (s._iO.onsuspend) {
|
1321
|
+
s._iO.onsuspend.apply(s);
|
1300
1322
|
}
|
1301
1323
|
return true;
|
1302
1324
|
};
|
1303
1325
|
this._onfailure = function(msg, level, code) {
|
1304
|
-
|
1305
|
-
if (
|
1306
|
-
|
1326
|
+
s.failures++;
|
1327
|
+
if (s._iO.onfailure && s.failures === 1) {
|
1328
|
+
s._iO.onfailure(s, msg, level, code);
|
1307
1329
|
} else {
|
1308
1330
|
}
|
1309
1331
|
};
|
1310
1332
|
this._onfinish = function() {
|
1311
|
-
var
|
1312
|
-
|
1313
|
-
|
1314
|
-
if (
|
1315
|
-
|
1316
|
-
if (!
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
if (
|
1325
|
-
|
1333
|
+
var io_onfinish = s._iO.onfinish;
|
1334
|
+
s._onbufferchange(0);
|
1335
|
+
s._resetOnPosition(0);
|
1336
|
+
if (s.instanceCount) {
|
1337
|
+
s.instanceCount--;
|
1338
|
+
if (!s.instanceCount) {
|
1339
|
+
detachOnPosition();
|
1340
|
+
s.playState = 0;
|
1341
|
+
s.paused = false;
|
1342
|
+
s.instanceCount = 0;
|
1343
|
+
s.instanceOptions = {};
|
1344
|
+
s._iO = {};
|
1345
|
+
stop_html5_timer();
|
1346
|
+
if (s.isHTML5) {
|
1347
|
+
s.position = 0;
|
1326
1348
|
}
|
1327
1349
|
}
|
1328
|
-
if (!
|
1329
|
-
if (
|
1330
|
-
|
1350
|
+
if (!s.instanceCount || s._iO.multiShotEvents) {
|
1351
|
+
if (io_onfinish) {
|
1352
|
+
wrapCallback(s, function() {
|
1353
|
+
io_onfinish.apply(s);
|
1354
|
+
});
|
1331
1355
|
}
|
1332
1356
|
}
|
1333
1357
|
}
|
1334
1358
|
};
|
1335
1359
|
this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) {
|
1336
|
-
var
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
if (!
|
1342
|
-
if (
|
1343
|
-
|
1360
|
+
var instanceOptions = s._iO;
|
1361
|
+
s.bytesLoaded = nBytesLoaded;
|
1362
|
+
s.bytesTotal = nBytesTotal;
|
1363
|
+
s.duration = Math.floor(nDuration);
|
1364
|
+
s.bufferLength = nBufferLength;
|
1365
|
+
if (!s.isHTML5 && !instanceOptions.isMovieStar) {
|
1366
|
+
if (instanceOptions.duration) {
|
1367
|
+
s.durationEstimate = (s.duration > instanceOptions.duration) ? s.duration : instanceOptions.duration;
|
1344
1368
|
} else {
|
1345
|
-
|
1369
|
+
s.durationEstimate = parseInt((s.bytesTotal / s.bytesLoaded) * s.duration, 10);
|
1346
1370
|
}
|
1347
1371
|
} else {
|
1348
|
-
|
1372
|
+
s.durationEstimate = s.duration;
|
1349
1373
|
}
|
1350
|
-
if (!
|
1351
|
-
|
1374
|
+
if (!s.isHTML5) {
|
1375
|
+
s.buffered = [{
|
1352
1376
|
'start': 0,
|
1353
|
-
'end':
|
1377
|
+
'end': s.duration
|
1354
1378
|
}];
|
1355
1379
|
}
|
1356
|
-
if ((
|
1357
|
-
|
1380
|
+
if ((s.readyState !== 3 || s.isHTML5) && instanceOptions.whileloading) {
|
1381
|
+
instanceOptions.whileloading.apply(s);
|
1358
1382
|
}
|
1359
1383
|
};
|
1360
1384
|
this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) {
|
1361
|
-
var
|
1385
|
+
var instanceOptions = s._iO,
|
1362
1386
|
eqLeft;
|
1363
1387
|
if (isNaN(nPosition) || nPosition === null) {
|
1364
1388
|
return false;
|
1365
1389
|
}
|
1366
|
-
|
1367
|
-
|
1368
|
-
if (!
|
1369
|
-
if (
|
1370
|
-
|
1390
|
+
s.position = Math.max(0, nPosition);
|
1391
|
+
s._processOnPosition();
|
1392
|
+
if (!s.isHTML5 && fV > 8) {
|
1393
|
+
if (instanceOptions.usePeakData && oPeakData !== _undefined && oPeakData) {
|
1394
|
+
s.peakData = {
|
1371
1395
|
left: oPeakData.leftPeak,
|
1372
1396
|
right: oPeakData.rightPeak
|
1373
1397
|
};
|
1374
1398
|
}
|
1375
|
-
if (
|
1376
|
-
|
1399
|
+
if (instanceOptions.useWaveformData && oWaveformDataLeft !== _undefined && oWaveformDataLeft) {
|
1400
|
+
s.waveformData = {
|
1377
1401
|
left: oWaveformDataLeft.split(','),
|
1378
1402
|
right: oWaveformDataRight.split(',')
|
1379
1403
|
};
|
1380
1404
|
}
|
1381
|
-
if (
|
1382
|
-
if (
|
1405
|
+
if (instanceOptions.useEQData) {
|
1406
|
+
if (oEQData !== _undefined && oEQData && oEQData.leftEQ) {
|
1383
1407
|
eqLeft = oEQData.leftEQ.split(',');
|
1384
|
-
|
1385
|
-
|
1386
|
-
if (
|
1387
|
-
|
1408
|
+
s.eqData = eqLeft;
|
1409
|
+
s.eqData.left = eqLeft;
|
1410
|
+
if (oEQData.rightEQ !== _undefined && oEQData.rightEQ) {
|
1411
|
+
s.eqData.right = oEQData.rightEQ.split(',');
|
1388
1412
|
}
|
1389
1413
|
}
|
1390
1414
|
}
|
1391
1415
|
}
|
1392
|
-
if (
|
1393
|
-
if (!
|
1394
|
-
|
1416
|
+
if (s.playState === 1) {
|
1417
|
+
if (!s.isHTML5 && fV === 8 && !s.position && s.isBuffering) {
|
1418
|
+
s._onbufferchange(0);
|
1395
1419
|
}
|
1396
|
-
if (
|
1397
|
-
|
1420
|
+
if (instanceOptions.whileplaying) {
|
1421
|
+
instanceOptions.whileplaying.apply(s);
|
1398
1422
|
}
|
1399
1423
|
}
|
1400
1424
|
return true;
|
1401
1425
|
};
|
1402
1426
|
this._oncaptiondata = function(oData) {
|
1403
|
-
|
1404
|
-
if (
|
1405
|
-
|
1427
|
+
s.captiondata = oData;
|
1428
|
+
if (s._iO.oncaptiondata) {
|
1429
|
+
s._iO.oncaptiondata.apply(s, [oData]);
|
1406
1430
|
}
|
1407
|
-
|
1431
|
+
};
|
1408
1432
|
this._onmetadata = function(oMDProps, oMDData) {
|
1409
1433
|
var oData = {}, i, j;
|
1410
1434
|
for (i = 0, j = oMDProps.length; i < j; i++) {
|
1411
1435
|
oData[oMDProps[i]] = oMDData[i];
|
1412
1436
|
}
|
1413
|
-
|
1414
|
-
if (
|
1415
|
-
|
1437
|
+
s.metadata = oData;
|
1438
|
+
if (s._iO.onmetadata) {
|
1439
|
+
s._iO.onmetadata.apply(s);
|
1416
1440
|
}
|
1417
|
-
|
1441
|
+
};
|
1418
1442
|
this._onid3 = function(oID3Props, oID3Data) {
|
1419
1443
|
var oData = [], i, j;
|
1420
1444
|
for (i = 0, j = oID3Props.length; i < j; i++) {
|
1421
1445
|
oData[oID3Props[i]] = oID3Data[i];
|
1422
1446
|
}
|
1423
|
-
|
1424
|
-
if (
|
1425
|
-
|
1447
|
+
s.id3 = mixin(s.id3, oData);
|
1448
|
+
if (s._iO.onid3) {
|
1449
|
+
s._iO.onid3.apply(s);
|
1426
1450
|
}
|
1427
1451
|
};
|
1428
1452
|
this._onconnect = function(bSuccess) {
|
1429
1453
|
bSuccess = (bSuccess === 1);
|
1430
|
-
|
1454
|
+
s.connected = bSuccess;
|
1431
1455
|
if (bSuccess) {
|
1432
|
-
|
1433
|
-
if (
|
1434
|
-
if (
|
1435
|
-
|
1436
|
-
} else if (
|
1437
|
-
|
1456
|
+
s.failures = 0;
|
1457
|
+
if (idCheck(s.id)) {
|
1458
|
+
if (s.getAutoPlay()) {
|
1459
|
+
s.play(_undefined, s.getAutoPlay());
|
1460
|
+
} else if (s._iO.autoLoad) {
|
1461
|
+
s.load();
|
1438
1462
|
}
|
1439
1463
|
}
|
1440
|
-
if (
|
1441
|
-
|
1464
|
+
if (s._iO.onconnect) {
|
1465
|
+
s._iO.onconnect.apply(s, [bSuccess]);
|
1442
1466
|
}
|
1443
1467
|
}
|
1444
1468
|
};
|
1445
1469
|
this._ondataerror = function(sError) {
|
1446
|
-
if (
|
1447
|
-
if (
|
1448
|
-
|
1470
|
+
if (s.playState > 0) {
|
1471
|
+
if (s._iO.ondataerror) {
|
1472
|
+
s._iO.ondataerror.apply(s);
|
1449
1473
|
}
|
1450
1474
|
}
|
1451
1475
|
};
|
1452
1476
|
};
|
1453
|
-
|
1454
|
-
return (
|
1477
|
+
getDocument = function() {
|
1478
|
+
return (doc.body || doc._docElement || doc.getElementsByTagName('div')[0]);
|
1455
1479
|
};
|
1456
|
-
|
1457
|
-
return
|
1480
|
+
id = function(sID) {
|
1481
|
+
return doc.getElementById(sID);
|
1458
1482
|
};
|
1459
|
-
|
1483
|
+
mixin = function(oMain, oAdd) {
|
1460
1484
|
var o1 = (oMain || {}), o2, o;
|
1461
|
-
o2 = (
|
1485
|
+
o2 = (oAdd === _undefined ? sm2.defaultOptions : oAdd);
|
1462
1486
|
for (o in o2) {
|
1463
|
-
if (o2.hasOwnProperty(o) &&
|
1487
|
+
if (o2.hasOwnProperty(o) && o1[o] === _undefined) {
|
1464
1488
|
if (typeof o2[o] !== 'object' || o2[o] === null) {
|
1465
1489
|
o1[o] = o2[o];
|
1466
1490
|
} else {
|
1467
|
-
o1[o] =
|
1491
|
+
o1[o] = mixin(o1[o], o2[o]);
|
1468
1492
|
}
|
1469
1493
|
}
|
1470
1494
|
}
|
1471
1495
|
return o1;
|
1472
1496
|
};
|
1473
|
-
|
1497
|
+
wrapCallback = function(oSound, callback) {
|
1498
|
+
if (!oSound.isHTML5 && fV === 8) {
|
1499
|
+
window.setTimeout(callback, 0);
|
1500
|
+
} else {
|
1501
|
+
callback();
|
1502
|
+
}
|
1503
|
+
};
|
1504
|
+
extraOptions = {
|
1474
1505
|
'onready': 1,
|
1475
1506
|
'ontimeout': 1,
|
1476
1507
|
'defaultOptions': 1,
|
1477
1508
|
'flash9Options': 1,
|
1478
1509
|
'movieStarOptions': 1
|
1479
1510
|
};
|
1480
|
-
|
1511
|
+
assign = function(o, oParent) {
|
1481
1512
|
var i,
|
1482
1513
|
result = true,
|
1483
|
-
hasParent = (
|
1484
|
-
setupOptions =
|
1485
|
-
|
1514
|
+
hasParent = (oParent !== _undefined),
|
1515
|
+
setupOptions = sm2.setupOptions,
|
1516
|
+
bonusOptions = extraOptions;
|
1486
1517
|
for (i in o) {
|
1487
1518
|
if (o.hasOwnProperty(i)) {
|
1488
|
-
if (typeof o[i] !== 'object' || o[i] === null || o[i] instanceof Array) {
|
1489
|
-
if (hasParent &&
|
1490
|
-
|
1491
|
-
} else if (
|
1492
|
-
|
1493
|
-
|
1494
|
-
} else if (
|
1495
|
-
|
1519
|
+
if (typeof o[i] !== 'object' || o[i] === null || o[i] instanceof Array || o[i] instanceof RegExp) {
|
1520
|
+
if (hasParent && bonusOptions[oParent] !== _undefined) {
|
1521
|
+
sm2[oParent][i] = o[i];
|
1522
|
+
} else if (setupOptions[i] !== _undefined) {
|
1523
|
+
sm2.setupOptions[i] = o[i];
|
1524
|
+
sm2[i] = o[i];
|
1525
|
+
} else if (bonusOptions[i] === _undefined) {
|
1526
|
+
complain(str((sm2[i] === _undefined ? 'setupUndef' : 'setupError'), i), 2);
|
1496
1527
|
result = false;
|
1497
1528
|
} else {
|
1498
|
-
if (
|
1499
|
-
|
1529
|
+
if (sm2[i] instanceof Function) {
|
1530
|
+
sm2[i].apply(sm2, (o[i] instanceof Array? o[i] : [o[i]]));
|
1500
1531
|
} else {
|
1501
|
-
|
1532
|
+
sm2[i] = o[i];
|
1502
1533
|
}
|
1503
1534
|
}
|
1504
1535
|
} else {
|
1505
|
-
if (
|
1506
|
-
|
1536
|
+
if (bonusOptions[i] === _undefined) {
|
1537
|
+
complain(str((sm2[i] === _undefined ? 'setupUndef' : 'setupError'), i), 2);
|
1507
1538
|
result = false;
|
1508
1539
|
} else {
|
1509
|
-
return
|
1540
|
+
return assign(o[i], i);
|
1510
1541
|
}
|
1511
1542
|
}
|
1512
1543
|
}
|
1513
1544
|
}
|
1514
1545
|
return result;
|
1515
1546
|
};
|
1516
|
-
function
|
1517
|
-
return (
|
1547
|
+
function preferFlashCheck(kind) {
|
1548
|
+
return (sm2.preferFlash && hasFlash && !sm2.ignoreFlash && (sm2.flash[kind] !== _undefined && sm2.flash[kind]));
|
1518
1549
|
}
|
1519
|
-
|
1520
|
-
var old = (
|
1550
|
+
event = (function() {
|
1551
|
+
var old = (window.attachEvent),
|
1521
1552
|
evt = {
|
1522
1553
|
add: (old?'attachEvent':'addEventListener'),
|
1523
1554
|
remove: (old?'detachEvent':'removeEventListener')
|
1524
1555
|
};
|
1525
1556
|
function getArgs(oArgs) {
|
1526
|
-
var args =
|
1557
|
+
var args = slice.call(oArgs),
|
1527
1558
|
len = args.length;
|
1528
1559
|
if (old) {
|
1529
1560
|
args[1] = 'on' + args[1];
|
@@ -1555,11 +1586,11 @@ function SoundManager(smURL, smID) {
|
|
1555
1586
|
'remove': remove
|
1556
1587
|
};
|
1557
1588
|
}());
|
1558
|
-
function
|
1589
|
+
function html5_event(oFn) {
|
1559
1590
|
return function(e) {
|
1560
|
-
var
|
1591
|
+
var s = this._s,
|
1561
1592
|
result;
|
1562
|
-
if (!
|
1593
|
+
if (!s || !s._a) {
|
1563
1594
|
result = null;
|
1564
1595
|
} else {
|
1565
1596
|
result = oFn.call(this, e);
|
@@ -1567,72 +1598,72 @@ function SoundManager(smURL, smID) {
|
|
1567
1598
|
return result;
|
1568
1599
|
};
|
1569
1600
|
}
|
1570
|
-
|
1571
|
-
abort:
|
1601
|
+
html5_events = {
|
1602
|
+
abort: html5_event(function() {
|
1572
1603
|
}),
|
1573
|
-
canplay:
|
1574
|
-
var
|
1604
|
+
canplay: html5_event(function() {
|
1605
|
+
var s = this._s,
|
1575
1606
|
position1K;
|
1576
|
-
if (
|
1607
|
+
if (s._html5_canplay) {
|
1577
1608
|
return true;
|
1578
1609
|
}
|
1579
|
-
|
1580
|
-
|
1581
|
-
position1K = (
|
1582
|
-
if (
|
1610
|
+
s._html5_canplay = true;
|
1611
|
+
s._onbufferchange(0);
|
1612
|
+
position1K = (s._iO.position !== _undefined && !isNaN(s._iO.position)?s._iO.position/1000:null);
|
1613
|
+
if (s.position && this.currentTime !== position1K) {
|
1583
1614
|
try {
|
1584
1615
|
this.currentTime = position1K;
|
1585
1616
|
} catch(ee) {
|
1586
1617
|
}
|
1587
1618
|
}
|
1588
|
-
if (
|
1589
|
-
|
1619
|
+
if (s._iO._oncanplay) {
|
1620
|
+
s._iO._oncanplay();
|
1590
1621
|
}
|
1591
1622
|
}),
|
1592
|
-
canplaythrough:
|
1593
|
-
var
|
1594
|
-
if (!
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1623
|
+
canplaythrough: html5_event(function() {
|
1624
|
+
var s = this._s;
|
1625
|
+
if (!s.loaded) {
|
1626
|
+
s._onbufferchange(0);
|
1627
|
+
s._whileloading(s.bytesLoaded, s.bytesTotal, s._get_html5_duration());
|
1628
|
+
s._onload(true);
|
1598
1629
|
}
|
1599
1630
|
}),
|
1600
|
-
ended:
|
1601
|
-
var
|
1602
|
-
|
1631
|
+
ended: html5_event(function() {
|
1632
|
+
var s = this._s;
|
1633
|
+
s._onfinish();
|
1603
1634
|
}),
|
1604
|
-
error:
|
1605
|
-
this.
|
1635
|
+
error: html5_event(function() {
|
1636
|
+
this._s._onload(false);
|
1606
1637
|
}),
|
1607
|
-
loadeddata:
|
1608
|
-
var
|
1609
|
-
if (!
|
1610
|
-
|
1638
|
+
loadeddata: html5_event(function() {
|
1639
|
+
var s = this._s;
|
1640
|
+
if (!s._loaded && !isSafari) {
|
1641
|
+
s.duration = s._get_html5_duration();
|
1611
1642
|
}
|
1612
1643
|
}),
|
1613
|
-
loadedmetadata:
|
1644
|
+
loadedmetadata: html5_event(function() {
|
1614
1645
|
}),
|
1615
|
-
loadstart:
|
1616
|
-
this.
|
1646
|
+
loadstart: html5_event(function() {
|
1647
|
+
this._s._onbufferchange(1);
|
1617
1648
|
}),
|
1618
|
-
play:
|
1619
|
-
this.
|
1649
|
+
play: html5_event(function() {
|
1650
|
+
this._s._onbufferchange(0);
|
1620
1651
|
}),
|
1621
|
-
playing:
|
1622
|
-
this.
|
1652
|
+
playing: html5_event(function() {
|
1653
|
+
this._s._onbufferchange(0);
|
1623
1654
|
}),
|
1624
|
-
progress:
|
1625
|
-
var
|
1655
|
+
progress: html5_event(function(e) {
|
1656
|
+
var s = this._s,
|
1626
1657
|
i, j, str, buffered = 0,
|
1627
1658
|
isProgress = (e.type === 'progress'),
|
1628
1659
|
ranges = e.target.buffered,
|
1629
1660
|
loaded = (e.loaded||0),
|
1630
1661
|
total = (e.total||1),
|
1631
1662
|
scale = 1000;
|
1632
|
-
|
1663
|
+
s.buffered = [];
|
1633
1664
|
if (ranges && ranges.length) {
|
1634
1665
|
for (i=0, j=ranges.length; i<j; i++) {
|
1635
|
-
|
1666
|
+
s.buffered.push({
|
1636
1667
|
'start': ranges.start(i) * scale,
|
1637
1668
|
'end': ranges.end(i) * scale
|
1638
1669
|
});
|
@@ -1641,71 +1672,75 @@ function SoundManager(smURL, smID) {
|
|
1641
1672
|
loaded = buffered/(e.target.duration*scale);
|
1642
1673
|
}
|
1643
1674
|
if (!isNaN(loaded)) {
|
1644
|
-
|
1645
|
-
|
1675
|
+
s._onbufferchange(0);
|
1676
|
+
s._whileloading(loaded, total, s._get_html5_duration());
|
1646
1677
|
if (loaded && total && loaded === total) {
|
1647
|
-
|
1678
|
+
html5_events.canplaythrough.call(this, e);
|
1648
1679
|
}
|
1649
1680
|
}
|
1650
1681
|
}),
|
1651
|
-
ratechange:
|
1682
|
+
ratechange: html5_event(function() {
|
1652
1683
|
}),
|
1653
|
-
suspend:
|
1654
|
-
var
|
1655
|
-
|
1656
|
-
|
1684
|
+
suspend: html5_event(function(e) {
|
1685
|
+
var s = this._s;
|
1686
|
+
html5_events.progress.call(this, e);
|
1687
|
+
s._onsuspend();
|
1657
1688
|
}),
|
1658
|
-
stalled:
|
1689
|
+
stalled: html5_event(function() {
|
1659
1690
|
}),
|
1660
|
-
timeupdate:
|
1661
|
-
this.
|
1691
|
+
timeupdate: html5_event(function() {
|
1692
|
+
this._s._onTimer();
|
1662
1693
|
}),
|
1663
|
-
waiting:
|
1664
|
-
var
|
1665
|
-
|
1694
|
+
waiting: html5_event(function() {
|
1695
|
+
var s = this._s;
|
1696
|
+
s._onbufferchange(1);
|
1666
1697
|
})
|
1667
1698
|
};
|
1668
|
-
|
1699
|
+
html5OK = function(iO) {
|
1669
1700
|
var result;
|
1670
|
-
if (iO.serverURL || (iO.type &&
|
1701
|
+
if (iO.serverURL || (iO.type && preferFlashCheck(iO.type))) {
|
1671
1702
|
result = false;
|
1672
1703
|
} else {
|
1673
|
-
result = ((iO.type ?
|
1704
|
+
result = ((iO.type ? html5CanPlay({type:iO.type}) : html5CanPlay({url:iO.url}) || sm2.html5Only));
|
1674
1705
|
}
|
1675
1706
|
return result;
|
1676
1707
|
};
|
1677
|
-
|
1708
|
+
html5Unload = function(oAudio, url) {
|
1678
1709
|
if (oAudio) {
|
1679
1710
|
oAudio.src = url;
|
1711
|
+
oAudio._called_load = false;
|
1712
|
+
}
|
1713
|
+
if (useGlobalHTML5Audio) {
|
1714
|
+
lastGlobalHTML5URL = null;
|
1680
1715
|
}
|
1681
1716
|
};
|
1682
|
-
|
1683
|
-
if (!
|
1717
|
+
html5CanPlay = function(o) {
|
1718
|
+
if (!sm2.useHTML5Audio || !sm2.hasHTML5) {
|
1684
1719
|
return false;
|
1685
1720
|
}
|
1686
1721
|
var url = (o.url || null),
|
1687
1722
|
mime = (o.type || null),
|
1688
|
-
aF =
|
1723
|
+
aF = sm2.audioFormats,
|
1689
1724
|
result,
|
1690
1725
|
offset,
|
1691
1726
|
fileExt,
|
1692
1727
|
item;
|
1693
|
-
if (mime &&
|
1694
|
-
return (
|
1728
|
+
if (mime && sm2.html5[mime] !== _undefined) {
|
1729
|
+
return (sm2.html5[mime] && !preferFlashCheck(mime));
|
1695
1730
|
}
|
1696
|
-
if (!
|
1697
|
-
|
1731
|
+
if (!html5Ext) {
|
1732
|
+
html5Ext = [];
|
1698
1733
|
for (item in aF) {
|
1699
1734
|
if (aF.hasOwnProperty(item)) {
|
1700
|
-
|
1735
|
+
html5Ext.push(item);
|
1701
1736
|
if (aF[item].related) {
|
1702
|
-
|
1737
|
+
html5Ext = html5Ext.concat(aF[item].related);
|
1703
1738
|
}
|
1704
1739
|
}
|
1705
1740
|
}
|
1706
|
-
|
1741
|
+
html5Ext = new RegExp('\\.('+html5Ext.join('|')+')(\\?.*)?$','i');
|
1707
1742
|
}
|
1708
|
-
fileExt = (url ? url.toLowerCase().match(
|
1743
|
+
fileExt = (url ? url.toLowerCase().match(html5Ext) : null);
|
1709
1744
|
if (!fileExt || !fileExt.length) {
|
1710
1745
|
if (!mime) {
|
1711
1746
|
result = false;
|
@@ -1716,23 +1751,23 @@ function SoundManager(smURL, smID) {
|
|
1716
1751
|
} else {
|
1717
1752
|
fileExt = fileExt[1];
|
1718
1753
|
}
|
1719
|
-
if (fileExt &&
|
1720
|
-
result = (
|
1754
|
+
if (fileExt && sm2.html5[fileExt] !== _undefined) {
|
1755
|
+
result = (sm2.html5[fileExt] && !preferFlashCheck(fileExt));
|
1721
1756
|
} else {
|
1722
1757
|
mime = 'audio/'+fileExt;
|
1723
|
-
result =
|
1724
|
-
|
1725
|
-
result = (result &&
|
1758
|
+
result = sm2.html5.canPlayType({type:mime});
|
1759
|
+
sm2.html5[fileExt] = result;
|
1760
|
+
result = (result && sm2.html5[mime] && !preferFlashCheck(mime));
|
1726
1761
|
}
|
1727
1762
|
return result;
|
1728
1763
|
};
|
1729
|
-
|
1730
|
-
if (!
|
1764
|
+
testHTML5 = function() {
|
1765
|
+
if (!sm2.useHTML5Audio || !sm2.hasHTML5) {
|
1731
1766
|
return false;
|
1732
1767
|
}
|
1733
|
-
var a = (
|
1768
|
+
var a = (Audio !== _undefined ? (isOpera && opera.version() < 10 ? new Audio(null) : new Audio()) : null),
|
1734
1769
|
item, lookup, support = {}, aF, i;
|
1735
|
-
function
|
1770
|
+
function cp(m) {
|
1736
1771
|
var canPlay, i, j,
|
1737
1772
|
result = false,
|
1738
1773
|
isOK = false;
|
@@ -1741,84 +1776,84 @@ function SoundManager(smURL, smID) {
|
|
1741
1776
|
}
|
1742
1777
|
if (m instanceof Array) {
|
1743
1778
|
for (i=0, j=m.length; i<j; i++) {
|
1744
|
-
if (
|
1779
|
+
if (sm2.html5[m[i]] || a.canPlayType(m[i]).match(sm2.html5Test)) {
|
1745
1780
|
isOK = true;
|
1746
|
-
|
1747
|
-
|
1781
|
+
sm2.html5[m[i]] = true;
|
1782
|
+
sm2.flash[m[i]] = !!(m[i].match(flashMIME));
|
1748
1783
|
}
|
1749
1784
|
}
|
1750
1785
|
result = isOK;
|
1751
1786
|
} else {
|
1752
1787
|
canPlay = (a && typeof a.canPlayType === 'function' ? a.canPlayType(m) : false);
|
1753
|
-
result = !!(canPlay && (canPlay.match(
|
1788
|
+
result = !!(canPlay && (canPlay.match(sm2.html5Test)));
|
1754
1789
|
}
|
1755
1790
|
return result;
|
1756
1791
|
}
|
1757
|
-
aF =
|
1792
|
+
aF = sm2.audioFormats;
|
1758
1793
|
for (item in aF) {
|
1759
1794
|
if (aF.hasOwnProperty(item)) {
|
1760
1795
|
lookup = 'audio/' + item;
|
1761
|
-
support[item] =
|
1796
|
+
support[item] = cp(aF[item].type);
|
1762
1797
|
support[lookup] = support[item];
|
1763
|
-
if (item.match(
|
1764
|
-
|
1765
|
-
|
1798
|
+
if (item.match(flashMIME)) {
|
1799
|
+
sm2.flash[item] = true;
|
1800
|
+
sm2.flash[lookup] = true;
|
1766
1801
|
} else {
|
1767
|
-
|
1768
|
-
|
1802
|
+
sm2.flash[item] = false;
|
1803
|
+
sm2.flash[lookup] = false;
|
1769
1804
|
}
|
1770
1805
|
if (aF[item] && aF[item].related) {
|
1771
1806
|
for (i=aF[item].related.length-1; i >= 0; i--) {
|
1772
1807
|
support['audio/'+aF[item].related[i]] = support[item];
|
1773
|
-
|
1774
|
-
|
1808
|
+
sm2.html5[aF[item].related[i]] = support[item];
|
1809
|
+
sm2.flash[aF[item].related[i]] = support[item];
|
1775
1810
|
}
|
1776
1811
|
}
|
1777
1812
|
}
|
1778
1813
|
}
|
1779
|
-
support.canPlayType = (a?
|
1780
|
-
|
1814
|
+
support.canPlayType = (a?cp:null);
|
1815
|
+
sm2.html5 = mixin(sm2.html5, support);
|
1781
1816
|
return true;
|
1782
1817
|
};
|
1783
|
-
|
1818
|
+
strings = {
|
1784
1819
|
};
|
1785
|
-
|
1820
|
+
str = function() {
|
1786
1821
|
};
|
1787
|
-
|
1788
|
-
if (
|
1822
|
+
loopFix = function(sOpt) {
|
1823
|
+
if (fV === 8 && sOpt.loops > 1 && sOpt.stream) {
|
1789
1824
|
sOpt.stream = false;
|
1790
1825
|
}
|
1791
1826
|
return sOpt;
|
1792
1827
|
};
|
1793
|
-
|
1828
|
+
policyFix = function(sOpt, sPre) {
|
1794
1829
|
if (sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) {
|
1795
1830
|
sOpt.usePolicyFile = true;
|
1796
1831
|
}
|
1797
1832
|
return sOpt;
|
1798
1833
|
};
|
1799
|
-
|
1834
|
+
complain = function(sMsg) {
|
1800
1835
|
};
|
1801
|
-
|
1836
|
+
doNothing = function() {
|
1802
1837
|
return false;
|
1803
1838
|
};
|
1804
|
-
|
1839
|
+
disableObject = function(o) {
|
1805
1840
|
var oProp;
|
1806
1841
|
for (oProp in o) {
|
1807
1842
|
if (o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') {
|
1808
|
-
o[oProp] =
|
1843
|
+
o[oProp] = doNothing;
|
1809
1844
|
}
|
1810
1845
|
}
|
1811
1846
|
oProp = null;
|
1812
1847
|
};
|
1813
|
-
|
1814
|
-
if (
|
1848
|
+
failSafely = function(bNoDisable) {
|
1849
|
+
if (bNoDisable === _undefined) {
|
1815
1850
|
bNoDisable = false;
|
1816
1851
|
}
|
1817
|
-
if (
|
1818
|
-
|
1852
|
+
if (disabled || bNoDisable) {
|
1853
|
+
sm2.disable(bNoDisable);
|
1819
1854
|
}
|
1820
1855
|
};
|
1821
|
-
|
1856
|
+
normalizeMovieURL = function(smURL) {
|
1822
1857
|
var urlParams = null, url;
|
1823
1858
|
if (smURL) {
|
1824
1859
|
if (smURL.match(/\.swf(\?.*)?$/i)) {
|
@@ -1830,110 +1865,110 @@ function SoundManager(smURL, smID) {
|
|
1830
1865
|
smURL += '/';
|
1831
1866
|
}
|
1832
1867
|
}
|
1833
|
-
url = (smURL && smURL.lastIndexOf('/') !== - 1 ? smURL.substr(0, smURL.lastIndexOf('/') + 1) : './') +
|
1834
|
-
if (
|
1868
|
+
url = (smURL && smURL.lastIndexOf('/') !== - 1 ? smURL.substr(0, smURL.lastIndexOf('/') + 1) : './') + sm2.movieURL;
|
1869
|
+
if (sm2.noSWFCache) {
|
1835
1870
|
url += ('?ts=' + new Date().getTime());
|
1836
1871
|
}
|
1837
1872
|
return url;
|
1838
1873
|
};
|
1839
|
-
|
1840
|
-
|
1841
|
-
if (
|
1842
|
-
|
1843
|
-
}
|
1844
|
-
var isDebug = (
|
1845
|
-
if (
|
1846
|
-
|
1847
|
-
}
|
1848
|
-
|
1849
|
-
if (
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1874
|
+
setVersionInfo = function() {
|
1875
|
+
fV = parseInt(sm2.flashVersion, 10);
|
1876
|
+
if (fV !== 8 && fV !== 9) {
|
1877
|
+
sm2.flashVersion = fV = defaultFlashVersion;
|
1878
|
+
}
|
1879
|
+
var isDebug = (sm2.debugMode || sm2.debugFlash?'_debug.swf':'.swf');
|
1880
|
+
if (sm2.useHTML5Audio && !sm2.html5Only && sm2.audioFormats.mp4.required && fV < 9) {
|
1881
|
+
sm2.flashVersion = fV = 9;
|
1882
|
+
}
|
1883
|
+
sm2.version = sm2.versionNumber + (sm2.html5Only?' (HTML5-only mode)':(fV === 9?' (AS3/Flash 9)':' (AS2/Flash 8)'));
|
1884
|
+
if (fV > 8) {
|
1885
|
+
sm2.defaultOptions = mixin(sm2.defaultOptions, sm2.flash9Options);
|
1886
|
+
sm2.features.buffering = true;
|
1887
|
+
sm2.defaultOptions = mixin(sm2.defaultOptions, sm2.movieStarOptions);
|
1888
|
+
sm2.filePatterns.flash9 = new RegExp('\\.(mp3|' + netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
|
1889
|
+
sm2.features.movieStar = true;
|
1855
1890
|
} else {
|
1856
|
-
|
1891
|
+
sm2.features.movieStar = false;
|
1857
1892
|
}
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1893
|
+
sm2.filePattern = sm2.filePatterns[(fV !== 8?'flash9':'flash8')];
|
1894
|
+
sm2.movieURL = (fV === 8?'soundmanager2.swf':'soundmanager2_flash9.swf').replace('.swf', isDebug);
|
1895
|
+
sm2.features.peakData = sm2.features.waveformData = sm2.features.eqData = (fV > 8);
|
1861
1896
|
};
|
1862
|
-
|
1863
|
-
if (!
|
1897
|
+
setPolling = function(bPolling, bHighPerformance) {
|
1898
|
+
if (!flash) {
|
1864
1899
|
return false;
|
1865
1900
|
}
|
1866
|
-
|
1901
|
+
flash._setPolling(bPolling, bHighPerformance);
|
1867
1902
|
};
|
1868
|
-
|
1869
|
-
if (
|
1870
|
-
|
1903
|
+
initDebug = function() {
|
1904
|
+
if (sm2.debugURLParam.test(wl)) {
|
1905
|
+
sm2.debugMode = true;
|
1871
1906
|
}
|
1872
1907
|
};
|
1873
|
-
|
1874
|
-
|
1908
|
+
idCheck = this.getSoundById;
|
1909
|
+
getSWFCSS = function() {
|
1875
1910
|
var css = [];
|
1876
|
-
if (
|
1877
|
-
css.push(
|
1911
|
+
if (sm2.debugMode) {
|
1912
|
+
css.push(swfCSS.sm2Debug);
|
1878
1913
|
}
|
1879
|
-
if (
|
1880
|
-
css.push(
|
1914
|
+
if (sm2.debugFlash) {
|
1915
|
+
css.push(swfCSS.flashDebug);
|
1881
1916
|
}
|
1882
|
-
if (
|
1883
|
-
css.push(
|
1917
|
+
if (sm2.useHighPerformance) {
|
1918
|
+
css.push(swfCSS.highPerf);
|
1884
1919
|
}
|
1885
1920
|
return css.join(' ');
|
1886
1921
|
};
|
1887
|
-
|
1888
|
-
var name =
|
1889
|
-
p =
|
1890
|
-
css =
|
1922
|
+
flashBlockHandler = function() {
|
1923
|
+
var name = str('fbHandler'),
|
1924
|
+
p = sm2.getMoviePercent(),
|
1925
|
+
css = swfCSS,
|
1891
1926
|
error = {type:'FLASHBLOCK'};
|
1892
|
-
if (
|
1927
|
+
if (sm2.html5Only) {
|
1893
1928
|
return false;
|
1894
1929
|
}
|
1895
|
-
if (!
|
1896
|
-
if (
|
1897
|
-
|
1930
|
+
if (!sm2.ok()) {
|
1931
|
+
if (needsFlash) {
|
1932
|
+
sm2.oMC.className = getSWFCSS() + ' ' + css.swfDefault + ' ' + (p === null?css.swfTimedout:css.swfError);
|
1898
1933
|
}
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1934
|
+
sm2.didFlashBlock = true;
|
1935
|
+
processOnEvents({type:'ontimeout', ignoreInit:true, error:error});
|
1936
|
+
catchError(error);
|
1902
1937
|
} else {
|
1903
|
-
if (
|
1904
|
-
|
1938
|
+
if (sm2.oMC) {
|
1939
|
+
sm2.oMC.className = [getSWFCSS(), css.swfDefault, css.swfLoaded + (sm2.didFlashBlock?' '+css.swfUnblocked:'')].join(' ');
|
1905
1940
|
}
|
1906
1941
|
}
|
1907
1942
|
};
|
1908
|
-
|
1909
|
-
if (
|
1910
|
-
|
1943
|
+
addOnEvent = function(sType, oMethod, oScope) {
|
1944
|
+
if (on_queue[sType] === _undefined) {
|
1945
|
+
on_queue[sType] = [];
|
1911
1946
|
}
|
1912
|
-
|
1947
|
+
on_queue[sType].push({
|
1913
1948
|
'method': oMethod,
|
1914
1949
|
'scope': (oScope || null),
|
1915
1950
|
'fired': false
|
1916
1951
|
});
|
1917
1952
|
};
|
1918
|
-
|
1953
|
+
processOnEvents = function(oOptions) {
|
1919
1954
|
if (!oOptions) {
|
1920
1955
|
oOptions = {
|
1921
|
-
type: (
|
1956
|
+
type: (sm2.ok() ? 'onready' : 'ontimeout')
|
1922
1957
|
};
|
1923
1958
|
}
|
1924
|
-
if (!
|
1959
|
+
if (!didInit && oOptions && !oOptions.ignoreInit) {
|
1925
1960
|
return false;
|
1926
1961
|
}
|
1927
|
-
if (oOptions.type === 'ontimeout' && (
|
1962
|
+
if (oOptions.type === 'ontimeout' && (sm2.ok() || (disabled && !oOptions.ignoreInit))) {
|
1928
1963
|
return false;
|
1929
1964
|
}
|
1930
1965
|
var status = {
|
1931
|
-
success: (oOptions && oOptions.ignoreInit?
|
1966
|
+
success: (oOptions && oOptions.ignoreInit?sm2.ok():!disabled)
|
1932
1967
|
},
|
1933
|
-
srcQueue = (oOptions && oOptions.type?
|
1968
|
+
srcQueue = (oOptions && oOptions.type?on_queue[oOptions.type]||[]:[]),
|
1934
1969
|
queue = [], i, j,
|
1935
1970
|
args = [status],
|
1936
|
-
canRetry = (
|
1971
|
+
canRetry = (needsFlash && !sm2.ok());
|
1937
1972
|
if (oOptions.error) {
|
1938
1973
|
args[0].error = oOptions.error;
|
1939
1974
|
}
|
@@ -1956,86 +1991,87 @@ function SoundManager(smURL, smID) {
|
|
1956
1991
|
}
|
1957
1992
|
return true;
|
1958
1993
|
};
|
1959
|
-
|
1960
|
-
|
1961
|
-
if (
|
1962
|
-
|
1994
|
+
initUserOnload = function() {
|
1995
|
+
window.setTimeout(function() {
|
1996
|
+
if (sm2.useFlashBlock) {
|
1997
|
+
flashBlockHandler();
|
1963
1998
|
}
|
1964
|
-
|
1965
|
-
if (typeof
|
1966
|
-
|
1999
|
+
processOnEvents();
|
2000
|
+
if (typeof sm2.onload === 'function') {
|
2001
|
+
sm2.onload.apply(window);
|
1967
2002
|
}
|
1968
|
-
if (
|
1969
|
-
|
2003
|
+
if (sm2.waitForWindowLoad) {
|
2004
|
+
event.add(window, 'load', initUserOnload);
|
1970
2005
|
}
|
1971
2006
|
},1);
|
1972
2007
|
};
|
1973
|
-
|
1974
|
-
if (
|
1975
|
-
return
|
2008
|
+
detectFlash = function() {
|
2009
|
+
if (hasFlash !== _undefined) {
|
2010
|
+
return hasFlash;
|
1976
2011
|
}
|
1977
|
-
var hasPlugin = false, n = navigator, nP = n.plugins, obj, type, types, AX =
|
2012
|
+
var hasPlugin = false, n = navigator, nP = n.plugins, obj, type, types, AX = window.ActiveXObject;
|
1978
2013
|
if (nP && nP.length) {
|
1979
2014
|
type = 'application/x-shockwave-flash';
|
1980
2015
|
types = n.mimeTypes;
|
1981
2016
|
if (types && types[type] && types[type].enabledPlugin && types[type].enabledPlugin.description) {
|
1982
2017
|
hasPlugin = true;
|
1983
2018
|
}
|
1984
|
-
} else if (
|
2019
|
+
} else if (AX !== _undefined && !ua.match(/MSAppHost/i)) {
|
1985
2020
|
try {
|
1986
2021
|
obj = new AX('ShockwaveFlash.ShockwaveFlash');
|
1987
2022
|
} catch(e) {
|
1988
2023
|
}
|
1989
2024
|
hasPlugin = (!!obj);
|
2025
|
+
obj = null;
|
1990
2026
|
}
|
1991
|
-
|
2027
|
+
hasFlash = hasPlugin;
|
1992
2028
|
return hasPlugin;
|
1993
2029
|
};
|
1994
|
-
|
2030
|
+
featureCheck = function() {
|
1995
2031
|
var needsFlash,
|
1996
2032
|
item,
|
1997
2033
|
result = true,
|
1998
|
-
formats =
|
1999
|
-
isSpecial = (
|
2034
|
+
formats = sm2.audioFormats,
|
2035
|
+
isSpecial = (is_iDevice && !!(ua.match(/os (1|2|3_0|3_1)/i)));
|
2000
2036
|
if (isSpecial) {
|
2001
|
-
|
2002
|
-
|
2003
|
-
if (
|
2004
|
-
|
2037
|
+
sm2.hasHTML5 = false;
|
2038
|
+
sm2.html5Only = true;
|
2039
|
+
if (sm2.oMC) {
|
2040
|
+
sm2.oMC.style.display = 'none';
|
2005
2041
|
}
|
2006
2042
|
result = false;
|
2007
2043
|
} else {
|
2008
|
-
if (
|
2009
|
-
if (!
|
2010
|
-
|
2044
|
+
if (sm2.useHTML5Audio) {
|
2045
|
+
if (!sm2.html5 || !sm2.html5.canPlayType) {
|
2046
|
+
sm2.hasHTML5 = false;
|
2011
2047
|
}
|
2012
2048
|
}
|
2013
2049
|
}
|
2014
|
-
if (
|
2050
|
+
if (sm2.useHTML5Audio && sm2.hasHTML5) {
|
2015
2051
|
for (item in formats) {
|
2016
2052
|
if (formats.hasOwnProperty(item)) {
|
2017
|
-
if ((formats[item].required && !
|
2053
|
+
if ((formats[item].required && !sm2.html5.canPlayType(formats[item].type)) || (sm2.preferFlash && (sm2.flash[item] || sm2.flash[formats[item].type]))) {
|
2018
2054
|
needsFlash = true;
|
2019
2055
|
}
|
2020
2056
|
}
|
2021
2057
|
}
|
2022
2058
|
}
|
2023
|
-
if (
|
2059
|
+
if (sm2.ignoreFlash) {
|
2024
2060
|
needsFlash = false;
|
2025
2061
|
}
|
2026
|
-
|
2027
|
-
return (!
|
2062
|
+
sm2.html5Only = (sm2.hasHTML5 && sm2.useHTML5Audio && !needsFlash);
|
2063
|
+
return (!sm2.html5Only);
|
2028
2064
|
};
|
2029
|
-
|
2065
|
+
parseURL = function(url) {
|
2030
2066
|
var i, j, urlResult = 0, result;
|
2031
2067
|
if (url instanceof Array) {
|
2032
2068
|
for (i=0, j=url.length; i<j; i++) {
|
2033
2069
|
if (url[i] instanceof Object) {
|
2034
|
-
if (
|
2070
|
+
if (sm2.canPlayMIME(url[i].type)) {
|
2035
2071
|
urlResult = i;
|
2036
2072
|
break;
|
2037
2073
|
}
|
2038
|
-
} else if (
|
2074
|
+
} else if (sm2.canPlayURL(url[i])) {
|
2039
2075
|
urlResult = i;
|
2040
2076
|
break;
|
2041
2077
|
}
|
@@ -2049,59 +2085,59 @@ function SoundManager(smURL, smID) {
|
|
2049
2085
|
}
|
2050
2086
|
return result;
|
2051
2087
|
};
|
2052
|
-
|
2088
|
+
startTimer = function(oSound) {
|
2053
2089
|
if (!oSound._hasTimer) {
|
2054
2090
|
oSound._hasTimer = true;
|
2055
|
-
if (!
|
2056
|
-
if (
|
2057
|
-
|
2091
|
+
if (!mobileHTML5 && sm2.html5PollingInterval) {
|
2092
|
+
if (h5IntervalTimer === null && h5TimerCount === 0) {
|
2093
|
+
h5IntervalTimer = setInterval(timerExecute, sm2.html5PollingInterval);
|
2058
2094
|
}
|
2059
|
-
|
2095
|
+
h5TimerCount++;
|
2060
2096
|
}
|
2061
2097
|
}
|
2062
2098
|
};
|
2063
|
-
|
2099
|
+
stopTimer = function(oSound) {
|
2064
2100
|
if (oSound._hasTimer) {
|
2065
2101
|
oSound._hasTimer = false;
|
2066
|
-
if (!
|
2067
|
-
|
2102
|
+
if (!mobileHTML5 && sm2.html5PollingInterval) {
|
2103
|
+
h5TimerCount--;
|
2068
2104
|
}
|
2069
2105
|
}
|
2070
2106
|
};
|
2071
|
-
|
2107
|
+
timerExecute = function() {
|
2072
2108
|
var i;
|
2073
|
-
if (
|
2074
|
-
|
2075
|
-
|
2109
|
+
if (h5IntervalTimer !== null && !h5TimerCount) {
|
2110
|
+
clearInterval(h5IntervalTimer);
|
2111
|
+
h5IntervalTimer = null;
|
2076
2112
|
return false;
|
2077
2113
|
}
|
2078
|
-
for (i =
|
2079
|
-
if (
|
2080
|
-
|
2114
|
+
for (i = sm2.soundIDs.length-1; i >= 0; i--) {
|
2115
|
+
if (sm2.sounds[sm2.soundIDs[i]].isHTML5 && sm2.sounds[sm2.soundIDs[i]]._hasTimer) {
|
2116
|
+
sm2.sounds[sm2.soundIDs[i]]._onTimer();
|
2081
2117
|
}
|
2082
2118
|
}
|
2083
2119
|
};
|
2084
|
-
|
2085
|
-
options = (
|
2086
|
-
if (typeof
|
2087
|
-
|
2120
|
+
catchError = function(options) {
|
2121
|
+
options = (options !== _undefined ? options : {});
|
2122
|
+
if (typeof sm2.onerror === 'function') {
|
2123
|
+
sm2.onerror.apply(window, [{type:(options.type !== _undefined ? options.type : null)}]);
|
2088
2124
|
}
|
2089
|
-
if (
|
2090
|
-
|
2125
|
+
if (options.fatal !== _undefined && options.fatal) {
|
2126
|
+
sm2.disable();
|
2091
2127
|
}
|
2092
2128
|
};
|
2093
|
-
|
2094
|
-
if (!
|
2129
|
+
badSafariFix = function() {
|
2130
|
+
if (!isBadSafari || !detectFlash()) {
|
2095
2131
|
return false;
|
2096
2132
|
}
|
2097
|
-
var aF =
|
2133
|
+
var aF = sm2.audioFormats, i, item;
|
2098
2134
|
for (item in aF) {
|
2099
2135
|
if (aF.hasOwnProperty(item)) {
|
2100
2136
|
if (item === 'mp3' || item === 'mp4') {
|
2101
|
-
|
2137
|
+
sm2.html5[item] = false;
|
2102
2138
|
if (aF[item] && aF[item].related) {
|
2103
2139
|
for (i = aF[item].related.length-1; i >= 0; i--) {
|
2104
|
-
|
2140
|
+
sm2.html5[aF[item].related[i]] = false;
|
2105
2141
|
}
|
2106
2142
|
}
|
2107
2143
|
}
|
@@ -2111,104 +2147,105 @@ function SoundManager(smURL, smID) {
|
|
2111
2147
|
this._setSandboxType = function(sandboxType) {
|
2112
2148
|
};
|
2113
2149
|
this._externalInterfaceOK = function(flashDate, swfVersion) {
|
2114
|
-
if (
|
2150
|
+
if (sm2.swfLoaded) {
|
2115
2151
|
return false;
|
2116
2152
|
}
|
2117
|
-
var e
|
2118
|
-
|
2119
|
-
|
2120
|
-
if (
|
2121
|
-
|
2153
|
+
var e;
|
2154
|
+
sm2.swfLoaded = true;
|
2155
|
+
tryInitOnFocus = false;
|
2156
|
+
if (isBadSafari) {
|
2157
|
+
badSafariFix();
|
2122
2158
|
}
|
2123
|
-
setTimeout(
|
2159
|
+
setTimeout(init, isIE ? 100 : 1);
|
2124
2160
|
};
|
2125
|
-
|
2126
|
-
if (
|
2161
|
+
createMovie = function(smID, smURL) {
|
2162
|
+
if (didAppend && appendSuccess) {
|
2127
2163
|
return false;
|
2128
2164
|
}
|
2129
|
-
function
|
2165
|
+
function initMsg() {
|
2130
2166
|
}
|
2131
|
-
if (
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2167
|
+
if (sm2.html5Only) {
|
2168
|
+
setVersionInfo();
|
2169
|
+
initMsg();
|
2170
|
+
sm2.oMC = id(sm2.movieID);
|
2171
|
+
init();
|
2172
|
+
didAppend = true;
|
2173
|
+
appendSuccess = true;
|
2138
2174
|
return false;
|
2139
2175
|
}
|
2140
|
-
var remoteURL = (smURL ||
|
2141
|
-
localURL = (
|
2176
|
+
var remoteURL = (smURL || sm2.url),
|
2177
|
+
localURL = (sm2.altURL || remoteURL),
|
2142
2178
|
swfTitle = 'JS/Flash audio component (SoundManager 2)',
|
2143
|
-
oTarget =
|
2144
|
-
extraClass =
|
2179
|
+
oTarget = getDocument(),
|
2180
|
+
extraClass = getSWFCSS(),
|
2145
2181
|
isRTL = null,
|
2146
|
-
html =
|
2182
|
+
html = doc.getElementsByTagName('html')[0],
|
2147
2183
|
oEmbed, oMovie, tmp, movieHTML, oEl, s, x, sClass;
|
2148
2184
|
isRTL = (html && html.dir && html.dir.match(/rtl/i));
|
2149
|
-
smID = (
|
2185
|
+
smID = (smID === _undefined?sm2.id:smID);
|
2150
2186
|
function param(name, value) {
|
2151
2187
|
return '<param name="'+name+'" value="'+value+'" />';
|
2152
2188
|
}
|
2153
|
-
|
2154
|
-
|
2155
|
-
smURL =
|
2156
|
-
|
2157
|
-
if (
|
2158
|
-
|
2189
|
+
setVersionInfo();
|
2190
|
+
sm2.url = normalizeMovieURL(overHTTP?remoteURL:localURL);
|
2191
|
+
smURL = sm2.url;
|
2192
|
+
sm2.wmode = (!sm2.wmode && sm2.useHighPerformance ? 'transparent' : sm2.wmode);
|
2193
|
+
if (sm2.wmode !== null && (ua.match(/msie 8/i) || (!isIE && !sm2.useHighPerformance)) && navigator.platform.match(/win32|win64/i)) {
|
2194
|
+
messages.push(strings.spcWmode);
|
2195
|
+
sm2.wmode = null;
|
2159
2196
|
}
|
2160
2197
|
oEmbed = {
|
2161
2198
|
'name': smID,
|
2162
2199
|
'id': smID,
|
2163
2200
|
'src': smURL,
|
2164
2201
|
'quality': 'high',
|
2165
|
-
'allowScriptAccess':
|
2166
|
-
'bgcolor':
|
2167
|
-
'pluginspage':
|
2202
|
+
'allowScriptAccess': sm2.allowScriptAccess,
|
2203
|
+
'bgcolor': sm2.bgColor,
|
2204
|
+
'pluginspage': http+'www.macromedia.com/go/getflashplayer',
|
2168
2205
|
'title': swfTitle,
|
2169
2206
|
'type': 'application/x-shockwave-flash',
|
2170
|
-
'wmode':
|
2207
|
+
'wmode': sm2.wmode,
|
2171
2208
|
'hasPriority': 'true'
|
2172
2209
|
};
|
2173
|
-
if (
|
2210
|
+
if (sm2.debugFlash) {
|
2174
2211
|
oEmbed.FlashVars = 'debug=1';
|
2175
2212
|
}
|
2176
|
-
if (!
|
2213
|
+
if (!sm2.wmode) {
|
2177
2214
|
delete oEmbed.wmode;
|
2178
2215
|
}
|
2179
|
-
if (
|
2180
|
-
oMovie =
|
2216
|
+
if (isIE) {
|
2217
|
+
oMovie = doc.createElement('div');
|
2181
2218
|
movieHTML = [
|
2182
|
-
'<object id="' + smID + '" data="' + smURL + '" type="' + oEmbed.type + '" title="' + oEmbed.title +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' +
|
2219
|
+
'<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">',
|
2183
2220
|
param('movie', smURL),
|
2184
|
-
param('AllowScriptAccess',
|
2221
|
+
param('AllowScriptAccess', sm2.allowScriptAccess),
|
2185
2222
|
param('quality', oEmbed.quality),
|
2186
|
-
(
|
2187
|
-
param('bgcolor',
|
2223
|
+
(sm2.wmode? param('wmode', sm2.wmode): ''),
|
2224
|
+
param('bgcolor', sm2.bgColor),
|
2188
2225
|
param('hasPriority', 'true'),
|
2189
|
-
(
|
2226
|
+
(sm2.debugFlash ? param('FlashVars', oEmbed.FlashVars) : ''),
|
2190
2227
|
'</object>'
|
2191
2228
|
].join('');
|
2192
2229
|
} else {
|
2193
|
-
oMovie =
|
2230
|
+
oMovie = doc.createElement('embed');
|
2194
2231
|
for (tmp in oEmbed) {
|
2195
2232
|
if (oEmbed.hasOwnProperty(tmp)) {
|
2196
2233
|
oMovie.setAttribute(tmp, oEmbed[tmp]);
|
2197
2234
|
}
|
2198
2235
|
}
|
2199
2236
|
}
|
2200
|
-
|
2201
|
-
extraClass =
|
2202
|
-
oTarget =
|
2237
|
+
initDebug();
|
2238
|
+
extraClass = getSWFCSS();
|
2239
|
+
oTarget = getDocument();
|
2203
2240
|
if (oTarget) {
|
2204
|
-
|
2205
|
-
if (!
|
2206
|
-
|
2207
|
-
|
2241
|
+
sm2.oMC = (id(sm2.movieID) || doc.createElement('div'));
|
2242
|
+
if (!sm2.oMC.id) {
|
2243
|
+
sm2.oMC.id = sm2.movieID;
|
2244
|
+
sm2.oMC.className = swfCSS.swfDefault + ' ' + extraClass;
|
2208
2245
|
s = null;
|
2209
2246
|
oEl = null;
|
2210
|
-
if (!
|
2211
|
-
if (
|
2247
|
+
if (!sm2.useFlashBlock) {
|
2248
|
+
if (sm2.useHighPerformance) {
|
2212
2249
|
s = {
|
2213
2250
|
'position': 'fixed',
|
2214
2251
|
'width': '8px',
|
@@ -2230,280 +2267,295 @@ function SoundManager(smURL, smID) {
|
|
2230
2267
|
}
|
2231
2268
|
}
|
2232
2269
|
}
|
2233
|
-
if (
|
2234
|
-
|
2270
|
+
if (isWebkit) {
|
2271
|
+
sm2.oMC.style.zIndex = 10000;
|
2235
2272
|
}
|
2236
|
-
if (!
|
2273
|
+
if (!sm2.debugFlash) {
|
2237
2274
|
for (x in s) {
|
2238
2275
|
if (s.hasOwnProperty(x)) {
|
2239
|
-
|
2276
|
+
sm2.oMC.style[x] = s[x];
|
2240
2277
|
}
|
2241
2278
|
}
|
2242
2279
|
}
|
2243
2280
|
try {
|
2244
|
-
if (!
|
2245
|
-
|
2281
|
+
if (!isIE) {
|
2282
|
+
sm2.oMC.appendChild(oMovie);
|
2246
2283
|
}
|
2247
|
-
oTarget.appendChild(
|
2248
|
-
if (
|
2249
|
-
oEl =
|
2250
|
-
oEl.className =
|
2284
|
+
oTarget.appendChild(sm2.oMC);
|
2285
|
+
if (isIE) {
|
2286
|
+
oEl = sm2.oMC.appendChild(doc.createElement('div'));
|
2287
|
+
oEl.className = swfCSS.swfBox;
|
2251
2288
|
oEl.innerHTML = movieHTML;
|
2252
2289
|
}
|
2253
|
-
|
2290
|
+
appendSuccess = true;
|
2254
2291
|
} catch(e) {
|
2255
|
-
throw new Error(
|
2292
|
+
throw new Error(str('domError')+' \n'+e.toString());
|
2256
2293
|
}
|
2257
2294
|
} else {
|
2258
|
-
sClass =
|
2259
|
-
|
2260
|
-
|
2261
|
-
if (
|
2262
|
-
oEl =
|
2263
|
-
oEl.className =
|
2295
|
+
sClass = sm2.oMC.className;
|
2296
|
+
sm2.oMC.className = (sClass?sClass+' ':swfCSS.swfDefault) + (extraClass?' '+extraClass:'');
|
2297
|
+
sm2.oMC.appendChild(oMovie);
|
2298
|
+
if (isIE) {
|
2299
|
+
oEl = sm2.oMC.appendChild(doc.createElement('div'));
|
2300
|
+
oEl.className = swfCSS.swfBox;
|
2264
2301
|
oEl.innerHTML = movieHTML;
|
2265
2302
|
}
|
2266
|
-
|
2303
|
+
appendSuccess = true;
|
2267
2304
|
}
|
2268
2305
|
}
|
2269
|
-
|
2270
|
-
|
2306
|
+
didAppend = true;
|
2307
|
+
initMsg();
|
2271
2308
|
return true;
|
2272
2309
|
};
|
2273
|
-
|
2274
|
-
if (
|
2275
|
-
|
2310
|
+
initMovie = function() {
|
2311
|
+
if (sm2.html5Only) {
|
2312
|
+
createMovie();
|
2276
2313
|
return false;
|
2277
2314
|
}
|
2278
|
-
if (
|
2315
|
+
if (flash) {
|
2279
2316
|
return false;
|
2280
2317
|
}
|
2281
|
-
if (!
|
2318
|
+
if (!sm2.url) {
|
2282
2319
|
return false;
|
2283
2320
|
}
|
2284
|
-
|
2285
|
-
if (!
|
2286
|
-
if (!
|
2287
|
-
|
2321
|
+
flash = sm2.getMovie(sm2.id);
|
2322
|
+
if (!flash) {
|
2323
|
+
if (!oRemoved) {
|
2324
|
+
createMovie(sm2.id, sm2.url);
|
2288
2325
|
} else {
|
2289
|
-
if (!
|
2290
|
-
|
2326
|
+
if (!isIE) {
|
2327
|
+
sm2.oMC.appendChild(oRemoved);
|
2291
2328
|
} else {
|
2292
|
-
|
2329
|
+
sm2.oMC.innerHTML = oRemovedHTML;
|
2293
2330
|
}
|
2294
|
-
|
2295
|
-
|
2331
|
+
oRemoved = null;
|
2332
|
+
didAppend = true;
|
2296
2333
|
}
|
2297
|
-
|
2334
|
+
flash = sm2.getMovie(sm2.id);
|
2298
2335
|
}
|
2299
|
-
if (typeof
|
2300
|
-
setTimeout(
|
2336
|
+
if (typeof sm2.oninitmovie === 'function') {
|
2337
|
+
setTimeout(sm2.oninitmovie, 1);
|
2301
2338
|
}
|
2302
2339
|
return true;
|
2303
2340
|
};
|
2304
|
-
|
2305
|
-
setTimeout(
|
2341
|
+
delayWaitForEI = function() {
|
2342
|
+
setTimeout(waitForEI, 1000);
|
2306
2343
|
};
|
2307
|
-
|
2344
|
+
waitForEI = function() {
|
2308
2345
|
var p,
|
2309
2346
|
loadIncomplete = false;
|
2310
|
-
if (!
|
2347
|
+
if (!sm2.url) {
|
2311
2348
|
return false;
|
2312
2349
|
}
|
2313
|
-
if (
|
2350
|
+
if (waitingForEI) {
|
2314
2351
|
return false;
|
2315
2352
|
}
|
2316
|
-
|
2317
|
-
|
2318
|
-
if (
|
2353
|
+
waitingForEI = true;
|
2354
|
+
event.remove(window, 'load', delayWaitForEI);
|
2355
|
+
if (tryInitOnFocus && !isFocused) {
|
2319
2356
|
return false;
|
2320
2357
|
}
|
2321
|
-
if (!
|
2322
|
-
p =
|
2358
|
+
if (!didInit) {
|
2359
|
+
p = sm2.getMoviePercent();
|
2323
2360
|
if (p > 0 && p < 100) {
|
2324
2361
|
loadIncomplete = true;
|
2325
2362
|
}
|
2326
2363
|
}
|
2327
2364
|
setTimeout(function() {
|
2328
|
-
p =
|
2365
|
+
p = sm2.getMoviePercent();
|
2329
2366
|
if (loadIncomplete) {
|
2330
|
-
|
2331
|
-
|
2367
|
+
waitingForEI = false;
|
2368
|
+
window.setTimeout(delayWaitForEI, 1);
|
2332
2369
|
return false;
|
2333
2370
|
}
|
2334
|
-
if (!
|
2371
|
+
if (!didInit && okToDisable) {
|
2335
2372
|
if (p === null) {
|
2336
|
-
if (
|
2337
|
-
if (
|
2338
|
-
|
2373
|
+
if (sm2.useFlashBlock || sm2.flashLoadTimeout === 0) {
|
2374
|
+
if (sm2.useFlashBlock) {
|
2375
|
+
flashBlockHandler();
|
2339
2376
|
}
|
2340
2377
|
} else {
|
2341
|
-
|
2378
|
+
processOnEvents({type:'ontimeout', ignoreInit: true});
|
2342
2379
|
}
|
2343
2380
|
} else {
|
2344
|
-
if (
|
2381
|
+
if (sm2.flashLoadTimeout === 0) {
|
2345
2382
|
} else {
|
2346
|
-
|
2383
|
+
failSafely(true);
|
2347
2384
|
}
|
2348
2385
|
}
|
2349
2386
|
}
|
2350
|
-
},
|
2387
|
+
}, sm2.flashLoadTimeout);
|
2351
2388
|
};
|
2352
|
-
|
2389
|
+
handleFocus = function() {
|
2353
2390
|
function cleanup() {
|
2354
|
-
|
2391
|
+
event.remove(window, 'focus', handleFocus);
|
2355
2392
|
}
|
2356
|
-
if (
|
2393
|
+
if (isFocused || !tryInitOnFocus) {
|
2357
2394
|
cleanup();
|
2358
2395
|
return true;
|
2359
2396
|
}
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2397
|
+
okToDisable = true;
|
2398
|
+
isFocused = true;
|
2399
|
+
waitingForEI = false;
|
2400
|
+
delayWaitForEI();
|
2364
2401
|
cleanup();
|
2365
2402
|
return true;
|
2366
2403
|
};
|
2367
|
-
|
2404
|
+
flushMessages = function() {
|
2405
|
+
};
|
2406
|
+
showSupport = function() {
|
2368
2407
|
};
|
2369
|
-
|
2370
|
-
if (
|
2408
|
+
initComplete = function(bNoDisable) {
|
2409
|
+
if (didInit) {
|
2371
2410
|
return false;
|
2372
2411
|
}
|
2373
|
-
if (
|
2374
|
-
|
2375
|
-
|
2412
|
+
if (sm2.html5Only) {
|
2413
|
+
didInit = true;
|
2414
|
+
initUserOnload();
|
2376
2415
|
return true;
|
2377
2416
|
}
|
2378
|
-
var wasTimeout = (
|
2417
|
+
var wasTimeout = (sm2.useFlashBlock && sm2.flashLoadTimeout && !sm2.getMoviePercent()),
|
2379
2418
|
result = true,
|
2380
2419
|
error;
|
2381
2420
|
if (!wasTimeout) {
|
2382
|
-
|
2383
|
-
if (
|
2384
|
-
error = {type: (!
|
2421
|
+
didInit = true;
|
2422
|
+
if (disabled) {
|
2423
|
+
error = {type: (!hasFlash && needsFlash ? 'NO_FLASH' : 'INIT_TIMEOUT')};
|
2385
2424
|
}
|
2386
2425
|
}
|
2387
|
-
if (
|
2388
|
-
if (
|
2389
|
-
|
2426
|
+
if (disabled || bNoDisable) {
|
2427
|
+
if (sm2.useFlashBlock && sm2.oMC) {
|
2428
|
+
sm2.oMC.className = getSWFCSS() + ' ' + (sm2.getMoviePercent() === null?swfCSS.swfTimedout:swfCSS.swfError);
|
2390
2429
|
}
|
2391
|
-
|
2392
|
-
|
2430
|
+
processOnEvents({type:'ontimeout', error:error, ignoreInit: true});
|
2431
|
+
catchError(error);
|
2393
2432
|
result = false;
|
2394
2433
|
} else {
|
2395
2434
|
}
|
2396
|
-
if (!
|
2397
|
-
if (
|
2398
|
-
|
2435
|
+
if (!disabled) {
|
2436
|
+
if (sm2.waitForWindowLoad && !windowLoaded) {
|
2437
|
+
event.add(window, 'load', initUserOnload);
|
2399
2438
|
} else {
|
2400
|
-
|
2439
|
+
initUserOnload();
|
2401
2440
|
}
|
2402
2441
|
}
|
2403
2442
|
return result;
|
2404
2443
|
};
|
2405
|
-
|
2444
|
+
setProperties = function() {
|
2406
2445
|
var i,
|
2407
|
-
o =
|
2446
|
+
o = sm2.setupOptions;
|
2408
2447
|
for (i in o) {
|
2409
2448
|
if (o.hasOwnProperty(i)) {
|
2410
|
-
if (
|
2411
|
-
|
2412
|
-
} else if (
|
2413
|
-
|
2449
|
+
if (sm2[i] === _undefined) {
|
2450
|
+
sm2[i] = o[i];
|
2451
|
+
} else if (sm2[i] !== o[i]) {
|
2452
|
+
sm2.setupOptions[i] = sm2[i];
|
2414
2453
|
}
|
2415
2454
|
}
|
2416
2455
|
}
|
2417
2456
|
};
|
2418
|
-
|
2419
|
-
if (
|
2457
|
+
init = function() {
|
2458
|
+
if (didInit) {
|
2420
2459
|
return false;
|
2421
2460
|
}
|
2422
|
-
function
|
2423
|
-
|
2461
|
+
function cleanup() {
|
2462
|
+
event.remove(window, 'load', sm2.beginDelayedInit);
|
2424
2463
|
}
|
2425
|
-
if (
|
2426
|
-
if (!
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2464
|
+
if (sm2.html5Only) {
|
2465
|
+
if (!didInit) {
|
2466
|
+
cleanup();
|
2467
|
+
sm2.enabled = true;
|
2468
|
+
initComplete();
|
2430
2469
|
}
|
2431
2470
|
return true;
|
2432
2471
|
}
|
2433
|
-
|
2472
|
+
initMovie();
|
2434
2473
|
try {
|
2435
|
-
|
2436
|
-
|
2437
|
-
if (!
|
2438
|
-
|
2474
|
+
flash._externalInterfaceTest(false);
|
2475
|
+
setPolling(true, (sm2.flashPollingInterval || (sm2.useHighPerformance ? 10 : 50)));
|
2476
|
+
if (!sm2.debugMode) {
|
2477
|
+
flash._disableDebug();
|
2439
2478
|
}
|
2440
|
-
|
2441
|
-
if (!
|
2442
|
-
|
2479
|
+
sm2.enabled = true;
|
2480
|
+
if (!sm2.html5Only) {
|
2481
|
+
event.add(window, 'unload', doNothing);
|
2443
2482
|
}
|
2444
2483
|
} catch(e) {
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2484
|
+
catchError({type:'JS_TO_FLASH_EXCEPTION', fatal:true});
|
2485
|
+
failSafely(true);
|
2486
|
+
initComplete();
|
2448
2487
|
return false;
|
2449
2488
|
}
|
2450
|
-
|
2451
|
-
|
2489
|
+
initComplete();
|
2490
|
+
cleanup();
|
2452
2491
|
return true;
|
2453
2492
|
};
|
2454
|
-
|
2455
|
-
if (
|
2493
|
+
domContentLoaded = function() {
|
2494
|
+
if (didDCLoaded) {
|
2456
2495
|
return false;
|
2457
2496
|
}
|
2458
|
-
|
2459
|
-
|
2460
|
-
|
2461
|
-
if (!
|
2462
|
-
|
2497
|
+
didDCLoaded = true;
|
2498
|
+
setProperties();
|
2499
|
+
initDebug();
|
2500
|
+
if (!hasFlash && sm2.hasHTML5) {
|
2501
|
+
sm2.setup({
|
2463
2502
|
'useHTML5Audio': true,
|
2464
2503
|
'preferFlash': false
|
2465
2504
|
});
|
2466
2505
|
}
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2506
|
+
testHTML5();
|
2507
|
+
sm2.html5.usingFlash = featureCheck();
|
2508
|
+
needsFlash = sm2.html5.usingFlash;
|
2509
|
+
if (!hasFlash && needsFlash) {
|
2510
|
+
messages.push(strings.needFlash);
|
2511
|
+
sm2.setup({
|
2473
2512
|
'flashLoadTimeout': 1
|
2474
2513
|
});
|
2475
2514
|
}
|
2476
|
-
if (
|
2477
|
-
|
2515
|
+
if (doc.removeEventListener) {
|
2516
|
+
doc.removeEventListener('DOMContentLoaded', domContentLoaded, false);
|
2478
2517
|
}
|
2479
|
-
|
2518
|
+
initMovie();
|
2480
2519
|
return true;
|
2481
2520
|
};
|
2482
|
-
|
2483
|
-
if (
|
2484
|
-
|
2485
|
-
|
2521
|
+
domContentLoadedIE = function() {
|
2522
|
+
if (doc.readyState === 'complete') {
|
2523
|
+
domContentLoaded();
|
2524
|
+
doc.detachEvent('onreadystatechange', domContentLoadedIE);
|
2486
2525
|
}
|
2487
2526
|
return true;
|
2488
2527
|
};
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
};
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2528
|
+
winOnLoad = function() {
|
2529
|
+
windowLoaded = true;
|
2530
|
+
event.remove(window, 'load', winOnLoad);
|
2531
|
+
};
|
2532
|
+
preInit = function() {
|
2533
|
+
if (mobileHTML5) {
|
2534
|
+
sm2.setupOptions.useHTML5Audio = true;
|
2535
|
+
sm2.setupOptions.preferFlash = false;
|
2536
|
+
if (is_iDevice || (isAndroid && !ua.match(/android\s2\.3/i))) {
|
2537
|
+
if (is_iDevice) {
|
2538
|
+
sm2.ignoreFlash = true;
|
2539
|
+
}
|
2540
|
+
useGlobalHTML5Audio = true;
|
2541
|
+
}
|
2542
|
+
}
|
2543
|
+
};
|
2544
|
+
preInit();
|
2545
|
+
detectFlash();
|
2546
|
+
event.add(window, 'focus', handleFocus);
|
2547
|
+
event.add(window, 'load', delayWaitForEI);
|
2548
|
+
event.add(window, 'load', winOnLoad);
|
2549
|
+
if (doc.addEventListener) {
|
2550
|
+
doc.addEventListener('DOMContentLoaded', domContentLoaded, false);
|
2551
|
+
} else if (doc.attachEvent) {
|
2552
|
+
doc.attachEvent('onreadystatechange', domContentLoadedIE);
|
2501
2553
|
} else {
|
2502
|
-
|
2554
|
+
catchError({type:'NO_DOM2_EVENTS', fatal:true});
|
2503
2555
|
}
|
2504
2556
|
}
|
2505
2557
|
// SM2_DEFER details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading
|
2506
|
-
if (
|
2558
|
+
if (window.SM2_DEFER === undefined || !SM2_DEFER) {
|
2507
2559
|
soundManager = new SoundManager();
|
2508
2560
|
}
|
2509
2561
|
window.SoundManager = SoundManager;
|