SwiftAudioPlayer icon indicating copy to clipboard operation
SwiftAudioPlayer copied to clipboard

Wrong duration for some mp3 streaming

Open newbdez33 opened this issue 4 years ago • 3 comments

When I try this podcast, all recent episode is not properly works in SwiftAudioPlayer. https://rss.art19.com/business-wars-daily

It looks like the duration of mp3 is wrong and it will stuck at the actual ended position. Tested on SwiftAudioPlayer Example project.

newbdez33 avatar Sep 03 '21 07:09 newbdez33

it looks like the duration is changing due to a random advertising clip appended at the end of the episode audio. I'm still researching it.

newbdez33 avatar Sep 06 '21 09:09 newbdez33

Thanks for researching this! I'll look into it as well but in general duration comes from either the metadata from the audio at the beginning of the audio if provided or calculated from the expected file size given by the server.

tanhakabir avatar Sep 10 '21 18:09 tanhakabir

I tried "metadata" and "calculated size" but couldn't get the correct duration. These episode are using some sort of DAI to dynamically insert a small part audio into the episode.

So I decide to use "durationLoadedByNetwork" to make sure the audio to play though. Please check pr #155 (just a theory, not fully check or test) to see if this theory works.

newbdez33 avatar Sep 13 '21 02:09 newbdez33