# HG changeset patch # User Chloe Laisne # Date 1470257269 -7200 # Node ID e4204b1a579afb3bb2bc3ce4cb591fede14834fa # Parent 256272c3334998006b086461b5f52472fb6c43af Quickfix micro-cuts diff -r 256272c33349 -r e4204b1a579a cms/app-client/app/components/player-component.js --- 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); }, diff -r 256272c33349 -r e4204b1a579a cms/app-client/app/components/playlist-component.js --- a/cms/app-client/app/components/playlist-component.js Fri Jul 22 18:25:02 2016 +0200 +++ b/cms/app-client/app/components/playlist-component.js Wed Aug 03 22:47:49 2016 +0200 @@ -54,8 +54,12 @@ actions: { - setItem: function(id) { - this.get('player').trigger('reset', id); + play: function(id) { + this.get('player').play(id); + }, + + pause: function(id) { + this.get('player').pause(); }, displayNotice: function(id) { diff -r 256272c33349 -r e4204b1a579a cms/app-client/app/components/transcript-component.js --- a/cms/app-client/app/components/transcript-component.js Fri Jul 22 18:25:02 2016 +0200 +++ b/cms/app-client/app/components/transcript-component.js Wed Aug 03 22:47:49 2016 +0200 @@ -26,7 +26,7 @@ actions: { play: function(progress) { - this.get('player').set('progress', progress); + this.get('player').trigger('progressupdate', progress); this.get('player').set('playing', true); } diff -r 256272c33349 -r e4204b1a579a cms/app-client/app/services/player.js --- a/cms/app-client/app/services/player.js Fri Jul 22 18:25:02 2016 +0200 +++ b/cms/app-client/app/services/player.js Wed Aug 03 22:47:49 2016 +0200 @@ -9,15 +9,25 @@ window: '', playing: false, progress: 0, // In Milliseconds - progressObserver: Ember.observer('progress', function() { - console.log('Ember.observer progress'); - }), reduce: false, init: function() { this.on('reset', Ember.run.bind(this, this.get('reset'))); }, + setProgress: function(time) { + this.set('progress', time); + }, + + play: function(id) { + this.set('item', id); + this.set('playing', true); + }, + + pause: function() { + this.set('playing', false); + }, + reset: function(id) { this.set('item', id); } diff -r 256272c33349 -r e4204b1a579a cms/app-client/app/templates/components/playlist-component.hbs --- a/cms/app-client/app/templates/components/playlist-component.hbs Fri Jul 22 18:25:02 2016 +0200 +++ b/cms/app-client/app/templates/components/playlist-component.hbs Wed Aug 03 22:47:49 2016 +0200 @@ -6,9 +6,9 @@
{{#if (ifAnd (eq player.playing true) (eq player.item document.id))}} - Pause + Pause {{else}} - Play + Play {{/if}} {{ to-minutes document.duration }}