• 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 add sliders to Facebook Stories to easily rewind videos
Tips

How to add sliders to Facebook Stories to easily rewind videos

April 21, 2026
How to change the default font on Windows 10
Tips

How to change the default font on Windows 10

April 13, 2026
5 tips for using a Browser to replace an App (helps save RAM, time and money)
Tips

5 tips for using a Browser to replace an App (helps save RAM, time and money)

April 13, 2026
How to make funny MeMe photos without Photoshop within 10 seconds
Tips

How to make funny MeMe photos without Photoshop within 10 seconds

April 11, 2026
How to quickly design your own Logo without Photoshop
Tips

How to quickly design your own Logo without Photoshop

April 10, 2026
How to convert Website into App on Windows
Tips

How to convert Website into App on Windows

April 9, 2026
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 a Face Sticker Collection using ChatGPT

How to create a Face Sticker Collection using ChatGPT

April 29, 2026
How to install the cute Bongo Cat mouse pointer for Windows

How to install the cute Bongo Cat mouse pointer for Windows

April 29, 2026
Tips for pinning the step counter to the iPhone screen to monitor your health

Tips for pinning the step counter to the iPhone screen to monitor your health

April 28, 2026
How to turn off password suggestions on iPhone: Prevent Safari from auto-filling passwords

How to turn off password suggestions on iPhone: Prevent Safari from auto-filling passwords

April 27, 2026
How to create a Face Sticker Collection using ChatGPT

How to create a Face Sticker Collection using ChatGPT

April 29, 2026
How to install the cute Bongo Cat mouse pointer for Windows

How to install the cute Bongo Cat mouse pointer for Windows

April 29, 2026
Tips for pinning the step counter to the iPhone screen to monitor your health

Tips for pinning the step counter to the iPhone screen to monitor your health

April 28, 2026
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 a Face Sticker Collection using ChatGPT

How to create a Face Sticker Collection using ChatGPT

April 29, 2026
How to install the cute Bongo Cat mouse pointer for Windows

How to install the cute Bongo Cat mouse pointer for Windows

April 29, 2026
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

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