That won't change anything, because I've already shown it by using different file names in each case.
I was able to reproduce the problem even with just one or two GD download links. In addition, after the problem appeared with Number ~40, I tried another GD link of my own. The same problem arose with this too. Only when I used a non-GD link did it work again. So there seems to be a limit to how often you can access GD (media file) links within a short period of time. The problem also occurs with Niotron; so it is not limited to AI2. It also has nothing to do with the Web
component. The same thing happens with my DownloadToASD
extension.
That link is for the Google Drive API, a different beast to simple "anyone with the link" sharing.
I do not believe this is the issue, but it does seem to be a google drive issue.
It might be overcome by using a google apps script, or service account (the above API, although this is tricky to setup), which then ensures the download action is generated by the file owner, which may overcome any restrictions.....
I do, however like the idea of downloading the whole lot on initialise (zipped or not), then playing back locally. The OP seems averse to this idea though....
will they be providing their own audio files on a google drive as well, or using the same ones you are testing with ?
> I was able to reproduce the problem even with just one or two GD download links.
Is this fact really compatible with a restriction on the part of Google to limit the large number of downloads?
> In addition, after the problem appeared with Number ~40, I tried another GD link of my own. The same problem arose with this too.
For my part, I observe the opposite (see the video): my test application is blocked, but WhatsApp manages to download the same links without problem... If I come back to my app right after, it is still blocked ...
> The problem also occurs with Niotron; so it is not limited to AI2.
This can help, provided that Niotron has not taken the code from "App Inventor" to do the same thing... they look very similar...
> The same thing happens with my DownloadToASD extension.
Also interesting, if the Java code generated by "DownloadToASD" is different from that generated by "Web".
> will they be providing their own audio files on a google drive as well, or using the same ones you are testing with ?
Each teacher would use their own Google account as they wish. However, I am trying to see if it would be possible to find other accommodation options later...
> ...which then ensures the download action is generated by the file owner, which may overcome any restrictions...
I just did the test: I read a file several times on the GD of the same Google account as my phone this time. And the blockage happened around 50 downloads.
> I do, however like the idea of downloading the whole lot on initialise (zipped or not), then playing back locally. The OP seems averse to this idea though...
Anything that adds manipulation will result in teachers not wanting to use the application... The simple use of a link to share a file on a shared folder of a GD is already a lot for some...
That is not the same thing as I suggested....
You only need to change the blocks a bit to handle this, the files are already being downloaded, just only download them once, if they already exist on the device, then just call the local filename. I will do some blocks for this if I get time....bear in mind that most mobile phones these days have plenty of storage space.
I believe this will do it (not tested)
You will end up with all the files eventually downloaded, named nMAELtemp.mp3
, where n is the URLIndex of the file in the list of urls.
Yes of course, I could still access the GD links via my PC or another external application.
But that's not the question, but whether it depends on the DG source. And that doesn't seem to be the case. Whether I retrieve the files from an external GD account or my own doesn't matter.
This system could at least limit the number of downloads, that's still it... Is there a way to make App Inventor just keep the name of the original files like "GI.mp3" or "GUE.mp3 “?
I did some more tests:
I managed to use a source other than GD to provide an .mp3 file online. I used DropBox. It is also possible to share a file with anyone who has the link. You only need to change "&dl=0" to "&dl=1" at the end of the address for the file to be downloadable...
So it works, I can listen to an .mp3 file downloaded from my DropBox.
And I managed to download and then listen to the same file more than 120 times without the bug occurring...
So it seems that this is a limitation of GD...
If this is really the case... Does this mean that my application which was easy to use, in reality, is not functional and I can't do anything?
Yes, as I said before, download the 14 files only once, play the one you need and delete these 14 files if desired at the end of using the app (e.g. when the app is closed).
Yes, when you get the url, also get the filename, and add this to a separate list that corresponds to the url list, e.g.
Then set the responsefilename to the actual filename in the filenames list using the url index:
I looked to see if there was a default limit on the number of downloads over a given time set up on Google Drive, but I couldn't find anything convincing...
And if I find a way to download an entire file at once, won't Google count the 14 downloads anyway?
Users discovered, at the beginning of 2023, that Google had introduced a limit of 5,000,000 files created per user without warning anyone, which was a scandal. But that doesn't concern me in my situation, it just shows that Google is capable of introducing hidden limitations without warning anyone...
I will write to them. But without much hope...
Yes, but you only do it once, after you have the 14 files, everything will happen on your phone/device, no more downloading....
Yes, you're right. However, when you manually download a folder from a computer, Google Drive offers a .Zip file. If it were possible to reproduce this from App Inventor: this one, by downloading a folder which is automatically unzipped on the phone, it would already be not bad and transparent for teachers. It would be enough to tell them that they put all the sound files for a given activity in a single folder (likely to be downloaded at the same time by all the students in a class). If only one class uses the activity, that's less than 30 downloads, it shouldn't bug. If 2 or more classes are involved in the activities, there could be problems again... But it is already the beginning of a solution...
Try this one:
Or try this
intDownload.aia (4.9 KB)
I have used images instead of mp3s, but the premise is the same.
View the first few images, then refresh the companion, you should not see the progress dialog until you reach a new file when you start viewing again. Once you have all the files then they view more or less immediately.
Here also is a short google apps script, bound to a google sheet, that writes file details to a google sheet:
function getFileIdAndNames() {
var FileFolderID = 'YOUR FOLDER ID HERE'; // the ID of the folder with files
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var urlCol = 1;
var urlRow = 1;
var folder = DriveApp.getFolderById(FileFolderID);
var files = folder.getFiles();
sheet.clear();
while (files.hasNext()) {
var file = files.next();
if (file.getName().indexOf(".png") != -1) {
sheet.getRange(urlRow, urlCol).setValue(file.getName());
sheet.getRange(urlRow, urlCol+1).setValue(file.getId());
sheet.getRange(urlRow, urlCol+2).setValue('https://drive.google.com/uc?export=download&id='+ file.getId());
sheet.getRange(urlRow, urlCol+3).setValue('PNG');
sheet.getRange(urlRow, urlCol+4).setValue(Math.round(file.getSize()/1000) + " KB");
sheet.getRange(urlRow, urlCol+5).setValue(file.getName().substr(7).slice(0, -4));
}
urlRow = urlRow+1;
}
sheet.sort(1, true);
sheet.sort(4, true);
sheet.insertRows(1);
var title = [["Filename","File ID","Direct Link to Download","File Type","File Size (KB)","Description"]];
var fontStyles = [ [ "bold", "bold", "bold", "bold", "bold","bold" ]];
var titleRange = sheet.getRange("A1:F1");
titleRange.setValues(title);
titleRange.setFontWeights(fontStyles);
}
Output: