<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Audio Player with Upload</title>
<style>
body {
font-family: Arial, sans-serif;
}
#audioPlayer {
width: 300px;
margin: 20px;
}
</style>
</head>
<body>
<input type="file" id="audioFile" accept="audio/*" />
<audio controls id="audioPlayer">
Your browser does not support the audio element.
</audio>
<script>
document.getElementById('audioFile').addEventListener('change', function(event) {
const audioPlayer = document.getElementById('audioPlayer');
const file = event.target.files[0];
if (file) {
const objectURL = URL.createObjectURL(file);
audioPlayer.src = objectURL;
}
});
</script>
</body>
</html>
Pages
▼
Html
▼
Pages
▼
▼
Audio player upload
Audio Player with Upload
📚📖📖
No comments:
Post a Comment