From 30a5657d62db3a1be0baf171120a3f72db5042b8 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Mon, 10 Jul 2017 21:38:27 -0700 Subject: [PATCH] soundcloud: fix volume issue It took them 4 years, but they finally did actually make the player accept volume in the range 0-100 like their documentation suggests. *slow clap* --- player/soundcloud.coffee | 7 +------ www/js/player.js | 6 +++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/player/soundcloud.coffee b/player/soundcloud.coffee index bb072d07..7be7be0f 100644 --- a/player/soundcloud.coffee +++ b/player/soundcloud.coffee @@ -91,13 +91,8 @@ window.SoundCloudPlayer = class SoundCloudPlayer extends Player @soundcloud.seekTo(time * 1000) setVolume: (volume) -> - # NOTE: SoundCloud's documentation claims that setVolume() accepts - # volumes in the range [0, 100], however it *actually* accepts volumes - # in the range [0, 1] (anything larger than 1 is treated as 1). I - # emailed them about this 2 years ago and they still haven't fixed - # their documentation. if @soundcloud and @soundcloud.ready - @soundcloud.setVolume(volume) + @soundcloud.setVolume(volume * 100) getTime: (cb) -> if @soundcloud and @soundcloud.ready diff --git a/www/js/player.js b/www/js/player.js index ce1933fc..18d17070 100644 --- a/www/js/player.js +++ b/www/js/player.js @@ -452,10 +452,10 @@ console.error('sortSources() called with null source list'); return []; } - qualities = ['1080', '720', '480', '360', '240']; + qualities = ['2160', '1440', '1080', '720', '540', '480', '360', '240']; pref = String(USEROPTS.default_quality); if (USEROPTS.default_quality === 'best') { - pref = '1080'; + pref = '2160'; } idx = qualities.indexOf(pref); if (idx < 0) { @@ -880,7 +880,7 @@ SoundCloudPlayer.prototype.setVolume = function(volume) { if (this.soundcloud && this.soundcloud.ready) { - return this.soundcloud.setVolume(volume); + return this.soundcloud.setVolume(volume * 100); } };