web/res/metadataplayer/Mediafragment.js
changeset 755 d50aeed9a54b
parent 694 e9400c80e1e4
child 765 8cde4d15a173
--- a/web/res/metadataplayer/Mediafragment.js	Tue Dec 18 17:16:26 2012 +0100
+++ b/web/res/metadataplayer/Mediafragment.js	Wed Dec 19 16:52:21 2012 +0100
@@ -4,9 +4,10 @@
     this.last_hash_value = "";
     window.onhashchange = this.functionWrapper("goToHash");
     if (typeof window.addEventListener !== "undefined") {
+        var _this = this;
         window.addEventListener('message', function(_msg) {
             if (/^#/.test(_msg.data)) {
-                this.setWindowHash(_msg.data);
+                _this.setWindowHash(_msg.data);
             }
         })
     };
@@ -18,14 +19,15 @@
 
 IriSP.Widgets.Mediafragment.prototype.draw = function() {
     this.onMediaEvent("pause","setHashToTime");
-    this.onMediaEvent("seeked","setHashToTime");
-    this.goToHash();
     var _this = this;
     this.getWidgetAnnotations().forEach(function(_annotation) {
         _annotation.on("click", function() {
             _this.setHashToAnnotation(_annotation.id);
         })
-    })
+    });
+    this.player.on("widgets-loaded", function() {
+        _this.goToHash();
+    });
 }
 
 IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) {