function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MenteeMentee 

Play audio files in Visualforce page which are saved in Files Object

<apex:page docType="html-5.0" standardController="Task">
    <div>
        <audio controls="true" preload="auto">
            <source src="https://mydomain.salesforce.com/servlet/servlet.FileDownload?file=0698c00000Allk9AAB"/>
        </audio>
    </div>
  <!--  <apex:outputLink value="https://mydomain.salesforce.com/servlet/servlet.FileDownload?file=0698c00000Allk9AAB" id="theLink" type="audio/mp3" rendered="" >Play Recording (mp3)</apex:outputLink>-->
</apex:page>

Need inputs please?
SwethaSwetha (Salesforce Developers) 
HI Mentee,
Please elaborate on the challenge you are facing so we can suggest better?
MenteeMentee
i have a audio file(.mp3 extension) uploaded in ContentDocumentLink object(Files) I need to play that audio in task record page User-added image
code pasted in initial post, is not working
SwethaSwetha (Salesforce Developers) 
I see you also reached out on https://salesforce.stackexchange.com/questions/383003/play-audio-files-in-visualforce-page-which-are-saved-in-files-object/383014#383014. Does the solution provided help?

If the file is attached as type "File" then you need to give permission for playing the file in browser as below.
Go to Setup-> File Upload and Download Security->edit and update the mp3 setting as "execute in browser". Then only you will be able to play the file in browser.
Now go to file which you want to play and click on download mp3 button and you will see the url copy the url in the vf page. The Url looks like below.
<source src="https://domain-dev-ed.file.force.com/sfc/servlet.shepherd/version/download/0685j00000Bj2HF?asPdf=false&operationContext=CHATTER"/>

If the file is upload as type attachment then anyway the file url will play as it is as the id starts with "00P".
<source src="https://sampledomain123-dev-ed.file.force.com/servlet/servlet.FileDownload?file=00P5j00000BvwlN" />

If this information helps, please mark the answer as best. Thank you
​​​​