Embed audio on a public website page

If you want a song or other MP3 file to be available on your website, you can add a link to the file, or display an audio control so that the person viewing the page can start and stop the playback and adjust the volume. If you want a song to play automatically when anyone views the page, that’s possible too.

Add a song or other MP3 file to a web page

You can display an audio control so that the user controls the playback. The control looks a little different in each browser. Here’s what it looks like in Internet Explorer:
The audio player control is displayed on the web page

  1. Sign in to your public website.
  2. Upload your audio file to your public website Site Assets library:
  1. In the upper right-hand corner, click Settings Settings button, and then click Site contents.
  2. Select Site Assets.
  3. Drag the audio file in.
  1. Right-click the audio file and choose Copy shortcut.
  2. On your public website, browse to the page where you want to add the audio.
  3. On the Page tab, choose Edit.
  4. Place your cursor where you want the audio control to show.
  5. From the Insert tab, click Video and Audio and choose Embed.
    Insert video on public website
  6. In the Embed window, copy the following HTML code and replace the path in quotes after src with the path to the audio file that you copied in step 3.

<audio src="https://contoso-public.sharepoint.com/SiteAssets/MyMusic.mp3" controls="controls"></audio>

  1. Click Insert to add the audio to your page.
  2. When you’re done customizing the page, click Save or Save and Publish.

 Tip    If you need to change the embedded code for the audio, click Edit Snippet at the bottom of the Snippet. Change the HTML and click Insert.

Top of Page Top of Page

Automatically play an MP3 file

Although it is possible to autoplay a file when a web page loads, think about whether it makes sense for your page. It can be annoying to people who are in a shared space or have their own music playing. It might make sense if you’re advertising a band or setting a mood.

  1. Sign in to your public website.
  2. Upload your audio file to your public website Site Assets library:
  1. In the upper right-hand corner, click Settings Settings button, and then click Site contents.
  2. Select Site Assets.
  3. Drag the audio file in.
  1. Right-click the audio file and choose Copy shortcut.
  2. Go to the public website page where you want to add the audio.
  3. On the Page tab, choose Edit.
  4. Put your cursor at the end of the page.

 Note    If you put an autoplay audio at the top of the page or in the middle of text, an empty line will appear on your published page. To avoid this, put the audio at the bottom.

  1. From the Insert tab, click Video and Audio and choose Embed.
    Insert video on public website
  2. In the Embed window, copy the following HTML code and replace the path in quotes after src with the path to the audio file that you copied in step 3.

<audio src="https://contoso-public.sharepoint.com/SiteAssets/MyMusic.mp3" loop="loop" autoplay="autoplay"></audio>

  1. Click Insert to add the audio to your page.
  2. When you’re done customizing the page, click Save or Save and Publish.

 Tip    If you need to change the embedded code for the audio, click Edit Snippet at the bottom of the Snippet. Change the HTML and click Insert.

Top of Page Top of Page

Learn more

In addition to adding audio to your website, you can add other content from your site and third-party sites, including video, App Parts, maps, and other web objects. Learn more in Public Website help for Office 365.

Top of Page Top of Page

 
 
Applies to:
Office 365 Enterprise admin, Office 365 Midsize Business admin, Office 365 Small Business admin, SharePoint admin center, SharePoint Online Enterprise (E1), SharePoint Online Enterprise (E3 & E4), SharePoint Online Midsized Business, SharePoint Online Small Business, SharePoint Online Website