Skip to content
Discussion options

You must be logged in to vote

I made it work by using .run.

case let .playAudio(file):
                return .run { send in
                    await send(
                        .playAudioResult(
                            .init {
                                try await audioPlayer.play(file.url)
                                return file
                            }
                        )
                    )
                    try await audioPlayer.waitForStop(file.url)
                    await send(.audioFinished(file))
                }
                .cancellable(id: file.id, cancelInFlight: true)

I could not manage to hook AVAudioPlayer's end of stream publisher so far but testing out with Task.sl…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@kakhaberikiknadze
Comment options

Comment options

You must be logged in to vote
7 replies
@acosmicflamingo
Comment options

@kakhaberikiknadze
Comment options

@acosmicflamingo
Comment options

@kakhaberikiknadze
Comment options

@kakhaberikiknadze
Comment options

Answer selected by kakhaberikiknadze
Comment options

You must be logged in to vote
1 reply
@kakhaberikiknadze
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants