• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

Download Code Listen to music online using HTML, CSS, JS

AnonyViet by AnonyViet
June 14, 2024
in Tips
0

Online music listening code written in HTML, CSS, JS is shared by author Nguyen Anh Nhan on Github. You can download and edit the interface and song list to your liking. The author also includes detailed instructions for you to customize to your liking.

Join the channel Telegram belong to AnonyViet 👉 Link 👈

Download Code Listen to music online

According to the author, the Online Music Listening Code using HTML and CSS is quite simple so it doesn't need much explanation. One thing you need to pay attention to on the HTML page is the Meta Tag: viewport. Why? Because without this Meta tag, display on mobile devices will have problems.

If you don't know HTML and CSS, you can Download the course for free shared by AnonyViet.

Download Code Listen to music online using HTML, CSS, JS

Link Source: MusicPlayer Repository (Github)

Demo: Demo Player

CODE EXPLANATION

To edit the playlist of Online Music Listening Code, just edit variable songs. songs(Array) in the following form:

Download Code Listen to music online using HTML, CSS, JS

Regarding Javascript, there are the following Functions:

  • shuffle.shuffle
  • playPause
  • showHover
  • playFromClickedPos
  • checkBuffering
  • selectTrack
  • initPlayer

Shuffle function:

This function will mix the order of items in the array in random order. For those who want to listen to music out of order, the songs will be played randomly.

playPause function:

This function Handle event click on the Play/Pause button. Stop music/resume playback from last stop.

showHover function:

Here this function will be responsible for the click event on the slider displaying the % duration of the song played. Click to play from where you just clicked.

When clicked, an argument is passed which is information about the event. This Event includes the mouse click position (Event.clientX is the mouse position calculated horizontally across the web (The purpose is to find out where the mouse moves to calculate the time)). seekT is the distance from the starting point of the display bar to the mouse point. seekLoc is the value in seconds.

This function will be CALLED CONTINUOUSLY when the mouse hovers over the slider. (The purpose is to set the value)

hideHover function:

Mouse moving away from the slider will call this event. The purpose is to reset the strip displaying the selected mouse part (from the starting point to the mouse position) to the starting point (sHover.width = 0).

In addition, this event also sets the timer text to the starting point.

function updateCurrTime:

Call to set the time. If it's 100% (all cards are gone), change the cards and set the time to start.

checkBuffering function:

Check if the music has finished loading.

selectTrack function:

Change tracks (forward/backward). Essentially, it's just increasing or decreasing the currIndex variable and setting the values ​​according to currIndex.

initPlayer function:

Start the player and sequentially assign events.

Player is edited/developed from the interface source of: CodePen

According to: Nguyen Anh Nhan

Previous Post

How to use NotebookLM to summarize and analyze internal documents

Next Post

Instructions for buying Water Bus tickets on Zalo

AnonyViet

AnonyViet

Related Posts

How to write Shell Script in Linux/Unix
Tips

How to write Shell Script in Linux/Unix

December 6, 2025
How to completely uninstall WSL on Windows 11?
Tips

How to completely uninstall WSL on Windows 11?

December 6, 2025
Kinh nghiệm mua Laptop cho sinh viên nhóm ngành kế toán, kinh tế, xã hội…
Tips

Kinh nghiệm mua Laptop cho sinh viên nhóm ngành kế toán, kinh tế, xã hội…

December 5, 2025
8 tips for more successful PowerPoint presentations
Tips

8 tips for more successful PowerPoint presentations

December 4, 2025
Chrome extensions to improve productivity in 2021
Tips

Chrome extensions to improve productivity in 2021

December 2, 2025
How to create photos that run KPIs while crying using Gemini for the 12 zodiac animals
Tips

How to create photos that run KPIs while crying using Gemini for the 12 zodiac animals

December 1, 2025
Next Post
Instructions for buying Water Bus tickets on Zalo

Instructions for buying Water Bus tickets on Zalo

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

How to create Mind Map and Flowchart using ChatGPT is super simple

How to create Mind Map and Flowchart using ChatGPT is super simple

December 7, 2025
Free Gemini Google certification exam guide and Answers

Free Gemini Google certification exam guide and Answers

December 6, 2025
How to write Shell Script in Linux/Unix

How to write Shell Script in Linux/Unix

December 6, 2025
How to completely uninstall WSL on Windows 11?

How to completely uninstall WSL on Windows 11?

December 6, 2025
How to create Mind Map and Flowchart using ChatGPT is super simple

How to create Mind Map and Flowchart using ChatGPT is super simple

December 7, 2025
Free Gemini Google certification exam guide and Answers

Free Gemini Google certification exam guide and Answers

December 6, 2025
How to write Shell Script in Linux/Unix

How to write Shell Script in Linux/Unix

December 6, 2025
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

How to create Mind Map and Flowchart using ChatGPT is super simple

How to create Mind Map and Flowchart using ChatGPT is super simple

December 7, 2025
Free Gemini Google certification exam guide and Answers

Free Gemini Google certification exam guide and Answers

December 6, 2025
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

trang chủ f168 nhà cái 78win https://www.qq8827.com/

No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

trang chủ f168 nhà cái 78win https://www.qq8827.com/

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply