• 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 with HTML, CSS, JS

AnonyViet by AnonyViet
February 3, 2023
in Tips
0

Online music player code written in HTML, CSS, JS shared by author Nguyen Anh Nhan on Github. You can download and edit the interface, 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 Code for Listening to Music Online uses HTML and CSS quite simply, so it doesn’t need much explanation. There is one thing you need to note in the HTML page that is the Meta Tag: viewport. Why? Without this Meta tag, display on mobile devices will be problematic.

If you do not know about HTML, CSS you can Free course download shared by AnonyViet.

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

Link Source: MusicPlayer Repository (Github)

Demo: Demo Player

EXPLAIN CODE

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

Download Code Listen to music online with HTML, CSS, JS 7

Regarding Javascript, here are the following Functions:

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

Shuffle function:

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

The playPause function:

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

showHover function:

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

When clicked, an argument is passed that is the information of the event. This event includes the mouse click position (Event.clientX is the horizontal position of the mouse on the web (The purpose is to find out where the mouse moves and calculate the time)). seekT is the distance from the starting point of the display bar to the point of the mouse. 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:

The mouse going out of the slider will call this event. The purpose is to reset the display range of 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.

The updateCurrTime function:

Call to set the time, if 100% (out of cards) then switch and set the time to start.

CheckBuffering function:

Check if the music has finished loading.

The selectTrack function:

Move track (forward/backward). In essence, it’s just increasing and decreasing the currIndex variable and setting the values ​​according to currIndex.

initPlayer function:

Start the player and assign the events sequentially.

Player is modified/developed from interface source of: CodePen

By: Nguyen Anh Nhan

The article achieved: 5/5 – (100 votes)

Tags: CodeCSSDownloadHTMLlistenmusiconline
Previous Post

The fastest way to increase Youtube Views with YouTube Viewers Tools

Next Post

Download free game 7554 made by Vietnam

AnonyViet

AnonyViet

Related Posts

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
Instructions for getting 3 months of Adobe Express Pro for free
Tips

Instructions for getting 3 months of Adobe Express Pro for free

April 9, 2026
Next Post
Download free game 7554 made by Vietnam

Download free game 7554 made by Vietnam

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 change the default font on Windows 10

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)

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

April 13, 2026
How to add WiFi Bluetooth button to iPhone home screen

How to add WiFi Bluetooth button to iPhone home screen

April 13, 2026
Instructions on how to activate 120Hz for smooth Safari browsing

Instructions on how to activate 120Hz for smooth Safari browsing

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

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)

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

April 13, 2026
How to add WiFi Bluetooth button to iPhone home screen

How to add WiFi Bluetooth button to iPhone home screen

April 13, 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 change the default font on Windows 10

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)

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

April 13, 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