Skip to content

Last track is replayed when ended #1

@eloiqs

Description

@eloiqs

Thanks for this library, I would have wrote it myself but you beat me to it! (not complaining 👍 )

private autoPlayNext() {
if (this.config && this.config.autoPlayNext) {
this.next()
this.play()
}
}

Right now when the last track ends, there are some safeguards in the next function that prevents the stream from nexting to an unexistant next track, but play still gets called. I wonder if this is intentional?

I have a one track stream and would like to just stop the stream when it ends. I tried implementing it myself:

    this.audioStream.events().subscribe((event) => {
      if (event.type === 'ended' && this.state.isLastTrack) {
        this.audioStream.stop();
      }
    });

But it looks like this runs before autoPlayNext gets called here

canPlay$.pipe(switchMap(event => ended$)).subscribe(value => this.autoPlayNext())

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