Activity Forums Salesforce® Discussions How to add music to a Salesforce Visualforce Page?

  • Abhinav

    Member
    July 29, 2016 at 1:22 pm

    Hi Tanu,

    To add video or music you can use the below sample :

    <apex:page showHeader="false" showChat="false" sidebar="false">
    <iframe width="560" height="315"
    src="http//myvideo.provider.com/embed/{!$CurrentPage.parameters.VideoID}"
    frameborder="0" allowfullscreen="true">
    </iframe>
    </apex:page>

  • Avnish Yadav

    Member
    September 30, 2018 at 1:26 am

    Hello,

    There is no visualforce custom tag that wraps playing media, or the HTML5 media tag types.

    I would suggest vanilla HTML for doing this as per the documentation here:

    http://www.w3schools.com/html/html5_audio.asp

    In your case, you'd just want the URL to point to a resolveable URL, whether hosted in: A static resource
    Some kind of content in Salesforce (attachment, chatter feed, etc.)
    An external URL from a CMS, CDN, or whatever
    Given your requirement of playing a single audio file I would use a zip static resource with several different files in it, so you can support as many browsers as possible. You'd then end up with something like this:
    <audio controls>
      <source src="{!URLFOR($Resource.AudioFiles, 'NewPage.ogg'}" type="audio/ogg">
      <source src="{!URLFOR($Resource.AudioFiles, 'NewPage.mp3'}" type="audio/mpeg">
    Your browser does not support the audio element.
    </audio>
    If it were dynamic, I'd probably bind the src to a field that output some kind URL pointing to the file. My first choice would then use a formula field or some Apex to populate the value. If the dynamic value was not dependent on data in Salesforce, then I'd fall back to Javascript, most likely.

    Thanks.

  • Lianas

    Member
    February 29, 2024 at 1:45 pm

    I would advise you to add music to the SoundCloud Promotion platform. An interesting platform where you can gather many listeners. Now there is even an opportunity to promote an account. Which will bring even more popularity.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos