Monday, March 12, 2018

Embedding audio from Google Drive

How can you play an audio file on Moodle, on a blog (such as Blogger) or on a web site (such as Google Sites)?  Sites like SoundCloud will give you embed code (meaning code that you can paste into your web site to play media from an external source), but wouldn't it be nice to be able to play a sound file from Google Drive?  Turns out you can. Here's a trick I found that does it nicely (tip of the hat to blogger Amit Agarwal).


In Drive, find the file and click on Share to get a shareable link.  You should get a link that looks something like: https://drive.google.com/file/d/1234xyz/view?usp=sharing.  The part in red is the id of your file.

In Google Sites, insert an Embed object. Or in Blogger or Moodle, switch to HTML mode.

Paste in this code:
<iframe frameborder="0" width="400" height="200" src="https://drive.google.com/file/d/1234xyz/preview"> </iframe>

Replace the id in red with the id of your file (yours won't be 1234xyz).

Save.


To see how it works, you should be able to play the audio below.  The file you're hearing is saved in my Drive.


No comments:

Post a Comment