src/js/modules/mediafragment.js
branchpopcorn-port
changeset 749 e9ee52225395
parent 653 29282fc3b3b2
child 751 5cea0b550154
equal deleted inserted replaced
748:ec1f7aa873f4 749:e9ee52225395
    38                           }));
    38                           }));
    39                   }
    39                   }
    40               }
    40               }
    41 };
    41 };
    42 
    42 
    43 IriSP.MediaFragment.prototype.updateTime = function() {
    43 /** handler for the seeked signal. It may have or may have not an argument.
       
    44     @param time if not undefined, the time we're seeking to 
       
    45 */
       
    46 IriSP.MediaFragment.prototype.updateTime = function(time) {
    44   if (this.mutex === true) {
    47   if (this.mutex === true) {
    45     return;
    48     return;
    46   }
    49   }
    47 
    50 
    48   var history = window.history;
    51   var history = window.history;
    49   if ( !history.pushState ) {
    52   if ( !history.pushState ) {
    50     return false;
    53     return false;
    51   }
    54   }
    52   
    55   
       
    56   
       
    57   if (IriSP.null_or_undefined(time)) {
       
    58     var ntime = this._Popcorn.currentTime().toFixed(2)
       
    59   } else {
       
    60     var ntime = time.toFixed(2);
       
    61   }
       
    62   
    53   splitArr = window.location.href.split( "#" )
    63   splitArr = window.location.href.split( "#" )
    54   history.replaceState( {}, "", splitArr[0] + "#t=" + this._Popcorn.currentTime().toFixed( 2 ) );
    64   history.replaceState( {}, "", splitArr[0] + "#t=" + ntime );
    55 };
    65 };
    56 
    66 
    57 
    67 
    58 IriSP.MediaFragment.prototype.updateAnnotation = function(annotationId) {
    68 IriSP.MediaFragment.prototype.updateAnnotation = function(annotationId) {
    59   var _this = this;
    69   var _this = this;
    65   }
    75   }
    66   
    76   
    67   splitArr = window.location.href.split( "#" )
    77   splitArr = window.location.href.split( "#" )
    68   history.replaceState( {}, "", splitArr[0] + "#id=" + annotationId);
    78   history.replaceState( {}, "", splitArr[0] + "#id=" + annotationId);
    69  
    79  
       
    80   // reset the mutex afterwards to prevent the module from reacting to his own changes.
    70   window.setTimeout(function() { _this.mutex = false }, 50);
    81   window.setTimeout(function() { _this.mutex = false }, 50);
    71 };
    82 };
    72 
    83 
    73 // lookup and seek to the beginning of an annotation
    84 // lookup and seek to the beginning of an annotation
    74 IriSP.MediaFragment.prototype.lookupAnnotation = function(annotationId) {
    85 IriSP.MediaFragment.prototype.lookupAnnotation = function(annotationId) {