Changeset 91bae44
- Timestamp:
- 12/13/11 15:32:47 (18 months ago)
- Branches:
- master, crem, crem2, dev, dev2, diadems, forma, generic, instru_search, lam, nlivemulti, production, release/1.4.4, security, social, storage, test, video
- Children:
- d4c2dd3, a50bf1e, b497a41
- Parents:
- 3f143f5
- git-author:
- yomguy <yomguy@…> (12/13/11 15:32:47)
- git-committer:
- yomguy <yomguy@…> (12/13/11 15:32:47)
- Location:
- telemeta
- Files:
-
- 1 added
- 2 edited
-
htdocs/timeside/js/player.js (modified) (25 diffs)
-
htdocs/timeside/js/timeside.js (modified) (12 diffs)
-
management/commands/telemeta-cleanup.py (added)
Legend:
- Unmodified
- Added
- Removed
-
telemeta/htdocs/timeside/js/player.js
r8868a69 r91bae44 30 30 //playerDiv, sound, durationInMsec, visualizers, markerMap); 31 31 Timeside.classes.Player = Timeside.classes.TimesideClass.extend({ 32 32 33 33 //sound duration is in milliseconds because the soundmanager has that unit, 34 34 //player (according to timeside syntax) has durations in seconds … … 64 64 65 65 var onReadyWithImage = configObject.onReadyWithImage; 66 66 67 67 if(typeof onReadyWithImage === 'function'){ 68 68 var onReadyWithImageNamespace = 'imgRefreshed.temp_'+new Date().getTime(); //get an unique namespace … … 110 110 if(sMan.canPlayURL(soundOptions.url)){ //this actually checks only if the url is well formed, not if the file is there 111 111 //check if we specified a valid sound duration, otherwise the sound must be loaded 112 112 113 113 sound = sMan.createSound(soundOptions); 114 114 }else{ … … 160 160 this.playState = 0; //0: not playing, 1: loading, 2:buffering, 3 playing (sound heard) 161 161 //container is the div #player 162 162 163 163 this.getContainer = function(){ 164 164 return container; 165 165 }; 166 167 166 167 168 168 169 169 var sd = this.toSec(soundDurationInMsec); … … 171 171 return sd; 172 172 }; 173 173 174 174 this.soundPosition = sound.position ? this.toSec(sound.position) : 0; 175 176 177 175 176 177 178 178 // 179 179 180 180 //initializing markermap and markerui 181 181 var map = new Timeside.classes.MarkerMap(); … … 191 191 } 192 192 } 193 193 194 194 //build the innerHTML as array, then join it. This is usually faster than string concatenation in some browsers. 195 195 //Note that the player image (see below) is not created now, however, if it was, it should be given a src … … 221 221 222 222 container.html(html.join('')); 223 223 224 224 var control = container.find('.ts-control'); 225 225 … … 421 421 var oldSoundPosition = this.soundPosition; 422 422 this.soundPosition = newPositionInSeconds; 423 423 424 424 //resume playing if it was playing: 425 425 if(wasPlaying){ 426 426 var player = this; 427 427 428 428 //delay a little bit the play resume, this might avoid fast pointer repositioning 429 429 //(it should not be the case, but it happens. why??) … … 446 446 //markerCrossedOffsetMargin : 0.5, 447 447 play : function(){ 448 448 449 449 if(this.soundErrorMsg){ 450 450 alert(this.soundErrorMsg); … … 459 459 return false; 460 460 } 461 461 462 462 463 463 var fireOnMarkerPosition = function(seconds){}; //does nothing by default … … 496 496 data.nextMarkerTimeInterval = marker ? [offs-margin, offs+margin] : undefined; 497 497 player.fire('markerCrossed',data); 498 498 499 499 if(idx<len){ 500 500 intervalUpperBound = offs+margin; … … 514 514 var bufferingString = this.msgs.buffering; 515 515 var loadingString = this.msgs.loading; 516 516 517 517 var updateWaitBar = this.setWait; 518 518 //building immediately data events to be passed instead of bulding them in the loop whileplaying … … 548 548 this.fire('playStateChanged',loadData); 549 549 } 550 550 551 551 var playOptions = { 552 552 553 553 position: sPosInMsec, 554 554 whileplaying: function(){ … … 556 556 var sPos = this.position; 557 557 var buffering = this.isBuffering || typeof sPos != 'number' || sPos < sPosInMsec; 558 558 559 559 //var buffering = this.isBuffering; //this refers to the soundmanager sound obj 560 560 //Now, what are we doing here below? we could simply check whether is buffering or not.. … … 600 600 }, 601 601 onfinish: function() { 602 602 603 603 //whileplaying is NOT called onsinfish. We must update the pointer: 604 604 //note that for small length sounds (wg, 5 secs) the pointer shifts abruptly from the last … … 680 680 setWait: function(msg){ 681 681 var wait = undefined; 682 682 683 683 wait = this.getWaitElement(); 684 684 if(!wait || msg === undefined){ … … 690 690 691 691 var visible = wait.css('display') != 'none'; 692 692 693 693 if(msg && !visible){ 694 694 wait.show(); … … 728 728 },100); 729 729 }, 730 730 731 731 resize: function() { 732 732 var height; 733 733 var container = this.getContainer(); 734 734 735 735 var wave = container.find('.ts-wave'); 736 736 … … 773 773 var imageC = container.find('.ts-image-container'); 774 774 var image = imageC.find('.ts-image'); 775 775 776 776 777 777 var size = this.getImageSize(); … … 785 785 return; 786 786 } 787 787 788 788 var player= this; 789 789 790 790 if(imageNotYetCreated){ 791 791 image = this.$J('<img/>'); … … 824 824 this.fire('imgRefreshing'); 825 825 image.attr('src', imgSrc); 826 826 827 827 }, 828 828 getImageSize: function(){ … … 880 880 } 881 881 } 882 882 883 883 if(idx< len){ 884 884 offset = markers[idx].offset; … … 1007 1007 // map.clear(); 1008 1008 // ruler.clear(); 1009 1009 1010 1010 var rulerAdd = ruler.add; 1011 1011 1012 1012 if(markers){ 1013 1013 //add markers to the map. No listeners associated to it (for the moment) … … 1021 1021 }); 1022 1022 } 1023 1023 1024 1024 //the function above calls map.add: 1025 1025 //add bindings when adding a marker: … … 1044 1044 1045 1045 //and now add a binding to the map when we move a marker: 1046 1046 1047 1047 map.bind('move', function(data){ 1048 1048 var from = data.fromIndex; -
telemeta/htdocs/timeside/js/timeside.js
r8868a69 r91bae44 90 90 * (Inspired by base2 and Prototype) 91 91 */ 92 92 93 93 /* 94 94 * In few words: the lightest and most-comprehensive way to implement inhertance and OOP in javascript. Usages can be found below. … … 119 119 * } 120 120 * 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'); 122 122 * } 123 123 * }, … … 132 132 * } 133 133 * 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 135 135 * //in the init method of the superclass (see above), THAT method will be called 136 136 * } … … 210 210 // Populate our constructed prototype object 211 211 Class.prototype = prototype; 212 212 213 213 // Enforce the constructor to be what we expect 214 214 Class.constructor = Class; … … 234 234 this.listenersMap={}; 235 235 }, 236 236 237 237 cssPrefix : 'ts-', //actually almost uneuseful, still here for backward compatibility with old code (TODO: remove?) 238 238 $J : jQuery, //reference to jQuery for faster lookup inside methods … … 266 266 }; 267 267 } 268 268 269 269 if(listenersMap.hasOwnProperty(eventType)){ 270 270 listenersMap[eventType].push(callback); … … 343 343 } 344 344 }, 345 345 346 346 /* 347 347 *formats (ie returns a string representation of) a time which is in the form seconds,milliseconds (eg 07.6750067) … … 364 364 formatArray = ['mm','ss']; 365 365 } 366 366 367 367 //marker offset is in float format second.decimalPart 368 368 var pInt = parseInt; … … 376 376 var seconds = pInt(time); 377 377 time-=seconds; 378 378 379 379 //here below the function to format a number 380 380 //ceilAsPowerOfTen is the ceil specifiedas integer indicating the relative power of ten … … 476 476 //3) each(m,n,callback) iterates over the elements from m (inclusive) to n-1 (inclusive) executing callback 477 477 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 479 479 //argument (even if it is a function) is a number. Why????? 480 480 //Anyway, we write the function arguments as empty … … 513 513 callback(i,me[i]); 514 514 } 515 515 516 516 }, 517 517 … … 696 696 Timeside.utils.flashFailed = true; 697 697 //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 699 699 //and load all anyway: 700 700 loadAll();
Note: See TracChangeset
for help on using the changeset viewer.
