locked
How to add sound RRS feed

  • Question

  • How do I add sound to a sharepoint page so that it plays in the background?
    Friday, September 26, 2008 7:31 PM

Answers

  • I have a theory on how you can do this. Unfortunately, I cannot test it because my virtual environment I do my developing and testing on doesn't plan sounds. So, I am sorry if this doesn't work but I based the ideas off two principals:
    1. How to incorporate images in at site (these are just a matter of setting the src correct)
    2. The bgsound tag which I have used in the past on regular websites to play sounds.

    So, tell me how the following works out:

     Use this tag in your master page.
    <bgsound src="mySound.wav"   />

    Adding it to the master page will add it to all pages that implement that master page. If you only want it on one specfic page then add a content editor webpart and switch to the html view of it and add it there. Then drop that webpart on your page an you will get it.

    Of course, you will have to put the sound file somewhere on your SharePoint box.
    You could put it in the 12 hive layouts folder located at Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS
    Then you can reference it like this <bgsound src="_layouts/mysound.wav" />

    Or, a better way is to put the file in a document library on your site collection root site. Then you can access it like this:
    <bgsound src="<% $SPUrl:~SiteCollection/Sounds/mysound.wav %>"  runat="server" />
    The above assumes you have a library called Sounds at your site collection root.
    The reason this is better is because you can switch out the sound file directly on your SharePoint site. Just make sure you set permissions appropriately on the file.

    Once again, I have to mention, I have never tried this before (i.e.: adding a sound file to a SharePoint site). But the theories I mentioned above are for how to add images to a site, so a sound should work the same way. And bgsound is how I have added sound to a website I built a long time ago. So, this theoretically should work.

    Tell me how it works out.

    • Edited by Greg Galipeau Friday, September 26, 2008 8:09 PM links got messed up when I copied the code in
    • Marked as answer by Lambert Qin [秦磊] Monday, September 29, 2008 8:33 AM
    Friday, September 26, 2008 8:07 PM

All replies

  • I have a theory on how you can do this. Unfortunately, I cannot test it because my virtual environment I do my developing and testing on doesn't plan sounds. So, I am sorry if this doesn't work but I based the ideas off two principals:
    1. How to incorporate images in at site (these are just a matter of setting the src correct)
    2. The bgsound tag which I have used in the past on regular websites to play sounds.

    So, tell me how the following works out:

     Use this tag in your master page.
    <bgsound src="mySound.wav"   />

    Adding it to the master page will add it to all pages that implement that master page. If you only want it on one specfic page then add a content editor webpart and switch to the html view of it and add it there. Then drop that webpart on your page an you will get it.

    Of course, you will have to put the sound file somewhere on your SharePoint box.
    You could put it in the 12 hive layouts folder located at Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS
    Then you can reference it like this <bgsound src="_layouts/mysound.wav" />

    Or, a better way is to put the file in a document library on your site collection root site. Then you can access it like this:
    <bgsound src="<% $SPUrl:~SiteCollection/Sounds/mysound.wav %>"  runat="server" />
    The above assumes you have a library called Sounds at your site collection root.
    The reason this is better is because you can switch out the sound file directly on your SharePoint site. Just make sure you set permissions appropriately on the file.

    Once again, I have to mention, I have never tried this before (i.e.: adding a sound file to a SharePoint site). But the theories I mentioned above are for how to add images to a site, so a sound should work the same way. And bgsound is how I have added sound to a website I built a long time ago. So, this theoretically should work.

    Tell me how it works out.

    • Edited by Greg Galipeau Friday, September 26, 2008 8:09 PM links got messed up when I copied the code in
    • Marked as answer by Lambert Qin [秦磊] Monday, September 29, 2008 8:33 AM
    Friday, September 26, 2008 8:07 PM
  • Thanks, it worked perfectly.
    Monday, September 29, 2008 7:21 PM
  • Not sure if you care, but this is probably IE specific. For a cross browser alternative, try Flash or try:

    <embed hidden=true loop=true src="<% $SPUrl:~SiteCollection/Sounds/mysound.wav %>"></embed>
    Randy Drisgill | The Mossman Blog | SharePoint Branding Services
    Monday, September 29, 2008 7:59 PM