diff --git a/spa/models/mix.py b/spa/models/mix.py index 1918d35..587a2f9 100644 --- a/spa/models/mix.py +++ b/spa/models/mix.py @@ -113,8 +113,7 @@ class Mix(_BaseModel): return super(Mix, self).get_image_url(self.mix_image, settings.STATIC_URL + 'img/default-track.png') def get_stream_path(self): - #return 'media/%s/' % self.local_file.name - return '/audio/stream/%d' % self.id + return '%s/mixes/%s.mp3' % (localsettings.STREAM_URL, self.uid) def get_date_as_rfc822(self): return rfc822.formatdate( diff --git a/static/js/app/views/mix/mixItemView.coffee b/static/js/app/views/mix/mixItemView.coffee index 54bf4d8..1a674f4 100644 --- a/static/js/app/views/mix/mixItemView.coffee +++ b/static/js/app/views/mix/mixItemView.coffee @@ -38,10 +38,11 @@ define ['moment', 'app', 'vent', 'marionette', 'models/comment/commentCollection @renderGenres() return - onDomRefresh: -> + onShow: -> #check if we're currently playing if com.podnoms.player.isPlayingId @model.id com.podnoms.settings.setupPlayerWrapper @model.get('id'), com.podnoms.player.getStreamUrl(), @el + @mixPlay(@model) true renderGenres: => diff --git a/static/js/app/views/mix/mixItemView.js b/static/js/app/views/mix/mixItemView.js index d620f99..31a85a1 100644 --- a/static/js/app/views/mix/mixItemView.js +++ b/static/js/app/views/mix/mixItemView.js @@ -60,9 +60,10 @@ this.renderGenres(); }; - MixItemView.prototype.onDomRefresh = function() { + MixItemView.prototype.onShow = function() { if (com.podnoms.player.isPlayingId(this.model.id)) { com.podnoms.settings.setupPlayerWrapper(this.model.get('id'), com.podnoms.player.getStreamUrl(), this.el); + this.mixPlay(this.model); } return true; }; diff --git a/static/js/app/views/user/userListView.coffee b/static/js/app/views/user/userListView.coffee index 55ffab8..19c7560 100644 --- a/static/js/app/views/user/userListView.coffee +++ b/static/js/app/views/user/userListView.coffee @@ -1,5 +1,5 @@ -define ['marionette', 'models/user/userCollection', 'views/user/userItemView', 'text!/tpl/UserListView', 'libs/bootstrap/bootpag'], -(Marionette, UserCollection, UserItemView, Template) -> +define ['jquery', 'marionette', 'models/user/userCollection', 'views/user/userItemView', 'text!/tpl/UserListView', 'libs/bootstrap/bootpag'], +($, Marionette, UserCollection, UserItemView, Template) -> class UserListView extends Marionette.CompositeView template: _.template(Template) diff --git a/static/js/app/views/user/userListView.js b/static/js/app/views/user/userListView.js index 6a098c2..db84b7f 100644 --- a/static/js/app/views/user/userListView.js +++ b/static/js/app/views/user/userListView.js @@ -4,7 +4,7 @@ __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - define(['marionette', 'models/user/userCollection', 'views/user/userItemView', 'text!/tpl/UserListView', 'libs/bootstrap/bootpag'], function(Marionette, UserCollection, UserItemView, Template) { + define(['jquery', 'marionette', 'models/user/userCollection', 'views/user/userItemView', 'text!/tpl/UserListView', 'libs/bootstrap/bootpag'], function($, Marionette, UserCollection, UserItemView, Template) { var UserListView, _ref; UserListView = (function(_super) { diff --git a/static/js/com.podnoms.player.js b/static/js/com.podnoms.player.js index db92189..74b9042 100644 --- a/static/js/com.podnoms.player.js +++ b/static/js/com.podnoms.player.js @@ -59,7 +59,11 @@ com.podnoms.player = { _whilePlaying: function () { if (!this.trackLoaded) { this.trackLoaded = true; + this.loadingEl.css('width', 100); } + + //need to call this every time as the boundaries may have changed. + this._calculateBounds(); this.currentPosition = this.currentSound.position; var duration = this._getDurationEstimate(this.currentSound); var percentageFinished = (this.currentSound.position / duration) * 100; @@ -103,7 +107,7 @@ com.podnoms.player = { this.loadingEl = options.loadingEl; this.currentPath = options.url; }, - _setupParams: function () { + _calculateBounds: function () { if (this.waveFormEl.position()) { this.waveFormTop = this.waveFormEl.position().top; this.waveFormLeft = this.waveFormEl.offset().left; @@ -147,7 +151,15 @@ com.podnoms.player = { }, setupPlayer: function (options) { this._parseOptions(options); - this._setupParams(); + this._calculateBounds(); + this._createTimeDisplayLabel(); + }, + _createTimeDisplayLabel: function () { + this.timeDisplayLabel = $('