I have code like this:
<audio id="player" autoplay controls>
<source src="http://docs.google.com/uc?export=open&id=107VpNA7BU4AIxVsK2sRg69-rOigdU57n" type="audio/mp3">
</audio>
Originally, the code above was supposed to play a song from a file on the drive. However, for some reason, it’s not working anymore. Has anyone experienced a similar issue?
It sounds like you’re facing a limitation with HTML not allowing streaming of music directly from a file on Google Drive. One workaround could be to host the music file on a server that allows direct streaming, or you could consider using a different platform or technology that supports this feature. Do you need help finding an alternative solution or platform?
3
Answers
It's a shame, because I needed Google Drive to create a web music player. In the end, I used a GitHub repository to store the music file and used the link from the file in the repository, and it worked. This is one alternative for streaming music without going through local storage.
Google Drive doesn’t support direct streaming.
You can try use Dropbox
The OP’s method actually did work for streaming audio from google drive, using;
src="http://docs.google.com/uc?export=open&id=file-id",
until around 1/10/2024.
I had several html/javascript web players streaming my music directly from drive until the date above.
Google has started to roll out changes that affect how drive files can be accessed from third parties; meaning outside of drive.google.com
Request for the file from outisde google drive servers is no longer treated the same.
The answer in the link below partly explains the problem:
https://stackoverflow.com/a/77805668/23238731
Although that answer is in reference to images from google drive, the same applies to audio files linked like the OP’s code.
Google suggest users now utilize iframes to display google drive content in html, including audio.
I have tested this and the iframe option does work for audio, although it is not useful for streaming.
google support