Changeset 91bae44


Ignore:
Timestamp:
Dec 13, 2011 3:32:47 PM (3 years ago)
Author:
yomguy <yomguy@…>
Branches:
master, crem, crem2, dev, dev2, diadems, dj1.6, 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:
d4c2dd3, a50bf1e, b497a41
Parents:
3f143f5
git-author:
yomguy <yomguy@…> (13/12/2011 15:32:47)
git-committer:
yomguy <yomguy@…> (13/12/2011 15:32:47)
Message:

add cleanup management script

Location:
telemeta
Files:
1 added
2 edited

Legend:

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

    r8868a69 r91bae44  
    3030//playerDiv, sound, durationInMsec, visualizers, markerMap); 
    3131Timeside.classes.Player = Timeside.classes.TimesideClass.extend({ 
    32      
     32 
    3333    //sound duration is in milliseconds because the soundmanager has that unit, 
    3434    //player (according to timeside syntax) has durations in seconds 
     
    6464 
    6565        var onReadyWithImage = configObject.onReadyWithImage; 
    66          
     66 
    6767        if(typeof onReadyWithImage === 'function'){ 
    6868            var onReadyWithImageNamespace = 'imgRefreshed.temp_'+new Date().getTime(); //get an unique namespace 
     
    110110                if(sMan.canPlayURL(soundOptions.url)){ //this actually checks only if the url is well formed, not if the file is there 
    111111                    //check if we specified a valid sound duration, otherwise the sound must be loaded 
    112                      
     112 
    113113                    sound = sMan.createSound(soundOptions); 
    114114                }else{ 
     
    160160        this.playState = 0; //0: not playing, 1: loading, 2:buffering, 3 playing (sound heard) 
    161161        //container is the div #player 
    162         
     162 
    163163        this.getContainer = function(){ 
    164164            return container; 
    165165        }; 
    166          
    167          
     166 
     167 
    168168 
    169169        var sd = this.toSec(soundDurationInMsec); 
     
    171171            return sd; 
    172172        }; 
    173          
     173 
    174174        this.soundPosition =  sound.position ? this.toSec(sound.position) : 0; 
    175   
    176         
    177          
     175 
     176 
     177 
    178178        // 
    179          
     179 
    180180        //initializing markermap and markerui 
    181181        var map = new Timeside.classes.MarkerMap(); 
     
    191191            } 
    192192        } 
    193         
     193 
    194194        //build the innerHTML as array, then join it. This is usually faster than string concatenation in some browsers. 
    195195        //Note that the player image (see below) is not created now, however, if it was, it should be given a src 
     
    221221 
    222222        container.html(html.join('')); 
    223          
     223 
    224224        var control = container.find('.ts-control'); 
    225225 
     
    421421        var oldSoundPosition = this.soundPosition; 
    422422        this.soundPosition = newPositionInSeconds; 
    423          
     423 
    424424        //resume playing if it was playing: 
    425425        if(wasPlaying){ 
    426426            var player = this; 
    427              
     427 
    428428            //delay a little bit the play resume, this might avoid fast pointer repositioning 
    429429            //(it should not be the case, but it happens. why??) 
     
    446446    //markerCrossedOffsetMargin : 0.5, 
    447447    play : function(){ 
    448          
     448 
    449449        if(this.soundErrorMsg){ 
    450450            alert(this.soundErrorMsg); 
     
    459459            return false; 
    460460        } 
    461          
     461 
    462462 
    463463        var fireOnMarkerPosition = function(seconds){}; //does nothing by default 
     
    496496                            data.nextMarkerTimeInterval = marker ? [offs-margin, offs+margin] : undefined; 
    497497                            player.fire('markerCrossed',data); 
    498                              
     498 
    499499                            if(idx<len){ 
    500500                                intervalUpperBound =  offs+margin; 
     
    514514        var bufferingString = this.msgs.buffering; 
    515515        var loadingString = this.msgs.loading; 
    516          
     516 
    517517        var updateWaitBar = this.setWait; 
    518518        //building immediately data events to be passed instead of bulding them in the loop whileplaying 
     
    548548            this.fire('playStateChanged',loadData); 
    549549        } 
    550          
     550 
    551551        var playOptions = { 
    552              
     552 
    553553            position: sPosInMsec, 
    554554            whileplaying: function(){ 
     
    556556                var sPos = this.position; 
    557557                var buffering = this.isBuffering || typeof sPos != 'number' || sPos < sPosInMsec; 
    558                  
     558 
    559559                //var buffering = this.isBuffering; //this refers to the soundmanager sound obj 
    560560                //Now, what are we doing here below? we could simply check whether is buffering or not.. 
     
    600600            }, 
    601601            onfinish: function() { 
    602                  
     602 
    603603                //whileplaying is NOT called onsinfish. We must update the pointer: 
    604604                //note that for small length sounds (wg, 5 secs) the pointer shifts abruptly from the last 
     
    680680    setWait: function(msg){ 
    681681        var wait = undefined; 
    682        
     682 
    683683        wait = this.getWaitElement(); 
    684684        if(!wait || msg === undefined){ 
     
    690690 
    691691        var visible = wait.css('display') != 'none'; 
    692          
     692 
    693693        if(msg && !visible){ 
    694694            wait.show(); 
     
    728728        },100); 
    729729    }, 
    730      
     730 
    731731    resize: function() { 
    732732        var height; 
    733733        var container = this.getContainer(); 
    734          
     734 
    735735        var wave = container.find('.ts-wave'); 
    736736 
     
    773773        var imageC = container.find('.ts-image-container'); 
    774774        var image = imageC.find('.ts-image'); 
    775          
     775 
    776776 
    777777        var size = this.getImageSize(); 
     
    785785            return; 
    786786        } 
    787          
     787 
    788788        var player= this; 
    789          
     789 
    790790        if(imageNotYetCreated){ 
    791791            image = this.$J('<img/>'); 
     
    824824        this.fire('imgRefreshing'); 
    825825        image.attr('src', imgSrc); 
    826         
     826 
    827827    }, 
    828828    getImageSize: function(){ 
     
    880880            } 
    881881        } 
    882          
     882 
    883883        if(idx< len){ 
    884884            offset = markers[idx].offset; 
     
    10071007        //        map.clear(); 
    10081008        //        ruler.clear(); 
    1009         
     1009 
    10101010        var rulerAdd = ruler.add; 
    1011              
     1011 
    10121012        if(markers){ 
    10131013            //add markers to the map. No listeners associated to it (for the moment) 
     
    10211021            }); 
    10221022        } 
    1023          
     1023 
    10241024        //the function above calls map.add: 
    10251025        //add bindings when adding a marker: 
     
    10441044 
    10451045        //and now add a binding to the map when we move a marker: 
    1046            
     1046 
    10471047        map.bind('move', function(data){ 
    10481048            var from = data.fromIndex; 
  • telemeta/htdocs/timeside/js/timeside.js

    r8868a69 r91bae44  
    9090 * (Inspired by base2 and Prototype) 
    9191 */ 
    92   
     92 
    9393/* 
    9494 * In few words: the lightest and most-comprehensive way to implement inhertance and OOP in javascript. Usages can be found below. 
     
    119119 *       } 
    120120 *       this.alert = function(){   //another public method, !!!WARNING: this will be put in the MyClass scope (NOT in the prototype) 
    121  *           alert('ok');            
     121 *           alert('ok'); 
    122122 *       } 
    123123 *   }, 
     
    132132 *  } 
    133133 *  alert: function(){                  //override a method 
    134  *      this._super();                  //call the super method, ie alerts 'no'. WARNING: However, as long as there is an alert written  
     134 *      this._super();                  //call the super method, ie alerts 'no'. WARNING: However, as long as there is an alert written 
    135135 *                                      //in the init method of the superclass (see above), THAT method will be called 
    136136 *  } 
     
    210210        // Populate our constructed prototype object 
    211211        Class.prototype = prototype; 
    212          
     212 
    213213        // Enforce the constructor to be what we expect 
    214214        Class.constructor = Class; 
     
    234234        this.listenersMap={}; 
    235235    }, 
    236      
     236 
    237237    cssPrefix : 'ts-', //actually almost uneuseful, still here for backward compatibility with old code (TODO: remove?) 
    238238    $J : jQuery, //reference to jQuery for faster lookup inside methods 
     
    266266            }; 
    267267        } 
    268          
     268 
    269269        if(listenersMap.hasOwnProperty(eventType)){ 
    270270            listenersMap[eventType].push(callback); 
     
    343343        } 
    344344    }, 
    345      
     345 
    346346    /* 
    347347     *formats (ie returns a string representation of) a time which is in the form seconds,milliseconds (eg 07.6750067) 
     
    364364            formatArray = ['mm','ss']; 
    365365        } 
    366          
     366 
    367367        //marker offset is in float format second.decimalPart 
    368368        var pInt = parseInt; 
     
    376376        var seconds = pInt(time); 
    377377        time-=seconds; 
    378          
     378 
    379379        //here below the function to format a number 
    380380        //ceilAsPowerOfTen is the ceil specifiedas integer indicating the relative power of ten 
     
    476476    //3) each(m,n,callback) iterates over the elements from m (inclusive) to n-1 (inclusive) executing callback 
    477477 
    478     //NOTE: writing   each : function(startInclusive, endExclusive, callback) throws an error in chrome, as the last  
     478    //NOTE: writing   each : function(startInclusive, endExclusive, callback) throws an error in chrome, as the last 
    479479    //argument (even if it is a function) is a number. Why????? 
    480480    //Anyway, we write the function arguments as empty 
     
    513513            callback(i,me[i]); 
    514514        } 
    515      
     515 
    516516    }, 
    517517 
     
    696696            Timeside.utils.flashFailed = true; 
    697697            //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'); 
    698              
     698 
    699699            //and load all anyway: 
    700700            loadAll(); 
Note: See TracChangeset for help on using the changeset viewer.