HTML Audio and Video APIs
HTML provides JavaScript APIs to control and manipulate audio and video elements. You can use these APIs to dynamically control playback, adjust volume, and respond to various events. Here's an example:
<audio id="myAudio" src="audio.mp3"></audio>
<button onclick="playAudio()">Play</button>
<button onclick="pauseAudio()">Pause</button>
<button onclick="stopAudio()">Stop</button>
<script>
const audio = document.getElementById("myAudio");
function playAudio() {
audio.play();
}
No comments:
Post a Comment