summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/loadfile.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index e4017a2afa..7acac24f72 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1586,6 +1586,13 @@ void mp_set_playlist_entry(struct MPContext *mpctx, struct playlist_entry *e)
assert(!e || playlist_entry_to_index(mpctx->playlist, e) >= 0);
mpctx->playlist->current = e;
mpctx->playlist->current_was_replaced = false;
+ // If something is currently loading, abort it a bit more forcefully. This
+ // will in particular make ytdl_hook kill the script. During normal
+ // playback, we probably don't want this, because it could upset the
+ // demuxer or decoders and spam nonsense errors.
+ if (mpctx->playing && !mpctx->playback_initialized)
+ mp_abort_playback_async(mpctx);
+ // Make it pick up the new entry.
if (!mpctx->stop_play)
mpctx->stop_play = PT_CURRENT_ENTRY;
mp_wakeup_core(mpctx);