To disable preloading for an individual player I select it and enter the custom attribute: preload = “none” and it seems to work, judging by the grayed-out state of those audio players.
But is there a way to disable preloading for ALL the audio players on my site? I have hundreds of them.
Thanks for your reply. I tried to do what you described, but what I tried didn’t work. I accessed a code editor using Page–> Settings and my input looked like this:
I suspect this is just for a page rather than the whole project, but I don’t see a way to bring up a code window for the whole project (I looked under File–>Project Settings…, did a search for “Code Editor” in the documentation and in this forum and came up with nothing in each case)
Also, I’m confused: will this change my Blocs project the way I requested? Or is this a “fix” that will only apply at the time pages are viewed in a browser? While programming tricks are very cool, I’m interested in simplicity. I’m just asking how to make mass changes in my Blocs project.
This does exactly what you want. A mass change across and entire project provided you add the code in the right place.
I can tell from screenshot that you’re using a version before me. I’m using Beta and I’ve lost track of which version has what at this point… but no worries.
Upload that file via Project Settings → Project Attachments (this is in docs)
Note: It’s similar to using the page settings except it’s for the entire project.
Explanation
This is exactly what you are doing when you add these attributes in blocs. Javascript is used to apply that attribute to the element, no different. Everything happens in the browser, that’s the nature of Javascript… it needs the browser to run. This is how everything you’re doing in blocs is achieved. Javascript is used to place the classes, attributes, HTML. You preview or export and the browser either standalone or inside of Blocs app does it’s thing.
@Whittfield I appreciate the efforts you’ve made to help. Thank you. However, I have to report that nothing I’ve tried based on your suggestions has helped. I thought for the sake of others I’d complete this thread with my results.
First, I decided to download the latest beta (build 5) and enter the code you provided using Window–>Code Editor:
Second, I tested and found that it did not work; judging by my observation (in different browsers) that all audio players were still pre-loading (except the ones I manually changed attributes for).
Third, I checked to see if your approach makes changes to my Blocs project. It doesn’t (just as you said), confirming my notion that your approach is a “programming trick” which (while perhaps very cool) does not address my simpler question “how can I make this mass change in my Blocs project”
Therefore, I conclude that there is no way to change the attributes of multiple blocs (e.g., audio players) in a Blocs Project.
I’m not sure how posts get marked “SOLVED” but someone marked this that way despite my clear statement otherwise. Although I appreciate Whittfield’s help very much and have learned from him, his posts do not address whether one can make mass changes in a bloc project. The blocs project is unchanged by his approach, as clever as it may be.
Here’s a screenshot of the script doing it’s thing. I’m inspecting the page with multiple audio players and they all have preload attribute added to them. Any audio player on any page get’s the same attribute added.
If you’re interested in doing that in bulk as well. The code below shows how.
But don’t forget that you’ve set the attribute for these elements in the Blocs UI, however you can simply remove this code and all of your original autoplay settings will still be there.