cms/app-client/app/components/player-component.js
changeset 209 35cb7200bb0a
parent 192 e1435b37301a
child 210 08ad36c693b1
--- a/cms/app-client/app/components/player-component.js	Fri Jun 24 17:07:24 2016 +0200
+++ b/cms/app-client/app/components/player-component.js	Mon Jun 27 11:35:10 2016 +0200
@@ -2,12 +2,16 @@
 
 export default Ember.Component.extend({
     classNames: ['player-component'],
+
+    player: Ember.inject.service(),
+
     currentTime: "00:00",
     duration: "00:00",
 
-    documentLoaded: Ember.observer('document.mediaArray', function() {
-        var mediaList = this.get('document').get("mediaList");
+    documentLoaded: Ember.observer('player.item', function() {
+        var mediaList = this.get('player').get('item').get('mediaList');
         if ((typeof(mediaList) !== 'undefined') && (mediaList.length > 0)) {
+
             if (this.audio.src){
                 this.pause();
                 this.updateProgress(0);
@@ -16,9 +20,15 @@
             this.audio.src = mp3.url;
             this.audio.load();
             this.set("currentTime", "00:00");
+            //console.log(mp3.url);
         }
     }),
 
+    init: function() {
+        this._super(...arguments);
+        this.get('player');
+    },
+
     didInsertElement: function() {
         var _this = this;