Skip to content

Commit

Permalink
last fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MorrisJobke committed Aug 27, 2014
1 parent 0aa6716 commit 6dc7126
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
22 changes: 8 additions & 14 deletions js/app/controllers/playercontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ angular.module('Music').controller('PlayerController',
$scope.repeat = false;
$scope.shuffle = false;

// TODO don't use jQuery
$scope.$playPosition = $('.play-position');
$scope.$loadPosition = $('.load-position');
$scope.$bufferBar = $('.buffer-bar');
$scope.$playBar = $('.play-bar');

Expand Down Expand Up @@ -93,13 +93,12 @@ angular.module('Music').controller('PlayerController',
$scope.player.play();

$scope.setPlay(true);
$scope.player.on("buffer", function (percent) {
$scope.setBufferPercent(parseInt(percent));
if (percent == 100) {
$scope.setBuffering(false);
}
$scope.setBuffering(false);

$scope.player.on('buffer', function (percent) {
$scope.setBufferPercentage(parseInt(percent));
});
$scope.player.on("progress", function (currentTime) {
$scope.player.on('progress', function (currentTime) {
$scope.setTime(currentTime/1000, $scope.player.duration/1000);
});
$scope.player.on('end', function() {
Expand Down Expand Up @@ -166,8 +165,7 @@ angular.module('Music').controller('PlayerController',
$scope.$playBar.css('width', (position / duration * 100) + '%');
};

$scope.setBufferPercent = function(percent) {
$scope.$loadPosition.text(gettext("Loading...") + percent + '%');
$scope.setBufferPercentage = function(percent) {
$scope.$bufferBar.css('width', percent + '%');
};

Expand All @@ -182,11 +180,7 @@ angular.module('Music').controller('PlayerController',
$scope.setPlay(true);
} else {
$scope.player.togglePlayback();
if($scope.playing) {
$scope.playing=false;
} else {
$scope.playing=true;
}
$scope.playing = !$scope.playing;
}
};

Expand Down
25 changes: 10 additions & 15 deletions js/public/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</div>
<div ng-show="currentTrack.title" class="progress-info">
<span ng-hide="buffering" class="play-position muted">&nbsp;</span>
<span ng-show="buffering" class="load-position muted">Loading...</span>
<span ng-show="buffering" class="muted">Loading...</span>
<div class="progress">
<div class="seek-bar" ng-click="seek($event)">
<div class="buffer-bar"></div>
Expand Down

0 comments on commit 6dc7126

Please sign in to comment.