Skip to content

Commit

Permalink
soundcloud: fix volume preservation
Browse files Browse the repository at this point in the history
Soundcloud requires rebinding the READY event when a new track is loaded
in order to set the volume.
  • Loading branch information
calzoneman committed Mar 26, 2016
1 parent 319c529 commit efdab32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions player/soundcloud.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ window.SoundCloudPlayer = class SoundCloudPlayer extends Player
else
soundUrl = data.id
@soundcloud.load(soundUrl, auto_play: true)
@soundcloud.bind(SC.Widget.Events.READY, =>
@setVolume(VOLUME)
)
else
console.error('SoundCloudPlayer::load() called but soundcloud is not ready')

Expand Down
7 changes: 6 additions & 1 deletion www/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,9 +771,14 @@
} else {
soundUrl = data.id;
}
return this.soundcloud.load(soundUrl, {
this.soundcloud.load(soundUrl, {
auto_play: true
});
return this.soundcloud.bind(SC.Widget.Events.READY, (function(_this) {
return function() {
return _this.setVolume(VOLUME);
};
})(this));
} else {
return console.error('SoundCloudPlayer::load() called but soundcloud is not ready');
}
Expand Down

0 comments on commit efdab32

Please sign in to comment.