Changeset 37137fd


Ignore:
Timestamp:
25/06/2011 17:40:10 (3 years ago)
Author:
riccardo <riccardo@…>
Branches:
master, crem, crem2, dev, dev2, diadems, feature/breadcrumbs, feature/ts-0.5, feature/ts-0.5.4, feature/writecache, forma, generic, instru_search, lam, lam2, mapsv3, merge, nlivemulti, production, release/1.4.4, sabiod, security, server, social, storage, telecaster, test, video
Children:
fe97d80
Parents:
75617ad
git-author:
riccardo <riccardo@…> (25/06/2011 17:40:10)
git-committer:
riccardo <riccardo@…> (25/06/2011 17:40:10)
Message:

cleanup and other stuff

Location:
telemeta/htdocs/timeside/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • telemeta/htdocs/timeside/js/player.js

    r2c46652 r37137fd  
    8484        var sound = configObject.sound; 
    8585        var createSound = false; 
    86         if(this.$TU.flahsFailed){ 
    87             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'; 
     86        if(this.$TU.flashFailed){ 
     87            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'; 
    8888        }else{ 
    8989            if(typeof sound !== 'string' && typeof sound !== 'object'){ 
    90                 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)'; 
     90                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'; 
    9191            }else if(typeof sound === 'string'){ 
    9292                createSound = true; 
     
    109109                var soundOptions = sound; 
    110110                if(sMan.canPlayURL(soundOptions.url)){ //this actually checks only if the url is well formed, not if the file is there 
     111                    //check if we specified a valid sound duration, otherwise the sound must be loaded 
     112                     
    111113                    sound = sMan.createSound(soundOptions); 
    112114                }else{ 
     
    125127        } 
    126128        var soundDurationInMsec = configObject.soundDuration; 
    127         if(isNaN(soundDurationInMsec) || soundDurationInMsec<=0){ 
     129        if(typeof soundDurationInMsec !== 'number' || soundDurationInMsec<=0){ 
    128130            onError('invalid soundDurationInMsec: NaN or not positive'); 
    129131            return; 
     
    376378        //ie, top: auto. This is however useful even if somebody specified a top property on the divs 
    377379        ruler_.add(wave).add(control).css('top','auto'); 
    378  
    379  
    380380        onReady(this); 
    381381    }, 
     
    441441 
    442442    }, 
    443  
    444     soundErrorMsg: "", 
     443    showSoundErroMessage: function(){ 
     444        alert(this.soundErrorMsg); 
     445    }, 
    445446    //given a marker at index I, specifies that a marker corss event is fired whenever the sound position (pointer) 
    446447    //is in the interval ]markerCrossedOffsetMargin-I,I+markerCrossedOffsetMargin[ 
  • telemeta/htdocs/timeside/js/timeside.js

    r85c7d5c r37137fd  
    666666 
    667667            }; 
    668  
    669         } 
     668        } 
     669 
     670        ts.player = undefined; 
     671        if(config.onReady && typeof config.onReady === 'function'){ 
     672            var oR = config.onReady; 
     673            config.onReady = function(player){ 
     674                ts.player = player; 
     675                oR(player); 
     676            }; 
     677        }else{ 
     678            config.onReady = function(player){ 
     679                ts.player = player; 
     680            }; 
     681        } 
     682 
    670683        //finally,define the error function 
    671684        ts.utils.loadScripts(thisScriptPath,ts_scripts, function() { 
    672             var p = new ts.classes.Player(config); 
    673             ts.player = p; 
    674             return false; 
     685            new ts.classes.Player(config); //do not assign it to any variable, we do it only onready 
    675686        },config.onError); 
    676687    }; 
     
    680691 
    681692    $J(win).ready(function(){ 
    682  
     693        var s = soundManager; 
    683694        //grab the case of soundManager init errors: 
    684         soundManager.onerror = function() { 
     695        s.onerror = function() { 
    685696            Timeside.utils.flashFailed = true; 
    686697            //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'); 
    687  
     698             
    688699            //and load all anyway: 
    689700            loadAll(); 
     
    693704        //onready is executed BEFORE onload, it basically queues several onload events. 
    694705        //It it is executed immetiately if soundmanager has already been loaded 
    695         soundManager.onready(loadAll); 
     706        s.onready(function(){loadAll();}); 
    696707    }); 
    697708}; 
Note: See TracChangeset for help on using the changeset viewer.