Share mp3 files from google drive with javascript


#1

I have different mp3 files stored in Google Drive and with javascript I play them in my Axure prototype. First I used the following code:

var audio1 = new Audio("https://docs.google.com/uc?export=open&id='id'");

But then I suddenly got the warning message of cors policy no ‘access-control-allow-origin’ and suddenly the audio files did not work anymore with a get 403 error. Then I used Google API with the following code:

var audio1 = new Audio(“https://www.googleapis.com/drive/v3/files/‘id’?alt=media&key=‘key’&v=.mp3”);

Someone this does also not work. The audio stops playing suddenly. I receive a get 403 error about the files. Occasionally I even get the message of too many requests. I searched on internet and they recommended to change the credentials in the http header. However it is not possible to access this in Axure.

Does someone know how to play different mp3 files in repeat without facing any credentials problems?


#2

Google–and other large companies–are always changing things for security, walled garden, or whatever reasons. Someone posted about a year ago they had success (but maybe this doesn’t work anymore?)

I’ve found that https://archive.org/ is great for hosting audio and video for prototypes, as well as accessing tons of public domain content.


closed #3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.