Skip to content

Commit

Permalink
Merge pull request #418 from Asymtode712/AudioPlayerExt
Browse files Browse the repository at this point in the history
added audio player extension
  • Loading branch information
Sulagna-Dutta-Roy authored May 23, 2024
2 parents d0d5e8d + 5a57b6e commit 8ce834f
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
Binary file added Audio Player/images.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions Audio Player/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Music Player</title>
<link rel="stylesheet" href="src/style.css">
</head>
<body>
<h1>Audio Player</h1>
<input type="file" id="fileInput" accept="audio/*">
<audio id="audioPlayer" controls></audio>

<script src="scripts/script.js"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions Audio Player/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"manifest_version": 3,
"name": "Audio Player",
"version": "1.0",
"description": "A simple music player for playing uploaded audio files.",
"action": {
"default_popup": "index.html"
},
"icons": {
"48": "images.jpg",
"128": "images.jpg"
},
"permissions": [
"storage"
],
"web_accessible_resources": [
{
"resources": [
"index.html"
],
"matches": [
"<all_urls>"
]
}
]
}
9 changes: 9 additions & 0 deletions Audio Player/scripts/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
document.getElementById('fileInput').addEventListener('change', function(event) {
const file = event.target.files[0];
if (file) {
const audioPlayer = document.getElementById('audioPlayer');
const objectUrl = URL.createObjectURL(file);
audioPlayer.src = objectUrl;
audioPlayer.play();
}
});
12 changes: 12 additions & 0 deletions Audio Player/src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
body {
font-family: Arial, sans-serif;
padding: 20px;
text-align: center;
}
input[type="file"] {
margin: 10px 0;
}
audio {
margin-top: 20px;
width: 100%;
}

0 comments on commit 8ce834f

Please sign in to comment.