Skip to content

Commit

Permalink
display song in page title
Browse files Browse the repository at this point in the history
  • Loading branch information
edoparearyee committed Jul 22, 2015
1 parent f6b7473 commit 820ea06
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<script src="components/angular-resource/angular-resource.js"></script>
<script src="components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="components/angular-spotify/src/angular-spotify.js"></script>
<script src="components/angular-title/dist/angular-title.js"></script>
<script src="components/angular-socket-io/socket.js"></script>
<script src="components/satellizer/satellizer.js"></script>
<script src="components/angular-notification/angular-notification.js"></script>
Expand Down
24 changes: 22 additions & 2 deletions app/js/player/controllers/PlayerCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,18 @@ angular.module("FM.player.PlayerCtrl",[
"FM.player.TrackTimer",
"ui.bootstrap.popover",
"template/popover/popover-template.html",
"template/popover/popover.html"
"template/popover/popover.html",
"sn.title"
])
/**
* @constant
* @property {Object} UNICODE
*/
.constant("UNICODE", {
play: "&#x25B6;",
pause: "&#10074;&#10074;"

})
/**
* @class PlayerCtrl
* @param {Object} $scope
Expand All @@ -28,7 +38,9 @@ angular.module("FM.player.PlayerCtrl",[
"PlayerMuteResource",
"PlayerVolumeResource",
"TrackTimer",
function ($scope, $q, PlayerTransportResource, PlayerMuteResource, PlayerVolumeResource, TrackTimer) {
"snTitle",
"UNICODE",
function ($scope, $q, PlayerTransportResource, PlayerMuteResource, PlayerVolumeResource, TrackTimer, snTitle, UNICODE) {

/**
* The currently playing track
Expand Down Expand Up @@ -82,6 +94,8 @@ angular.module("FM.player.PlayerCtrl",[
var elapsed = parseInt(response[0].player.elapsed_time) || 0; // jshint ignore:line
$scope.trackPositionTimer.start($scope.track.track.duration, elapsed);

snTitle.setPageTitle(UNICODE.play + " " + $scope.track.track.name);

}
});
};
Expand Down Expand Up @@ -143,6 +157,8 @@ angular.module("FM.player.PlayerCtrl",[
$scope.trackPositionTimer.pause();
$scope.trackPositionTimer.reset();
$scope.track = null;

snTitle.setPageTitle(null);
};

/**
Expand All @@ -152,6 +168,8 @@ angular.module("FM.player.PlayerCtrl",[
$scope.onPause = function onPause() {
$scope.trackPositionTimer.pause();
$scope.paused = true;

snTitle.setPageTitle(UNICODE.pause + " " + $scope.track.track.name);
};

/**
Expand All @@ -161,6 +179,8 @@ angular.module("FM.player.PlayerCtrl",[
$scope.onResume = function onResume() {
$scope.trackPositionTimer.start($scope.track.track.duration);
$scope.paused = false;

snTitle.setPageTitle(UNICODE.play + " " + $scope.track.track.name);
};

/**
Expand Down
1 change: 1 addition & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"angular-bootstrap": "0.13.0",
"angular-socket-io": "0.7.0",
"angular-spotify": "0.11.0",
"angular-title": "0.0.2",
"bootstrap": "3.3.4",
"satellizer": "0.9.4",
"socket.io-client": "https://github.com/Automattic/socket.io-client.git#1.3.5",
Expand Down
1 change: 1 addition & 0 deletions scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"./app/components/angular-animate/angular-animate.js",
"./app/components/angular-resource/angular-resource.js",
"./app/components/angular-bootstrap/ui-bootstrap-tpls.js",
"./app/components/angular-title/dist/angular-title.js",
"./app/components/angular-spotify/src/angular-spotify.js",
"./app/components/angular-socket-io/socket.js",
"./app/components/satellizer/satellizer.js",
Expand Down

0 comments on commit 820ea06

Please sign in to comment.