Question: Skipping to Next Track After DJ Disconnects #2123
Replies: 9 comments 2 replies
-
I was also looking for a way to skip the track when switching to an another source. I got something working like this:
It's apparently (?) important to time the duration and delay together and to set it to Now, that works great if the next source is a request (here the playlist goes to a request that plays the jingle twice, then it goes back to the playlist): https://s.kdy.ch/dtr_dj-shows-dj.mp3 But when using an "Oh, I could use
And changing the This 5 second problem could be discussed in an another issue - I might be missing something - but that wasn't an issue for us on 1.4.4 and I'm bringing it up here since we're talking about going live anyways. |
Beta Was this translation helpful? Give feedback.
-
Oh, that's an interesting idea...skipping the track upon the fade-in to the live broadcast, not on the fade-out, so it's just sitting there paused in the background basically, then when it fades, it fades to the new track directly. That might actually help a lot in this case. |
Beta Was this translation helpful? Give feedback.
-
I'm noticing something, though, and perhaps this is something @toots should be aware of: any time, in these transitions, that I call Is this a known issue? |
Beta Was this translation helpful? Give feedback.
-
Really? I added some logs at the start of my transition function and one inside the thread function and it did respect my delay, at least with the 2.0.1 docker image. |
Beta Was this translation helpful? Give feedback.
-
Yeah...I did the same thing, set up logging for both the outer and inner section, and it is delaying 2 seconds. And yet I'm still hearing the song sequence from one to the other before the live stream kicks in. I wonder if that delay has to exceed the buffer setting for the Live broadcast, since that's what causes a delay in the stream kicking over to the live broadcast. |
Beta Was this translation helpful? Give feedback.
-
After further research, it appears that Liquidsoap will just pause the previous stream right where it is, regardless of what position it's in on skipping from one track to the next. So, you can either have this happen before the live stream starts or immediately afterward, but you can't remove that crossfade from happening, and there's apparently no setting that will make that possible. It may be that, given the current code, the best we can hope to do is "hide" the crossfade from one song to another from the listener, by fading out before it actually happens, but that's a pretty shaky way of doing it and doesn't feel stable or reliable at all. |
Beta Was this translation helpful? Give feedback.
-
Hi all, Thanks for these details. I believe that, at the core of it, there's something of an impossible need. In fact, crossfade sources always overlap beginning and end of tracks so it's impossible to get a clean skip at any time. That is, unless you implement your own crossfading function that is aware of your skip. Here we go: # A source of requests
files = playlist("/tmp/pl")
# A reference to wether we're going to the live source
to_live = ref(false)
# Custom transition
def transition(old, new) =
# If going to the live show, play a simple sequence
if !to_live then
sequence([fade.out(old.source),fade.in(new.source)])
else
# Otherwise, use the smart transition
cross.smart(old, new)
end
end
# Apply cross
radio = cross(transition, files)
# Live source
live = input.harbor("test")
# This is a _track sensitive_ fallback!
radio = fallback([live, radio])
# Trigger a track skip when live becomes available.
def check_live() =
if live.is_ready() then
# Only do that once:
if not !to_live then
to_live := true
files.skip()
end
else
# If not available, revert to radio songs and normal crossfade transitions
to_live := false
end
end
# Continuously check on live.
radio = source.on_frame(radio, check_live) This script seems to behave nicely. When the live becomes available, a skip is issued, directly to the underlying request source (always a better idea). This track skip generates a clean sequence of fade.out and fade.in due to the At the Then, when live becomes unavailable again, the fallback resumes with the second half of the sequence, i.e. a clean fade.in on the new track. At this point,
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the example. I'm wondering if there is a race between Maybe it's naive but what if we have a track insensitive source and the skip is issued when live disconnects? Something like this: ...
def transition(old, new) =
#I'm not sure how to check if old is the live source, but I'm sure there is a way
if (old_source_is_live) then
new.source.skip()
sequence([fade.out(old.source),fade.in(new.source)])
else
sequence([fade.out(old.source),fade.in(new.source)])
end
end
radio = cross(transition, files)
radio = fallback(track_sensitive=true, [live, radio])
... In this way, we don't need to have a "watchdog" for the live source's availability, plus the behaviour is explicitly deterministic. What do you think? @toots how do you format your example so nicely (w/ colors)? :) |
Beta Was this translation helpful? Give feedback.
-
@toots can you help me to understand one detail in you example? As you call I now tried with a radio = switch(track_sensitive=false,
[({!live_enabled}, live),
({1w and 12h-13h}, delay(60., playlist_my_show)),
({true}, radio)])
def fading_transition(a,b)
sequence([fade.out(a.source),fade.in(b.source)])
end
radio = cross(fading_transition, radio) The problem is that for some reason the |
Beta Was this translation helpful? Give feedback.
-
The previous issue on this got closed, and unfortunately that was the end of the follow-up that we heard about it, but it's a huge issue that's been a big deal on our users' minds for many years now, so I'm determined to get to the bottom of it, even if it means being a little pesky on here!
Basically, here's the solution we've come up with that is an almost-perfect way of skipping to the next track after a live DJ disconnects from the stream:
There's just one problem: if a user has crossfading enabled, you hear the live broadcast abruptly disconnect, then the previously playing track plays, but is immediately faded into the next track. It's the auditory equivalent of this:
Basically...I need to be able to disable crossfading, but for that skip only, then return to normal fading rules afterward.
Things I've tried:
minimum
on the crossfade to0.
, or1.
, or any of a number of higher valuesconservative=false
on the crossfade to prevent it from "buffering" any amount of the previous tracksource.skip
on the source from before the crossfadeNo dice on any of them.
I feel like we're 95% of the way to having a great solution here that works for our users. For users with crossfading disabled, the code above works perfectly to skip to a new track when a DJ disconnects. We just have to figure out what to do in the case of crossfades.
Beta Was this translation helpful? Give feedback.
All reactions