-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Waveforms can be Pre-Loaded #72
Comments
It's possible for there to be more than one linked data script on a page - if you're going to use the script/type element selector like that, it may be wise to perform some additional checks to confirm that the resulting parsed object is what you expect it to be. I'm not sure how many audio elements are present on the target pages, but it might be a bit easier to scope a selector knowing the DOM as well as you do. |
fair point. on the page I've been looking at, it's the only one. However, there are some reasonable checks that could be done. Additionally, if I eventually build out a cache for these waveforms, there is a |
track links are actually available with this:
there is probably a better way to parse this (since relying on the index order of some arrays is not likely too smart). With this info several things are possible:
|
additionally, preloading the waveform could also allow for storing the downloaded audio and caching that. This would be a respectful thing to do since then multiple downloads of the file do not happen (and so Bandcamp will be happier). Example: |
the page can be fetched from another page like this: https://gomakethings.com/getting-html-with-fetch-in-vanilla-js/ |
|
frig. it looks like BC might have removed the mp3 src from this data!
|
might re-visit in the future as part of playlists but caching locally makes more sense in the short term (as will be done in the playlists feature). I also can't really think of a good way to manage pre-load -- as in, how do you do it without wasting peoples' bandwidth. ideally, in the future, we can have a distributed DB that allows users to just get this data without pulling the whole audio file. |
re-opening because it looks like we can just provide the audio to i.e.:
|
It turns out that the Ids for tracks are available on the player page in a
application/ld+json
as show here this can be accessed with:
which results in this:
using this, the waveform could be generated on page load for all tracks (or, possible some subset) and then the waveform loaded on track play.
additionally, there is a different location where the audio stream can be accessed that uses the Bandcamp domain (this would remove the need for the extra domain privilege in the manifest). This url can be found by inspecting the
audio
element on a user's page when listening to a track.The text was updated successfully, but these errors were encountered: