Skip to content

Duplicate Audio Playback (echo) on HLS Streams with ArtPlayer #624

@nt74

Description

@nt74

Bug: Duplicate Audio Playback (echo) on HLS Streams with ArtPlayer

Describe the bug

When playing an HLS stream (for example, Alpha TV) on Arch Linux, IPTVnator produces duplicated audio — a clear echo effect.
After pressing Pause, the video stops, but the audio keeps playing in the background.
This indicates that multiple WebKit/GStreamer media pipelines are active simultaneously.


Environment

  • OS: Arch Linux
  • Audio system: PipeWire / PulseAudio
  • App binary: /usr/bin/IPTVnator (ELF 64-bit, not stripped)
  • Default video player: ArtPlayer
  • Backend: WebKitGTK + GStreamer
  • Tested stream:

[https://alphalive-i.akamaihd.net/hls/live/682132/AlphaTV/playlist.m3u8](https://alphalive-i.akamaihd.net/hls/live/682132/AlphaTV/playlist.m3u8)


Steps to Reproduce

  1. Launch IPTVnator.
  2. Add and start the Alpha TV HLS stream:

[https://alphalive-i.akamaihd.net/hls/live/682132/AlphaTV/playlist.m3u8](https://alphalive-i.akamaihd.net/hls/live/682132/AlphaTV/playlist.m3u8)

  1. Observe normal playback (audio + video).
  2. Press Pause — the video stops, but audio continues playing.
  3. Check active audio sinks:
pactl list sink-inputs | grep -E 'application.name|media.name|pid'

Example output:

application.name = "IPTVnator"
media.name = "Playback Stream"
application.name = "IPTVnator"
media.name = "Playback Stream"

→ Confirms two concurrent audio streams active at the same time.


Debug Evidence

GStreamer Debug Log (GST_DEBUG=3,webkit*:5):

Full logs gst.log available if requested and needed that shows multiple internal MSE-based players created by WebKit:

<MSE-media-player-0>
<MSE-media-player-1>
<MSE-media-player-2>
<MSE-media-player-3>

Each player transitions into the PLAYING state but is not destroyed when playback is paused or replaced.
As a result, multiple GStreamer audio pipelines remain active, producing duplicated audio output.


Likely root cause

IPTVnator uses ArtPlayer as its default player, which internally relies on WebKitGTK + GStreamer for playback.
When new playback starts (or when pausing a stream), previous MediaPlayerPrivateGStreamer instances are not properly destroyed, leading to:

  • Multiple parallel GStreamer pipelines, and
  • Audio continuing to play from hidden WebKit instances even after pause.

Expected Behavior

  • Only one active media pipeline (audio/video) should exist at any given time.
  • When playback is paused, both audio and video should stop.
  • When starting a new stream, previous pipelines should be fully destroyed.

Suggested Fix

Before initializing new playback in ArtPlayer, ensure the previous instance is fully cleaned up:

video.pause();
video.removeAttribute('src');
video.srcObject = null;
if (hls) { hls.destroy(); hls = null; }
if (mediaSource) { try { mediaSource.endOfStream(); } catch(e){} mediaSource = null; }

Make sure that:

  • Existing ArtPlayer or WebKit media instances are cleanly destroyed before new playback begins.
  • The Pause button triggers a full pipeline stop within GStreamer, not just a UI pause on the <video> element.

Additional Data

  • Verified on Arch Linux using Alpha TV HLS stream.
  • pactl list sink-inputs confirms duplicate active playback streams.
  • Full GStreamer debug log (gst.log) is available on request if needed for reference.
  • No strace logs were used — only gst.log for diagnostics.

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