The HTML Audio element is used to play an audio file on a web page. There are three supported audio formats: MP3, WAV and OGG. All of the attributes and events for HTML5 Audio are available to use. The demo embeds an MP3 and an OGG file with controls and logs the onplay and onpause events to the browser console.
<div class="card">
<h5>MP3</h5>
<p:audio value="http://download.lisztonian.com/music/download/Larghetto+in+F-62.mp3"
player="mp3"
controls="true"
onplay="console.log('MP3 Started Playing')"
onpause="console.log('MP3 Stopped Playing')">
Your browser does not support the audio element.
See: <h:outputLink value="https://www.w3schools.com/html/html5_audio.asp">HTML5 Audio</h:outputLink>
</p:audio>
</div>
<div class="card">
<h5>OGG</h5>
<p:audio value="/resources/demo/media/sample-ogg.ogg"
controls="true"
onplay="console.log('OGG Started Playing')"
onpause="console.log('OGG Stopped Playing')">
Your browser does not support the audio element.
See: <h:outputLink value="https://www.w3schools.com/html/html5_audio.asp">HTML5 Audio</h:outputLink>
</p:audio>
</div>