Skip to content

Commit

Permalink
check for user.profile.playing
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayman committed Jun 16, 2014
1 parent 760b133 commit 1652bf1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client/views/common/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ function onPlayerStateChange(event) {
// observe changes in the user.playing object
var lastPlaylistIndex, lastPlaylistId;
Deps.autorun(function () {
var userId = Meteor.userId(); // 28
if (!userId) // 29
return;

var user = Meteor.users.findOne(userId);
var user = Meteor.user();
if (!user || !user.profile)
return;

var playing = user.profile.playing;
if (!playing)
return;

// start the youtube video on pause,
// on page load, both are undefined
var startPaused = (!lastPlaylistIndex && !lastPlaylistId);

var playing = user.profile.playing;
if (playing.playlist == lastPlaylistId &&
playing.playlistIndex == lastPlaylistIndex) {
console.log('not playing: same song');
Expand Down

0 comments on commit 1652bf1

Please sign in to comment.