Embed MP3 Hosted on Google Drive

Music embed everywhere around the websites, portfolio, blog and etc.. But to securely playing or looping a music from a official publisher, it had to through embed which makes you share and play the media legally under a public site or private site.

Step 1 - Upload MP3 files to a folder in Google Drive

Create a folder in your Google Drive and upload mp3 file.

Step 2 - Share the MP3 and get the direct URL

Make sure that it is open to public so that everyone can open and view it.

Step 3 - Modify the direct URL

The Direct URL will look something like this https://drive.google.com/file/d/XXXXXXXXXX/view?usp=sharing XXXXXXXXXX is the ID of your MP3 file. Then you can obtain a direct link to this audio by changing it to http://docs.google.com/uc?export=open&id=XXXXXXXXX

<audio> <source src="http://docs.google.com/uc?export=open&id=XXXXXXXXXXXX> </source> </audio>

Step 5 - Finalize

There are attributes that can make your life easier.
1. autoplay

<audio autoplay>... </audio>
2. controls
<audio controls>... </audio>
3. loop
<audio loop> ... </audio>
You can combine it to make it like this
<audio autoplay controls loop>... </audio>
Alternative using YouTube.

p/s It is not suitable for large amount of viewer.

google drive will give notice like below

Please stay with us, the alternative method with youtube will be publish in the coming post. Feel free to share this article around and do like & follow at our Facebook page.  NIT Looking for Contributors
keyword, keywords, google, nit, contributor, contribute, ideas, blog, blogger, blogging, science, hacks, computer, computing, sharing, engineering, knowledge, caring, guide, post, posting, news, technology, information
links, url, link, http, https, nit.blogspot.com, fb.com/nitforall, nitforall@gmail.com, contact nit, contact us, email nit, website nit, facebook nit, web nit, fb nit


Post a Comment