-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Thanks for this library, I would have wrote it myself but you beat me to it! (not complaining 👍 )
rxjs-audio/src/rxjs-audio-stream.ts
Lines 244 to 249 in 7bf226c
| 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
rxjs-audio/src/rxjs-audio-stream.ts
Line 285 in 7bf226c
| canPlay$.pipe(switchMap(event => ended$)).subscribe(value => this.autoPlayNext()) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels