diff -r 7c1d08cf6956 -r 4da0a5740b6c src/widgets/Mediafragment.js --- a/src/widgets/Mediafragment.js Fri Sep 14 10:38:04 2012 +0900 +++ b/src/widgets/Mediafragment.js Mon Sep 17 00:17:06 2012 +0900 @@ -10,15 +10,15 @@ } }) }; - this.bindPopcorn("pause","setHashToTime"); - this.bindPopcorn("seeked","setHashToTime"); - this.bindPopcorn("IriSP.Mediafragment.setHashToAnnotation","setHashToAnnotation"); + this.onMdpEvent("Mediafragment.setHashToAnnotation","setHashToAnnotation"); this.blocked = false; } IriSP.Widgets.Mediafragment.prototype = new IriSP.Widgets.Widget(); IriSP.Widgets.Mediafragment.prototype.draw = function() { + this.onMediaEvent("pause","setHashToTime"); + this.onMediaEvent("seeked","setHashToTime"); this.goToHash(); } @@ -52,11 +52,11 @@ if (this.last_hash_key == "id") { var _annotation = this.source.getElement(this.last_hash_value); if (typeof _annotation !== "undefined") { - this.player.popcorn.currentTime(_annotation.begin.getSeconds()); + this.media.setCurrentTime(_annotation.begin); } } if (this.last_hash_key == "t") { - this.player.popcorn.currentTime(this.last_hash_value); + this.media.setCurrentTime(1000*this.last_hash_value); } break; } @@ -68,10 +68,8 @@ this.setHash( 'id', _annotationId ); } -IriSP.Widgets.Mediafragment.prototype.setHashToTime = function(_time) { - if (_time !== NaN) { - this.setHash( 't', this.player.popcorn.currentTime() ); - } +IriSP.Widgets.Mediafragment.prototype.setHashToTime = function() { + this.setHash( 't', this.media.getCurrentTime().getSeconds() ); } IriSP.Widgets.Mediafragment.prototype.setHash = function(_key, _value) { @@ -100,5 +98,5 @@ window.clearTimeout(this.blockTimeout); } this.blocked = true; - this.blockTimeout = window.setTimeout(this.functionWrapper("unblock"), 1000); + this.blockTimeout = window.setTimeout(this.functionWrapper("unblock"), 1500); }