var sMan = soundManager;
var sound = configObject.sound;
var createSound = false;
- if(this.$TU.flahsFailed){
- this.soundErrorMsg = 'SoundManager error. If your browser does not support HTML5, Flash player (version '+soundManager.flashVersion+'+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences/options/tools) and reload the page\n - Restart the browser';
+ if(this.$TU.flashFailed){
+ this.soundErrorMsg = 'soundManager error. If your browser does not support HTML5, Flash player (version '+sMan.flashVersion+'+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences/options/tools) and reload the page\n - Restart the browser';
}else{
if(typeof sound !== 'string' && typeof sound !== 'object'){
- this.soundErrorMsg ='bad sound parameter (specify a a valid soundManager sound-object, an object with at least two properties, url and id, or URL as string)';
+ this.soundErrorMsg ='bad sound parameter: specify a a valid soundManager sound-object, an object with at least two properties, url and id, or URL as string';
}else if(typeof sound === 'string'){
createSound = true;
var soundURL = sound;
if(createSound){
var soundOptions = sound;
if(sMan.canPlayURL(soundOptions.url)){ //this actually checks only if the url is well formed, not if the file is there
+ //check if we specified a valid sound duration, otherwise the sound must be loaded
+
sound = sMan.createSound(soundOptions);
}else{
this.soundErrorMsg = 'bad sound parameter (soundManager.canPlayURL returned false)';
};
}
var soundDurationInMsec = configObject.soundDuration;
- if(isNaN(soundDurationInMsec) || soundDurationInMsec<=0){
+ if(typeof soundDurationInMsec !== 'number' || soundDurationInMsec<=0){
onError('invalid soundDurationInMsec: NaN or not positive');
return;
}
//Weird enough (with IE it isn't actually), we have just to set the property we already set in the css:
//ie, top: auto. This is however useful even if somebody specified a top property on the divs
ruler_.add(wave).add(control).css('top','auto');
-
-
onReady(this);
},
});
},
-
- soundErrorMsg: "",
+ showSoundErroMessage: function(){
+ alert(this.soundErrorMsg);
+ },
//given a marker at index I, specifies that a marker corss event is fired whenever the sound position (pointer)
//is in the interval ]markerCrossedOffsetMargin-I,I+markerCrossedOffsetMargin[
//the value is in seconds
}
};
+ }
+ ts.player = undefined;
+ if(config.onReady && typeof config.onReady === 'function'){
+ var oR = config.onReady;
+ config.onReady = function(player){
+ ts.player = player;
+ oR(player);
+ };
+ }else{
+ config.onReady = function(player){
+ ts.player = player;
+ };
}
+
//finally,define the error function
ts.utils.loadScripts(thisScriptPath,ts_scripts, function() {
- var p = new ts.classes.Player(config);
- ts.player = p;
- return false;
+ new ts.classes.Player(config); //do not assign it to any variable, we do it only onready
},config.onError);
};
$J(win).ready(function(){
-
+ var s = soundManager;
//grab the case of soundManager init errors:
- soundManager.onerror = function() {
+ s.onerror = function() {
Timeside.utils.flashFailed = true;
//end('SoundManager error. If your browser does not support HTML5, Flash player (version '+soundManager.flashVersion+'+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences/options/tools) and reload the page\n - Restart the browser');
-
+
//and load all anyway:
loadAll();
};
//if soundmanager is ready, the callback is executed immetiately
//onready is executed BEFORE onload, it basically queues several onload events.
//It it is executed immetiately if soundmanager has already been loaded
- soundManager.onready(loadAll);
+ s.onready(function(){loadAll();});
});
};