doublesymmetry / react-native-track-player

A fully fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!
https://rntp.dev/
Apache License 2.0
3.25k stars 1.01k forks source link

SeekBy causes position to change from reporting seconds to what appears to be milliseconds but not accurate. #2215

Closed appdevsa closed 10 months ago

appdevsa commented 10 months ago

Describe the Bug We have an Audio Streaming Application that points to a .m3u8 file and audio files converted to cmfa. We're using useTrackPlayerEvents to get the duration and position back and playing the track normally works perfectly, audio plays, position is perfect etc. But when you want to seek into the track using SeekBy(100) // 100 seconds for example it works for one or two times, watching the position in a console.log shows the position jumping by 100 seconds which is expected. But then suddenly, and arbitrary big number is reported back for the position in the same function. The number looks like it's suddenly converted the position to MS but it's also does not seem accurate all the time.

The issue does not happen when you point directly to an MP3 file, only when you point to a m3u8 playlist file.

Btw, useProgress also reports the same values.

Steps To Reproduce Using RNTP 4.01, point to a .m3u8 playlist URL. Play the track and console log the position, and then have a button to skip by 100 seconds a few times. Watch the position after a few times.

Environment Info: System: OS: macOS 13.5.1 CPU: (4) x64 Intel(R) Core(TM) i5-7600 CPU @ 3.50GHz Memory: 18.60 MB / 48.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.16.0 path: ~/.nvm/versions/node/v18.16.0/bin/node Yarn: version: 1.22.21 path: ~/Projects/Apps/XXXX/node_modules/.bin/yarn npm: version: 9.5.1 path: ~/.nvm/versions/node/v18.16.0/bin/npm Watchman: version: 2023.10.23.00 path: /usr/local/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms:

appdevsa commented 10 months ago

Not an issue with the RNTP, our fragment lengths were wrong. Thanks anyway.