src/js/modules/mediafragment.js
branchpopcorn-port
changeset 658 cfaf0986d22b
parent 653 29282fc3b3b2
child 749 e9ee52225395
equal deleted inserted replaced
657:138160f52f14 658:cfaf0986d22b
    26                     // timecode 
    26                     // timecode 
    27                     if ( pageoffset.substring( 2 ) != null ) {
    27                     if ( pageoffset.substring( 2 ) != null ) {
    28                     var offsettime = pageoffset.substring( 2 );
    28                     var offsettime = pageoffset.substring( 2 );
    29                     this._Popcorn.currentTime( parseFloat( offsettime ) );
    29                     this._Popcorn.currentTime( parseFloat( offsettime ) );
    30                     }
    30                     }
    31                   } else if ( pageoffset.substring(0, 2) === "a=") {
    31                   } else if ( pageoffset.substring(0, 3) === "id=") {
    32                     // annotation
    32                     // annotation
    33                     var annotationId = pageoffset.substring( 2 );
    33                     var annotationId = pageoffset.substring( 3 );
    34 
       
    35                     // there's no better way than that because
    34                     // there's no better way than that because
    36                     // of possible race conditions
    35                     // of possible race conditions
    37                     this._serializer.sync(IriSP.wrap(this, function() {
    36                     this._serializer.sync(IriSP.wrap(this, function() {
    38                           this.lookupAnnotation.call(this, annotationId); 
    37                           this.lookupAnnotation.call(this, annotationId); 
    39                           }));
    38                           }));
    64   if ( !history.pushState ) {
    63   if ( !history.pushState ) {
    65     return false;
    64     return false;
    66   }
    65   }
    67   
    66   
    68   splitArr = window.location.href.split( "#" )
    67   splitArr = window.location.href.split( "#" )
    69   history.replaceState( {}, "", splitArr[0] + "#a=" + annotationId);
    68   history.replaceState( {}, "", splitArr[0] + "#id=" + annotationId);
    70  
    69  
    71   window.setTimeout(function() { _this.mutex = false }, 50);
    70   window.setTimeout(function() { _this.mutex = false }, 50);
    72 };
    71 };
    73 
    72 
    74 // lookup and seek to the beginning of an annotation
    73 // lookup and seek to the beginning of an annotation
    87       }
    86       }
    88   }
    87   }
    89 
    88 
    90   if (typeof(annotation) !== "undefined") {
    89   if (typeof(annotation) !== "undefined") {
    91     this._Popcorn.currentTime(annotation.begin / 1000);
    90     this._Popcorn.currentTime(annotation.begin / 1000);
       
    91     this._Popcorn.trigger("IriSP.Mediafragment.showAnnotation", annotationId);
    92   }
    92   }
    93   
    93   
    94   window.setTimeout(function() { _this.mutex = false }, 50);
    94   window.setTimeout(function() { _this.mutex = false }, 50);
    95 };
    95 };