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