src/widgets/Sparkline.js
branchplayers-as-widgets
changeset 957 4da0a5740b6c
parent 876 03967b6ada7c
child 980 9ee8c00ae5b7
--- a/src/widgets/Sparkline.js	Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Sparkline.js	Mon Sep 17 00:17:06 2012 +0900
@@ -1,6 +1,5 @@
 IriSP.Widgets.Sparkline = function(player, config) {
     IriSP.Widgets.Widget.call(this, player, config);
-    //this.bindPopcorn("timeupdate", "onTimeupdate");
 };
 
 IriSP.Widgets.Sparkline.prototype = new IriSP.Widgets.Widget();
@@ -68,14 +67,14 @@
    
     this.$.click(function(_e) {
         var _x = _e.pageX - _this.$.offset().left;
-        _this.player.popcorn.currentTime(_this.source.getDuration().getSeconds() * _x / _this.width);
+        _this.media.setCurrentTime(_this.media.duration * _x / _this.width);
     });
     
-    this.bindPopcorn("timeupdate","onTimeupdate");
+    this.onMediaEvent("timeupdate","onTimeupdate");
 }
 
-IriSP.Widgets.Sparkline.prototype.onTimeupdate = function() {
-    var _x = Math.floor( this.width * this.player.popcorn.currentTime() / this.source.getDuration().getSeconds());
+IriSP.Widgets.Sparkline.prototype.onTimeupdate = function(_time) {
+    var _x = Math.floor( this.width * _time / this.media.duration);
     this.rectangleProgress.attr({
         "width" : _x
     });