Hello! I had a use case for working with "secret" Soundcloud tracks. In the case of "secret" Soundcloud tracks, the stream urls are given with a secret_token query param, e.g.:
I defined a simple helper function for appending query params to a url that
checks to see if there is already any params defined. This is currenly only in
use on the play function because that was my specific use case, but there
look to be some other parts of the code that could use it.
It was a little tricky to test because this would only throw an error when the audio element attempted to play the src with the incorrect URL, but let me know if you have any suggestions.
Hello! I had a use case for working with "secret" Soundcloud tracks. In the case of "secret" Soundcloud tracks, the stream urls are given with a
secret_token
query param, e.g.:https://api.soundcloud.com/tracks/xxxxx/stream?secret_token=xxxx
The
play
function previously just appended `?client_id=...' to the end of the stream URL for the track, so the resulting URL was incorrect:https://api.soundcloud.com/tracks/xxxxx/stream?secret_token=xxxx?client_id=...
I defined a simple helper function for appending query params to a url that checks to see if there is already any params defined. This is currenly only in use on the
play
function because that was my specific use case, but there look to be some other parts of the code that could use it.It was a little tricky to test because this would only throw an error when the
audio
element attempted to play thesrc
with the incorrect URL, but let me know if you have any suggestions.Thanks!