src/widgets/Mediafragment.js
changeset 987 7b65bf78873a
parent 986 f9d51dd4a3fe
child 1013 392ddcd212d7
equal deleted inserted replaced
986:f9d51dd4a3fe 987:7b65bf78873a
    16 }
    16 }
    17 
    17 
    18 IriSP.Widgets.Mediafragment.prototype = new IriSP.Widgets.Widget();
    18 IriSP.Widgets.Mediafragment.prototype = new IriSP.Widgets.Widget();
    19 
    19 
    20 IriSP.Widgets.Mediafragment.prototype.draw = function() {
    20 IriSP.Widgets.Mediafragment.prototype.draw = function() {
    21     this.onMediaEvent("pause","setHashToTime");
    21     this.onMediaEvent("setpause","setHashToTime");
    22     var _this = this;
    22     var _this = this;
    23     this.getWidgetAnnotations().forEach(function(_annotation) {
    23     this.getWidgetAnnotations().forEach(function(_annotation) {
    24         _annotation.on("click", function() {
    24         _annotation.on("click", function() {
    25             _this.setHashToAnnotation(_annotation.id);
    25             _this.setHashToAnnotation(_annotation.id);
    26         })
    26         })
    27     });
    27     });
    28     this.player.on("widgets-loaded", function() {
    28     if (this.media.loadedMetadata) {
    29         _this.goToHash();
    29         this.goToHash();
    30     });
    30     } else {
       
    31         this.onMediaEvent("loadedmetadata","goToHash");
       
    32     }
    31 }
    33 }
    32 
    34 
    33 IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) {
    35 IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) {
    34     if (typeof window.history !== "undefined" && typeof window.history.replaceState !== "undefined") {
    36     if (typeof window.history !== "undefined" && typeof window.history.replaceState !== "undefined") {
    35         window.history.replaceState({}, "", _hash);
    37         window.history.replaceState({}, "", _hash);