cms/app-client/app/components/player-component.js
changeset 249 e4204b1a579a
parent 248 256272c33349
child 251 ac320de33ec7
--- a/cms/app-client/app/components/player-component.js	Fri Jul 22 18:25:02 2016 +0200
+++ b/cms/app-client/app/components/player-component.js	Wed Aug 03 22:47:49 2016 +0200
@@ -33,10 +33,6 @@
         this.get('popcorn').load();
     }),
 
-    progressObserver: Ember.observer('player.progress', function() {
-        this.get('popcorn').currentTime(this.get('player').get('progress') / 1000);
-    }),
-
     playingObserver: Ember.observer('player.playing', function() {
         if(this.get('player').get('playing')) {
             this.play();
@@ -46,8 +42,12 @@
     }),
 
     init: function() {
+        var self = this;
+        this.get('player').on('progressupdate', function(progress) {
+            self.get('popcorn').currentTime(progress / 1000);
+        });
+
         this._super(...arguments);
-        this.get('player');
     },
 
     didInsertElement: function() {
@@ -68,7 +68,7 @@
         var progress = this.get('popcorn').currentTime();
         var duration = this.get('popcorn').duration();
         this.$('.bar .value').width(progress * 100 / duration + '%');
-        this.get('player').set('progress', progress * 1000);
+        this.get('player').setProgress(progress * 1000);
         this.set('head', progress);
         this.set('remaining', duration - progress);
     },