Skip to content
5 changes: 2 additions & 3 deletions Sources/CSFBAudioEngine/Player/AudioPlayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2222,9 +2222,8 @@ Flags clearFlags(Flags flags, std::memory_order order = std::memory_order_acq_re
auto shouldStop = true;

if (__strong id<SFBAudioPlayerDelegate> delegate = player.delegate;
delegate != nil && [delegate respondsToSelector:@selector(audioPlayerEndOfAudio:)]) {
[delegate audioPlayerEndOfAudio:player];
shouldStop = false;
delegate != nil && [delegate respondsToSelector:@selector(audioPlayerShouldStopAtEndOfAudio:)]) {
shouldStop = [delegate audioPlayerShouldStopAtEndOfAudio:player];
}

Comment thread
sbooth marked this conversation as resolved.
if (shouldStop) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,11 @@ NS_SWIFT_NAME(AudioPlayer.Delegate)
/// - parameter audioPlayer: The `SFBAudioPlayer` object
/// - parameter playbackState: The current playback state
- (void)audioPlayer:(SFBAudioPlayer *)audioPlayer playbackStateChanged:(SFBAudioPlayerPlaybackState)playbackState;
/// Called to notify the delegate when rendering is complete for all available decoders
/// Called to query the delegate whether playback should stop when rendering is complete for all available decoders
/// - parameter audioPlayer: The `SFBAudioPlayer` object
- (void)audioPlayerEndOfAudio:(SFBAudioPlayer *)audioPlayer NS_SWIFT_NAME(audioPlayerEndOfAudio(_:));
/// - returns: `YES` if the player should stop playback, `NO` to continue rendering silence
- (BOOL)audioPlayerShouldStopAtEndOfAudio:(SFBAudioPlayer *)audioPlayer
NS_SWIFT_NAME(audioPlayerShouldStopAtEndOfAudio(_:));
/// Called to notify the delegate after performing a user-initiated seek in a decoder
/// - warning: Do not change any properties of `decoder`
/// - parameter audioPlayer: The `SFBAudioPlayer` object processing `decoder`
Expand Down