Activity › Forums › Salesforce® Discussions › How to add music to a Salesforce Visualforce Page?
Tagged: Apex Page, CDN, External URL, HTML5 Media Tag, iFrame, Inline Visualforce Page, Salesforce Visualforce Page
-
How to add music to a Salesforce Visualforce Page?
Posted by Tanu on July 26, 2016 at 2:42 PMHow to add music to a vf page?
As visualforce page opens music starts automatically and provide an icon on title or on vf page to stop/play that music.
Lianas replied 2 years, 2 months ago 4 Members · 3 Replies -
3 Replies
-
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> - [adinserter block='9']
-
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.
-
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.