player-sdk-swift icon indicating copy to clipboard operation
player-sdk-swift copied to clipboard

Audio playback stops during scroll

Open alexiscreuzot opened this issue 3 years ago • 2 comments

Is there an option to specify the RunLoop ?

alexiscreuzot avatar May 06 '22 14:05 alexiscreuzot

All API-Methods (see AudioPlayer.swift and YbridControl.swift) wrap the execution of player internals asynchronously using let playerQueue = DispatchQueue(label: "io.ybrid.playing"). All callback methods of AudioPlayerListener are asynchronously called by DispatchQueue.global().async { ... .

We use Swift's Grand Central Dispatch API to strictly decouple the player itself from the usage of the player. One purpose of GCD is to hide the thread layer from the developer. As far as I know there is no way to change the specific RunLoop (working thread).

Can you tell, why this is neccessary to you?

Would you please describe the audio you use and the action/s you mean by 'scrolling'.

FlorianAtNacamar avatar May 09 '22 07:05 FlorianAtNacamar

When playing an audio file (local data) with the SDK, it appears to stop when I scroll through a UITableView. So I'm guessing the async task is still running on a RunLoop that gets halted by the system during user interaction. I'll do some more testing to confirm.

alexiscreuzot avatar Jun 24 '22 12:06 alexiscreuzot