1
0

Add 5 seconds to time.Now() to more accurately represent the time when a song actually starts to play.

This commit is contained in:
Alexander Andreev 2023-10-09 01:15:05 +04:00
parent 46dbe72253
commit 7d4de3f6a6
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -83,7 +83,10 @@ func (dj *DJHandlers) PlaylistNext(w http.ResponseWriter, _ *http.Request) {
Title: oggf.GetTag("title"),
Duration: oggf.GetDuration(),
MaxListeners: dj.listeners.Current(),
StartAt: time.Now()}
// Here 5 seconds are being added because it is approximately the
// time between the creation of this Song object and when ezstream
// actually starts to play it.
StartAt: time.Now().Add(5 * time.Second)}
if strings.HasSuffix(nxt, "/fallback.ogg") {
song.Artist = "Nothing to play. Playing a fallback: " + song.Artist