Skip to content

YouTube Music: cannot resume playback after ~1 minute pause #267

Description

@ihnatsyeu-andrei

Summary

When playing YouTube Music tracks in cliamp, pausing for about a minute and then resuming often does not restart playback.

Reproduction

  1. Start playing a YouTube Music track (ytmusic provider).
  2. Pause playback.
  3. Wait ~60 seconds.
  4. Press play/resume.

Actual behavior

Playback does not reliably resume.

Expected behavior

Playback should resume reliably after pause, even after longer idle periods.

Technical context

The current unpause reconnect logic appears to reconnect only for tracks considered live (track.IsLive()) in ui/model/playback.go (togglePlayPause + shouldReconnectOnUnpause).

YouTube Music playback is handled through yt-dlp/ffmpeg (playlist.IsYTDL(...)) and may not be marked live, so unpause currently toggles pause instead of rebuilding the stream pipeline. After longer pauses, that pipeline can be stale.

Proposal

Reconnect-on-unpause should also cover yt-dlp streams (or at least YouTube/YouTube Music), not only live streams.

Suggested implementation direction:

  • Extend shouldReconnectOnUnpause(...) to reconnect for playlist.IsYTDL(track.Path) (or YouTube-specific variants).
  • Optionally gate this with a pause-duration threshold (e.g., 45–60s) to avoid unnecessary restarts for short pauses.
  • Optionally preserve position by snapshotting m.player.Position() before restart and applying resume after reconnect when feasible.

Why this helps

This aligns runtime behavior with how yt-dlp-backed streams behave in practice and prevents stale pipeline resume failures after longer pauses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions