-
Notifications
You must be signed in to change notification settings - Fork 748
Dj mixer app #1789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
biplobsarkar800b-dotcom
wants to merge
1
commit into
Acode-Foundation:main
from
biplobsarkar800b-dotcom:patch-1
Closed
Dj mixer app #1789
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>10 Track DJ Mixer</title> | ||
| <style> | ||
| body{ | ||
| background:#000; | ||
| color:#fff; | ||
| font-family:Arial; | ||
| text-align:center; | ||
| } | ||
| .track{ | ||
| border:1px solid #444; | ||
| margin:10px; | ||
| padding:10px; | ||
| } | ||
| button{ | ||
| padding:8px 15px; | ||
| margin:5px; | ||
| font-size:16px; | ||
| } | ||
| input[type=range]{ | ||
| width:80%; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
|
|
||
| <h2>🎧 Plug & Play DJ Mixer (10 Track)</h2> | ||
|
|
||
| <script> | ||
| let tracks = []; | ||
| for(let i=1;i<=10;i++){ | ||
| tracks[i] = new Audio("track"+i+".mp3"); | ||
| } | ||
| function play(i){ tracks[i].play(); } | ||
| function pause(i){ tracks[i].pause(); } | ||
| function volume(i,v){ tracks[i].volume=v; } | ||
| </script> | ||
|
|
||
| <!-- 10 Tracks --> | ||
| <div id="mixer"> | ||
| <script> | ||
| for(let i=1;i<=10;i++){ | ||
| document.write(` | ||
| <div class="track"> | ||
| <h3>Track ${i}</h3> | ||
| <button onclick="play(${i})">▶ Play</button> | ||
| <button onclick="pause(${i})">⏸ Pause</button><br> | ||
| Volume: | ||
| <input type="range" min="0" max="1" step="0.01" | ||
| value="1" oninput="volume(${i},this.value)"> | ||
| </div> | ||
| `); | ||
| } | ||
| </script> | ||
| </div> | ||
|
|
||
| </body> | ||
| </html>dj-app/ | ||
| │ | ||
| ├── index.html | ||
| ├── track1.mp3 | ||
| ├── track2.mp3 | ||
| ├── track3.mp3 | ||
| ├── track4.mp3 | ||
| ├── track5.mp3 | ||
| ├── track6.mp3 | ||
| ├── track7.mp3 | ||
| ├── track8.mp3 | ||
| ├── track9.mp3 | ||
| └── track10.mp3 | ||
|
Comment on lines
+61
to
+73
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
আপনার বর্তমান জাভাস্ক্রিপ্ট কোডটি কিছু পুরোনো কৌশল ব্যবহার করে যা আধুনিক ওয়েব ডেভেলপমেন্টে নিরুৎসাহিত করা হয়।
document.write()-এর ব্যবহার:document.write()পেজের পারফরম্যান্সের জন্য ক্ষতিকর এবং এটি ব্যবহার করা উচিত নয়।tracks,play,pause,volumeসবকিছু গ্লোবাল স্কোপে আছে, যা অন্য স্ক্রিপ্টের সাথে conflict করতে পারে।onclickব্যবহার করলে কোড পরিচালনা করা কঠিন হয়ে যায়।এই সমস্ত समस्या সমাধানের জন্য, কোডটিকে রিഫ্যাক্টর করার পরামর্শ দেওয়া হচ্ছে। নিচের কোഡ്টি
DOMContentLoadedইভেন্ট ব্যবহার করে DOM প্রস্তুত হওয়ার পর রান হবে, ডাইনামিকভাবে ट्रैक তৈরি করবে এবং কোনো গ্লোবাল ভেরিয়েबल তৈরি করবে না। এটিaddEventListenerব্যবহার করে ইভেন্ট পরিচালনা করে, যা কোডকে আরও পরিষ্কার ও মডিউলার করে তোলে।