K
K
Kostyan2019-09-27 17:30:07
Audio broadcast
Kostyan, 2019-09-27 17:30:07

How to create a music radio on the site?

Perhaps the question does not sound very clear.
There is a site, there is a folder in the root of the site, a bunch of mp3 files are loaded in the folder. We need a script that endlessly plays this "playlist" from the folder.
We display an audio player on the site, with minimal buttons ( < || > ), it is possible with the name of the track and without displaying the playlist. When you press Play, the player starts playing not from the first track in the folder, but from the moment that the script played before. And so that the included "Radio" on the site plays in the background, i.e. we go through the pages, and the music plays. You can fix the Player.
By the way, the site is on DLE, but I think this will not play a special role in this case.
I searched all over the Internet, but I did not find something similar. Usually standard players with playlists in which you need to register each track manually.
Can you please tell me how to implement this?
Immensely grateful!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin B., 2019-09-27
@Kostik_1993

Sea options. In your case, there is a folder with tracks. You need to go through all the files to find out the time of each and make a playlist (that is, make a certain map that carries information about what time which track plays), it is desirable to save it somewhere (DB, cache, etc. the main thing is on the server)
Further, everything is simple, the user opens the site (meaning the first opening, by the way, the site should be SPA in no other way), an appeal is made to the server to receive a playlist, in which it is necessary to indicate which song is playing now and a link to its file. Next, start the player in the browser and as soon as the current song is over, start the next one

G
GuitarHero007, 2019-09-27
@GuitarHero007

Well .... You can save the state of the div in Cookie or localStorage, which will be responsible for displaying the playback, load them when the page loads. Or google about Web Audio Api. Cool thing, I think it will definitely help with your problem)

E
Eugene, 2019-09-27
@Nc_Soft

Here the problem will not be in the player, but to force dle to switch pages without reloading. Something like pjax. And even that is unlikely to work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question